Issue with 'ubi part' ubi_io_read: error -74 (ECC error)

Sorry for a bit recalcitrant with the issue of calling 'ubi part" error -74 -EBADMSG, is it MTD issue or u-boot issue?
I used Linux kernel 4.19 to flash UBIFS volume images ubi.img to imx6ull NAND using following command in Linux:
flash_erase /dev/mtd2 0 0 ubiformat /dev/mtd2 -f ubi.img
The flashing image process went well, not errors, but in NAND booting (u-boot version 2018), running "ubi part" stuck following errors:
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2 35:0, read 64 bytes ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 235:2048, read 2048 bytes
The document says "The -74 error code is -EBADMSG and means an ECC error. In other words, UBI tried to read some data from the flash, but the flash driver found that there is an uncorrectable ECC error, and returned -EBADMSG."
My question for ubiformat, how does it write ECC to UBIFS volume partition when it flashed UBIFS image to NAND?
In NAND booting, how does the "ubi part" read ECC (DTB) from?
Thank you very much, appreciate your kind advice.
- j

On Sun, May 17, 2020 at 1:28 PM Jupiter jupiter.hce@gmail.com wrote:
Sorry for a bit recalcitrant with the issue of calling 'ubi part" error -74 -EBADMSG, is it MTD issue or u-boot issue?
I used Linux kernel 4.19 to flash UBIFS volume images ubi.img to imx6ull NAND using following command in Linux:
flash_erase /dev/mtd2 0 0 ubiformat /dev/mtd2 -f ubi.img
The flashing image process went well, not errors, but in NAND booting (u-boot version 2018), running "ubi part" stuck following errors:
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2 35:0, read 64 bytes ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 235:2048, read 2048 bytes
The document says "The -74 error code is -EBADMSG and means an ECC error. In other words, UBI tried to read some data from the flash, but the flash driver found that there is an uncorrectable ECC error, and returned -EBADMSG."
My question for ubiformat, how does it write ECC to UBIFS volume partition when it flashed UBIFS image to NAND?
Neither UBI nor UBIFS care about ECC. The MTD stack does. If you write something in Linux you cannot read back in u-boot a common problem is that u-boot and Linux use different MTD settings (layout, ECC, etc...).

Thanks Richard for the response.
On 5/19/20, Richard Weinberger richard.weinberger@gmail.com wrote:
Neither UBI nor UBIFS care about ECC. The MTD stack does. If you write something in Linux you cannot read back in u-boot a common problem is that u-boot and Linux use different MTD settings (layout, ECC, etc...).
That is exactly the problem I have, the MTD layout in both Linux and u-boot is the same:
# mtdinfo Count of MTD devices: 3 Present MTD devices: mtd0, mtd1, mtd2 Sysfs interface supported: yes
Are there any ways or tools in Linux to change MTD settings (most likely the ECC or DTB) to the same setting in u-boot? I do have mtd and fw_setenv in Linux.
Thank you so much.
Kind regards,
- jh

Hello Jupiter,
Am 19.05.2020 um 14:06 schrieb Jupiter:
Thanks Richard for the response.
On 5/19/20, Richard Weinberger richard.weinberger@gmail.com wrote:
Neither UBI nor UBIFS care about ECC. The MTD stack does. If you write something in Linux you cannot read back in u-boot a common problem is that u-boot and Linux use different MTD settings (layout, ECC, etc...).
That is exactly the problem I have, the MTD layout in both Linux and u-boot is the same:
# mtdinfo Count of MTD devices: 3 Present MTD devices: mtd0, mtd1, mtd2 Sysfs interface supported: yes
Are there any ways or tools in Linux to change MTD settings (most likely the ECC or DTB) to the same setting in u-boot? I do have mtd and fw_setenv in Linux.
No for U-Boot (as I am aware of). You need to fix the DTS or may if older U-Boot your code.
May you need to add in your U-Boot DTS gpmi node the property:
fsl,legacy-bch-geometry;
?
see commit:
51cdf83eea - mtd: gpmi: provide the option to use legacy bch geometry
bye, Heiko

Hi Heiko,
Thanks for your response.
On 5/22/20, Heiko Schocher hs@denx.de wrote:
Are there any ways or tools in Linux to change MTD settings (most likely the ECC or DTB) to the same setting in u-boot? I do have mtd and fw_setenv in Linux.
No for U-Boot (as I am aware of). You need to fix the DTS or may if older U-Boot your code.
May you need to add in your U-Boot DTS gpmi node the property:
fsl,legacy-bch-geometry;
I tried but that did not work, it is equivalent to remove fsl,use-minimum-ecc in gpmi node I used to run ubiformat to flash UBIFS image to NAND:
# flash_erase /dev/mtd2 0 0 # ubiformat /dev/mtd2 -f /tmp/ubi.img
That caused the NAND boot error to run "ubi part" ubi_io_read: error -74 (ECC error).
Richard shed light on the problem that u-boot and Linux use different MTD settings, I figured out it is the ECC problem, while adding fsl,use-minimum-ecc in gpmi node cannot even start NAND boot. Why fsl,use-minimum-ecc in gpmi node causing such predicament?
Thank you.
Kind regards,
- jh
participants (3)
-
Heiko Schocher
-
Jupiter
-
Richard Weinberger