1 获得ubuntu基本裸系统
1.1 利用debootstrap工具
由于我要跨平台运行,所以不能简单地进行本机编译,在网上查询专门有一个模拟不同机器架构的软件qemu,而在ubuntu中对其支持良好。所以首先在PC主机ubuntu系统中安装qemu模拟器:
最好是在docker 中制作,不会影响当前环境
sudo docker run -i -t --privileged ubuntu:16.04 /bin/bash
进入docker 后,下载需要的一些工具:
apt update
sudo apt-get install -y vim qemu-user-static debootstrap qemu-user-static autoconf gcc g++ gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf make zip unzip bzip2 file
然后就可以利用下面的命令获得一个基本的ubuntu arm文件系统:
# sysroot
qemu-debootstrap \--arch=armhf \--verbose \--include=fakeroot,build-essential,libx11-dev,libxext-dev,libxrandr-dev,libxrender-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev \--resolve-deps trusty \/opt/chroot \|| true
for fi in ` bash -c "ls /opt/chroot/var/cache/apt/archives/*.