(C++) Running raspbian under qemu
January 9, 2018 · View on GitHub
Running raspbian under qemu describes how to run raspbian under qemu.
Summary from [1] (see [1] for more detailed instructions):
- Download the linux kernel:\ \ ------------------------------------------------------------------------
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu------------------------------------------------------------------------ \ - Download the raspbian .img file '2012-10-28-wheezy-raspbian.zip' (or any newer file) from http://www.raspberrypi.org/downloads
- Put the linux kernel and raspbian image in same working folder
- In the working folder, do:\ \ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda 2012-10-28-wheezy-raspbian.img---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \



Increase harddisk size
Initially, there is little disk space left on the emulated raspbian.

Solution:
- Increase the raspbian image its size by 10G:\ \ -----------------------------------------------------------------
qemu-img resize 2012-10-28-wheezy-raspbian.img +10G----------------------------------------------------------------- \ Note that the image is resized, but its hard disk use not yet (see view) - Start using its hard disk: \ ---------------------------------------------------------------------------------------------------------------------------------------------------------
cp /usr/bin/raspi-config ~ sed -i 's/mmcblk0p2/sda2/' ~/raspi-config sed -i 's/mmcblk0/sda/' ~/raspi-config sudo ~/raspi-config--------------------------------------------------------------------------------------------------------------------------------------------------------- \ Select 'expand_rootfs' and raspi-config will add the resized harddisk (see view)


Error: infinite login
When following the instructions from [1] (using the newer file '2013-02-09-wheezy-raspbian.zip' from http://www.raspberrypi.org/downloads), raspbian started but looped the login: after every login, there was a new login.
Solution: use the file '2012-10-28-wheezy-raspbian.zip' from http://www.raspberrypi.org/downloads instead.
References
- xecdesign.com's article how to setup qemu under GNU/Linux and Windows (link broken)
- How to start using the resized harddisk