Boot Images

This section will cover image generation and boot flows with QEMU.

PetaLinux provides a simpler way to customize boot flow, however this section will cover lower-level tools available for more complex boot flows, should they be needed.

This section does not cover building the files used when creating the boot images.  If they are not available, they can be built in a PetaLinux project.



Using SD for Boot

Creating the SD Image

We will create the SD image using dd, mkfs, and mcopy.

mcopy is a part of mtools, and can be downloaded through your package manager (e.g. apt-get) or from GNU.org.

dd if=/dev/zero of=qemu_sd.img bs=256M count=1
mkfs.vfat -F 32 qemu_sd.img
mcopy -i qemu_sd.img BOOT.BIN ::/
mcopy -i qemu_sd.img Image ::/
mcopy -i qemu_sd.img system.dtb ::/

Booting the Image in QEMU

Booting the Image with Zynq UltraScale+ MPSoC

To boot with SD on Zynq UltraScale+ MPSoC, specify:
-boot mode=3
-drive index=0

or

-boot mode=5
-drive index=1

For SD0 or SD1 respectively.

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-multiarch-pmu.dtb \
-kernel ${PROJ_DIR}/images/linux/pmu_rom_qemu_sha3.elf \
-device loader,file=${PROJ_DIR}/images/linux/pmufw.elf \
-device loader,addr=0xfd1a0074,data=0x01011003,data-len=4 \
-device loader,addr=0xfd1a007c,data=0x01010f03,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-serial mon:stdio \
-m 4G \
-global xlnx,zynqmp-boot.cpu-num=0 \
-global xlnx,zynqmp-boot.use-pmufw=true \
-global xlnx,zynqmp-boot.load-pmufw-cfg=false \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-arm.dtb \
-device loader,file=${PROJ_DIR}/images/linux/zynqmp_fsbl.elf,cpu-num=1 \
-drive file=qemu_sd.img,if=sd,format=raw,index=0 \
-net nic -net nic -net nic -net nic \
-boot mode=5 \
-machine-path /tmp/qemu-shm

Even though we put the FSBL in the SD image (as a part of BOOT.BIN), it needs to be passed through the command line as an ELF since QEMU does not have a boot ROM to load the FSBL.

Booting the Image with Versal Adaptive SoC

To boot with SD on Versal Adaptive SoC, specify:
-boot mode=3
-drive index=0

or

-boot mode=5
-drive index=1

For SD0 or SD1 respectively.

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-serial mon:stdio \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-multiarch-pmc.dtb \
-device loader,file=${PROJ_DIR}/images/linux/pmc_cdo.bin,addr=0xf2000000 \
-device loader,file=${PROJ_DIR}/images/linux/plm.elf,cpu-num=1 \
-device loader,file=${PROJ_DIR}/images/linux/BOOT_bh.bin,addr=0xf201e000,force-raw \
-device loader,addr=0xf0000000,data=0xba020004,data-len=4 \
-device loader,addr=0xf0000004,data=0xb800fffc,data-len=4 \
-device loader,addr=0xf1110620,data=0x1,data-len=4 \
-device loader,addr=0xf1110624,data=0x0,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-m 8G \
-nographic \
-serial null \
-serial null \
-serial mon:stdio \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-ps.dtb \
-dtb ${PROJ_DIR}/images/linux/system.dtb \
-drive file=qemu_sd.img,if=sd,format=raw,index=1 \
-net nic -net nic \
-boot mode=5 \
-machine-path /tmp/qemu-shm

Even though we put the FSBL in the SD image (as a part of BOOT.BIN), it needs to be passed through the command line as an ELF since QEMU needs access to the boot ROM.

Using QSPI for Boot

This section will cover both single flash and dual parallel mode.
Use the one that is more suited to your needs.

The read and write addresses given in these examples depend on the sizes of your images and how your flash is partitioned.


In this example, Our flash is partitioned in the following way for Zynq UltraScale+ MPSoC:

Partition StartPartition EndPartition Name
0x00x1e00000Boot
0x1e000000x1e40000DTB
0x1e400000x4240000Kernel

and has only one partition on Versal Adaptive SoC:

Partition StartPartition EndPartition Name
0x00x20000000Flash

