Linux-mtd Archive on lore.kernel.org
 help / color / Atom feed
* Any UBIFS volume image installation command with selective ECC (DTB) in Linux?
@ 2020-05-14 11:37 Jupiter
  2020-05-15  1:16 ` Jupiter
  0 siblings, 1 reply; 4+ messages in thread
From: Jupiter @ 2020-05-14 11:37 UTC (permalink / raw)
  To: linux-mtd

Hi,

I used ubinize to build a UBIFS image ubi.img, the image has three
volumes, dtb-volume (imx6ulz.dtb), kernel-volume and rootfs-volume.

To install u-boot and root UBIFS image to iMX6ULL NAND, I used a
zImage-initramfs to install the u-boot to u-boot mtd partition first,
then to install ubi.img in UBIFS partition by running following
commands:

flash_erase /dev/mtd2 0 0
ubiformat /dev/mtd2 -f /tmp/ubi.img

It was all fine, but after the installation, it cannot run ubi part in u-boot:

ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 3
83:0, read 64 bytes
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB
 383:2048, read 2048 bytes

The problem was that u-boot installation requires a higher bit ECC, so
that zImage-initramfs was started with imx6ulz-kobs.dtb, if I change
to start  zImage-initramfs with a low bit ECC imx6ulz.dtb, that ECC
error gone away, but then I could not flash u-boot to NAND.

Are there any way or mtd / ubi command to flash ubi.img to NAND based
on a specific ECC / dtb?

Appreciate any your kind advice.

Thank you.

Kind regards,

- jupiter


-- 
"A man can fail many times, but he isn't a failure until he begins to
blame somebody else."
-- John Burroughs

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Any UBIFS volume image installation command with selective ECC (DTB) in Linux?
  2020-05-14 11:37 Any UBIFS volume image installation command with selective ECC (DTB) in Linux? Jupiter
@ 2020-05-15  1:16 ` Jupiter
  2020-05-15  6:59   ` Jupiter
  0 siblings, 1 reply; 4+ messages in thread
From: Jupiter @ 2020-05-15  1:16 UTC (permalink / raw)
  To: linux-mtd

Seems I am not alone for this issue, found the comments from following
link https://community.nxp.com/thread/324502 6 years ago, it is not
exactly the same to my issue, but are there any new development to
decouple the MTD UBI ECC with u-boot ECC?

"It definitely looks as if the Linux MTD's ECC doesn't agree with the
U-Boot ECC.  For instance, I have the same message if I write a UBI
partition with Software-ECC and then mount with Hardware-ECC. Here is
some conversation with Stefan Agner and I

http://lists.infradead.org/pipermail/linux-mtd/2014-April/053553.html
http://lists.infradead.org/pipermail/linux-mtd/2014-April/053560.html
http://lists.infradead.org/pipermail/linux-mtd/2014-April/053570.html
............
"

Thank you.

Kind regards,

- j


On 5/14/20, Jupiter <jupiter.hce@gmail.com> wrote:
> Hi,
>
> I used ubinize to build a UBIFS image ubi.img, the image has three
> volumes, dtb-volume (imx6ulz.dtb), kernel-volume and rootfs-volume.
>
> To install u-boot and root UBIFS image to iMX6ULL NAND, I used a
> zImage-initramfs to install the u-boot to u-boot mtd partition first,
> then to install ubi.img in UBIFS partition by running following
> commands:
>
> flash_erase /dev/mtd2 0 0
> ubiformat /dev/mtd2 -f /tmp/ubi.img
>
> It was all fine, but after the installation, it cannot run ubi part in
> u-boot:
>
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from
> PEB 3
> 83:0, read 64 bytes
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from
> PEB
>  383:2048, read 2048 bytes
>
> The problem was that u-boot installation requires a higher bit ECC, so
> that zImage-initramfs was started with imx6ulz-kobs.dtb, if I change
> to start  zImage-initramfs with a low bit ECC imx6ulz.dtb, that ECC
> error gone away, but then I could not flash u-boot to NAND.
>
> Are there any way or mtd / ubi command to flash ubi.img to NAND based
> on a specific ECC / dtb?
>
> Appreciate any your kind advice.
>
> Thank you.
>
> Kind regards,
>
> - jupiter
>
>
> --
> "A man can fail many times, but he isn't a failure until he begins to
> blame somebody else."
> -- John Burroughs
>


-- 
"A man can fail many times, but he isn't a failure until he begins to
blame somebody else."
-- John Burroughs

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Any UBIFS volume image installation command with selective ECC (DTB) in Linux?
  2020-05-15  1:16 ` Jupiter
@ 2020-05-15  6:59   ` Jupiter
  2020-05-20 11:22     ` Alexander Dahl
  0 siblings, 1 reply; 4+ messages in thread
From: Jupiter @ 2020-05-15  6:59 UTC (permalink / raw)
  To: linux-mtd

My apology for keeping posts while reading more to understand the
error -74 (ECC error) from
http://www.linux-mtd.infradead.org/faq/ubi.html#L_ecc_error, but I am
still not clear why the ECC error occured, let me rephrase it:

- I used ubiformat to flash the UBIFS volume image ubi.img to NAND MTD
partition 2 in Kernel 4.19:

ubiformat /dev/mtd2 -f /tmp/ubi.img

