From a66f0309e5ac56c8223414542874a657768eec03 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Jul 2020 16:12:55 +0900 Subject: [PATCH 1/3] docs: qemu: add build instructions for QEMU_EFI.fd and rootfs.cpio.gz This commit solves the limitation, "No build instructions for QEMU_EFI.fd and rootfs-arm64.cpio.gz" Document the steps to build them. Change-Id: Ic6d895617cf71fe969f4aa9820dad25cc6182023 Signed-off-by: Masahiro Yamada --- docs/plat/qemu.rst | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/docs/plat/qemu.rst b/docs/plat/qemu.rst index afa32c11b..368300d86 100644 --- a/docs/plat/qemu.rst +++ b/docs/plat/qemu.rst @@ -20,11 +20,46 @@ provided as it's generated by QEMU. Current limitations: - Only cold boot is supported -- No build instructions for QEMU\_EFI.fd and rootfs-arm64.cpio.gz -``QEMU_EFI.fd`` can be dowloaded from +Getting non-TF images +--------------------- + +``QEMU_EFI.fd`` can be downloaded from http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-KERNEL-AARCH64/RELEASE_GCC5/QEMU_EFI.fd +or, can be built as follows: + +.. code:: shell + + git clone https://github.com/tianocore/edk2.git + cd edk2 + git submodule update --init + make -C BaseTools + source edksetup.sh + export GCC5_AARCH64_PREFIX=aarch64-linux-gnu- + build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc + +```` + +Then, you will get ``Build/ArmVirtQemuKernel-AARCH64/DEBUG_GCC5/FV/QEMU_EFI.fd`` + +Please note you do not need to use GCC 5 in spite of the environment variable +``GCC5_AARCH64_PREFIX`` + +The rootfs can be built by using Buildroot as follows: + +.. code:: shell + + git clone git://git.buildroot.net/buildroot.git + cd buildroot + make qemu_aarch64_virt_defconfig + utils/config -e BR2_TARGET_ROOTFS_CPIO + utils/config -e BR2_TARGET_ROOTFS_CPIO_GZIP + make olddefconfig + make + +Then, you will get ``output/images/rootfs.cpio.gz``. + Booting via semi-hosting option ------------------------------- @@ -50,7 +85,7 @@ To start (QEMU v4.1.0): qemu-system-aarch64 -nographic -machine virt,secure=on -cpu cortex-a57 \ -kernel Image \ -append "console=ttyAMA0,38400 keep_bootcon root=/dev/vda2" \ - -initrd rootfs-arm64.cpio.gz -smp 2 -m 1024 -bios bl1.bin \ + -initrd rootfs.cpio.gz -smp 2 -m 1024 -bios bl1.bin \ -d unimp -semihosting-config enable,target=native Booting via flash based firmwares @@ -99,5 +134,5 @@ To start (QEMU v2.6.0): qemu-system-aarch64 -nographic -machine virt,secure=on -cpu cortex-a57 \ -kernel Image -no-acpi \ -append 'console=ttyAMA0,38400 keep_bootcon root=/dev/vda2' \ - -initrd rootfs-arm64.cpio.gz -smp 2 -m 1024 -bios flash.bin \ + -initrd rootfs.cpio.gz -smp 2 -m 1024 -bios flash.bin \ -d unimp From 624120e05c7a864b90848c7a31c881f2b98c5b74 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Jul 2020 17:10:25 +0900 Subject: [PATCH 2/3] docs: qemu: remove unneeded root=/dev/vda2 kernel parameter In my understanding, /dev/vda2 does not exist unless you add virtio drive to the qemu command line. The rootfs is already specified by '-initrd rootfs.cpio.gz'. Change-Id: Ifdca5d4f3819d87ef7e8a08ed870872d24b86370 Signed-off-by: Masahiro Yamada --- docs/plat/qemu.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plat/qemu.rst b/docs/plat/qemu.rst index 368300d86..3f79d76eb 100644 --- a/docs/plat/qemu.rst +++ b/docs/plat/qemu.rst @@ -84,7 +84,7 @@ To start (QEMU v4.1.0): qemu-system-aarch64 -nographic -machine virt,secure=on -cpu cortex-a57 \ -kernel Image \ - -append "console=ttyAMA0,38400 keep_bootcon root=/dev/vda2" \ + -append "console=ttyAMA0,38400 keep_bootcon" \ -initrd rootfs.cpio.gz -smp 2 -m 1024 -bios bl1.bin \ -d unimp -semihosting-config enable,target=native @@ -133,6 +133,6 @@ To start (QEMU v2.6.0): qemu-system-aarch64 -nographic -machine virt,secure=on -cpu cortex-a57 \ -kernel Image -no-acpi \ - -append 'console=ttyAMA0,38400 keep_bootcon root=/dev/vda2' \ + -append 'console=ttyAMA0,38400 keep_bootcon' \ -initrd rootfs.cpio.gz -smp 2 -m 1024 -bios flash.bin \ -d unimp From 231d0b351d42266da9814d025f1a0b7c6a856bb3 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Jul 2020 17:15:44 +0900 Subject: [PATCH 3/3] docs: qemu: bump to QEMU 5.0.0 Fix the version inconsistency in the same file. I tested QEMU 5.0.0, and it worked for me. Change-Id: I9d8ca9aae1e413410eb5676927e13ae4aee9fad8 Signed-off-by: Masahiro Yamada --- docs/plat/qemu.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plat/qemu.rst b/docs/plat/qemu.rst index 3f79d76eb..66b82473c 100644 --- a/docs/plat/qemu.rst +++ b/docs/plat/qemu.rst @@ -78,7 +78,7 @@ To build: make CROSS_COMPILE=aarch64-none-elf- PLAT=qemu -To start (QEMU v4.1.0): +To start (QEMU v5.0.0): .. code:: shell @@ -127,7 +127,7 @@ To build flash.bin: dd if=build/qemu/release/bl1.bin of=flash.bin bs=4096 conv=notrunc dd if=build/qemu/release/fip.bin of=flash.bin seek=64 bs=4096 conv=notrunc -To start (QEMU v2.6.0): +To start (QEMU v5.0.0): .. code:: shell