If you're not sure how your flash is partitioned, you can view the partitions in a few ways:

  1. On the Linux guest, run cat /proc/mtd
  2. In a PetaLinux project, run petalinux-config and navigate to Subsystem AUTO Hardware SettingsFlash Settings, and change your partitions as desired.
    After configuration the partitions, build your project with petalinux-build.
  3. Unflatten your system.dtb file by doing dtc -I dtb -O dts system.dtb -o system.dts and find the node for spi@ff0f0000 on Zynq UltraScale+ MPSoC, or spi@f1030000 on Versal ACAP.  The flash will be a child node of the SPI node.
    The partitions are defined in the reg property in the format of reg = <partition_start partition_size>;.  Modify them as you see fit.
    Once done, reflatten the DTB by doing dtc -I dts -O dtb system.dts -o system.dtb
    More information on modifying device trees can be found here.

Note that only methods 2 and 3 allow modification of the partitions.

QSPI Boot with Zynq UltraScale+ MPSoC

Creating the QSPI boot image

Single Flash Mode

dd if=/dev/zero of=qemu_qspi.bin bs=256M count=1
dd if=BOOT.BIN of=qemu_qspi.bin bs=1 seek=0 conv=notrunc
dd if=system.dtb of=qemu_qspi.bin bs=1 seek=31457280 conv=notrunc # Seek offset is 0x1E00000 in hex
dd if=Image of=qemu_qspi.bin bs=1 seek=31719424 conv=notrunc # Seek offset is 0x1E40000 in hex

Dual Parallel Mode

If using parallel mode, you must use the flash_strip_bw utility.
Information and a download for flash_strip_bw can be found here.

Use the same steps as you would for building a QSPI boot image for single flash mode, but after you're done, run:

flash_strip_bw qemu_qspi.bin qemu_qspi_low.bin qemu_qspi_high.bin

This byte-stripes the boot image so it can be used in dual parallel mode.

This command may take several minutes.

Boot the Image in QEMU

Single Flash Mode

To boot with single flash QSPI on Zynq UltraScale+ MPSoC, specify:
-boot mode=1
-drive index=0

or

-boot mode=2
-drive index=1

For 24-bit or 32-bit QSPI respectively.

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-multiarch-pmu.dtb \
-kernel ${PROJ_DIR}/images/linux/pmu_rom_qemu_sha3.elf \
-device loader,file=${PROJ_DIR}/images/linux/pmufw.elf \
-device loader,addr=0xfd1a0074,data=0x01011003,data-len=4 \
-device loader,addr=0xfd1a007c,data=0x01010f03,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-serial mon:stdio \
-m 4G \
-global xlnx,zynqmp-boot.cpu-num=0 \
-global xlnx,zynqmp-boot.use-pmufw=true \
-global xlnx,zynqmp-boot.load-pmufw-cfg=false \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-arm.dtb \
-device loader,file=${PROJ_DIR}/images/linux/zynqmp_fsbl.elf,cpu-num=0 \
-drive file=qemu_qspi.bin,if=mtd,format=raw,index=0 \
-net nic -net nic -net nic -net nic \
-boot mode=1 \
-machine-path /tmp/qemu-shm

Dual Parallel Mode

To boot with dual parallel flash QSPI on Zynq UltraScale+ MPSoC, specify:
-boot mode=1
-drive qspi_low,index=0
-drive qspi_high,index=1

or

-boot mode=2
-drive qspi_low,index=0
-drive qspi_high,index=1

For 24-bit or 32-bit QSPI respectively.

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-multiarch-pmu.dtb \
-kernel ${PROJ_DIR}/images/linux/pmu_rom_qemu_sha3.elf \
-device loader,file=${PROJ_DIR}/images/linux/pmufw.elf \
-device loader,addr=0xfd1a0074,data=0x01011003,data-len=4 \
-device loader,addr=0xfd1a007c,data=0x01010f03,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-serial mon:stdio \
-m 4G \
-global xlnx,zynqmp-boot.cpu-num=0 \
-global xlnx,zynqmp-boot.use-pmufw=true \
-global xlnx,zynqmp-boot.load-pmufw-cfg=false \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-arm.dtb \
-device loader,file=${PROJ_DIR}/images/linux/zynqmp_fsbl.elf,cpu-num=0 \
-drive file=qemu_qspi_low.bin,if=mtd,format=raw,index=0 \
-drive file=qemu_qspi_high.bin,if=mtd,format=raw,index=1 \
-net nic -net nic -net nic -net nic \
-boot mode=1 \
-machine-path /tmp/qemu-shm

U-Boot Commands

In this section we'll use the following U-Boot commands to copy our data from flash into RAM and boot from it.

CommandDescriptionExample
sf probe [bus[:cs]] [hz] [mode]Initializes a flash device on a given bus and chip select.

sf probe 0 0 0

Probes for a flash device on bus 0

sf read <memory addr> <flash addr> <len>Reads len bytes from flash at flash addr and stores it in memory at memory addr.

