After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

Arek
Contact:
Posts: 4
Joined: Wed Sep 27, 2017 10:08 am

After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

Thu Mar 15, 2018 2:41 pm

Hello,

I'm working on custom board based on SAMA5d36. I created working custom image/distribution using Yocto Krogoth branch.

Recently I'm trying to migrate to Morty branch, but now I stuck on Kernel 4.9 boot issue. I narrowed to boot problem to Kernel 4.9. All other elements (hardware, bootloader, kernel configuration, rootfs, device tree) did not change.

Kernel 4.9 error:
```
ubi0: attaching mtd4
atmel_nand 60000000.nand: PMECC: Too many errors
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2:0, read only 64 bytes, retry
atmel_nand 60000000.nand: PMECC: Too many errors
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2:0, read only 64 bytes, retry
atmel_nand 60000000.nand: PMECC: Too many errors
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2:0, read only 64 bytes, retry
atmel_nand 60000000.nand: PMECC: Too many errors
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.9.52-linux4sam_5.7 #1
```

While Kernel 4.1 boots up fine:
```
ubi0: attaching mtd4
ubi0: scanning is finished
ubi0: attached mtd4 (name "sys", size 254 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 2034, bad PEBs: 4, corrupted PEBs: 0
ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1249350788
ubi0: available PEBs: 0, total reserved PEBs: 2034, PEBs reserved for bad PEB handling: 36
```

Full 4.1 boot log: https://pastebin.com/3fevguP0
Full 4.9 boot log: https://pastebin.com/FpJZrkfi
blue_z
Location: USA
Posts: 1721
Joined: Thu Apr 19, 2007 10:15 pm

Re: After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

Fri Mar 16, 2018 8:25 pm

Arek wrote:All other elements (hardware, bootloader, kernel configuration, rootfs, device tree) did not change.
This statement doesn't make sense. If you're going to update from Krogoth to Morty, then you have to update these components.
Clearly you updated AT91Bootstrap and U-Boot to newer versions.
Presumably you mean you tried to use the same components when comparing.
What rootfs is installed in NAND? What built that rootfs?
What dtb is installed in NAND? What built that dtb?

Be aware that the likeliest reason for such ECC errors with UBI/UBIFS is pilot error.

Regards
Arek
Contact:
Posts: 4
Joined: Wed Sep 27, 2017 10:08 am

Re: After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

Sat Mar 17, 2018 5:14 pm

Thank you for your answer.

Rootfs was built by Yocto Morty branch.
DTS is customized version of at91-sama5d3_xplained.dts file. It is patched in to Kernel using Yocto patch mechanism.

I did update AT91Bootstrap and U-Boot to newest versions. After migration to Morty - when I encountered boot problem - I started to replace component by component and check result.

I found that replacing Kernel by "old" one, built by Yocto Krogoth, with all other components (AT91Bootstrap, U-Boot, rootfs) taken from Morty - allows device to boot up.

Kernel, and rootfs are all packed in to UBI images different volumes. I created ubinize.cfg file to build test UBI images in same environment - still same result.

Both Kernel and device tree are packed in to U-BOOT FIT image. My primary suspect is the device tree file, although Kernel boot log suggests otherwise. Also DTB file found in Kernel build directory looks good (has correct name).

Regards
blue_z
Location: USA
Posts: 1721
Joined: Thu Apr 19, 2007 10:15 pm

Re: After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

Sun Mar 18, 2018 12:14 am

Arek wrote:DTS is customized version of at91-sama5d3_xplained.dts file.
The name of the dtb you used is revealed in the boot logs.
What's not clear is what version of .dtb you're using with each kernel.
(You have a custom board, yet use the name of an Atmel board.)

Arek wrote:I found that replacing Kernel by "old" one, built by Yocto Krogoth, with all other components (AT91Bootstrap, U-Boot, rootfs) taken from Morty - allows device to boot up.
Again you fail to clarify which .dtb you're using.


FWIW I happen to have Yocto builds of the Linux4SAM demo for version 5.3 (Jethro) (using Linux 4.1) and version 5.7 (Morty) (using Linux 4.9) for the SAMA5D36-EK.
I flashed the kernel, dtb, and rootfs from Linux4SAM demo 5.3, along with Linux4SAM 5.7 releases of AT91Bootstrap and U-Boot.
As expected this booted cleanly.
i reboot into U-Boot, tftp into memory the Linux4SAM demo 5.7 kernel and dtb, and then successfully booted with the Linux4SAM demo 5.3. rootfs in NAND.
The one anomaly noticed is that the number of reserved PEBs is off by two.
UBI in Linux 4.1 reports that the rootfs volume has 36 reserved PEBs.
But Linux 4.9 reports that the same volume has only 34 reserved PEBs.

Regards
Arek
Contact:
Posts: 4
Joined: Wed Sep 27, 2017 10:08 am

Re: After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

Tue Mar 20, 2018 3:23 pm

I was able to track commit, that causes my problems.
https://github.com/linux4sam/linux-at91 ... 0c49d0b0ff
Before this commit, Kernel boots up.

I got sama5d3-xplained board. I flashed my problem-causing images there, and I got same error.

I'm using dtb that was generated by Yocto for currently selected Kernel version.
blue_z
Location: USA
Posts: 1721
Joined: Thu Apr 19, 2007 10:15 pm

Re: After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

Thu Mar 22, 2018 2:12 am

Arek wrote:I was able to track commit, that causes my problems.
Since the 4.9 kernel that I used does contain that commit, it alone does not seem sufficient to cause ECC issues.
IOW not using that commit is probably a band-aid/work-around rather than a solution for the root problem.

Regards
Arek
Contact:
Posts: 4
Joined: Wed Sep 27, 2017 10:08 am

Re: After migration from 4.1, Kernel 4.9 fails to attach ubi mtd device

Thu Mar 22, 2018 7:57 am

Problem solved.

I was using SAM-BA 2 to program device flash, after upgrade to SAM-BA 3.2.0 Linux boots up without errors.

Regards
Arek Marud

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 1 guest