Advertisement
metalx1000

Chroot for cross arch ARM

Sep 28th, 2015
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.34 KB | None | 0 0
  1. #!/bin/bash
  2. dir="debian_armel_wheezy"
  3. ver="wheezy"
  4.  
  5. #create empty image and mount it
  6. img=debian_arm.img
  7. dd bs=512 count=5400000 if=/dev/zero of=$img #creates a empty IMG file that is about 2GB
  8.  
  9. fdisk $img
  10. mkfs.ext4 $img
  11.  
  12. mkdir $dir
  13. modprobe loop
  14. mount -o loop $img $dir
  15. #sudo cp -pfr squashfs-root/* op/   #copies with permissions intact
  16.  
  17. #https://wiki.debian.org/EmDebian/CrossDebootstrap#QEMU.2Fdebootstrap_approach
  18. apt-get install binfmt-support qemu qemu-user-static debootstrap
  19.  
  20. #mkdir $dir
  21.  
  22. debootstrap --foreign --arch armel $ver $dir http://ftp.debian.org/debian/
  23.  
  24. cp /usr/bin/qemu-arm-static $dir/usr/bin
  25.  
  26. DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
  27.  LC_ALL=C LANGUAGE=C LANG=C chroot $dir /debootstrap/debootstrap --second-stage
  28.  
  29. DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
  30.  LC_ALL=C LANGUAGE=C LANG=C chroot $dir dpkg --configure -a
  31.  
  32. echo "Welcome to your ARM chroot!"
  33.  
  34. chroot $dir bash
  35.  
  36.  
  37.  
  38. ################notes##########
  39. echo “deb http://http.debian.net/debian wheezy main non-free contrib” > /etc/apt/sources.list
  40. echoexport PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin” >> /root/.bashrc
  41. echoexport TERM=xterm” >> /root/.bashrc
  42.  
  43. ###########bashrc######
  44. export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
  45. export TERM=xterm
  46. export HOME=/root
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement