Running RaspberryPi using Qemu (Fedora 24)

Mostly taken from here: https://wiki.debian.org/RaspberryPi/qemu-user-static
Adopted to run using Fedora 24


Install qemu-user-static:

dnf install qemu-user-static


Register binfmt:

systemctl restart systemd-binfmt


Check binfmt interpreter:

cat /proc/sys/fs/binfmt_misc/qemu-arm-static will show you:

enabled
interpreter /usr/bin/qemu-arm
flags:
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00fffffffffffffffffeffffff

Make symbolic link to match the interpreter path:
ln -s /usr/bin/qemu-arm-static /usr/bin/qemu-arm

Download raspbian image, and extract it

(Skip this if you already have sdcard with raspbian)

wget ......
unzip 2016-05-27-raspbian-jessie.zip

Setup loopback:
losetup -f -P --show 2016-05-27-raspbian-jessie.img


Mount image or sdcard:

cd ~
mkdir ~/mnt

mount /dev/loop0p2 ~/mnt
mount /dev/loop0p1 ~/mnt/boot

# or for sdcard

mount /dev/mmcblk0p2 ~/mnt
mount /dev/mmcblk0p1 ~/mnt/boot


Copy qemu-arm-static:

cp  /usr/bin/qemu-arm-static ~/mnt/usr/bin/qemu-arm


Now, spawn your raspi:

systemd-nspawn -D ~/mnt -M raspi bin/bash

Press ^] three times within 1s to kill container.
root@raspi:/#

Modify your image:

Do something like:

root@raspi:/# apt-get install kodi

Write image to sdcard:

(Skip this if you already have sdcard with raspbian)

exit from systemd-nspawn
umount ~/mnt/boot
umount ~/mnt
losetup -D
dd bs=4M if=2016-05-27-raspbian-jessie.img of=/dev/mmcblk0





Comments

Popular posts from this blog

Ports to allow for whatsapp call

Manually clean up zimbra zmcat/zmcpustat exploit

Keychron K2 in Linux