一、安裝工具 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.,說明根文件系統就定製成功了。