The FIT Image size can be reduced using the following methods:
- Launch the root file system configuration menu using the
following
command:
$ cd <plnx-proj-root> $ petalinux-config -c rootfs
- 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.
- Launch the kernel configuration menu using the following
command:
$ cd <plnx-proj-root> $ petalinux-config -c kernel
- 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 someconfig
items may lead to unsuccessful boot. It is expected that you have the knowledge ofconfig
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 platform-top.h:
For U-Boot, distro boot using platform-top.h in PetaLinux is disabled by default. U-Boot autoconfig is disabled in the following menu option.
$ petalinux-config ---> Auto Config Settings ---> [ ] u-boot autoconfig
Any U-Boot configuration and environment variables added to platorm-top.h are be included in the U-Boot build when autoconfig is disabled. To fix this issue, use one of the two following methods:
- Method 1: This method demonstrates how to use the
platform-top.h with U-Boot autoconfig
disabled.
- Remove or comment out the following line in
<plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h.
#include <configs/platform-auto.h>
- Create a U-Boot fragment config file (for example:
bsp.cfg) and set the
CONFIG_SYS_CONFIG_NAME as follows in
<plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg.
$ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg CONFIG_SYS_CONFIG_NAME="platform-top"
- In
<plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
recipes, include this bsp.cfg file in the
SRC_URI variable. Install platform-top.h to
u-boot/include/configs in the
do_configure_append bitbake task as shown
below.
FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += " \ file://platform-top.h \ file://bsp.cfg \ " do_configure_append () { if [ "${U_BOOT_AUTO_CONFIG}" = "1" ]; then install ${WORKDIR}/platform-auto.h ${S}/include/configs/ install ${WORKDIR}/platform-top.h ${S}/include/configs/ else install ${WORKDIR}/platform-top.h ${S}/include/configs/ fi } do_configure_append_microblaze () { if [ "${U_BOOT_AUTO_CONFIG}" = "1" ]; then install -d ${B}/source/board/xilinx/microblaze-generic/ install ${WORKDIR}/config.mk ${B}/source/board/xilinx/microblaze-generic/ fi }
- Add the desired U-Boot configuration and environment variables to platform-top.h.
- Clean the U-Boot-xlnx sstate cache and rebuild the U-Boot-xlnx
recipes:
$ petalinux-build -c u-boot -x cleansstate $ petalinux-build -c u-boot
- Remove or comment out the following line in
<plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h.
- Method 2: This method demonstratess how to use
platform-top.h with the U-Boot autoconfig
enabled.
- Run the following PetaLinux command, then enable U-Boot
autconfig and
save.
$ petalinux-config ---> Auto Config Settings ---> [*] u-boot autoconfig
- Add the desired U-Boot configuration and environment variables to platform-top.h.
- Clean the U-Boot-xlnx sstate cache and rebuild the U-Boot-xlnx
recipes:
$ petalinux-build -c u-boot -x cleansstate $ petalinux-build -c u-boot
- Run the following PetaLinux command, then enable U-Boot
autconfig and
save.
- Method 1: This method demonstrates how to use the
platform-top.h with U-Boot autoconfig
disabled.
- Mention the Bootm length in <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h.
#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/platform-top.h.