Steps for Managing Image Size - 2022.2 English

PetaLinux Tools Documentation: Reference Guide (UG1144)

Document ID
Release Date
2022.2 English

The FIT Image size can be reduced using the following methods:

  1. Launch the root file system configuration menu using the following command:
    $ cd <plnx-proj-root>
    $ petalinux-config -c rootfs
  2. Select File System Packages.

    Under this submenu, you can find the list of options corresponding to the root file system packages. If your requirement does not need some of these packages, you can shrink the size of the root file system image by disabling them.

  3. Launch the kernel configuration menu using the following command:
    $ cd <plnx-proj-root>
    $ petalinux-config -c kernel
  4. Select General Setup.

    Under this sub-menu, you can find options to set the config items. Any item that is not mandatory to have in the system can be disabled to reduce the kernel image size. For example, CONFIG_SHMEM, CONFIG_AIO, CONFIG_SWAP, CONFIG_SYSVIPC. For more details, see the Linux kernel documentation.

    Note: Note that disabling of some config items may lead to unsuccessful boot. It is expected that you have the knowledge of config items before disabling them.

    Including extra configuration items and file system packages lead to increase in the kernel image size and the root file system size respectively.

    If the kernel or the root file system size increases and is greater than 128 MB, make the following changes in bsp.cfg:

    • Any U-Boot configuration and environment variables that are added to bsp.cfg are included in the U-Boot build.
    • Mention the Bootm length in <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg.
      #define CONFIG_SYS_BOOTM_LEN <value greater than image size>
    • Undef CONFIG_SYS_BOOTMAPSZ in <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg.