Additional Options for Booting on QEMU - 2023.2 English

PetaLinux Tools Documentation: Reference Guide (UG1144)

Document ID
UG1144
Release Date
2023-10-18
Version
2023.2 English
  • To download the newly built <plnx-proj-root>/images/linux/u-boot.elf with QEMU:
    petalinux-boot --qemu --u-boot
    • For Zynq UltraScale+ MPSoC and Versal adaptive SoC, it loads <plnx-proj-root>/images/linux/u-boot.elf and boots the TF-A image <plnx-proj-root>/images/linux/bl31.elf with QEMU. The TF-A boots the loaded U-Boot image.
    • For MicroBlaze CPUs and Zynq 7000 devices, it boots <plnx-proj-root>/images/linux/u-boot.elf with QEMU.
  • To download the newly built kernel with QEMU:
    petalinux-boot --qemu --kernel
    • For MicroBlaze processors, it boots <plnx-proj-root>/images/linux/image.elf with QEMU.
    • For Zynq 7000 devices, it boots <plnx-proj-root>/images/linux/zImage with QEMU.
    • For Zynq UltraScale+ MPSoC, it loads the kernel image <plnx-proj-root>/images/linux/Image and boots the TF-A image <plnx-proj-root>/images/linux/bl31.elf with QEMU. The TF-A boots the loaded kernel image, with PMU firmware running in the background.
    • For AMD Versalâ„¢ adaptive SoC, it loads the kernel image <plnx-proj-root>/images/linux/Image and boots the TF-A image <plnx-proj-root>/images/linux/bl31.elf with QEMU. The TF-A boots the loaded kernel image with PLM and PSM firmware running in the background.
      Note: For Versal adaptive SoC, QEMU boots up to the tiny root file system if switch_root is enabled and gives you the rootfs prompt with ERROR: There's no '/dev' on rootfs.. message. This is because PetaLinux uses the SD boot mode in QEMU and the SD image has only FAT with tiny rootfs by default.

After Linux booted successfully, ensure to first login with username petalinux and change the password. Try commands such as ls, ifconfig, cat/proc/cpuinfoand. They behave the same as on real hardware. To exit the emulator when you are finished,

  1. press Ctrl A
  2. release
  3. press X
  • To download a customized U-Boot image with --uboot/--u-boot option:
    petalinux-boot --qemu --u-boot/--uboot <specify custom u-boot.elf path>
  • To download a customized kernel image with --kernel option:
    • For Zynq UltraScale+ MPSoC and Versal adaptive SoC, use image:
      petalinux-boot --qemu --kernel <specify custom Image path>
    • For Zynq 7000 devices, use zImage:
      petalinux-boot --qemu --kernel <specify custom zimage path>
    • For MicroBlaze processors, use Image.elf:
      petalinux-boot --qemu --kernel <specify custom Image.elf path>
  • To download a customized root file system image with --rootfs option:
    petalinux-boot --qemu --kernel --rootfs <specify custom cpio.gz.u-boot path>
  • To download a customized DTB image with --kernel option:
    petalinux-boot --qemu --kernel <specify custom kernel path> --dtb <specify custom dtb path>
  • To download a customized DTB image with --uboot/--u-boot option:
    petalinux-boot --qemu --u-boot/--uboot <specify custom u-boot path> --dtb <specify custom dtb path> 

    This is not supported by Versal adaptive SoCs.

  • To download a customized pmufw image with the --kernel option:
    petalinux-boot --qemu --kernel <specify custom kernel path> --pmufw <specify custom pmufw.elf path>
  • To download a customized pmufw image with --uboot/--u-boot option:
    petalinux-boot --qemu --uboot/--u-boot <specify custom u-boot path> --pmufw <specify custom pmufw.elf path>
  • To change the boot mode to QSPI for the board which does not have SD :
    • The default petalinux-boot command with QEMU work in SD boot mode. If your board does not have the SD and support QSPI or OSPI, follow the steps to change the boot mode to QSPI or OSPI
    • Note: In the following command, boot mode is specified as 8, which works with vck190 board. To check the boot mode number of the respective board, refer to the board user guide of that board mentioned in the BSP README file.
      petalinux-package --boot --uboot 
      dd if=/dev/zero bs=1G count=1 > <QEMU_QSPI>.bin
      dd if=prebuilt/linux/images/BOOT.BIN of=<QEMU_QSPI>.bin bs=1 seek=0 conv=notrunc
      petalinux-boot --qemu --prebuilt 3 --qemu-args=" -drive file=<QEMU_QSPI>.bin,if=mtd,format=raw,index=4 -boot mode=8"
      booti [<addr> [<initrd>[:<size>]] [<fdt>]]
Note: QEMU version has been upgraded to 7.1. The old options are deprecated in the new version but remain functionally operational. Warning messages are displayed because PetaLinux tools still use the old options. You can ignore them.