制作debian系统,首先要安装软件:
sudo apt-get install debian-archive-keyring debian-keyring
sudo apt-get install binfmt-support qemu qemu-user-static debootstrap multibootstrap
基本软件安装之后需要下载debian源码:
1.debootstrap --arch=armel --foreign wheezy rootfs_debian/ http://ftp.us.debian.org/debian
arch:表示支持的架构,x86,arm等,armel是比较低端的arm芯片,armhf是支持浮点运算的arm芯片,arm64是arm64架构。
wheezy 表示debian软件版本,目前wheezy已经停止支持,
rootfs_debian 表示要存放文件系统的目录。
debootstrap --arch=armhf --foreign stretch rootfs_debian/ http://ftp.us.debian.org/debian
2. cp /usr/bin/qemu-arm-static ./rootfs_debian/usr/bin/
3. chroot ./rootfs_debian /debootstrap/debootstrap --second-stage
4. rm rootfs_debian/usr/bin/qemu-arm-static
5. vim rootfs_debian/etc/shadow
去掉root登录密码, 去掉'*'
root::15880:0:99999:7:::
6.添加串口支持
在文件rootfs_debian/etc/inittab 中添加
T0:23:respawn:/sbin/getty -L ttymxc0 115200 vt100
7.添加更新包的源/etc/apt/sources.list
deb http://ftp.us.debian.org/debian wheezy main
讲原始的源替换为:
deb http://mirror.lzu.edu.cn/debian stable main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian stable main contrib non-free
deb http://mirror.lzu.edu.cn/debian stable-updates main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian stable-updates main contrib non-free
deb http://mirror.lzu.edu.cn/debian/ stretch-backports main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian/ stretch-backports main contrib non-free
deb http://mirror.lzu.edu.cn/debian-security/ stretch/updates main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian-security/ stretch/updates main contrib non-free
这些工作做完之后就得到一个完整的文件系统了。
文件系统可以通过nfs网络挂载方式添加到开发板,或是通过mfgtool 软件烧录,烧录之前需要把文件系统压缩为tar.bz2的格式:
tar -jcvf nfs_debian.tar.bz2 nfs_debian
8.通过nfs挂载启动之后,遇到如下问题:
apt-get install vim时,提示/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory,可以通过执行命令:apt-get install locales-all来解决
root@cxt-Vostro-5468:/# locale -a
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
root@cxt-Vostro-5468:/# vim /etc/default/locale
2.安装基本的软件支持包
https://github.com/deadsnakes/
More info: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding itgpg: keybox '/tmp/tmp7b0aya_p/pubring.gpg' created
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/tmp/tmp7b0aya_p/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr
apt update
apt-get install locales-all
apt-get install net-tools python3 python3-pip busybox udhcpc iw rfkill
apt-get install minicom rsyslog libatlas-base-dev screen cmake libboost-all-dev
apt-get install dirmngr
cp /lib -a
cp /usr/libexec
添加brcm_patchram_plus的bin文件
安装bootst软件
./bootstrap.sh --with-libraries=all --with-toolset=gcc
3.生成了debian文件系统之后,如果通过mfgtool软件烧录,需要将文件压缩为rootfs.tar.bz2格式。
注意压缩的路径,只能是当前路径压缩,如果在上级目录,就会导致系统不能成功挂载:提示devtmpfs: error mounting -2
XT3-fs (mmcblk1p2): using internal journal
EXT3-fs (mmcblk1p2): recovery complete
EXT3-fs (mmcblk1p2): mounted filesystem with ordered data mode
VFS: Mounted root (ext3 filesystem) on device 179:2.
--cxt---mntdir is dev
devtmpfs: error mounting -2
Freeing unused kernel memory: 400K (80a2a000 - 80a8e000)