sf read 0x1e00000 0x1e00000 0x20000

Reads 0x20000 bytes from 0x1e00000 on the flash and stores it in memory at 0x1e00000

booti [addr [initrd[:size]] [fdt]]

Boot ARM64 Linux image stored at addr.

initrd specifies the address of an initrd in memory. size allows you to specify the size of a raw initrd.

If booting a Linux image with a DTB but without an initrd, '-' must be used in place of the initrd argument.

booti 0x1e40000 - 0x1e00000

Boots using a Linux image stored at 0x1e40000 and a DTB stored at 0x1e00000, with no initrd.

Use the commands below to copy the data from flash to RAM:

sf probe 0 0 0 # Probe the flash so we can access it
sf read 0x1e00000 0x1e00000 0x00020000 # Read system.dtb
sf read 0x01e40000 0x01e40000 0x2100000 # Read Image
booti 0x1e40000 - 0x1e00000 # Boot

QSPI Boot with Versal ACAP

Creating the QSPI Boot Image

Single Flash Mode

dd if=/dev/zero of=qemu_qspi.bin bs=512M count=1
dd if=BOOT.BIN of=qemu_qspi.bin bs=1 seek=0 conv=notrunc
dd if=system.dtb of=qemu_qspi.bin bs=1 seek=31457280 conv=notrunc # Seek offset is 0x1E00000 in hex
dd if=Image of=qemu_qspi.bin bs=1 seek=31719424 conv=notrunc # Seek offset is 0x1E40000 in hex
dd if=rootfs.cpio.gz.u-boot of=qemu_qspi.bin bs=1 seek=50331648 conv=notrunc # Seek offset is 0x3000000 in hex

Dual Parallel Mode

If using parallel mode, you must use the flash_strip_bw utility.
Information and a download for flash_strip_bw can be found here.

Use the same steps as you would for building a QSPI boot image for single flash mode, but after you're done, run:

flash_strip_bw qemu_qspi.bin qemu_qspi_low.bin qemu_qspi_high.bin

This byte-stripes the boot image so it can be used in dual parallel mode.

This command may take around 10 minutes to finish.

Boot the Image in QEMU

Single Flash Mode

To boot with single flash QSPI on Versal ACAP, specify:
-boot mode=1
-drive index=0

or

-boot mode=2
-drive index=1

For 24-bit or 32-bit QSPI respectively.

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-serial mon:stdio \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-multiarch-pmc.dtb \
-device loader,file=${PROJ_DIR}/images/linux/pmc_cdo.bin,addr=0xf2000000 \
-device loader,file=${PROJ_DIR}/images/linux/plm.elf,cpu-num=1 \
-device loader,file=${PROJ_DIR}/images/linux/BOOT_bh.bin,addr=0xf201e000,force-raw \
-device loader,addr=0xf0000000,data=0xba020004,data-len=4 \
-device loader,addr=0xf0000004,data=0xb800fffc,data-len=4 \
-device loader,addr=0xf1110620,data=0x1,data-len=4 \
-device loader,addr=0xf1110624,data=0x0,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-m 8G \
-nographic \
-serial null \
-serial null \
-serial mon:stdio \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-ps.dtb \
-dtb ${PROJ_DIR}/images/linux/system.dtb \
-drive file=qemu_qspi.bin,if=mtd,format=raw,index=0 \
-net nic -net nic \
-boot mode=1 \
-machine-path /tmp/qemu-shm

Dual Parallel Mode

To boot with dual parallel flash QSPI on Versal ACAP, specify:
-boot mode=1
-drive qspi_low,index=0
-drive qspi_high,index=3

or

-boot mode=2
-drive qspi_low,index=0
-drive qspi_high,index=3

For 24-bit or 32-bit QSPI respectively.

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-serial mon:stdio \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-multiarch-pmc.dtb \
-device loader,file=${PROJ_DIR}/images/linux/pmc_cdo.bin,addr=0xf2000000 \
-device loader,file=${PROJ_DIR}/images/linux/plm.elf,cpu-num=1 \
-device loader,file=${PROJ_DIR}/images/linux/BOOT_bh.bin,addr=0xf201e000,force-raw \
-device loader,addr=0xf0000000,data=0xba020004,data-len=4 \
-device loader,addr=0xf0000004,data=0xb800fffc,data-len=4 \
-device loader,addr=0xf1110620,data=0x1,data-len=4 \
-device loader,addr=0xf1110624,data=0x0,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-m 8G \
-nographic \
-serial null \
-serial null \
-serial mon:stdio \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-ps.dtb \
-dtb ${PROJ_DIR}/images/linux/system.dtb \
-drive file=qemu_qspi_high.bin,if=mtd,format=raw,index=0 \
-drive file=qemu_qspi_low.bin,if=mtd,format=raw,index=3 \
-net nic -net nic \
-boot mode=1 \
-machine-path /tmp/qemu-shm

