Skip to content

Instantly share code, notes, and snippets.

@philipz
Created March 9, 2015 03:17
Show Gist options
  • Save philipz/04a9a165f8ce561f7ddd to your computer and use it in GitHub Desktop.
Save philipz/04a9a165f8ce561f7ddd to your computer and use it in GitHub Desktop.
Debian ARM64 (Aarch64) image for QEMU
QEMU version: 2.2.0
HDD init: qemu-img create -f qcow debian8-arm64.img 10G

Netinstall initrd: http://ftp.ru.debian.org/debian/dists/jessie/main/installer-arm64/20150107/images/netboot/debian-installer/arm64/initrd.gz
Netinstall kernel: wget http://ftp.ru.debian.org/debian/dists/jessie/main/installer-arm64/20150107/images/netboot/debian-installer/arm64/linux

Netinstall start:
 qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 512 -kernel linux -initrd initrd.gz -append "root=/dev/ram console=ttyAMA0" -global virtio-blk-device.scsi=off -device virtio-scsi-device,id=scsi -drive file=debian8-arm64.img,id=rootimg,cache=unsafe,if=none -device scsi-hd,drive=rootimg -netdev user,id=unet -device virtio-net-device,netdev=unet -net user

Extract kernel and initrd after install:
 sudo modprobe nbd max_part=16
 sudo qemu-nbd -c /dev/nbd0 debian8-arm64.img
 sudo partprobe /dev/nbd0

 mkdir sda2
 sudo mount /dev/nbd0p2 sda2

 cp sda2/boot/vmlinuz vmlinuz-run
 cp sda2/boot/initrd.img initrd-run.img

 sudo umount sda2
 rmdir sda2
 sudo /opt/qemu220/bin/qemu-nbd -d /dev/nbd0

Running:
 qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 512 -kernel vmlinuz-run -initrd initrd-run.img -append "root=/dev/sda2 console=ttyAMA0" -global virtio-blk-device.scsi=off -device virtio-scsi-device,id=scsi -drive file=debian8-arm64.img,id=rootimg,cache=unsafe,if=none -device scsi-hd,drive=rootimg -netdev user,id=unet -device virtio-net-device,netdev=unet -net user
@philipz
Copy link
Author

philipz commented Mar 13, 2015

@timothy-hayes
Copy link

These are great instructions, thanks. Just a note: in Debian 9+ following the default installation, the /boot/ directory will be in its own partition so /dev/nbd0p2 becomes /dev/nbd0p1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment