1、预装必要基础组件
./mount.sh -m
apt install -y net-tools ethtool ifupdown iputils-ping network-manager htop kmod vim language-pack-en-base bash-completion rsync rsyslog openssh-server ssh udev apt-utils dialog exfat-fuse sudo
基础组件的对应描述
apt install net-tools ethtool ifupdown iputils-ping network-manager
apt install htop
apt install kmod
apt install vim
apt install language-pack-en-base
apt install bash-completion
apt install rsync
apt install rsyslog
apt install openssh-server ssh
apt install udev
apt install apt-utils
apt install dialog
apt install exfat-fuse
apt install sudo
2、可选安装组件
apt install exfat* ntfs-3g
apt install ibus-pinyin ibus-sunpinyin
apt-get install neofetch screenfetch
apt-get install libqt5serialport5-dev
3、安装桌面环境
ubuntu常见桌面
Gnome桌面
安装 GNOME 最小桌面环境,后续实际使用中发现触摸屏适配有问题,不需要触摸的可以使用该桌面
apt install --no-install-recommends ubuntu-desktop
LXDE桌面
这里推荐使用这个桌面环境,可玩性很高,当然需要集成的工作也比较多,但是流畅性好
apt install lxde-core
如果执行出错再执行一次,部分错误是由于网络访问超时引起的;
4、退出模拟环境,打包镜像
退出文件系统
exit
sudo ./mount.sh -u
创建相对应的目录
mkdir ./rootfs
创建打包脚本
sudo vim resize.sh
#!/bin/bash
LINUXROOT=./linuxroot.img
ubuntu_order=`sudo du -m --max-depth=0 ubuntufs/`;
ubuntu_size=$((`echo "$ubuntu_order" | awk '{print $1}'`+1024));
echo $ubuntu_size
sudo rm -rf rootfs/*
if [ ! -f "$LINUXROOT" ];then
echo "$LINUXROOT is not exits"
else
rm -rf $LINUXROOT
fi
dd if=/dev/zero of=linuxroot.img bs=1M count=$ubuntu_size
mkfs.ext4 -F -L linuxroot $LINUXROOT
sudo mount $LINUXROOT ./rootfs
cp -rfp ./ubuntufs/* ./rootfs
sudo umount ./rootfs
e2fsck -p -f $LINUXROOT
resize2fs -M $LINUXROOT
ls -lh $LINUXROOT
执行打包脚本
sudo ./resize.sh
等待几分钟,会生成镜像文件linuxroot.img
直至基础的文件系统就制作完毕了,别急着烧录,请看下章。