U-Boot Commands

In this section we'll use the following U-Boot commands to copy our data from flash into RAM and boot from it:

CommandDescriptionExample
sf probe [bus[:cs]] [hz] [mode]Initializes a flash device on a given bus and chip select.

sf probe 0 0 0

Probes for a flash device on bus 0

sf read <memory addr> <flash addr> <len>Reads len bytes from flash at flash addr and stores it in memory at memory addr.

sf read 0x1e00000 0x1e00000 0x20000

Reads 0x20000 bytes from 0x1e00000 on the flash and stores it in memory at 0x1e00000

booti [addr [initrd[:size]] [fdt]]

Boot ARM64 Linux image stored at addr.

initrd specifies the address of an initrd in memory. size allows you to specify the size of a raw initrd.

If booting a Linux image with a DTB but without an initrd, '-' must be used in place of the initrd argument.

booti 0x1e40000 - 0x1e00000

Boots using a Linux image stored at 0x1e40000 and a DTB stored at 0x1e00000, with no initrd.

Use the commands below to copy the data from flash to RAM:

sf probe 0 0 0 # Probe the flash so we can access it
sf read 0x1e00000 0x1e00000 0x00020000 # Read system.dtb
sf read 0x1e40000 0x1e40000 0x1000000 # Read Image
sf read 0x3000000 0x3000000 0x2000000 # Read initrd
booti 0x1e40000 0x3000000 0x1e00000 # Boot

Using TFTP to Boot

TFTP Boot with Zynq UltraScale+ MPSoC

Run QEMU using the commands shown below:

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-multiarch-pmu.dtb \
-kernel ${PROJ_DIR}/images/linux/pmu_rom_qemu_sha3.elf \
-device loader,file=${PROJ_DIR}/images/linux/pmufw.elf \
-device loader,addr=0xfd1a0074,data=0x01011003,data-len=4 \
-device loader,addr=0xfd1a007c,data=0x01010f03,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-serial mon:stdio \
-global xlnx,zynqmp-boot.cpu-num=0 \
-global xlnx,zynqmp-boot.use-pmufw=true \
-global xlnx,zynqmp-boot.load-pmufw-cfg=false \
-nographic \
-hw-dtb ${PROJ_DIR}/images/linux/zynqmp-qemu-arm.dtb \
-device loader,file=${PROJ_DIR}/images/linux/u-boot.elf \
-net nic -net nic -net nic -net nic \
-net user,id=eth0,tftp=${PROJ_DIR}/images/linux \
-m 4G \
-machine-path /tmp/qemu-shm

The TFTP folder should contain the boot image and system DTB.


In the U-Boot prompt, run:

tftpb 0x4000000 system.dtb
tftpb 0x80000 Image
booti 0x80000 - 0x4000000

TFTP Boot with Versal ACAP

Run QEMU using the commands shown below:

MicroBlaze Machine
qemu-system-aarch64 -M microblaze-fdt \
-nographic \
-serial mon:stdio \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-multiarch-pmc.dtb \
-device loader,file=${PROJ_DIR}/images/linux/pmc_cdo.bin,addr=0xf2000000 \
-device loader,file=${PROJ_DIR}/images/linux/plm.elf,cpu-num=1 \
-device loader,file=${PROJ_DIR}/images/linux/BOOT_bh.bin,addr=0xf201e000,force-raw \
-device loader,addr=0xf0000000,data=0xba020004,data-len=4 \
-device loader,addr=0xf0000004,data=0xb800fffc,data-len=4 \
-device loader,addr=0xf1110620,data=0x1,data-len=4 \
-device loader,addr=0xf1110624,data=0x0,data-len=4 \
-machine-path /tmp/qemu-shm
ARM Machine
qemu-system-aarch64 -M arm-generic-fdt \
-m 8G \
-nographic \
-serial null \
-serial null \
-serial mon:stdio \
-kernel ${PROJ_DIR}/images/linux/u-boot.elf \
-hw-dtb ${PROJ_DIR}/images/linux/versal-qemu-ps.dtb \
-net nic -net nic \
-net user,id=eth0,tftp=${PROJ_DIR}/images/linux \
-machine-path /tmp/qemu-shm

The TFTP folder should contain the boot image and system DTB.

In the U-Boot prompt, run:

