Skip to main content
7 events
when toggle format what by license comment
Apr 23, 2023 at 8:40 comment added wangt13 I just read the codes of fw_printenv, I think it is using /dev/mtdblockN instead of /dev/mtdN, so I changed my code to use /dev/mtdblock0 also, I can succeed in reading/writing data to raw FLASH of u-boot, the u-boot reboot well without comlaining about the oob errors. So I think in this case I should use /dev/mtdblockN not /dev/mtdN. This question is from my lack of knowledge of Linux MTD, and Philippos's answer is correct on /dev/mtd0 which is asked by me, I vote for his answer.
Apr 21, 2023 at 7:43 comment added wangt13 The LSP is packed within buildroot and I found it has uboot-tools-fwprintenv, I booted it and installed it to target then ran it, it partially working!!! Since the u-boot ENV is not written, only using default env (u-boot is NOT built from within buildroot). I will run saveenv in u-boot to have some data in the FLASH. As for the error of spi nand read oob error, it seemed that something wrong in OOB, maybe ECC, I am not sure it I needs to write data to OOB... I am still reading the NAND FLASH data sheet.
Apr 21, 2023 at 7:11 comment added Philippos How do you build your Linux board support package? There is a Yocto recipe for u-boot-fw-utils, I think. I'm sorry I fail to help with the read error.
Apr 21, 2023 at 6:50 comment added wangt13 I tried with ioctl(fd, MEMERASE, &erase) in my code, to erase one eraseblock (128KB) of U-boot partition (1MB), and I can write my data into the block. But when I reboot to u-boot, I got the same error about spi nand read oob error ,ret= -74, I am not sure if I need to explicitly set OOB?? I am also checking if I can compile fw_printenv of u-boot for my target.
Apr 20, 2023 at 23:46 vote accept wangt13
Apr 20, 2023 at 23:46 comment added wangt13 Philippos, thanks for your pointing out the IOCTL on MTD device, I will try it. Then I did try fw_printenv in my environment, but I failed to build it (I don't know why it is compiled with host CC not with the cross compiler) and it also seemed that fw_printenv needs to re-partition the NAND FLASH,,, I am not sure about that. So I decided to R/W U-boot NAND partition directly by myself. I will check if fw_printenv can meet my requirement in this system.
Apr 20, 2023 at 14:40 history answered Philippos CC BY-SA 4.0