Switch_root in petalinux-config - 2021.2 English

PetaLinux Tools Documentation: Reference Guide

Document ID
UG1144
Release Date
2021-10-27
Version
2021.2 English

The switch_root is a utility used to switch from one root file system to another file system as the root of the mount tree. It is primarily used for initramfs/initrd cases.

In PetaLinux Zynq UltraScale+ MPSoC and Versal BSPs, the default menuconfig option for petalinux-config > Image Package Configuration > INITRAMFS/INITRD image name is set to petalinux-initramfs-image which is treated as switch_root enabled. The respective config image is packaged in the image.ub file and is also copied into the images/linux folder with ramdisk prefixed to the file name (for example, ramdisk.cpio.gz.u-boot), if the image specified in the config option name contains the initramfs.

The default generated ramdisk.cpio.gz.u-boot is a tiny-based search of the root file system for the EXT partition in SD/eMMC that is used as a real time rootfs file system irrespective of boot mode. If the init script in the tiny rootfs system does not find any rootfs in real time, it lands in to the tiny-based rootfs with the '/#' prompt.

Figure 1. Tiny Root File System Prompt

For example, if you are in the QSPI boot mode and you have flashed the BOOT.BIN, boot.scr, and image.ub files, it will boot up to tiny rootfs and search for the ext2/3/4 to mount and use it as real rootfs.

The default Zynq UltraScale+ MPSoC and Versal BSP prebuilt/built images are configured as mentioned above to facilitate the larger rootfs support in PetaLinux. In TEMPLATE projects, switch_root is disabled by default starting from the PetaLinux 2021.2 release.

To disable switch_root in BSPs, follow the steps mentioned in Disabling switch_root