Home | History | Annotate | Download | only in internals
      1 
      2 How to install and configure a QEMU aarch64-linux installation.
      3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      4 
      5 Last updated 30 April 2015
      6 
      7 This gives a fairly usable, and not entirely slow, arm64-linux
      8 install.  It has the advantage that the idle loop works right and so
      9 when the guest becomes idle, qemu uses only very little host cpu, so
     10 you can leave the guest idling for long periods without bad
     11 performance effects on the host.
     12 
     13 More or less following
     14 https://gmplib.org/~tege/qemu.html, section 14 (for arm64)
     15 
     16 Build qemu-2.2.1 with --target-list including aarch64-softmmu
     17 
     18 mkdir Arm64-2
     19 cd Arm64-2
     20 
     21 wget http://d-i.debian.org/daily-images/arm64/daily/netboot/debian-installer/arm64/linux
     22 
     23 wget http://d-i.debian.org/daily-images/arm64/daily/netboot/debian-installer/arm64/initrd.gz
     24 
     25 # Note.  6G is easily enough to install debian and do a build of Valgrind.
     26 # If you envisage needing more space, now is the time to choose a larger
     27 # number.
     28 
     29 /path/to/Qemu221/bin/qemu-img create disk6G.img 6G
     30 
     31 /path/to/Qemu221/bin/qemu-system-aarch64 \
     32   -M virt -cpu cortex-a57 -m 256             \ 
     33   -drive file=disk6G.img,if=none,id=blk -device virtio-blk-device,drive=blk \
     34   -net user,hostfwd=tcp::5555-:22 -device virtio-net-device,vlan=0 \
     35   -kernel linux                                                 \
     36   -initrd initrd.gz                                             \
     37   -append "console=ttyAMA0 --"                                  \
     38   -nographic
     39 
     40 Do an install, be as vanilla as possible, allow it to create a user
     41 "username", and do not ask it to install any extra software.  But,
     42 when you get to here
     43 
     44    [!!] Finish the installation 
     45                                                                          
     46                           Installation complete                         
     47   Installation is complete, so it is time to boot into your new system. 
     48   Make sure to remove the installation media (CD-ROM, floppies), so     
     49   that you boot into the new system rather than restarting the          
     50   installation.                                                         
     51                                                                         
     52       <Go Back>                                          <Continue>     
     53                                                                          
     54   
     55 
     56 do "Go Back"
     57 then in the next menu "Execute a shell", "Continue"
     58 
     59 This gives you a root shell in the new VM.  In that shell:
     60 
     61   mount -t proc proc /target/proc
     62   mount --rbind /sys /target/sys
     63   mount --rbind /dev /target/dev
     64   chroot /target bash
     65   /etc/init.d/ssh start
     66   mv /boot/initrd.img-3.16.0-4-arm64 /boot/initrd.img-3.16.0-4-arm64.old
     67   echo virtio-mmio >>/etc/initramfs-tools/modules
     68   /usr/sbin/update-initramfs -c -k 3.16.0-4-arm64
     69 
     70 Then on the host, copy out the files that the above created.
     71 
     72 cd Arm64-2
     73 ssh -p 5555 username@localhost \
     74    "tar -c -f - --exclude=lost+found /boot" | tar xf -
     75 
     76 Now back in the VM, we can finish the installation.
     77 
     78   exit
     79   exit
     80   Select "Finish the installation"
     81   Continue
     82 
     83 When it reboots, kill qemu from another shell, else it will try to reinstall.
     84 
     85 Now start the installation:
     86 
     87 /path/to/Qemu221/bin/qemu-system-aarch64 -M virt \
     88   -cpu cortex-a57 -m 1024 -drive file=disk6G.img,if=none,id=blk \
     89   -device virtio-blk-device,drive=blk -net user,hostfwd=tcp::5555-:22 \
     90   -device virtio-net-device,vlan=0 -kernel boot/vmlinuz-3.16.0-4-arm64 \
     91   -initrd boot/initrd.img-3.16.0-4-arm64 \
     92   -append "root=/dev/vda2 rw console=ttyAMA0 --" -nographic
     93 
     94 Now you can ssh into the VM and install stuff as usual:
     95 
     96 ssh -XC -p 5555 username@localhost
     97 
     98   (on the guest)
     99   become root
    100   apt-get install make gcc g++ automake autoconf emacs subversion gdb
    101 
    102 Hack on, etc.
    103