git: bba96bb143bb - main - CI: add arm64 support to ci-qemu-test.sh

Ed Maste emaste at FreeBSD.org
Sat Jun 26 20:15:31 UTC 2021


The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=bba96bb143bb803968036543b76e062445cc9834

commit bba96bb143bb803968036543b76e062445cc9834
Author:     Ed Maste <emaste at FreeBSD.org>
AuthorDate: 2021-06-23 19:24:23 +0000
Commit:     Ed Maste <emaste at FreeBSD.org>
CommitDate: 2021-06-26 18:26:41 +0000

    CI: add arm64 support to ci-qemu-test.sh
    
    Reviewed by:    imp (earlier)
    MFC after:      3 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D30907
---
 tools/boot/ci-qemu-test.sh | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/tools/boot/ci-qemu-test.sh b/tools/boot/ci-qemu-test.sh
index acd905b7ece8..e6481c794af5 100755
--- a/tools/boot/ci-qemu-test.sh
+++ b/tools/boot/ci-qemu-test.sh
@@ -44,11 +44,11 @@ EOF
 	    FreeBSD-clibs FreeBSD-runtime
 
 	# Put loader in standard EFI location.
-	mv ${ROOTDIR}/boot/loader.efi ${ROOTDIR}/efi/boot/BOOTx64.EFI
+	mv ${ROOTDIR}/boot/loader.efi ${ROOTDIR}/efi/boot/$EFIBOOT
 
 	# Configuration files.
 	cat > ${ROOTDIR}/boot/loader.conf <<EOF
-vfs.root.mountfrom="msdosfs:/dev/ada0s1"
+vfs.root.mountfrom="msdosfs:/dev/$ROOTDEV"
 autoboot_delay=-1
 boot_verbose=YES
 EOF
@@ -77,11 +77,26 @@ if [ -z "${OBJTOP}" ]; then
 	die "Cannot locate top of object tree"
 fi
 
-# Locate the uefi firmware file used by qemu.
-: ${OVMF:=/usr/local/share/qemu/edk2-x86_64-code.fd}
-if [ ! -r "${OVMF}" ]; then
-	die "Cannot read UEFI firmware file ${OVMF}"
-fi
+: ${TARGET:=$(uname -m)}
+case $TARGET in
+amd64)
+	# Locate the uefi firmware file used by qemu.
+	: ${OVMF:=/usr/local/share/qemu/edk2-x86_64-code.fd}
+	if [ ! -r "${OVMF}" ]; then
+		die "Cannot read UEFI firmware file ${OVMF}"
+	fi
+	QEMU="qemu-system-x86_64 -drive if=pflash,format=raw,readonly,file=${OVMF}"
+	EFIBOOT=BOOTx64.EFI
+	ROOTDEV=ada0s1
+	;;
+arm64)
+	QEMU="qemu-system-aarch64 -cpu cortex-a57 -M virt -bios edk2-aarch64-code.fd"
+	EFIBOOT=BOOTAA64.EFI
+	ROOTDEV=vtbd0s1
+	;;
+*)
+	die "Unknown TARGET:TARGET_ARCH $TARGET:$TARGET_ARCH"
+esac
 
 # Create a temp dir to hold the boot image.
 ROOTDIR=$(mktemp -d -t ci-qemu-test-fat-root)
@@ -93,8 +108,7 @@ trap tempdir_cleanup EXIT SIGINT SIGHUP SIGTERM SIGQUIT
 # And, boot in QEMU.
 : ${BOOTLOG:=${TMPDIR:-/tmp}/ci-qemu-test-boot.log}
 timeout 300 \
-    qemu-system-x86_64 -m 256M -nodefaults \
-   	-drive if=pflash,format=raw,readonly,file=${OVMF} \
+    $QEMU -m 256M -nodefaults \
         -serial stdio -vga none -nographic -monitor none \
         -snapshot -hda fat:${ROOTDIR} 2>&1 | tee ${BOOTLOG}
 


More information about the dev-commits-src-all mailing list