petalinux-package --wic Command Examples - 2022.1 English

PetaLinux Tools Documentation: Reference Guide (UG1144)

Document ID
UG1144
Release Date
2022-04-26
Version
2022.1 English

Packaging the WIC Image using Default Images

The following command generates the wic image, petalinux-sdimage.wic, in the images/linux folder with the default images from the images/linux directory.

$ petalinux-package --wic

Packaging the WIC Image in a Specific Folder

The following command generates the wic image, petalinux-sdimage.wic, in the wicimage/ folder.

$ petalinux-package --wic --outdir wicimage/

Packaging the WIC Image with Specified Images Path

The following command packs all bootfiles from the custom-imagespath/ directory.

$ petalinux-package --wic --images-dir custom-imagespath/

Packaging Custom Bootfiles into the /boot Directory

  • To copy boot.bin userfile1 userfile2 files from the <plnx-proj-root>/images/linux directory to the /boot of media, use the following command:
    $ petalinux-package --wic --bootfiles "boot.bin userfile1 userfile2"

    This generates the wic image with specified files copied into the /boot directory.

    Note: Ensure that these files are part of the images directory.
  • To copy the uImage file named kernel to the /boot directory, use the following command:
    $ petalinux-package --wic --extra-bootfiles "uImage:kernel"
  • To copy the default bootfiles and specified bootfiles by user files into the /boot directory, use the following command:
    $ petalinux-package --wic --bootfiles "userfiles/*"
  • To copy all the files in the userfiles/ directory to the /boot/user_boot directory, use the following command:
    $ petalinux-package --wic --extra-bootfiles "userfiles/*:user_boot"
    Note: Ensure that these files are part of the images directory.

Packaging Custom Root File System

The following command unpacks your custom-rootfs.tar.gz file and copies it to the /rootfs directory.

$ petalinux-package --wic --rootfs-file custom-rootfs.tar.gz

Customizing WIC Partitions

PetaLinux uses the kickstart (.wks) file to define the partitions to create the WIC image. When the petalinux-package --wic command is executed, the default .wks file is placed in <plnx-proj-root>/build/wic/rootfs.wks. This can be modified and provided as an input to create the WIC images as per the requirement. Following is the default rootfs.wks file:
part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4 --size 800
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4 --size 2400
You can refer to https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-kickstart for each argument specified in the wks file.
Once you have the updated .wks file, use the following command to create WIC image:
$ petalinux-package --wic --wks <path to the wks file>