Booting from SD card with an ext4 filesystem

cancel
Showing results for 
Search instead for 
Did you mean: 

Booting from SD card with an ext4 filesystem

Jump to solution
1,489 Views
igor_franco
Contributor IV

Hello,

I'm using the LS1028ARDB with a SD card and the LSDKUG Rev20.04 document to develop the software. I used the flex-build to compile all the firmware, as shown in the document mentioned. However, I don't want to use the RAMdisk filesystem. Is there some argument or command on the bootloader that allow me to use a rootfs.ext4 filesystem (generated on buildroot) written in the same partition used to boot in a SD card? It is not a problem if the bootloader needs to create another partitions, but it is desirable that I don't need to do it externally (using Gparted).

Thank you in advance,

Igor

0 Kudos
1 Solution
1,324 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the following boot commands.

=>setenv bootargs "root=/dev/mmcblk0p4 rootwait rw console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500"

=>load mmc 0:2 0xa0000000 Image

=> load mmc 0:2 0xb0000000 fsl-ls1028a-rdb.dtb

=>booti 0xa0000000 - 0xb0000000

View solution in original post

0 Kudos
10 Replies
1,324 Views
yipingwang
NXP TechSupport
NXP TechSupport

In LSDK 20.04, we suggest customers use the following command to deploy SD/MMC card, no need to consider partition problem.
$ flex-installer -b <bootpartition> -r <rootfs> -f <firmware> -d <device>
For example:
$ flex-installer -b bootpartition_arm64_lts_5.4.tgz -r rootfs_lsdk2004_ubuntu_main_arm64.tgz -f firmware_ls1028ardb_uboot_sdboot.img -d /dev/sdx


You could refer to section "4.1.3 Manually download LSDK images" in LSDK 20.04 user manual to download pre-built images.
LSDK 20.04 user manual could be downloaded from Layerscape SDK | NXP .

0 Kudos
1,324 Views
igor_franco
Contributor IV

Thank you for the quick answer Yiping.

I made this process but I don't understand what the bootpartion and rootfs parameters do. I used an Ubuntu VirtualBox to write it in a microSD card. Found the command used below:

$ sudo flex-installer -b build/images/bootpartition_LS_arm64_lts_4.19_202006171634.tgz -r build/images/rootfs_lsdk2004_buildroot_tiny_arm64_202006171638.tgz -f build/images/firmware_ls1028ardb_uboot_sdboot.img -d /dev/sdb

However, it seems that the boot occured in the RAMdisk, not from the rootfs I gave.

 Screenshot_3.png

My kernel command-line was: "console=ttyS1,115200 root=/dev/mmcblk0p4 rw rootwait ignore_loglevel"

According to the LSDK 20.04 user manual, the partition 4 must be the Userland (primary rfs). How can I boot my buildroot rootfs instead of the based on Yocto (I know that is the default in the composite firmware passed in the -f argument)?

Best regards,

Igor

0 Kudos
1,324 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please use Ubuntu-based main userland rootfs rather than yocto tiny rootfs, you could refer to section "LSDK userland" in LSDK user manual.

$ sudo flex-installer -b build/images/bootpartition_LS_arm64_lts_4.19_202006171634.tgz -r build/images/rootfs_lsdk2004_ ubuntu_main_arm64.tgz -f build/images/firmware_ls1028ardb_uboot_sdboot.img -d /dev/sdb

0 Kudos
1,324 Views
igor_franco
Contributor IV

Hello Yiping,

I really need to use the buildroot distribution as I used in my flex-installer command:

$ sudo flex-installer -b build/images/bootpartition_LS_arm64_lts_4.19_202006171634.tgz -r build/images/rootfs_lsdk2004_buildroot_tiny_arm64_202006171638.tgz -f build/images/firmware_ls1028ardb_uboot_sdboot.img -d /dev/sdb

This processor will be used in a custom product that has its filesystem compiled in the buildroot. So, because our custom applications are adapted to the buildroot, this compiler must not change.

Also, my problem is that apparently the filesystem mounted by the Kernel is in the RAM (included in the composite firmware passed in the argument -f of the flex-installer). I say this because the welcome message of the buildroot filesystem must be this, according the defconfig of the board (qoirq_arm64_tiny_defconfig on flex-builder configs/buildroot):

pastedImage_6.png

Not this:

Screenshot_3.png

I need that the Kernel mount the EXT4 partition where my buildroot rootfs was installed (argument -r of the flex-installer).  How can I make the Kernel mount the EXT4 partition instead of the RAMdisk filesystem on the composite firmware?

