Skip to content

Efficient CLI for Raspian ARM on QEMU

Notifications You must be signed in to change notification settings

PSU-HC/QEMU-Raspian

 
 

Repository files navigation

Using QEMU for Raspian ARM


README yet to be updated with Makerspace-specific formatting


single ARM guest configuration tested on Mac OSX 10.14.6 host
experimental multi-guest support for Ubuntu 18.04 host (Gnome / Budgie) over virtual network bridge

Emulates a variety of Raspian releases on proper ARM hardware with QEMU.

Prerequisites:

QEMU and wget (OSX homebrew)

# OSX:
brew install qemu wget 

# Ubuntu:
sudo apt-get install qemu-system-arm -y

Get the Python3 CLI in this repo:

wget https://raw.githubusercontent.com/Jesssullivan/USBoN/master/QEMU_Raspian.py

info - multiple guests over virtual bridge (.deb distros only):

  • multiple guests get unique MAC addresses
  • see /setupHostDepends.sh for required packages
# permiss shell scripts with ``` sudo chmod u+x ... ``` 

sudo ./setupHostDepends.sh

# switch to bridge br0:
sudo ./UPbrctl.sh

# back to normal host network:
sudo ./DOWNbrctl.sh

# add network bits for host:
rm /etc/network/interfaces  # existing lo file
cp interfaces /etc/network/  # replace from this repo
cp qemu-ifup /etc/

usage - single guest:

After the first launch, it will launch from the persistent .qcow2 image.

With no arguments & in a new folder, Raspian "stretch-lite" (no desktop environment) will be:
- downloaded as a zip archive with a release kernel
- unarchived --> to img
- converted to a Qcow2 with 8gb allocated as disk
- launched from Qcow2 as administrator

sudo python3 QEMU_Raspian.py 

optional guest configuration arguments:

  • -h prints CLI usage help
  • -rm removes ALL files added in dir with QEMU_Raspian.py
  • stretch uses standard graphical stretch release with GUI
  • stretchlite for stretchlite release [default!]
  • buster for standard graphical buster release [YMMV]
  • busterlite for busterlite release [YMMV]
# examples:
sudo python3 QEMU_Raspian.py busterlite
python3 QEMU_Raspian -h  # print help

# YMMV: burn / backup as .img:     

to burn the new image back to an SD card for a hardware Pi:     

# bash
qemu-img convert -f qcow2 -O raw file.qcow2 file.img

Alt text

About

Efficient CLI for Raspian ARM on QEMU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 73.7%
  • Shell 26.3%