Image Packaging Configuration - 2024.2 English

PetaLinux Tools Documentation: Reference Guide (UG1144)

Document ID
UG1144
Release Date
2024-11-13
Version
2024.2 English

The Image Packaging Configuration submenu allows you to set the following image packaging configurations:

  • Adding required root file system types.
  • File name of the generated bootable kernel image.
  • Linux kernel image hash function.
  • DTB padding size.
  • Whether to copy the bootable images to host TFTP server directory.
Tip: The petalinux-build tool always generates a FIT image as the kernel image.
Figure 1. Image Packaging Configuration Generated by Your Tool
Note: You can add extra spaces in the root file system by adding value to this variable <project>/project-spec/meta-user/conf/petalinuxbsp.conf IMAGE_ROOTFS_EXTRA_SPACE.

Meta-user Layer Changes

The u-boot-zynq-scr.bbappend and bootcmd files are removed from the meta-user layer and moved to Yocto eSDKs at <plnx-proj-root>/components/yocto/layers/meta-xilinx/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr. You can find these files on running the petalinux-config/petalinux-build command.

serial-autologin-root

serial-autologin-root option in PetaLinux tool is disabled by default. You can enable this with petalinux-config -c rootfs -→ Image Features  -→ [ ] serial-autologin-root.

Linux Components Selection

Added Image selector menu configuration option. It is disabled by default.

Option to Change RAM-based Filesystem

There is a menu configuration option to build the initial RAM-based root file system as highlighted in the following figure.

Figure 2. RAM-based Root File System Generated by Your Tool

You can provide the name of the Yocto image recipe that is used to build an initial RAM filesystem in the menu configuration 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 adaptive SoCs. 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..
Using the petalinux-initramfs-image as the INITRD/INITRAMFS image, boot up the system with tiny rootfs, search for the ext2, ext3, and ext4 SD partitions, and check for the /dev,/etc and /sbin/init file/ folder in it to validate whether the rootfs is valid and can be used as a real file system using the command switch_root. If you want to specify the SD device which has the ext rootfs, add ext4=/dev/mmcblk0p2:/rootfs in system bootargs as follows:
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 run the petalinux-build command.

Note: If you built using the petalinux-initramfs-image command, you continue to see the ramdisk.* images in the images/linux folder. To avoid confusion, check the time stamp.
Note: If you enable Xen when switch_root is enabled, you see build failures because Xen only supports the ramfs boot. Enabling switch_root enables the ext4-based boot. To resolve the issue, change the previous configuration to petalinux-image-minimal from petalinux-initramfs-image.