【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
相关推荐
STDD3 分钟前
strace 和 perf:Linux 进程调试和性能分析深度指南
linux·运维·php
Rain50910 分钟前
05. mini-cc 工具系统:让 AI 拥有动手能力
linux·前端·人工智能·ubuntu·typescript·ai编程
都在酒里14 分钟前
Linux字符设备驱动开发(五):PWM调光——实现LED亮度控制与呼吸灯效果
linux·运维·驱动开发
YDS82921 分钟前
浅谈近期关于Docker部署产生的一些问题
运维·docker·容器
爱喝水的鱼丶24 分钟前
SAP-ABAP:变量、常量、结构与内表声明(10篇博客合集) 第六篇:ABAP 7.40+新特性:声明语法的简化写法与兼容注意事项
运维·服务器·开发语言·学习·算法·sap·abap
Hani_9733 分钟前
Code Coverage系列(三)gcov 是什么?做什么?两个参数?检测原理?gcno文件内容?gcda文件内容?
linux·代码覆盖率
青梅橘子皮36 分钟前
Linux---进程状态与优先级
linux·运维·服务器
H Journey1 小时前
Linux VIM介绍与常用命令
linux·运维·vim
invicinble1 小时前
设计模式(类的拓扑结构)(为什么会产生设计模式,以及什么是设计模式)
linux·服务器·设计模式
bukeyiwanshui1 小时前
20260526 综合实践:企业网站上云部署实践
运维·服务器