Skip to content

Instantly share code, notes, and snippets.

@saljam
Created October 23, 2016 21:21
Show Gist options
  • Save saljam/6ca324567c4f9baeb6858c6b05ebc13f to your computer and use it in GitHub Desktop.
Save saljam/6ca324567c4f9baeb6858c6b05ebc13f to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# To reproduce on sid:
#
# apt-get install gcc make bc gcc-aarch64-linux-gnu qemu-system-arm qemu-user-static
#
# # build a kernel
# curl -O https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.5.tar.xz
# tar xfv linux-4.4.5.tar.xz
# cp config linux-4.4.5/.config
# cd linux-4.4.5
# ARCH=arm64 make
# cp arch/arm64/boot/Image ../Image
# cd ..
#
# # bootstrap a debian root filesystem
# qemu-img create -f raw sid.img 1G
# mkfs.ext4 sid.img
# mount sid.img /mnt
# qemu-debootstrap --arch=arm64 --variant=buildd --exclude=debfoster sid /mnt
# umount /mnt
#
# That's it! It's the same process as building Debian images for xhyve. You'll have
# a sid.img root image and a bzImage kernel. Forget EFI.
kernel="Image"
image="sid.img"
append="root=/dev/vda"
mac="82:92:84:bb:b2:cb"
exec qemu-system-aarch64 \
-nographic \
-m 1024 -cpu cortex-a57 -M virt \
-kernel $kernel \
-drive if=none,format=raw,file=$image,id=hd0 -device virtio-blk-device,drive=hd0 \
-append "$append"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment