Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 2ea4cae

Browse files
committed
driver: Support booting via EFI on arm64 and x86_64
If the ovmf or qemu-efi-aarch64 packages are installed on Debian or Ubuntu, use those files to boot up via EFI. This will help prevent regressions like ClangBuiltLinux/linux#634. I considered checking in the fd files so that other distributions could take advantage of this but these files are over 50MB, which is too much of a burden to force on everyone. Signed-off-by: Nathan Chancellor <[email protected]>
1 parent 3c54a7f commit 2ea4cae

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.fd
12
*.swp
23
*.tar.gz
34
.ccache

driver.sh

+12
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ setup_variables() {
8787
qemu_cmdline=( -cpu cortex-a57
8888
-drive "file=images/arm64/rootfs.ext4,format=raw"
8989
-append "console=ttyAMA0 root=/dev/vda" )
90+
aavmf=/usr/share/AAVMF
91+
if [[ -f ${aavmf}/AAVMF_CODE.fd && -f ${aavmf}/AAVMF_VARS.fd ]]; then
92+
cp ${aavmf}/AAVMF_VARS.fd images/arm64
93+
qemu_cmdline+=( -drive "if=pflash,format=raw,readonly,file=${aavmf}/AAVMF_CODE.fd"
94+
-drive "if=pflash,format=raw,file=images/arm64/AAVMF_VARS.fd" )
95+
fi
9096
export CROSS_COMPILE=aarch64-linux-gnu- ;;
9197

9298
"mipsel")
@@ -147,6 +153,12 @@ setup_variables() {
147153
qemu_cmdline=( -drive "file=images/x86_64/rootfs.ext4,format=raw,if=ide"
148154
-append "console=ttyS0 root=/dev/sda" ) ;;
149155
esac
156+
ovmf=/usr/share/OVMF
157+
if [[ -f ${ovmf}/OVMF_CODE.fd && -f ${ovmf}/OVMF_VARS.fd ]]; then
158+
cp ${ovmf}/OVMF_VARS.fd images/x86_64
159+
qemu_cmdline+=( -drive "if=pflash,format=raw,readonly,file=${ovmf}/OVMF_CODE.fd"
160+
-drive "if=pflash,format=raw,file=images/x86_64/OVMF_VARS.fd" )
161+
fi
150162
# Use KVM if the processor supports it (first part) and the KVM module is loaded (second part)
151163
[[ $(grep -c -E 'vmx|svm' /proc/cpuinfo) -gt 0 && $(lsmod 2>/dev/null | grep -c kvm) -gt 0 ]] && qemu_cmdline=( "${qemu_cmdline[@]}" -enable-kvm )
152164
image_name=bzImage

0 commit comments

Comments
 (0)