mkdir /opt/rootfs -p
apt-get install debootstrap -y
apt-get install qemu-user-static -y
cd /opt/
#debootstrap --foreign --verbose --arch=armhf stretch rootfs http://ftp2.cn.debian.org/debian
debootstrap --foreign --verbose --arch=armhf stretch rootfs http://ftp.de.debian.org/debian
###挂载###
mount --bind /dev /opt/rootfs/dev/
mount --bind /sys /opt/rootfs/sys/
mount --bind /proc /opt/rootfs/proc/
mount --bind /dev/pts /opt/rootfs/dev/pts/
cp /usr/bin/qemu-arm-static /opt/rootfs/usr/bin/
chmod +x /opt/rootfs/usr/bin/qemu-arm-static
###解压###
LC_ALL=C LANGUAGE=C LANG=C chroot rootfs /debootstrap/debootstrap --second-stage --verbose
###可以在这个时候, 安装任何东西###
LC_ALL=C LANGUAGE=C LANG=C chroot rootfs
###删除qemu-arm-static, 深藏功与名###
rm rootfs/usr/bin/qemu-arm-static
###卸载###
umount /opt/rootfs/dev/
umount /opt/rootfs/sys/
umount /opt/rootfs/proc/
umount /opt/rootfs/dev/pts/
cd /opt/rootfs/
tar cvzf ../debian9.9.rootfs.gz .
https://linux-sunxi.org/Debootstrap
其他配置:
参考:
https://gist.github.com/linzheming/205752af251ef2160fcfa2ee51a83287
如:
/etc/resolv.conf
echo DebianHostName > /etc/hostname