http://cdimage.ubuntu.com/ubuntu-base/releases/
在PC上解压
cd /home/zuozhongkai/linux/nfs //进入到 nfs 目录下
mkdir ubuntu_rootfs //创建名为“ubuntu_rootfs”目录
sudo tar -vzxf ubuntu-base-16.04.5-base-armhf.tar.gz
PC下载安装qemu
并拷贝到ubuntu-base
sudo apt-get install qemu-user-static
cd /home/zuozhongkai/linux/nfs/ubuntu_rootfs //进入到 ubuntu_rootfs 目录下
sudo cp /usr/bin/qemu-arm-static ./usr/bin/ //拷贝 qemu-arm-static
将 Ubuntu 主机下的 DNS 配置文件/etc/resolv.conf 拷贝到根文件系统中,命令如下:
cd /home/zuozhongkai/linux/nfs/ubuntu_rootfs //进入到 ubuntu_rootfs 目录下
sudo cp /etc/resolv.conf ./etc/resolv.conf //拷贝 resolv.conf
打开根文件系统中的 ubuntu_rootfs/etc/apt/sources.list 文件,在此文件最后面添加软件源
mount.sh
1 #!/bin/bash
2 echo "MOUNTING"
3 sudo mount -t proc /proc
/home/zuozhongkai/linux/nfs/ubuntu_rootfs/proc
4 sudo mount -t sysfs /sys
/home/zuozhongkai/linux/nfs/ubuntu_rootfs/sys
5 sudo mount -o bind /dev /home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev
6 sudo mount -o bind /dev/pts
/home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev/pts
7 sudo chroot /home/zuozhongkai/linux/nfs/ubuntu_rootfs
unmount.sh
1 #!/bin/bash
2 echo "UNMOUNTING"
3 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/proc
4 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/sys
5 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev/pts
6 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev
常用命令、软件安装
apt update
apt install sudo
apt install vim
apt install kmod
apt install net-tools
apt install ethtool
apt install ifupdown
apt install language-pack-en-base
apt install rsyslog
apt install htop
apt install iputils-ping
设置基本参数和环境
passwd root
echo "alientek_imx6ul" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "127.0.0.1 alientek_imx6ul" >> /etc/hosts
ln -s /lib/systemd/system/getty@.service/etc/systemd/system/getty.target.wants/getty@ttymxc0.service
//ALPHA开发板使用的UART1对应的串口设备文件为ttymxc0,我们需要添加一个名为getty@ttymxc0.service的链接,链接到 getty@.service 服务上
exit//退出根文件系统
./unmount.sh
setenv bootargs ‘console=tty1 console=ttymxc0,115200 root=/dev/nfs nfsroot=192.168.1.253:/home/zuozhongkai/linux/nfs/ubuntu_rootfs rw ip=192.168.1.251:192.168.1.253:192.168.1.1:255.255.255.0::eth0:off’
saveenv //保存环境变量
重启即可
//PC上打包文件系统
cd ubuntu_rootfs //进入到 ubuntu 根文件系统
tar -vcjf ubuntu_rootfs.tar.bz2 * //打包根文件系统
见系统烧写方式章节(后续整理)