4 Rebuilding the image

If we maintain two types of images with, at least, different boot methods and potentially other parameters somewhat different, then it's reasonable to have separate directories to deploy raw built artifacts into.

The script 'deploy_dir.sh' allows to tweak config parameters faster than doing it through the ncurses-based menu offered by 'petalinux-config' with parameter '--get-hw-description='. The script assigns a chosen directory inside the 'path_to_the_project/images/linux' path as a Deploy Directory.

For example, it can be 'path_to_the_project/images/linux/ext4' for EXT4 boot method:

$ ./deploy_dir.sh u96v2_sbc_base_2023_2 ext4

If the 2nd parameter is skipped, the Deploy Directory falls back to the default 'path_to_the_project/images/linux.

When everything is set, run the following command to build an image:

$ petalinux-build -p u96v2_sbc_base_2023_2 -c u96v2exp-image-core

After the image has been built, we should generate boot file BOOT.BIN using 'petalinux-package' utility.

All parameters for the utility are set in the script 'update.bootbin.sh'. 'petalinux-package' doesn't use Deploy Directory variable defined in the project, so we have to provide a path to the components 'petalinux-package' uses (fsbl, atf, u-boot, etc) and where to place BOOT.BIN into.

Like for Deploy Directory, 'update.bootbin.sh' takes the second parameter to construct a path to the components inside directory 'path_to_the_project/images/linux'.

For example, if your Deploy Directory was 'path_to_the_project/images/linux/ext4', you will run:

$ ./update.bootbin.sh u96v2_sbc_base_2023_2 ext4

If the 2nd parameter is skipped, 'path_to_the_project/images/linux' will be used.

All done.

4.1 Populating SD card

Now you need to place:

  • BOOT.BIN

  • u-boot.scr

  • image.ub

into the first partition of boot SD card.

If you built 'INITRD' image, compressed ramdisk is already in 'image.ub'.

If you built 'EXT4' image, you need to unpack 'rootfs.tar.gz' into the second partition:

$ tar xvf rootfs.tar.gz -C [path to a mount point of the 2nd partition]

Last updated