cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sonminh
Adventurer
Adventurer
560 Views
Registered: ‎10-02-2018

Error once use fw_setenv from user space

Hi 

Now, I 'm boot petalinux 2017.4 on zcu102 from qspi flash with BOOT.BIN, image.ub, rootfs.jffs2. This my partition of flash:

root@xilinx-zcu102-2017_4:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00f00000 00020000 "boot"
mtd1: 00040000 00020000 "bootenv"
mtd2: 01400000 00020000 "kernel"
mtd3: 00f00000 00020000 "jffs2_3"
mtd4: 00f00000 00020000 "boot_1"
mtd5: 01400000 00020000 "kernel_1"
mtd6: 00f00000 00020000 "jffs2_6"
mtd7: 01400000 00020000 "user data"

I modify /etc/fw_env.config to BOOT.bin read environment variable from bootenv in /mtd1 and then load image.ub and rootfs in mtd2 and mtd3.

Then I rebooted successful. Once booted successful, I can ssh any file.txt to ip of board(192.168.15.150). Even boot again mutiple time, that file.txt still exist in rootfs.

But once I use fw_setenv, this error occur:

root@xilinx-zcu102-2017_4:~# fw_setenv a "1"
[ 91.895236] m25p80 spi0.0: trying to lock already unlocked area
root@xilinx-zcu102-2017_4:~# [ 115.368481] jffs2: Node totlen on flash (0xffffffff) != totlen from node ref (0x00000044)

Then once, I ssh other file111.txt to board, log notify on teraterm:

root@xilinx-zcu102-2017_4:~# [ 37.054390] jffs2: Node totlen on flash (0xff00ff44) != totlen from node ref (0x00000044)

And once reboot again , that file111.txt not exist in rootfs.

How do slove this problem ?

thanks and brgs

0 Kudos
1 Reply
467 Views
Registered: ‎08-12-2019

Maybe you have the same problem than me: Flash protection seems not to work correctly with my SPI Flash (MT25QU02GCBB8E12). After protecting 1 sector (fw_setenv protects the sector with the u-boot environments) the whole SPI is write protected. You can check this with the flash_lock -i command, e.g:

for i in 1 3 6; do flash_lock -i "/dev/mtd$i";done
fw_setenv a "1"
for i in 1 3 6; do flash_lock -i "/dev/mtd$i";done
0 Kudos