Skip to content

Instantly share code, notes, and snippets.

@franciscocpg
Last active May 17, 2018 07:39
Show Gist options
  • Select an option

  • Save franciscocpg/14e6b89b173d48acd10658fb45626537 to your computer and use it in GitHub Desktop.

Select an option

Save franciscocpg/14e6b89b173d48acd10658fb45626537 to your computer and use it in GitHub Desktop.
Arm emulation with qemu on ubuntu 16.04.1

Run the script below inside a folder you create. For example: ~/qemu/arm64

# Install QEMU and the EFI image for QEMU:
sudo apt install qemu qemu-system-arm qemu-efi

# Now you'll need to create pflash volumes for UEFI. Two volumes are required, one static one for the UEFI firmware, and another dynamic one to store variables. Both need to be exactly 64M in size.
dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64

# Download xenial arm64 
wget http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-uefi1.img

# Changing the password for image
bzr branch lp:~smoser/+junk/backdoor-image
cd backdoor-image 
./backdoor-image --user ubuntu --password ubuntu --password-auth ../xenial-server-cloudimg-arm64-uefi1.img
cd..

# Running with networking. User/password is ubuntu/ubuntu
sudo qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt -nographic -pflash flash0.img -pflash flash1.img -drive if=none,file=xenial-server-cloudimg-arm64-uefi1.img,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0,mac=$(printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment