metalx1000

Chroot for cross arch ARM

Sep 28th, 2015 (edited)
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.37 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. mkfs.ext4 -F my_image.img
  12.  
  13. mkdir $dir
  14. modprobe loop
  15. mount -o loop $img $dir
  16. #sudo cp -pfr squashfs-root/* op/   #copies with permissions intact
  17.  
  18. #https://wiki.debian.org/EmDebian/CrossDebootstrap#QEMU.2Fdebootstrap_approach
  19. apt-get install binfmt-support qemu qemu-user-static debootstrap
  20.  
  21. #mkdir $dir
  22.  
  23. debootstrap --foreign --arch armel $ver $dir http://ftp.debian.org/debian/
  24.  
  25. cp /usr/bin/qemu-arm-static $dir/usr/bin
  26.  
  27. DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
  28.  LC_ALL=C LANGUAGE=C LANG=C chroot $dir /debootstrap/debootstrap --second-stage
  29.  
  30. DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
  31.  LC_ALL=C LANGUAGE=C LANG=C chroot $dir dpkg --configure -a
  32.  
  33. echo "Welcome to your ARM chroot!"
  34.  
  35. chroot $dir bash
  36.  
  37.  
  38.  
  39. ################notes##########
  40. echo “deb http://http.debian.net/debian wheezy main non-free contrib” > /etc/apt/sources.list
  41. echoexport PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin” >> /root/.bashrc
  42. echoexport TERM=xterm” >> /root/.bashrc
  43.  
  44. ###########bashrc######
  45. export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
  46. export TERM=xterm
  47. export HOME=/root
Advertisement
Add Comment
Please, Sign In to add comment