Foundation Model V8 is a emulator for ARM64 architecture, but it has many limits, such as slow CPU, small memory (about 2GB), etc. Therefore I want to run fedora on qemu emulator for aarch64. There are already many docs to introduce how to run Foundation Model V8 on Fedora 21 on the web, but none of them could point out the way to run qemu-aarch64 on Fedora 21. Spent about a week, I finally find out the path.
Step 1 Build the edk2 UEFI
Followed this article,you should download the linaro toolchain and edit the “Conf/target.txt”. Then follow these steps to build a file in “Build/ArmVirtualizationQemu-AARCH64/DEBUG_GCC48/FV/QEMU_EFI.fd”
Step 2 Build the qemu-aarch64
I recommend the latest stable QEMU-2.2.0
wget http://wiki.qemu-project.org/download/qemu-2.2.0.tar.bz2 tar jxf qemu-2.2.0.tar.bz2 cd qemu-2.2.0 ./configure --target-list=aarch64-softmmu make
Now, you have file in “qemu-2.2.0/aarch64-softmmu/qemu-system-aarch64”
Step 3 Download the Fedora 21 image for Foundation Model V8
wget https://dmarlin.fedorapeople.org/fedora-arm/aarch64/F21-20140829-foundation-v8.tar.xz tar Jxf F21-20140829-foundation-v8.tar.xz
Now you have “F21-20140829-foundation-v8/F21-20140829-foundation-v8.img”
Step 4 Run the qemu
qemu-2.2.0/aarch64-softmmu/qemu-system-aarch64 -M virt -cpu cortex-a57 \ -smp 1 -m 4096 \ -bios QEMU_EFI.fd \ -drive if=none,file=F21-20140829-foundation-v8.img,id=hd0,cache=unsafe -device virtio-blk-device,drive=hd0 \ -netdev user,id=unet,hostfwd=tcp::5555-:22 -device virtio-net-device,netdev=unet -nographic
The Qemu will boot into the UEFI, you could select into the “shell”, in the UEFI shell:
shell>fs0: fs0:>EFI\fedora\grubaa64.efi
Then you can enter into a grub provided by Fedora 21 and boot into it automaticly.
Step 5 Add the UEFI entry for fedora permanently (optional)
cat QEMU_EFI.fd /dev/zero | dd iflag=fullblock bs=1M count=64 of=flash0.img dd if=/dev/zero of=flash1.img bs=1M count=64
Launch qemu-system-aarch64 by change “-bios xxx” to “-pflash flash0.img -pflash flash1.img” and after enter the UEFI shell:
shell>bcfg boot add 0 EFI\fedora\grubaa64.efi "fedora" shell>reset
The UEFI boot entry will write into flash*.img file and the Qemu could boot into Fedora 21 automaticly now.