使用F1C200S从零制作掌机之构建debian文件系统

前情:使用buildrootfs构建的文件系统调试了很久NES模拟器,执行InfoNES模拟器的时候一直黑屏,无内容显示,调不通了,所以改用debian系统试试。

一、环境配置

首先下载两个工具:qemu-arm-static和debootstrap。

  • qemu-arm-static:通过qemu-arm-static,我们在x86的Ubuntu PC机上,可以模拟ARM处理器,就像运行在ARM上一样进行各种操作。这样既实现了ARM环境,又利用了x86 PC的处理能力。
  • debootstrap:是Debian/Ubuntu下的一个工具,用来构建一套基本的系统(根文件系统)。生成的目录符合Linux文件系统标准(FHS),即包含了/boot、/etc、/bin、/usr等等目录,但它比发行版本的Linux体积小很多,当然功能也没那么强大,因此,只能说是“基本的系统”。
sudo apt install qemu-user-static -y
sudo apt install debootstrap -y
mkdir debian_rootfs

二、构建

2.1 下载

使用清华镜像源抽取根文件系统。其中foreign表示若目标架构与本机架构不符时,需要携带该参数;arch代表架构,armhf (支持硬件浮点)、armel (软浮点);verbose表示不打印wget等包下载数据,进行静默安装。

从https://www.debian.org/mirror/list.zh-cn.html

image-20240705134439996

华为镜像源

cd debian_rootfs
sudo debootstrap --foreign --verbose --arch=armel bullseye rootfs http://mirrors.huaweicloud.com/debian/

至此,已经下载了最小的Debian系统, 你也可以将它想象为"最小系统"类似的存在,没有其他 “外设” 。这里改为bullseye,网上大部分使用的buster提示出错,不知道以后bullseye会不会也出错。在buster下找不到binary-armel。

2.2 文件挂载

cd rootfs
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts/

2.3 模拟

sudo cp /usr/bin/qemu-arm-static  usr/bin/
cd ..
对拉取的Debian根文件系统进行配置。
sudo LC_ALL=C LANGUAGE=C LANG=C chroot rootfs /debootstrap/debootstrap --second-stage --verbose
进入qemu虚拟器
sudo LC_ALL=C LANGUAGE=C LANG=C chroot rootfs

2.4 配置

更新源
vi /etc/apt/sources.list
#写入: deb http://mirrors.huaweicloud.com/debian bullseye main
apt-get update

安装软件
apt-get install wpasupplicant #安装WIFI配置相关的组件
apt-get install net-tools     #安装网络基础组件、如使用ifconfig等
apt-get install udhcpc        #当wifi连接成功后,需要用这个组件去获取IP地址
apt-get install evtest        #触摸屏测试
apt-get install mplayer
apt-get install alsa-utils    #音频测试
apt-get install wireless-tools 
apt install sudo vim openssh-server htop
apt install pciutils usbutils acpi #acpi我没有安装成功,换了其他的源也不可以

设置root账号密码
passwd root
123456

配置时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

配置SSH
vi /etc/ssh/sshd_config
#写入: PermitRootLogin yes

apt clean #清理
exit #退出chroot
sudo rm rootfs/usr/bin/qemu-arm-static #删除之前拷贝的文件

cd rootfs
sudo umount   dev/pts/ # 一定要在/dev前面umount
sudo umount   dev/
sudo umount   sys/
sudo umount   proc/

sudo tar cvf ../rootfs.tar ./ #在rootfs目录下执行

2.5 启动

tar -xvf rootfs.tar -C /media/wang/rootfs/

uboot bootargs:

console=tty1 console=ttyS1,115200 panic=5 rootwait root=/dev/mmcblk0p2 rootfstype=ext4 earlyprintk rw Loglevel=7

2.6 增加swap分区(按需,在开发板执行)

free -m
dd if=/dev/zero of=/swap1 bs=1M count=512  #count是SWAP大小,512就是512MB
mkswap /swap1
swapon /swap1

vi /etc/fstab
# 最后一行添加 
/swap1 swap swap defaults 0 0

三、编译InfoNES

apt-get install gcc
apt-get install g++
apt-get install make
apt-get install libasound2-dev
apt-get install zlib1g-dev

使用的模拟器源码:https://files.cnblogs.com/files/twzy/arm-NES-linux-master.zip

源码进入linux目录,直接编译即可。拷贝nes游戏到文件系统。

在开发启动程序,屏幕可显示游戏界面。

四、注意

debian的版本,使用buster会报错,使用oldstable无法启动。最后改用bullseye。

修改rootfs分区大小为2048M。

五、debian系统下外设

待完成。

六、移植好的文件系统

https://download.csdn.net/download/weixin_36117563/89524570

七、参考

https://whycan.com/t_4236_10.html

https://blog.csdn.net/qq_41709234/article/details/128570505

https://blog.csdn.net/qq_41709234/article/details/128758130

https://www.cnblogs.com/twzy/p/15356127.html

https://mirrors.tuna.tsinghua.edu.cn/debian/dists/oldstable/main/

相关推荐

  1. 使用Pytorch开始构建RNN

    2024-07-12 13:24:05       44 阅读
  2. 全志F1C100s Linux 系统编译出错:不能连接 github

    2024-07-12 13:24:05       63 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-12 13:24:05       49 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-12 13:24:05       53 阅读
  3. 在Django里面运行非项目文件

    2024-07-12 13:24:05       42 阅读
  4. Python语言-面向对象

    2024-07-12 13:24:05       53 阅读

热门阅读

  1. linux上mmm和mm指令的区别

    2024-07-12 13:24:05       17 阅读
  2. docker 常用命令

    2024-07-12 13:24:05       20 阅读
  3. Redis的五种数据类型 #系统架构设计师#

    2024-07-12 13:24:05       21 阅读
  4. netstat 和ss命令

    2024-07-12 13:24:05       16 阅读
  5. 标准盒模型和怪异盒子模型的区别

    2024-07-12 13:24:05       19 阅读
  6. flink 配置表

    2024-07-12 13:24:05       25 阅读
  7. 无障碍快捷方式图标

    2024-07-12 13:24:05       21 阅读