tftpb 0x4000000 system.dtb
tftpb 0x80000 Image
tftpb 0x4002000 rootfs.cpio.gz.u-boot
booti 0x80000 0x4002000 0x4000000

SD Partitioning and Loading an Ubuntu-core File System

Creating a Dummy Container

To create a dummy container for QEMU, use qemu-imgqemu-img is built when QEMU is built and can be found in your build directory.

CommandDescriptionExample
qemu-img create <name> <size>
Creates an SD card image with name name with size size.
qemu-img create sd.img 2G

Creating the Network Backend

A network backend for QEMU can be created with qemu-nbd. qemu-nbd is built when QEMU is built and can be found in your build directory.

CommandDescriptionExample
qemu-nbd -c <nbd> <img> 
Connects image img to network block device nbd.
qemu-nbd /dev/nbd0 sd.img

If /dev/nbd0 is not found on the machine, the nbd driver is not running.
Install nbd-client and nbd-server (if they are not already installed) and do modprobe nbd to enable them.

Creating and Formatting Partitions

Partitions can be created using a terminal-based tool such as fdisk or a GUI-based tool like gparted.

CommandDescriptionExample
fdisk <img>
Goes through partition creation on image img.
fdisk /dev/nbd0
gparted <img>
Goes through partition creation on image img.
gparted /dev/nbd0


At least two primary partitions are required:

  1. A bootable partition that contains BOOT.BIN, Image, and system.dtb.  This should be large enough to fit these 3 items, generally around 300MB for Zynq UltraScale+ MPSoC.

    The bootable flag can be toggled using fdisk.

  2. A partition for rootfs.

For Example:

$ sudo fdisk /dev/nbd0

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x358a6e79.

Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-6291455, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-6291455, default 6291455): +300M

Created a new partition 1 of type 'Linux' and of size 300 MiB.

Device      Boot Start    End Sectors  Size Id Type
/dev/nbd0p1       2048 616447  614400  300M 83 Linux

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (616448-6291455, default 616448): 
Last sector, +sectors or +size{K,M,G,T,P} (616448-6291455, default 6291455): 

Created a new partition 2 of type 'Linux' and of size 2.7 GiB.

Command (m for help): a
Partition number (1,2, default 2): 1

The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk /dev/nbd0: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x358a6e79

Device      Boot  Start     End Sectors  Size Id Type
/dev/nbd0p1 *      2048  616447  614400  300M 83 Linux
/dev/nbd0p2      616448 6291455 5675008  2.7G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.


Partitions can be created with mkfs.  Bootable partitions must be formatted as FAT and other partitions can be ext2 or ext4.

CommandDescriptionExample
mkfs.vfat -F <fat-size> <partition>
Creates a FAT filesystem on partition partition.
mkfs.fvat -F 32 /dev/nbd0p1

Creates a FAT32 filesystem on p1 on /dev/nbd0

mkfs.ext4 <partition>
Creates an ext4 filesystem on partition partition.
mkfs.ext4 /dev/nbd0p2

Creates an ext4 filesystem on p2 on /dev/nbd0

Mounting Partitions and Copying Files

If using PetaLinux, the Image file must be loaded without initramfs.

To do this, do the following steps:

  1. In your PetaLinux project, run petalinux-config
  2. Go to Image Packaging Configuration
  3. Go to Root filesystem type (INITRAMFS)
  4. Select EXT
  5. Exit petalinux-config

This step is not required if performing switch-root.

Ubuntu-core can be downloaded from here.  Download and extract the ARM64 image.

Mount the partitions and copy the necessary files.
Remember that the images required for booting, such as BOOT.BIN, Image, and system.dtb, must go into the bootable partition, and ubuntu-core must go into the second partition.

For Example:

$ sudo mount /dev/nbd0p1 /mnt
$ sudo cp -v Image system.dtb BOOT.BIN /mnt
'Image' -> '/mnt/Image'
'system.dtb' -> '/mnt/system.dtb'
'BOOT.BIN' -> '/mnt/BOOT.BIN'
$ sudo umount /dev/nbd0p1

$ sudo mount /dev/nbd0p2 /mnt
$ unxz ubuntu-core.img.xz
$ sudo cp ubuntu-core.img /mnt
$ sudo umount /dev/nbd0p2

Once the files are copied, un-mount the partitions and disconnect the nbd connection.

CommandDescriptionExample
qemu-nbd -d <nbd>
Disconnects network block device nbd.
qemu-nbd -d /dev/nbd0

Bootargs

Ensure that bootargs points to the correct filesystem for root.  In this case, it is:

root=/dev/mmcblk0p2 rw rootfstype=ext4

See the bootparam manual page for more information.



© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy