Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Warning

If the install fails because the aarch64 QEMU package is not available from a repo, you may need to build QEMU from source. If the install succeeds, you may skip to the next section“Prepare Workspace.

Build QEMU for Aarch64

CentOS/Fedora/RHEL

...

Code Block
$ git clone https://git.qemu.org/git/qemu.git
$ cd qemu
$ git checkout -b v4.1.1.xlnx v4.1.1 # or later stable tag
$ git submodule update --init --recursive
$ ./configure --target-list=aarch64-softmmu,microblazeel-softmmu --disable-kvm --disable-xen
$ make

Add the path for the newly built aarch64 Qemu to you PATH variable in “.bashrc”, which should be $HOME/qemu/aarch64-softmmu. Otherwise you will need to

Prepare Workspace

Create a directory structure for your workspace.

Code Block
languagebash
$ export IMGCOS_ROOT=${HOME}/imagesBUILD=$HOME/centos8-dev
$ mkdir -p $IMG_ROOT/{{boot,efi},$COS_BUILD/rpmbuild $COS_BUILD/images/{efi,boot} $COS_BUILD/deploy/{boot,efi/dtb/xilinx}},boot}
$ export IMG_ROOT= $COS_BUILD/images
$ cd $IMG_ROOT

Download the UEFI boot image for the QEMU generic ARM model.

...

info
Code Block
languagebash
#!/bin/bash
# Install distro from an ISO onto a virtual disk image
# . runqemu-iso <distro>.iso

iso=$1
os=${iso%.iso}
size=7G

disk_img=$os.qcow2
efi_img=$os.efi

qemu-img create -f qcow2 $disk_img ${size}
qemu-img create -f qcow2 $efi_img 64M

qemu-system-aarch64 \
    -cpu cortex-a53 -M virt -m 4096 -nographic -smp $(nproc) -boot d \
    -drive if=pflash,format=raw,file=QEMU_EFI.img \
    -drive if=pflash,format=qcow2,file=${efi_img} \
    -device virtio-scsi-device \
    -device scsi-cd,drive=cdrom \
    -device virtio-blk-device,drive=hd0 \
    -drive file=${iso},id=cdrom,media=cdrom,if=none \
    -drive file=${disk_img},id=hd0,if=none

The actual storage space on your SD card is less than the size on the label.

...

This script creates a 7 GB image

...

targeting an 8 GB SD card

...

.

Create the QEMU script to boot from a QCOW2 or raw image.

info
Code Block
languagebash
#!/bin/bash
# Boot distro from a QCOW2 or raw image
# . runqemu-img <distro>.qcow2

disk_img=$1
efi_img=${1%.*}.efi

qemu-system-aarch64 \
    -cpu cortex-a53 -M virt -m 4096 -nographic -smp $(nproc) \
    -drive if=pflash,format=raw,file=QEMU_EFI.img \
    -drive if=pflash,format=qcow2,file=${efi_img} \
    -device virtio-blk-device,drive=hd0 \
    -drive file=${disk_img},id=hd0,if=none 

If building QEMU from source, make sure you provide the full path or add it to PATH in “.bashrc”.

CentOS

Install CentOS on Virtual Disk from ISO

...

Code Block
languagebash
$ cd $IMG_ROOT
$ wget http://mirrors.usc.edu/pub/linux/distributions/centos/8.0.1905/isos/aarch64/CentOS-8-aarch64-1905-dvd1.iso
$ wget http://mirrors.usc.edu/pub/linux/distributions/centos/8.0.1905/isos/aarch64/CHECKSUM
$ sha256sum -c CHECKSUM
CentOS-8-aarch64-1905-boot.iso: OK
Code Block
languagebash
$ . runqemu-iso CentOS-8-aarch64-1905-dvd1.iso

...

Code Block
languagebash
# echo "add_drivers+=\"mmc_block sdhci-of-arasan\"" > /etc/dracut.conf.d/zcu102.conf
# dracut --force
Warning

If your ZCU102 fails to boot, you can try adding all the kernel modules to the initramfs with dracut “no-hostonly” option.

Code Block
# dracut --force --no-hostonly

...