SHARE
TWEET

Untitled

a guest May 14th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WORK IN PROGRESS
  2. How to build latest QEMU:
  3.  
  4. #0. Use full Raspbian to make sure all dependencies are met.
  5.  
  6. 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!
  7. Use a command like: sudo cp -a /rootfs/location /destination/dir
  8.  
  9. 2. Install packages on your PC:
  10. sudo apt install systemd-container qemu-user-static
  11.  
  12. 3. Copy qemu executable:
  13. sudo cp /usr/bin/qemu-arm-static /path/to/rootfs/usr/bin
  14.  
  15. 4. Try chrooting using systemd-nspawn:
  16. sudo systemd-nspawn -D /path/to/rootfs
  17.  
  18. 5. You may need this to make networking work. Do something like this:
  19. sudo nano /etc/resolv.conf
  20. Put there this line:
  21. nameserver 8.8.8.8
  22.  
  23. 6. Add src repo:
  24. nano /etc/apt/sources.list
  25. deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
  26. (you probably just have to uncomment it)
  27.  
  28. 7. Update the system:
  29. apt update && apt dist-upgrade && apt autoremove && apt autoclean
  30.  
  31. 8. Install QEMU dependencies:
  32. 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
  33. //not in Raspbian repo - libnuma-dev
  34. 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:
  35. apt build-dep qemu
  36.  
  37. Symlink time (trying to solve /usr/bin/ld: cannot find -lp11-kit):
  38. ln -s /usr/lib/arm-linux-gnueabihf/libp11-kit.so.0 /usr/lib/libp11-kit.so.0
  39. ln -s /usr/lib/arm-linux-gnueabihf/libp11-kit.so /usr/lib/libp11-kit.so
  40.  
  41. 8. Don’t compile as root:
  42. exit
  43. sudo systemd-nspawn –user=pi -D /path/to/rootfs
  44. This may result in some QEMU bugs when running sudo (on older versions), but don’t worry – it shouldn’t affect the build.
  45.  
  46. 9. Download QEMU (https://www.qemu.org/download/#source):
  47. git clone https://git.qemu.org/git/qemu.git
  48. cd qemu
  49. git submodule update --init --recursive
  50.  
  51. 10. Configure QEMU:
  52. ./configure \
  53.     --prefix=$(cd ..; pwd)/qemu-user-static \
  54.     --static \
  55.     --disable-system \
  56.     --target-list=i386-linux-user
  57. Optional: add
  58.     ----extra-cflags=CFLAGS \
  59.     ----extra-cxxflags=CXXFLAGS
  60. Use these flags to optimize build for your architecture, e.g. --with-arch=armv8-a
  61. 11. Compile and „install”
  62. make -jx
  63. x is the number of cores/threads on your pc
  64. make install
  65. cd ../qemu-user-static/bin
  66. for i in *; do cp $i $i-static; done
  67.  
  68. 12.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top