LS1046ARDB mount rootfs as tmpfs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LS1046ARDB mount rootfs as tmpfs

628 Views
srechermann
Contributor III

Hello,

What I want to achieve:

I want to write bootloaders, kernel, dtb and rootfs on my SD Card (in a later stage I want to do the same with the QSPI-Flash). As a rootfs image I want to use a custom-image I create using yocto, that's inheriting from the core-image-minimal and adds a few additional packages (I attached the custom-image recipe). When booting I want to create my rootfs as a tmpfs so that my system is volatile and completely in RAM. I don't know how to archive this and in which format I need my custom-image (cpio, cpio.gz, tar.gz ...). Or if it's necessary/beneficial to combine my kernel, dts and rootfs in a fitImage? In the documentation(https://www.nxp.com/docs/en/supporting-information/QORIQ_LS1046A_BSP_V0-4_REV-A.pdf) I found this:

 

 

setenv bootargs "root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200" 

 

 

 I guess that's a ramdisk approach which is deprecated and it's more modern and efficient to use a tmpfs (https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt)? But I'm no expert here and maybe I am misunderstanding something here. Please correct me if I'm wrong and if I can achieve it to have a completely RAM based system using this I'm also happy with this root=/dev/ram0 approach but I also don't know how to modify my current workflow to achieve this approach.

My current workflow having the rootfs as a non volatile SD card partition:
Currently I'm programming my SD card like this:

1. Write bootloader files to the SD card

 

 

cd tmp/deploy/images/ls1046ardb
bl2_sd_file="atf/bl2_sd.pbl"
fip_uboot_file="atf/fip_uboot.bin"
fman_ucode_file="fsl_fman_ucode_ls1046_r1.0_106_4_18.bin"

image="custom-image-ls1046ardb.tar.gz"
kernel="Image"
dtb="fsl-ls1046a-rdb-sdk.dtb"

# write the bootloader files to the SD card
sudo dd if={bl2_sd_file} of=/dev/sdb bs=512 seek=8
sudo dd if={fip_uboot_file} of=/dev/sdb bs=512 seek=2048
sudo dd if={fman_ucode_file} of=/dev/sdb bs=512 seek=18432

 

 

2. Create ext2 partition right behind the bootloader files using fdisk and mkfs.ext2

 

 

sudo fdisk /dev/sdb
    n # new partiton
    p # primary partition
    1 #partition number 1
    <18432 + number_of_blocks(fsl_fman_ucode_ls1046_r1.0_106_4_18.bin)> # start address
    +200M # partition size
    w
sudo mkfs.ext2 /dev/sdb1

 

 

3. Unpack custom-image.tar.gz to the ext2 partition and copy Image+dtb to /boot directory

 

 

sudo mount /dev/sdb1 /mnt/sdcard
sudo tar -xzf custom-image-ls1046ardb.tar.gz -C /mnt/sdcard
sudo cp Image /mnt/sdcard/boot
sudo cp fsl-ls1046a-rdb-sdk.dtb /mnt/sdcard/boot

 

 

 4. Put SD card in board and switch board on (dip switches are set to SD card boot) and enter uboot prompt

 

 

setenv bootcmd 'setenv bootargs root=/dev/mmcblk0p1 rw rootdelay=5 console=ttyS0,115200;mmcinfo;ext2load mmc 0:1 0xa0000000 boot/Image;ext2load mmc 0:1 0xb0000000 /boot/fsl-ls1046a-rdb-sdk.dtb;booti 0xa0000000 - 0xb0000000'
boot

 

 

Summary

My current workflow works but as already described I want to have my rootfs only in RAM and I don't know what's the best approach to achieve this (not only initramfs, but this would also be ok if it's NOT getting remounted during init process to a rootfs located on SD card). I tried for example using a compressed cpio archive loading it to RAM and passing it as initrd parameter to the booti command but it is not working and I get the error "Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid".

 

 

setenv bootcmd 'setenv bootargs rootfstype=tmpfs rw size=1024M rootdelay=5 console=ttyS0,115200;mmcinfo;ext2load mmc 0:1 0xa0000000 Image;ext2load mmc 0:1 0xb0000000 fsl-ls1046a-rdb-sdk.dtb;ext2load mmc 0:1 0xc0000000 custom-image-initramfs.cpio.gz;booti 0xa0000000 0xc0000000 0xb0000000'
boot

 

 

 

 

 

0 Kudos
1 Reply

581 Views
srechermann
Contributor III

I tried duplicated the post here https://community.nxp.com/t5/QorIQ/mount-compressed-rootfs-image-located-on-SD-card-as-tmpfs-in-RAM/... as I think product forums is not the correct location for my question. But it was marked as spam so maybe it's possible for a moderator to move this question to the correct forum (I think QoriIQ Processing Platforms) and delete this one here?

0 Kudos