Best regards,

Igor

0 Kudos
1,324 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Igor,

Would you please provide your Linux Kernel booting up log(from u-boot booting up) ?

Thanks,

Yiping

0 Kudos
1,324 Views
igor_franco
Contributor IV

Hello Yiping,

Find boot log from the bootloader to the tiny rootfs login attach in this message.

Best regards,

Igor

0 Kudos
1,324 Views
yipingwang
NXP TechSupport
NXP TechSupport

According to the following Kernel command line value in your log, the system boot from partition 4 of the SD card, not from ramdisk.

Kernel command line: console=ttyS1,115200 root=/dev/mmcblk0p4 rw rootwait ignore_loglevel

You could write Ubuntu rootfs to the target board with the following command.

 flex-installer -b bootpartition_arm64_lts_5.4.tgz -r rootfs_lsdk2004_ubuntu_main_arm64.tgz -f firmware_ls1028ardb_uboot_sdboot.img -d /dev/sdx

0 Kudos
1,324 Views
igor_franco
Contributor IV

I'm using the flex-installer command to install my rootfs, as I shown on my second message. And change it for ubuntu must not solve the problem. The problem is that the Linux is not using the rootfs that I passed. If you see the logs I sent in the previous message, you will find the follow:

MMC read: dev # 0, block # 32768, count 81920 ... 81920 blocks read: OK
## Loading kernel from FIT Image at a0000000 ...
Using 'ls1028ardb' configuration
Trying 'kernel' kernel subimage
Description: ARM64 Kernel
Created: 2020-06-16 14:09:36 UTC
Type: Kernel Image
Compression: gzip compressed
Data Start: 0xa00000d0
Data Size: 10878911 Bytes = 10.4 MiB
Architecture: AArch64
OS: Linux
Load Address: 0x84080000
Entry Point: 0x84080000
Hash algo: crc32
Hash value: ee5639f0
Verifying Hash Integrity ... crc32+ OK
## Loading ramdisk from FIT Image at a0000000 ...
Using 'ls1028ardb' configuration
Trying 'initrd' ramdisk subimage
Description: initrd for arm64
Created: 2020-06-16 14:09:36 UTC
Type: RAMDisk Image
Compression: uncompressed
Data Start: 0xa0a60170
Data Size: 22512876 Bytes = 21.5 MiB
Architecture: AArch64
OS: Linux
Load Address: 0x00000000
Entry Point: 0x00000000
Hash algo: crc32
Hash value: 6801318d
Verifying Hash Integrity ... crc32+ OK
## Loading fdt from FIT Image at a0000000 ...
Using 'ls1028ardb' configuration
Trying 'ls1028ardb-dtb' fdt subimage
Description: ls1028ardb-dtb
Created: 2020-06-16 14:09:36 UTC
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0xa1fe3bbc
Data Size: 20362 Bytes = 19.9 KiB
Architecture: AArch64
Load Address: 0x90000000
Hash algo: crc32
Hash value: 657f3913
Verifying Hash Integrity ... crc32+ OK
Loading fdt from 0xa1fe3bbc to 0x90000000
Booting using the fdt blob at 0x90000000
Uncompressing Kernel Image
Using Device Tree in place at 0000000090000000, end 0000000090007f89
Unable to update property /sysclk:clock-frequency, err=FDT_ERR_NOTFOUND
WARNING could not find node snps,dwc3: FDT_ERR_NOTFOUND.
WARNING could not find node snps,dwc3: FDT_ERR_NOTFOUND.

Starting kernel ...

.

.

.

[ 1.379149] Trying to unpack rootfs image as initramfs...
[ 2.285467] Freeing initrd memory: 21980K

You can notice that even my Kernel command inform that root=/dev/mmcblk0p4, the Kernel is using the RAMDisk. Usually, the logs show when a device is mounted as rootfs. There is nothing indicating that my parition 4 was mounted.

Also, I tested the filesystem by writing a file and rebooting the board, the file was not there, which is a behavior of a RAM filesystem.

Best regards,

Igor

0 Kudos
1,325 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the following boot commands.

=>setenv bootargs "root=/dev/mmcblk0p4 rootwait rw console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500"

=>load mmc 0:2 0xa0000000 Image

=> load mmc 0:2 0xb0000000 fsl-ls1028a-rdb.dtb

=>booti 0xa0000000 - 0xb0000000

0 Kudos
1,324 Views
igor_franco
Contributor IV

Hello Yiping,

Now it works!

pastedImage_1.png

Thank you for the support.

I marked the last message as solution.

0 Kudos