In previous post, I described how to run ARM64 Linux inside Qemu. But is the stock Linux. In this post, I'll describe how to install the Ubuntu 15.10 for ARM64 platform Qemu.
There are two types of Ubuntu can is installed in Qemu. The ' is ' to-use Ubuntu Cloud image. But It needs setup ssh key to connect to it. And it is a installed image. I can play it without any customization or installation. I don ' t like it. I don ' t want a image which can is deployed on Amazon cloud. The second one is what I'll describe here. It is to install the Ubuntu from scratch! Just like we did on real system. Download kernel and initrd from Ubuntu Web site. Please note this two files are only used for boot and installation. After we installed Ubuntu on Hard Disk, we don ' t need them anymore.
Create a qcow2 image as Hard Disk. I set the size as 10G. It should be enough to light use.
Qemu-img create-f qcow2 Ubuntu.qcow2 10G
Boot QEMU by using above kernel, INITRD. The Qcow2 is as the HD. It takes for a while. I recommend to read some articles like this one.
Qemu-system-aarch64-machine virt-cpu cortex-a57-nographic-smp 1-m 512-kernel linux-initrd initrd.gz--append "early PRINTK console=ttyama0 root=/dev/sda1 "-netdev user,id=eth0-device virtio-net-device,netdev=eth0-redir tcp:2222::22- Drive If=none,file=ubuntu.qcow2,id=hd0-device virtio-blk-device,drive=hd0 During above installation, flash boot would be Failed. But it doesn ' t matter.
After this, we get qcow2 image which Ubuntu installed in that. Then we need to retrieve Ubuntu ' s Vmlinuz and initrd.img from it.
sudo modprobe nbd max_part=16 sudo qemu-nbd-c/dev/nbd0 ubuntu.qcow2 mkdir-p/mnt sudo mount/dev/nbd0p1/mnt mkdir-p b Oot sudo cp-rf/mnt/* boot/sudo umount/mnt sudo qemu-nbd-d/dev/nbd0 sudo killall qemu-nbd '
Now we have all we need to boot up ARM64 based Ubuntu inside qemu! Let run it.
Qemu-system-aarch64-machine virt-cpu cortex-a57-nographic-smp 8-m 512-kernel vmlinuz-initrd-initrd.img "ea RLYPRINTK console=ttyama0 root=/dev/vda2 init=/sbin/init "-netdev user,id=eth0-device Virtio-net-device,netdev=eth0- Redir tcp:2222::22-drive If=none,file=ubuntu.qcow2,id=hd0-device virtio-blk-device,drive=hd0
Original: https://zhiyisun.github.io/2016/02/04/Install-Ubuntu-1510-ARM64-Inside-of-Qemu.html