There is a menu config option to build the initial RAM-based root filesystem as highlighted in the following figure.
You can provide the name of the Yocto image recipe that is used to build an initial RAM filesystem in the menu config option, INITRAMFS/INITRD Image name. By default, it is set to petalinux-image-minimal for Zynq-7000 devices and MicroBlaze processors and to petalinux-initramfs-image for Zynq UltraScale+ MPSoCs and Versal ACAPs. The petalinux-initramfs-image is a small file system which is deployed into images/linux as ramdisk.cpio.gz.u-boot. It is also packed into Fit image as image.ub. This allows the specified image to be bundled inside the kernel image. An INITRAMFS/INITRD image provides a temporary root file system used for early system initialization, for example, when loading modules that are needed to locate and mount the "real" root filesystem.
After configuration, you can find the following bootargs changes in <plnx-proj-root>/configs/config:
init_fatal_sh=1:
Launch the initramfs prompt if the specified device not available.
You can see the two root file systems in <plnx-proj-root>/images/linux:
ramdisk.cpio, ramdisk.cpio.gz.u-boot etc..
rootfs.cpio, rootfs.cpio.gz.u-boot etc..
switch_root
. If you want to specify the SD device which
has the ext rootfs, add ext4=/dev/mmcblk0p2:/rootfs
in system bootargs as shown
below:petalinux-config ---> DTG Settings ---> Kernel Bootargs ---> [ ] generate boot args automatically
petalinux-config ---> DTG Settings ---> Kernel Bootargs ---> (earlycon console=ttyPS0,115200 clk_ignore_unused init_fatal_sh=1 ext4=/dev/mmcblk0p2:/rootfs) user set kernel bootargs
Disabling switch_root
If you do not want to use the switch_root
command
which is the default command to mount and use the ext rootfs in Zynq UltraScale+ MPSoC and Versal devices, you
can disable it in build time using the following command:
petalinux-config ---> Image Packaging Configuration --->
Update the name petalinux-initramfs-image to petalinux-image-minimal in INITRAMFS/INITRD image name and then run
the petalinux-build
command.
petalinux-initramfs-image
command, you will continue to
see the ramdisk.* images in the
images/linux folder. To avoid confusion, check the time
stamp.switch_root
is enabled, you will see build failures because Xen
only supports the ramfs boot. Enabling switch_root
will enable the
ext4-based boot. To resolve the issue, change the above configuration to
petalinux-image-minimal
from
petalinux-initramfs-image
.