1.开发背景
一般根文件系统使用 Busybox 或者是 Buildroot 构建,这样构建出来的文件系统比较小,但是不具备上网功能,扩展性比较差。随着 ARM 的日益强大,ARM 可以搭载更庞大复杂的系统,可以是 Ubuntu 或者 Debian 等发行版本。
2.开发需求
下载最新的 Debian10,即 Debian10.13,移植系统成功在板卡上运行。
3.开发环境
开发环境:Ubuntu20.04
目标系统: Debian10.13
板卡芯片:RK3568
4.实现步骤
4.1 下载最小系统
这里没有找到合适的镜像包,只能使用 qemu 工具完成。
(1)安装 debootstrap 和 qemu-user-static
sudo apt install debootstrap
sudo apt install qemu-user-static
(2)拉数据包,拉数据包很漫长,各种解包操作
# 这里的 buster 代表的就是 Debian10
mkdir debian-root
sudo qemu-debootstrap --arch=arm64 buster ./debian-root http://deb.debian.org/debian/
最后提示 successful 就是安装成功了
4.2 修改用户密码
最初构建的文件系统密码是不知道的,如果直接挂载到板卡上也进不去,所以需要修改密码和添加必须的用户,我们可以使用 chroot 从开发端直接进入文件系统
# 文件系统名字 rootfs
sudo chroot rootfs
修改密码和添加登录账号,一般不允许 root 直接登录
passwd root
useradd -m yangjinghui
usermod -s /bin/bash yangjinghui
passwd yangjinghui
退出系统
exit
4.3 网络挂载登录
挂载登录成功