Virtually Install CentOS and Fedora on Zynq UltraScale+

This article describes how to install CentOS or Fedora on a disk image from an ISO installer image using Qemu. This disk image can be copied to an SD card to boot the ZCU102.

Table of Contents

Introduction

Linux distros generally distribute ISO files for installation. This works well for PC and server platforms, but generally not for embedded platforms. In this article we will use QEMU with a generic ARM64 model to install CentOS and Fedora from an ISO onto a raw disk image. We will install CentOS 8 and Fedora 29 as both of these ship with 4.18 kernel which has enough upstreamed driver support for Zynq Ultrascale+.

Installing a CentOS or Fedora system for Zynq UltraScale+ is currently a proof-of-concept (POC). You should not assume this builds a Xilinx supported, production-ready system. Please do your due diligence before deploying CentOS or Fedora and regression test against your system requirements.

While this flow targets CentOS and Fedora because they are close relatives, this flow can be extended to support Ubuntu, Debian and openSUSE.

Requirements

  • Linux VM or bare-metal machine

    • Sudo privileges

    • Terminal emulator

    • Internet access

  • ZCU102 evaluation board

    • 8 GB (minimum)/16 GB (recommended) SD card

Linux Host Machine

Install Host Package Dependencies

CentOS/Fedora/RHEL

$ sudo dnf group install "Virtualization Host" $ sudo dnf install wget kpartx epel-release

Ubuntu/Debian

$ sudo apt-get install qemu wget kpartx

Install QEMU for Aarch64

CentOS/Fedora/RHEL

$ sudo dnf install qemu-system-aarch64

Ubuntu/Debian

If the install fails you may need to build QEMU from source. If the install succeeds, you may skip to “Prepare Workspace.”

Build QEMU for Aarch64

CentOS/Fedora/RHEL

Ubuntu/Debian

Build QEMU

Prepare Workspace

Create a directory structure for your workspace.

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

Create the QEMU script to run the ISO installer.

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

CentOS

Install CentOS on Virtual Disk from ISO

Download an ISO from one of mirrors for aarch64 CentOS 8.

At the Grub menu, select install Linux and follow the installation menus. Configure as you see fit and let the VM reboot.

Prepare the Virtual Disk Image for ZCU102

Login as root or switch to superuser (su). Since the initramfs is built with “hostonly” support, we will force dracut to add the MMC and SDHCI drivers.

Power down the VM.

Convert the QCOW2 image to a raw disk image.

Create loop devices for the raw disk image. Mount the 2nd partition onto the “boot” directory.

Next grep the kernel configuration looking for a couple key options to see if we at least have a console and SDHCI support.

Unmount the boot directory and cleanup the mappings.

Boot the system with the raw disk image and we will install the kernel RPM packages in the QEMU VM.

Login as root and install the kernel.

Once the kernel installation is complete, power-off the VM.

Next lets check the partition scheme on the raw disk image. The installer should have used a GPT scheme.

However, the Zynq UltraScale+ ROM requires an MBR scheme. So let’s convert the GPT to MBR.

Mark the 1st partition with the boot flag.

Lets check to make sure the partition scheme converted correctly. You should see “Disklabel type: dos” and the Boot flag marked.

Now lets create mappings for the raw image and mount the 1st partition on “efi.”

Install the UEFI (boot.bin), DTB and replace shim with GRUB since we are not using PC secure boot.

Unmount the “efi” partition and delete the mappings.

Finally copy the raw disk image to the SD card and boot the ZCU102.

Boot CentOS on ZCU102

Fedora

Install Fedora on Virtual Disk from ISO

At the Grub menu, select Install Linux and follow the installation menus. Configure as you see fit and let the VM reboot.

Prepare the Virtual Disk Image for ZCU102

Login as root or switch to superuser (su). Since the initramfs is built with “hostonly” support, we will force dracut to add the MMC and SDHCI drivers. You can verify the presence of these modules in the initramfs using “lsinitrd” before and after running dracut.

Power down the VM.

First you will need to first convert the QCOW2 image to a raw disk image.

Create loop devices for the raw disk image. Mount the 2nd partition onto the “boot” directory.

Next check the kernel to see if we believe it will boot the ZCU102. Let’s grep the configuration looking for a couple key options.

It appears there are enough configuration options to at least get a console and mount the SD card.

Unmount the boot directory and cleanup the mappings.

Next lets check the partition scheme on the raw disk image. The installer should have used a GPT scheme.

However, the Zynq UltraScale+ ROM requires an MBR scheme. So let’s convert the GPT to MBR.

Also, mark the 1st partition with the boot flag.

Now lets check to make sure the partition scheme converted correctly. You should see “Disklabel type: dos” and the Boot flag marked.

Now lets create mappings for the raw image and mount the 1st partition on “efi” and the 2nd partition on “boot”.

Install UEFI (boot.bin), DTB and replace shim with GRUB since we are not using PC secure boot.

Unmount the “efi” and “boot” partitions. Then delete the mappings.

Finally copy the raw disk image to the SD card and boot the ZCU102.

Boot Fedora on ZCU102

Fedora (Quick Install)

This quick install leverages a preinstalled RPI ARMv8 disk image.

Install Fedora from a Raw Disk Image

Prepare the Virtual Disk Image for ZCU102

The raw image is already formatted as MBR, so we don’t need to modify the partitioning scheme.

Now lets create mappings for the raw image and mount the 1st partition on “efi” and the 2nd partition on “boot”.

Install UEFI (boot.bin), DTB and replace shim with GRUB since we are not using PC secure boot.

Next check the kernel to see if we believe it will boot the ZCU102. Let’s grep the configuration looking for a couple key options.

It appears there are enough configuration options to at least get a console and mount the SD card.

Check the initramfs for mmc_block and sdhci-of-arasan kernel modules.

These modules are installed in the initramfs, so we should be able to mount a block device on the SD card.

Unmount the “efi” and “boot” partitions and delete the mappings.

Finally copy the raw disk image to the SD card and boot the ZCU102.

References

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy