Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WORK IN PROGRESS
- How to build latest QEMU:
- #0. Use full Raspbian to make sure all dependencies are met.
- 1. Copy RPi rootfs to a folder on your PC. You can mount Raspbian image and copy „rootfs” or copy it from your Rpi’s microSD!
- Use a command like: sudo cp -a /rootfs/location /destination/dir
- 2. Install packages on your PC:
- sudo apt install systemd-container qemu-user-static
- 3. Copy qemu executable:
- sudo cp /usr/bin/qemu-arm-static /path/to/rootfs/usr/bin
- 4. Try chrooting using systemd-nspawn:
- sudo systemd-nspawn -D /path/to/rootfs
- 5. You may need this to make networking work. Do something like this:
- sudo nano /etc/resolv.conf
- Put there this line:
- nameserver 8.8.8.8
- 6. Add src repo:
- nano /etc/apt/sources.list
- deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
- (you probably just have to uncomment it)
- 7. Update the system:
- apt update && apt dist-upgrade && apt autoremove && apt autoclean
- 8. Install QEMU dependencies:
- apt install raspberrypi-kernel-headers git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev git-email libaio-dev libbluetooth-dev libbrlapi-dev libbz2-dev libcap-dev libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev libibverbs-dev libjpeg8-dev libncurses5-dev librbd-dev librdmacm-dev libsasl2-dev libsdl1.2-dev libseccomp-dev libsnappy-dev libssh2-1-dev libvde-dev libvdeplug-dev libvte-2.90-dev libxen-dev liblzo2-dev valgrind xfslibs-dev libnfs-dev libiscsi-dev bison flex p11-kit libp11-dev libp11-2
- //not in Raspbian repo - libnuma-dev
- A lot, but this should make sure that we have all dependencies! If you get a message that a package wasn’t found, remove it and run the command again. Run also this:
- apt build-dep qemu
- Symlink time (trying to solve /usr/bin/ld: cannot find -lp11-kit):
- ln -s /usr/lib/arm-linux-gnueabihf/libp11-kit.so.0 /usr/lib/libp11-kit.so.0
- ln -s /usr/lib/arm-linux-gnueabihf/libp11-kit.so /usr/lib/libp11-kit.so
- 8. Don’t compile as root:
- exit
- sudo systemd-nspawn –user=pi -D /path/to/rootfs
- This may result in some QEMU bugs when running sudo (on older versions), but don’t worry – it shouldn’t affect the build.
- 9. Download QEMU (https://www.qemu.org/download/#source):
- git clone https://git.qemu.org/git/qemu.git
- cd qemu
- git submodule update --init --recursive
- 10. Configure QEMU:
- ./configure \
- --prefix=$(cd ..; pwd)/qemu-user-static \
- --static \
- --disable-system \
- --target-list=i386-linux-user
- Optional: add
- ----extra-cflags=CFLAGS \
- ----extra-cxxflags=CXXFLAGS
- Use these flags to optimize build for your architecture, e.g. --with-arch=armv8-a
- 11. Compile and „install”
- make -jx
- x is the number of cores/threads on your pc
- make install
- cd ../qemu-user-static/bin
- for i in *; do cp $i $i-static; done
- 12.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement