diff --git a/.gitignore b/.gitignore index d755b96..6eed8e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.fd *.swp *.tar.gz .ccache diff --git a/driver.sh b/driver.sh index 2f4784e..545af0c 100755 --- a/driver.sh +++ b/driver.sh @@ -87,7 +87,13 @@ setup_variables() { qemu_cmdline=( -cpu cortex-a57 -drive "file=images/arm64/rootfs.ext4,format=raw,id=rootfs,if=none" -device "virtio-blk-device,drive=rootfs" - -append "console=ttyAMA0 root=/dev/vda" ) + -append "console=ttyAMA0 earlycon root=/dev/vda" ) + aavmf=/usr/share/AAVMF + if [[ ${tree} != common && -f ${aavmf}/AAVMF_CODE.fd && -f ${aavmf}/AAVMF_VARS.fd ]]; then + cp ${aavmf}/AAVMF_VARS.fd images/arm64 + qemu_cmdline+=( -drive "if=pflash,format=raw,readonly,file=${aavmf}/AAVMF_CODE.fd" + -drive "if=pflash,format=raw,file=images/arm64/AAVMF_VARS.fd" ) + fi export CROSS_COMPILE=aarch64-linux-gnu- ;; "mipsel") @@ -148,6 +154,12 @@ setup_variables() { qemu_cmdline=( -drive "file=images/x86_64/rootfs.ext4,format=raw,if=virtio" -append "console=ttyS0 root=/dev/vda" ) ;; esac + ovmf=/usr/share/OVMF + if [[ ${tree} != common && -f ${ovmf}/OVMF_CODE.fd && -f ${ovmf}/OVMF_VARS.fd ]]; then + cp ${ovmf}/OVMF_VARS.fd images/x86_64 + qemu_cmdline+=( -drive "if=pflash,format=raw,readonly,file=${ovmf}/OVMF_CODE.fd" + -drive "if=pflash,format=raw,file=images/x86_64/OVMF_VARS.fd" ) + fi # Use KVM if the processor supports it (first part) and the KVM module is loaded (second part) [[ $(grep -c -E 'vmx|svm' /proc/cpuinfo) -gt 0 && $(lsmod 2>/dev/null | grep -c kvm) -gt 0 ]] && qemu_cmdline=( "${qemu_cmdline[@]}" -enable-kvm ) image_name=bzImage