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
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.
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 2022.1 release.
To disable switch_root in BSPs, follow the steps mentioned in Disabling switch_root