Linux unable to load ubifs root filesystem (sama5d2)

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

Moderator: nferre

riktw
Posts: 8
Joined: Mon Sep 26, 2016 1:35 pm

Linux unable to load ubifs root filesystem (sama5d2)

Tue Nov 01, 2016 5:54 pm

Hello,

I are working on a project that uses the SAMA5D27 as microcontroller. I designed a custom board for this project containing the SAMA5D27, 256Mbyte DDR3 and 1Gbit NAND flash. I want to use Linux as OS for this project, part of the code has already been developed on the SAMA5D2 Xplained board.
The Linux image is being made using buildroot.

The boot stragety is as follows:
The BootROM loads the AT91bootstrap3 into SRAM.
The AT91bootstrap3 copies the Linux kernel and devicetree to the DDR memory and then starts Linux.
The Root filesystem is using ubifs as filesystem.

On boot the board correctly loads the at91bootstrap and the Linux kernel.
The problem is that Linux cannot mount the root filesystem:
[ 3.840000] ubi0 error: ubi_read_volume_table: the layout volume was not found
[ 3.840000] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22

The ubi file is created by Buildroot and I have ubinized the ubi file using the command:
ubinize -o rootfs.ubi -m 0x800 -p 0x20000 -s 2048 ubinize.cfg
The config file ubinize.cfg can be found here: http://pastebin.com/mtgt6nuB

I used the sam-ba 3.13 tool to program the rootfs and the rest of the files to the nand flash. The config script can be found here: http://pastebin.com/mE6KTkaG

The full log of the Linux boot can be found here: http://pastebin.com/zw5Ls68z

I hope someone can help me with why Linux is unable to mount the root filesystem

Used hardware:
SAMA5D27 revision B
mt29f1g08 NAND Flash

Best regards,

Rik
blue_z
Location: USA
Posts: 1560
Joined: Thu Apr 19, 2007 10:15 pm

Re: Linux unable to load ubifs root filesystem (sama5d2)

Wed Nov 02, 2016 2:31 am

riktw wrote:I are working on a project that uses the SAMA5D27 as microcontroller. I designed a custom board for this project containing the SAMA5D27, 256Mbyte DDR3 and 1Gbit NAND flash.
How did you verify the functionality of the hardware?
Have you been able to boot Linux at all and/or test NAND using U-Boot?
riktw wrote:The problem is that Linux cannot mount the root filesystem:
[ 3.840000] ubi0 error: ubi_read_volume_table: the layout volume was not found
[ 3.840000] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22
No, you're confusing a secondary issue with the primary issue.
The message clearly states that the UBI volume was not found.
Since there's no UBI volume, later, when it's time to mount the rootfs, there is no UBIFS (which would be contained within the UBI volume).

A UBI volume problem usually points the finger at either your ubinize procedure, and/or the flashing of the ubi image, and/or the NAND configuration in the kernel (which you completely omit).
riktw wrote:The ubi file is created by Buildroot and I have ubinized the ubi file using the command:
ubinize -o rootfs.ubi -m 0x800 -p 0x20000 -s 2048 ubinize.cfg
The config file ubinize.cfg can be found here: http://pastebin.com/mtgt6nuB
If Buildroot is producing the ubi file, then why are you performing another ubinize?

You need to double check the NAND parameters that you are using.
The kernel boot log clearly indicates that you are not configuring the proper number of ECC bits for the NAND chip.
riktw wrote:I used the sam-ba 3.13 tool to program the rootfs and the rest of the files to the nand flash. The config script can be found here: http://pastebin.com/mE6KTkaG
That's not a "config" script, but rather a script to install the images to NAND flash.
What are the actual NAND and PMECC parameters used by SAM-BA to write to your board?
I.E. have you created an applet for your custom board?
riktw wrote:The full log of the Linux boot can be found here: http://pastebin.com/zw5Ls68z
Curiously you seem to have built a RC version of the kernel, i.e. version 4.4.24-linux4sam_5.5, whereas the release tarball for "5.5" is version 4.4.26-linux4sam_5.5.

Regards
riktw
Posts: 8
Joined: Mon Sep 26, 2016 1:35 pm

Re: Linux unable to load ubifs root filesystem (sama5d2)

Wed Nov 02, 2016 9:56 pm

blue_z wrote:How did you verify the functionality of the hardware?
Have you been able to boot Linux at all and/or test NAND using U-Boot?
If I read back the full nand memory using sam-ba and compare this with files I have written to sam-ba they match.
I used this as a quick verify of the NAND Flash.
The Linux kernel gets copied from NAND to DDR and boots fine, apart from the ubifs
blue_z wrote: If Buildroot is producing the ubi file, then why are you performing another ubinize?
Mostly as a sanity check, to see if something went wrong with the ubinizing process.
I am letting buildroot do this now instead of doing it manually, the config remains the same.
blue_z wrote: That's not a "config" script, but rather a script to install the images to NAND flash.
What are the actual NAND and PMECC parameters used by SAM-BA to write to your board?
I.E. have you created an applet for your custom board?
As far as I know the NAND header in the script (nandHeader: 0xc0902405) sets the NAND parameters and PMECC parameters for Sam-ba.
I am using Sam-ba 3.14 as the 2.xx with GUI does not support the SAMA5D2.
I though this was enough, if this is not enough and I need to create a custom applet, where can I find some information on this?
I added some info in the script, which can be found here: http://pastebin.com/9aqRa0Zy

I have changed and tried a couple of things. I removed nfc from the devicetree, now Linux managed attach the rootfs as mtd2.
ubi then tries to erase the first block and fails, I am not entirely sure why it does this and why it fails.
Because ubi cannot erase this block it tries to mark it as a bad block and fails with this as well, causing ubi to go to read only mode.
Because of this the Kernel cannot mount the root filesystem and fails.
I also fixed a mistake in the device tree, the nand_ready pin was connected to the wrong pin in the device tree.

My full bootlog can be found here: http://pastebin.com/XQsDweFV
The device tree files can be found here: http://pastebin.com/B1VceJC0 and here: http://pastebin.com/u9YYBbEA
riktw
Posts: 8
Joined: Mon Sep 26, 2016 1:35 pm

Re: Linux unable to load ubifs root filesystem (sama5d2)

Thu Nov 03, 2016 5:28 pm

The problem has been solved.
NFC was needed in the device tree, it wasn't working earlier as I had the nand_rdy pin wrong in the device tree. Without NFC I could only read the NAND, not write or erase it. The datasheet makes it seem NAND should also work without NFC, just with a higher CPU load.
After adding nfc back and and getting all the ubifs configs correct I can now load the rootfs from NAND.
peSchb
Posts: 2
Joined: Thu Dec 07, 2017 10:23 am

Re: Linux unable to load ubifs root filesystem (sama5d2)

Thu Dec 07, 2017 10:32 am

could you please provide your used device tree sources that now made the NAND flash properly work ?
thx,
peter

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 2 guests