The ubi.img contains a dtb-volume in

- In NAND boot

Calling ubi part ubifs_partition before caused following error before
it could read ubi readvol 0x88c00000 dtb-volume:

ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes
from PEB 3 83:0, read 64 bytes
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048
bytes from PEB 383:2048, read 2048 bytes

The document says UBI tried to read some data from the flash, but the
flash driver found that there is an uncorrectable ECC error, and
returned -EBADMSG.

I can eliminate the causes in the document such as buggy NAND driver
and HW issue, or flash image improperly.

I am baffled when ubiformat flashed ubi.img to NAND, who wrote the ECC
to the flash?, Does ubiformat write ECC to NAND? If so, how can select
the ECC for ubiformat to write correct ECC to NAND?

Thank you.

Kind regards,

- j

On 5/15/20, Jupiter <jupiter.hce@gmail.com> wrote:
> Seems I am not alone for this issue, found the comments from following
> link https://community.nxp.com/thread/324502 6 years ago, it is not
> exactly the same to my issue, but are there any new development to
> decouple the MTD UBI ECC with u-boot ECC?
>
> "It definitely looks as if the Linux MTD's ECC doesn't agree with the
> U-Boot ECC.  For instance, I have the same message if I write a UBI
> partition with Software-ECC and then mount with Hardware-ECC. Here is
> some conversation with Stefan Agner and I
>
> http://lists.infradead.org/pipermail/linux-mtd/2014-April/053553.html
> http://lists.infradead.org/pipermail/linux-mtd/2014-April/053560.html
> http://lists.infradead.org/pipermail/linux-mtd/2014-April/053570.html
> ............
> "
>
> Thank you.
>
> Kind regards,
>
> - j
>
>
> On 5/14/20, Jupiter <jupiter.hce@gmail.com> wrote:
>> Hi,
>>
>> I used ubinize to build a UBIFS image ubi.img, the image has three
>> volumes, dtb-volume (imx6ulz.dtb), kernel-volume and rootfs-volume.
>>
>> To install u-boot and root UBIFS image to iMX6ULL NAND, I used a
>> zImage-initramfs to install the u-boot to u-boot mtd partition first,
>> then to install ubi.img in UBIFS partition by running following
>> commands:
>>
>> flash_erase /dev/mtd2 0 0
>> ubiformat /dev/mtd2 -f /tmp/ubi.img
>>
>> It was all fine, but after the installation, it cannot run ubi part in
>> u-boot:
>>
>> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes
>> from
>> PEB 3
>> 83:0, read 64 bytes
>> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes
>> from
>> PEB
>>  383:2048, read 2048 bytes
>>
>> The problem was that u-boot installation requires a higher bit ECC, so
>> that zImage-initramfs was started with imx6ulz-kobs.dtb, if I change
>> to start  zImage-initramfs with a low bit ECC imx6ulz.dtb, that ECC
>> error gone away, but then I could not flash u-boot to NAND.
>>
>> Are there any way or mtd / ubi command to flash ubi.img to NAND based
>> on a specific ECC / dtb?
>>
>> Appreciate any your kind advice.
>>
>> Thank you.
>>
>> Kind regards,
>>
>> - jupiter
>>
>>
>> --
>> "A man can fail many times, but he isn't a failure until he begins to
>> blame somebody else."
>> -- John Burroughs
>>
>
>
> --
> "A man can fail many times, but he isn't a failure until he begins to
> blame somebody else."
> -- John Burroughs
>


-- 
"A man can fail many times, but he isn't a failure until he begins to
blame somebody else."
-- John Burroughs

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Any UBIFS volume image installation command with selective ECC (DTB) in Linux?
  2020-05-15  6:59   ` Jupiter
@ 2020-05-20 11:22     ` Alexander Dahl
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Dahl @ 2020-05-20 11:22 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jupiter

Hei hei,

Am Freitag, 15. Mai 2020, 08:59:53 CEST schrieb Jupiter:
> I am baffled when ubiformat flashed ubi.img to NAND, who wrote the ECC
> to the flash?, Does ubiformat write ECC to NAND? If so, how can select
> the ECC for ubiformat to write correct ECC to NAND?

IIRC those are set in DT for Linux. You can find some information on that in 
Documentation/devicetree/bindings/mtd/nand-controller.yaml – look out for 
"nand-ecc", e.g.:

  nand-ecc-strength = <8>;

Those settings should match the settings from your bootloader. In U-Boot those 
are not necessarily set through DT however. I just checked with U-Boot 2019.10 
for a sama5d2 based board, and there I find in the kconfig something like 
this: 

  CONFIG_PMECC_CAP=8

However I do not remember, how I came up with the actual values for that 
board, but I do remember I had to make sure these settings should match.

HTH & Greets




______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 11:37 Any UBIFS volume image installation command with selective ECC (DTB) in Linux? Jupiter
2020-05-15  1:16 ` Jupiter
2020-05-15  6:59   ` Jupiter
2020-05-20 11:22     ` Alexander Dahl

Linux-mtd Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mtd/0 linux-mtd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mtd linux-mtd/ https://lore.kernel.org/linux-mtd \
		linux-mtd@lists.infradead.org
	public-inbox-index linux-mtd

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mtd


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git