【imx6ul 学习笔记】移植ubuntu 20.04系统

文章目录

上一篇:【imx6ul 学习笔记】Docker 运行百问网 imx6ul_qemu

前置准备

复制代码
cd ubuntu-18.04_imx6ul_qemu_system/

备份原文件:先把 imx6ull-system-image/rootfs.img 重命名备份

bash 复制代码
sudo apt update
sudo apt install -y debootstrap qemu-user-static binfmt-support

制作 Ubuntu 20.04 ARM 根文件系统

在主机 Linux 执行

创建工作目录

随便找个地方

bash 复制代码
mkdir ubuntu_imx6ull && cd ubuntu_imx6ull

下载 Ubuntu20.04 armhf 最小系统

bash 复制代码
# --arch=armhf 适配 i.MX6ULL,focal=Ubuntu20.04
sudo debootstrap --arch=armhf --foreign focal ubuntu_rootfs http://ports.ubuntu.com/ubuntu-ports/

拷贝 qemu 模拟器

让 x86 主机能运行 ARM 程序

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

进入 ARM 环境完成系统配置

bash 复制代码
sudo chroot ubuntu_rootfs /bin/bash

进入后命令行变成

bash 复制代码
groups: cannot find name for group ID 0
I have no name!@xxx:/# 

配置系统

系统初始化

在 chroot 后的 ARM Ubuntu 终端 执行以下命令:

bash 复制代码
/debootstrap/debootstrap --second-stage

设置 root 密码

bash 复制代码
passwd root
# 输入两次密码

开启串口登录

i.MX6ULL QEMU 用 ttymxc0 串口

bash 复制代码
# 1. 创建串口登录服务软链接 让系统开机自动启动 ttymxc0 串口
ln -s /lib/systemd/system/serial-getty@.service /etc/systemd/system/getty.target.wants/serial-getty@ttymxc0.service

# 2. 允许 root 用户通过串口 ttymxc0 登录
echo "ttymxc0" >> /etc/securetty

配置软件源

bash 复制代码
cat > /etc/apt/sources.list << EOF
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
EOF

安装基础工具

按需安装

bash 复制代码
apt update
apt install -y net-tools iputils-ping vim ssh

退出 chroot 环境

bash 复制代码
exit

打包成 QEMU 能用的 rootfs.img

打包成 raw 格式 ext4 镜像

创建 4G 空镜像文件

bash 复制代码
sudo dd if=/dev/zero of=rootfs.img bs=1G count=4

格式化为 ext4

bash 复制代码
sudo mkfs.ext4 rootfs.img

挂载镜像拷贝系统

bash 复制代码
# 创建挂载目录
sudo mkdir mnt
# 挂载镜像
sudo mount -o loop rootfs.img mnt
# 拷贝所有 Ubuntu 文件
sudo cp -rp ubuntu_rootfs/* mnt/
# 卸载镜像
sudo umount mnt

替换镜像并运行

把刚做好的 rootfs.img复制到 imx6ull-system-image/ 覆盖原文件

使用原有的启动脚本

bash 复制代码
./qemu-imx6ull-gui.sh


相关推荐
LinXunFeng5 天前
Obsidian - 使用 Share Note 分享笔记并自部署
前端·笔记·github
通信小呆呆10 天前
当算法有了“五感”:多模态数据融合如何向人体感官协同学习?
人工智能·学习·算法·机器学习·机器人
H__Rick10 天前
自动对焦学习-3
人工智能·学习·计算机视觉
Daisy Lee10 天前
量化学习-第1章-什么是量化金融
学习·金融·datawhale
Alsn8610 天前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker
YM52e10 天前
买菜计算器小应用 - HarmonyOS ArkUI 开发实战-PC版本
学习·华为·harmonyos·鸿蒙·鸿蒙系统
小雨下雨的雨10 天前
HarmonyOS ArkUI训练营入门-组件掌握系列-Animation 动画效果实现-PC版本
学习·华为·harmonyos·鸿蒙
闪闪发亮的小星星10 天前
高斯光以及高斯光公式解释
笔记
cqbzcsq10 天前
CellFlow虚拟细胞论文阅读
论文阅读·人工智能·笔记·学习·生物信息
YangYang9YangYan10 天前
2026初入职场学习数据分析的价值
学习·数据挖掘·数据分析