Booting a PetaLinux Image on Hardware with SD Card - 2023.2 English

PetaLinux Tools Documentation: Reference Guide (UG1144)

Document ID
UG1144
Release Date
2023-10-18
Version
2023.2 English
You can boot a PetaLinux image on hardware using an SD card by copying the required images manually or by flashing a WIC image into the mounted SD card.

Flashing and Booting the PetaLinux Images Manually

  1. Partition the SD card by following Partitioning and Formatting an SD Card.
  2. Copy the following files from <plnx-proj-root>/images/linux or <plnx-proj-root>/pre-built/linux/images/ into the boot directory of the first partition, which is in FAT32 format in the SD card:
    • BOOT.BIN
    • image.ub
    • boot.scr
  3. Mount the ext4 partition and extract the rootfs.tar.gz folder into the ext4 partition of the SD card with sudo permissions.
    -> mount /dev/mmcblk1p1 /mnt
    -> cd /mnt
    -> tar -xzvf /PATH/TO/rootfs.tar.gz
  4. Connect the serial port on the board to your workstation.
  5. Open a console on the workstation and start the preferred serial communication program (For example: kermit, minicom, gtkterm) with the baud rate set to 115200 on that console.
  6. Power off the board.
  7. Set the boot mode of the board to SD boot. Refer to the board documentation for details.
  8. Plug the SD card into the board.
  9. Power on the board.
  10. A boot message displays on the serial console.

Flashing and Booting the PetaLinux Image Using WIC Image

  1. To generate the WIC image in PetaLinux project see petalinux-package --wic Command Examples.
  2. Go to the <plnx-proj-root>/images/linux or <plnx-proj-root>/pre-built/linux/images/ directory. For example, cd images/linux/.
  3. If the WIC image is compressed with XZ format, extract the petalinux-sdimage.wic.xz file using xz command. For example, xz -d petalinux-sdimage.wic.xz.
    Note: If xz package is not installed in your build machine, use the prebuilt xz binary from $PETALINUX/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/xz.
  4. Flash the extracted petalinux-sdimage.wic image into the SD card.
    Flash the WIC image in Linux
    To flash the WIC image to SD card in Linux machines, connect the SD card to the host system and use the dd command:

    dd if=petalinux-sdimage.wic of=/dev/sd<X> conv=fsync

    Note: You need sudo access to do this.
    Flash the WIC image in Windows
    To flash the WIC image to the SD card in Windows, you can use any of the following:
    • BalenaEtcher tool
    • Win32DiskImager
  5. Insert the SD card into the board and boot the system.
  6. Connect the serial port on the board to your workstation.
  7. Open a console on the workstation and start the preferred serial communication program (For example: kermit, minicom, gtkterm) with the baud rate set to 115200 on that console.
  8. Power off the board.
  9. Set the boot mode of the board to SD boot. Refer to the board documentation for details.
  10. Plug the SD card into the board.
  11. Power on the board. The boot logs display on the serial console:
Tip: To stop auto-boot, hit any key when you see a message on the console: Hit any key to stop autoboot.