create_arm_debootstrap.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #/bin/sh
  2. ######################
  3. # Debootstrap part #
  4. ######################
  5. targetdir=/olinux/debootstrap
  6. distro=wheezy
  7. rm -rf $targetdir && mkdir -p $targetdir
  8. # install packages for debootstap
  9. apt-get install --force-yes -y debootstrap dpkg-dev qemu binfmt-support qemu-user-static dpkg-cross
  10. mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
  11. update-binfmts --enable
  12. # Debootstrap
  13. debootstrap --arch=armhf --foreign $distro $targetdir
  14. cp /usr/bin/qemu-arm-static $targetdir/usr/bin/
  15. cp /etc/resolv.conf $targetdir/etc
  16. chroot $targetdir /debootstrap/debootstrap --second-stage
  17. # Configure debian apt repository
  18. cat <<EOT > $targetdir/etc/apt/sources.list
  19. deb http://ftp.fr.debian.org/debian $distro main contrib non-free
  20. EOT
  21. cat <<EOT > $targerdir/etc/apt/apt.conf.d/71-no-recommends
  22. APT::Install-Suggests "0";
  23. EOT
  24. chroot $targetdir apt-get update
  25. # Add ssh server and ntp client
  26. chroot $targetdir apt-get install -y --force-yes openssh-server ntp
  27. # Use dhcp on boot
  28. echo <<EOT > $targetdir/etc/network/interfaces
  29. auto lo
  30. iface lo inet loopback
  31. allow-hotplug eth0
  32. iface eth0 inet dhcp
  33. EOT
  34. # Configure tty
  35. echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> $targetdir/etc/inittab
  36. # Remove useless files
  37. chroot $targetdir apt-get clean
  38. rm $targetdir/etc/resolv.conf
  39. rm $targetdir/usr/bin/qemu-arm-static