Building EDK2 Qemu From Scratch On Raspberry Pi
Orion Electric Age

Prerequisites

Building EDK2

  • Install required packages

    1
    sudo apt install build-essential git uuid-dev iasl nasm python
  • Get the latest source for EDKII

    1
    2
    3
    mkdir code; cd code
    git clone https://github.com/tianocore/edk2.git
    cd edk2; git submodule update --init
  • Config and building

    • Compile base tools
      1
      make -C BaseTools
    • Set up build environment
      1
      . ./edksetup.sh
  • Set up build target

    1
    vi Conf/target.txt
    • set ACTIVE_PLATFORM = ArmVirtPkg/ArmVirtQemu.dsc
    • set TARGET = DEBUG
    • set TARGET_ARCH = AARCH64
    • set TOOL_CHAIN_TAG = GCC5
  • Building MdeModulePkg module package

    1
    build

    Note: build, which is exported by edksetup.sh, is not a system command

  • Get the UEFI bin

    1
    ls Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV/QEMU_EFI.fd

Building Qemu

  • Get the latest source for Qemu

    1
    2
    3
    cd ..
    wget https://download.qemu.org/qemu-6.0.0.tar.xz
    tar -xvf qemu-6.0.0.tar.xz
  • Install required packages

    1
    2
    sudo apt install build-essential
    sudo apt install libaio1 libaio-dev
  • Config and building

    1
    2
    3
    cd qemu-6.0.0
    ./configure --enable-trace-backend=simple --enable-debug --target-list=aarch64-softmmu --prefix=/usr/local --without-default-features --enable-kvm --enable-linux-aio --enable-vhost-net --enable-vhost-vsock --enable-vhost-scsi --enable-vhost-kernel --enable-vnc --enable-tools
    make -j 3

    Note: type ./configure –help to set your own configurations

  • Get the Qemu bin

    1
    2
    ./build/qemu-system-aarch64 --version
    ./build/qemu-img --version

References