【I.MX6ULL移植】Ubuntu-base根文件系统移植

1.下载Ubuntu16.04根文件系统
http://cdimage.ubuntu.com/
1

2

3

4

5

2.解压ubuntu base 根文件系统

为了存放 ubuntu base 根文件系统,先在 PC 的 Ubuntu 系统中的 nfs 目录下创建一个名为

ubuntu_rootfs 的目录,命令如下:

【注意,这是一定使用下面解压命令解压,否则后面设置密码会出现错误】

bash 复制代码
cd /home/wj/linux/nfs 
mkdir ubuntu_rootfs
cd ubuntu_rootfs
sudo tar -vzxf ubuntu-base-16.04.5-base-armhf.tar.gz


3.安装 qemu

bash 复制代码
sudo apt-get install qemu-user-static

将刚刚安装的 qemu-user-static 拷贝到刚刚解压出来的 ubuntu base 目录中,也就是

ubuntu_rootfs/usr/bin 目录下,命令如下:

bash 复制代码
sudo cp /usr/bin/qemu-arm-static ./usr/bin/

sudo cp /etc/resolv.conf ./etc/resolv.conf 


4.设置中科大源

bash 复制代码
sudo gedit ubuntu_rootfs/etc/apt/sources.list 

将下面命令添加到sources.list 文件最后,切记这里是ubuntu_rootfs下面的,而不是自己PC电脑上的

bash 复制代码
#中科大源
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe


5.在主机挂载根文件系统

在 ubuntu_rootfs 目录下创建一个名为 mount.sh 和 unmount.sh的 shell 脚本

bash 复制代码
touch mount.sh  unmount.sh

其中mount.sh文件内容如下:【换成自己的ubuntu_rootfs路径】

bash 复制代码
#!/bin/bash
echo "MOUNTING"
sudo mount -t proc /proc /home/wj/linux/nfs/ubuntu_rootfs/proc
sudo mount -t sysfs /sys /home/wj/linux/nfs/ubuntu_rootfs/sys
sudo mount -o bind /dev /home/wj/linux/nfs/ubuntu_rootfs/dev
sudo mount -o bind /dev/pts /home/wj/linux/nfs/ubuntu_rootfs/dev/pts
sudo chroot /home/wj/linux/nfs/ubuntu_rootfs

其中unmount.sh文件内容如下:【换成自己的ubuntu_rootfs路径】

bash 复制代码
#!/bin/bash
echo "UNMOUNTING"
sudo umount /home/wj/linux/nfs/ubuntu_rootfs/proc
sudo umount /home/wj/linux/nfs/ubuntu_rootfs/sys
sudo umount /home/wj/linux/nfs/ubuntu_rootfs/dev/pts
sudo umount /home/wj/linux/nfs/ubuntu_rootfs/dev

最后给权限:

bash 复制代码
sudo chmod 777 mount.sh unmount.sh

一切准备就绪以后执行 mount.sh 脚本,将制作的根文件系统挂载到主机下,输入如下命

令:

bash 复制代码
./mount.sh

6.安装常用的命令和软件

bash 复制代码
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

7.设置 root 用户密码

账号和密码都设置成root

bash 复制代码
passwd root


8.设置本机名称和 IP 地址

c 复制代码
echo "wj_imx6ul" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "127.0.0.1 wj_imx6ul" >> /etc/hosts


9.设置串口终端

bash 复制代码
ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttymxc0.service 

10.退出挂载

bash 复制代码
exit
./unmount.sh


11.nfs 挂载测试

bash 复制代码
setenv bootargs 'console=tty1 console=ttymxc0,115200 root=/dev/nfs rw nfsroot=192.168.104.168:/home/wj/linux/nfs/ubuntu_rootfs ip=192.168.104.90:192.168.104.168:192.168.104.1:255.255.255.0::eth0:off'

saveenv

reset
相关推荐
Trouvaille ~1 天前
【Linux】库制作与原理(三):动态链接与加载机制
linux·c语言·汇编·got·动静态库·动态链接·plt
写代码的橘子n1 天前
IPV6复习(基础入手版)
运维·服务器·网络
APIshop1 天前
高性能采集方案:淘宝商品 API 的并发调用与数据实时处理
linux·网络·算法
ICT技术最前线1 天前
H3C双WAN口策略路由配置技术教程
运维·网络·h3c·策略路由
一分半心动1 天前
windows docker desktop 安装VibeVoice
运维·docker·容器
松涛和鸣1 天前
DAY38 TCP Network Programming
linux·网络·数据库·网络协议·tcp/ip·算法
川211 天前
ZooKeeper配置+失误
linux·分布式·zookeeper
向日葵.1 天前
中间件交接文档
linux·运维·服务器
LucidX1 天前
Docker核心操作实战
运维·docker·容器
隔壁阿布都1 天前
Docker Compose中的网络管理
运维·docker·容器