Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Dec 2021 00:28:11 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 129d0eb49ece - stable/13 - CI: add arm64 support to ci-qemu-test.sh
Message-ID:  <202112130028.1BD0SBk2059885@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by emaste:

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

commit 129d0eb49ece4b2359d3f69b5543f4881e936b13
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-06-23 19:24:23 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-12-12 22:45:25 +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
    
    (cherry picked from commit bba96bb143bb803968036543b76e062445cc9834)
---
 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}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112130028.1BD0SBk2059885>