1. 准备开发环境
必须使用ubuntu
或debian
作为开发环境系统,并安装以下工具。
安装必要的工具
sudo apt-get install debootstrap qemu-user-static binfmt-support
准备一个文件夹,用来保存生成好的文件系统
用来保存生成的文件系统
mkdir ~/debianfs
2. 生成文件系统
从官方镜像下载文件系统,使用debian-8.2(jeesis)
sudo debootstrap --foreign --arch=armhf jeesie ~/debianfs # 也可以指定镜像地址,加快下载速度 sudo debootstrap --foreign --arch=armhf jeesie ~/debianfs http://ftp.cn.debian.org/debian
3. 初始化文件系统
初始化文件系统时,需要chroot
到文件系统中,但由于开发机一般为X86
,所以需要用到qemu-arm
工具
sudo cp /usr/bin/qemu-arm-static ~/debianfs/usr/bin sudo chroot ~/debianfs /debootstrap/debootstrap --second-stage
3. 配置
修改root
密码
vim ~/debian/etc/shadow
删除代表密码域的*号
添加串口终端
echo "T0:23:respawn:/sbin/getty -L ttymxc0 115200 vt100" >> ~/debianfs/etc/inittab