[Cin] qemu user mode

Andrew Randrianasulu randrianasulu at gmail.com
Sat Jan 8 18:03:21 CET 2022


should be faster than full VM for compiling, but might not work for testing
/proc/self pointing at wrong image? also ALSA still not work if called
under qemu-user, last I checked)

https://wiki.debian.org/QemuUserEmulation

Installing packages
The binfmt-support package contains a helper script to easily
register/unregister binary formats with the kernel using the binfmt_misc
module.

Install qemu, binfmt-support, and qemu-user-static:

# apt install qemu binfmt-support qemu-user-static
Check whether the binfmt entries were successfully registered:

# update-binfmts --display
This command should print entries for each supported target user emulator,
except for the host system.

===


see appendix if you already have chroot folder with arm system

or try to use Raspbian's one from


https://wiki.debian.org/RaspberryPi/qemu-user-static

a bit involved when it comes to image resizing...

===

Note: If the host system is Debian Buster and the chroot will be Debian
Bullseye, it is good to make sure the host has the version 5.2 of
qemu-user-static, available from buster-backports. Otherwise some binaries
may cause qemu-user-static to Seg Fault, see 987497. For example setting
locale(s) in chroot fails without the upgrade of qemu-user-static.

{..}
sudo losetup -f -P --show 2020-08-20-raspios-buster-arm64.img


Mounting the image
Mount the image with root permissions:

sudo mount /dev/loop0p2 -o rw /mnt
Optional: If you want to mount the RaspiOS /boot

sudo mount /dev/loop0p1 -o rw /mnt/boot
Also mount necessary host directories.

cd /mnt
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
(not necessary/advised if you use systemd-nspawn)

To get everything work (e.g., network) you need to comment out everything
in /mnt/etc/ld.so.preload before you chroot in. Take care of that now!

(not sure if copying qemu binary into chroot still needed on latest
Debian?)
cp /usr/bin/qemu-aarch64-static /mnt/usr/bin

or qemu-arm-static for armhf

Now chroot in!

cd /mnt
(not needed if we already in mnt?)
sudo chroot . bin/bash

now you can try to get git sources and install usual deps for Cin-gg
compilation from inside arm/aarch64 chroot and see how far it comes!

===
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20220108/1ab345ac/attachment.htm>


More information about the Cin mailing list