[U-Boot] [PATCH] Fix fw_env bug for multi-sector environments on NOR flash
When storing u-boot environment variables on a NOR flash using multiple sectors, the following error occurs when writing changes using fw_setenv. /etc # cat fw_env.config /dev/mtd12 0x 0x2 0x1 2 /etc # fw_setenv test test End of range reached, aborting Error: can't write fw_env to flash The reason for the error is that although both sectors are written in one pass, the loop for the write is executed twice because the processed variable is incremented by the incorrect amount. Signed-off-by: Yiyang Fei yiyang@barco.com --- tools/env/fw_env.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index ed6b53f..e6b2cae 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -880,9 +880,8 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count, ioctl (fd, MEMLOCK, erase); - processed += blocklen; - block_seek = 0; - blockstart += blocklen; + processed += erasesize; + blockstart += erasesize; } if (write_total count) -- 1.7.2.5 Sorry for the disclaimer...it is out of my control. Yiyang Fei ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] fw_env bug for multi-sector environments on NOR flash
Hi, I am storing u-boot environment variables on a NOR flash using two sectors. I encountered an error when writing changes using fw_setenv. /etc # cat fw_env.config # Configuration file for fw_(printenv/saveenv) utility. # Up to two entries are valid, in this case the redundand # environment sector is assumed present. # MTD device name Device offset Env. size Flash sector size Number of sectors /dev/mtd12 0x 0x2 0x1 2 /etc # fw_setenv test test End of range reached, aborting Error: can't write fw_env to flash The reason for the error is that although both sectors are written in one pass, the loop for the write is executed twice because the processed variable is incremented by the incorrect amount. The following change is needed to fix this issue for NOR multi-sector environments. diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index ed6b53f..e6b2cae 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -880,9 +880,8 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count, ioctl (fd, MEMLOCK, erase); - processed += blocklen; - block_seek = 0; - blockstart += blocklen; + processed += erasesize; + blockstart += erasesize; } if (write_total count) Are there any objections to committing this change? Yiyang Fei ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] fw_env bug for multi-sector environments on NOR flash
Dear Mr. Denk, Stupid question: why do you define an environment size of 128 kB? I bet you use less than 10% of this, right? Correct Are you aware that this has a lof of disadvantages, lile significantly slowing down your boot process? I am now, but the first product is already released and cannot be changed easily. Your Signed-off-by: line is missing... I resubmitted updated message. Best regards, Yiyang Fei ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] JFFS2 duplicate file entries
Hi, I'm using the 2010.12 u-boot source code. I use a JFFS2 partition on a NAND flash to store the kernel image as well as an FGPA images for my platform. I also mount this partition inside the kernel because I need the ability to overwrite the contents during a field-upgrade of the embedded software. When I make changes to this partition from the kernel, everything looks correct. But when I reboot and break into u-boot, the contents of the partition is incorrect. For example, if I do the following from the kernel... /mnt/bootfs # ll -rw-r--r--1 6410562004 9232568 Feb 10 2011 netviz_core_fpga.bit -rw-r--r--1 6410562004 2138968 Feb 10 2011 uImage /mnt/bootfs # touch test /mnt/bootfs # ll -rw-r--r--1 6410562004 9232568 Feb 10 2011 netviz_core_fpga.bit -rw-r--r--1 root root 0 Jan 1 00:27 test -rw-r--r--1 6410562004 2138968 Feb 10 2011 uImage /mnt/bootfs # rm test /mnt/bootfs # ll -rw-r--r--1 6410562004 9232568 Feb 10 2011 netviz_core_fpga.bit -rw-r--r--1 6410562004 2138968 Feb 10 2011 uImage /mnt/bootfs # echo some text test /mnt/bootfs # ll -rw-r--r--1 6410562004 9232568 Feb 10 2011 netviz_core_fpga.bit -rw-r--r--1 root root10 Jan 1 00:27 test -rw-r--r--1 6410562004 2138968 Feb 10 2011 uImage /mnt/bootfs # reboot During the boot, if I break into u-boot, here is what I see... Hit any key to stop autoboot: 0 NetViz ls -rw-r--r-- 9232568 Thu Feb 10 00:31:27 2011 netviz_core_fpga.bit -rw-r--r-- 2138968 Thu Feb 10 00:31:03 2011 uImage -rw-r--r--0 Thu Jan 01 00:27:14 1970 test -rw-r--r-- 10 Thu Jan 01 00:27:42 1970 test NetViz Do you have any suggestions on how I should track down the cause for this problem? Yiyang Fei DISCLAIMER: Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Skipping bad blocks while reading and writing JFFS2 image to NAND flash
Hi, When writing a JFFS2 image to NAND flash, any bad blocks in the BBT is skipped. However, while scanning a JFFS2 partition, bad blocks are not skipped. Is this intended or am I mis-configuring u-boot somehow? I'm using the 2010.12 u-boot source code. The BBT table for my system includes the following bad blocks... Bad block table found at page 524224, version 0x03 Bad block table found at page 524160, version 0x03 nand_read_bbt: Bad block at 0x00d4 nand_read_bbt: Bad block at 0x2bb4 nand_read_bbt: Bad block at 0x2bb6 nand_read_bbt: Bad block at 0x2fec nand_read_bbt: Bad block at 0x3b6a nand_read_bbt: Bad block at 0x3ff4 Offset 0xD4 is in the middle of my JFFS2 partition, which contains my kernel image. During boot, when the JFFS2 partition is loaded, I see the following errors: In:serial Out: serial Err: serial ### JFFS2 loading 'netviz_core_fpga.bit' to 0x100 Scanning JFFS2 FS: . read_nand_cached: error reading nand off 0xd4 size 8192 bytes done. ### JFFS2 load complete: 9232568 bytes loaded to 0x100 I traced the code path while writing and reading NAND. The nand write command eventually calls the nand_write_skip_bad() function in nand_util.c which is why it was skipping the bad blocks; this is what I think should happen. However, the JFFS2 code directly calls nand_read() function instead. What should be the correct behavior? Thanks, Yiyang Fei DISCLAIMER: Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot