一、安装工具 qumu和debootstrap
apt-get install binfmt-support qemu qemu-user-static debootstrap
二、抽取系统基本文件
在根目录 workspace 下 创建文件系统目录 fs_debian_stretch
执行命令:
sudo debootstrap --foreign --arch armhf stretch fs_debian_stretch https://mirrors.cloud.tencent.com/debian
抽取如果不成功在保证网络正常的情况下多试几次(在代理网络下未成功,通过手机联网的方式成功下载!)
三、抽取完毕进行第二阶段
因为宿主是X86 架构,不能安装arm架构的软件。需要qemu-arm-static 来模拟arm环境进行安装
复制 qemu-arm-static 到刚构建的基本系统中
#sudo cp /usr/bin/qemu-arm-static fs_debian_stretch/usr/bin
执行第二阶段安装
#sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C \chroot fs_debian_stretch debootstrap/debootstrap --second-stage
该命令意思是设置一些环境变量,然后切换根目录到fs_debian_stretch,执行目录fs_debian_stretch /debootstrap下的命令: debootstrap --second-stage.
终端上会最后打印 I: Base system installed successfully.,说明根文件系统就定制成功了。