单片机技术网|技术阅读
登录|注册

您现在的位置是:单片机技术网 > 技术阅读 > 移植 ubuntu core 16.04(ubuntu-base)到i.MX6ULL开发板

移植 ubuntu core 16.04(ubuntu-base)到i.MX6ULL开发板

一、准备工作

1. 安装 qemu

sudo apt-get install qemu-user-static

2. 下载 ubuntu-core 32 位版本

ubuntu cdimg[1] 下载,选择 ubuntu-base-16.04.6-base-armhf.tar.gz

axel http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.6-base-armhf.tar.gz

解压:

mkdir temp
sudo tar -xpf ubuntu-base-16.04.6-base-armhf.tar.gz -C temp

二、修改根文件系统

1. 准备工作

(1)准备网络:

sudo cp -b /etc/resolv.conf temp/etc/resolv.conf

(2)准备 qemu

sudo cp /usr/bin/qemu-arm-static temp/usr/bin/

(3)换源

这里需要更换为 ubuntu ARM 源 Ubuntu Ports(中国科学技术大学源[2])。

sudo vim temp/etc/apt/source.list

在 vim 的命令模式完成替换:

:%s/ports.ubuntu.com/mirrors.ustc.edu.cn

保存退出后,添加一个 apt 配置文件:

sudo vim temp/etc/apt/apt.conf.d/99self

在其中编写如下内容:

Acquire::http::Pipeline-Depth "0";

2. 挂载根文件系统到主机

切换根文件系统:

sudo chroot temp

3. 更新及安装

(1)更新

apt update
apt-get update

(2)安装一些必备的软件包

apt-get install sudo
apt-get install vim

开启 ssh 服务:

apt-get install openssh-server

net-tools 提供了 ifconfig 命令等网络工具:

apt-get install net-tools

kmod 提供了一组操作 Linux kernel module 的工具,常用的 insmod,modprobe 等命令本质上调用的都是 kmod 命令:

apt-get install kmod

ethtool 用于查看和修改网络设备(以太网)的驱动参数和硬件设置,可以根据需要更改以太网卡的参数,包括自动协商、速度、双工和局域网唤醒等参数。

apt-get install ethtool

ubuntu 本身支持 linux 的网络底层设置命令:ifconfig,route,ip 等命令,但为了让网络设置更加简单,Debian 提供了一个标准的高级网络设置工具,包含 ifup 和 ifdown 程序和 /etc/network/interfaces 文件。

apt-get install ifupdown

htop 是 top 的升级版,允许用户监视系统上运行的进程及其完整的命令行。

apt-get install htop

iputils 软件包是 Linux 环境下一些实用的网络工具的集合,包括 ping、tftpd 等。

apt-get install iputils-ping

4. 添加用户及设置密码

添加用户:

useradd -s '/bin/bash' -m -G adm,sudo mculover666

设置密码:

passwd mculover666

给 root 用户设置密码:

passwd

5. 设置串口终端

ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttymxc0.service

6. 退出

根文件系统修改完成,退出。

exit

三、制作根文件系统

(1)查看根文件系统的大小

sudo du -h -d 0 temp/

(2)生成压缩包

cd temp
sudo tar -jcf rootfs.tar.bz2 *

压缩完的包 110M:将该包烧录到 imx6ull 开发板的 eMMC 中,烧录方法参考:i.MX6ULL 系统移植 | 使用 NXP MfgTool 烧写系统到 eMMC[3]。

烧录完成后,ubuntu 系统启动如下:

四、ssh 登录

.bashrc中将 shell 颜色打开:

force_color_prompt=yes

设置网卡 ip:

sudo ifconfig eth0 192.168.1.102

修改主机名:

sudo hostname imx6ull

ssh 远程登录:

参考资料

[1]

ubuntu cdimg: http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/

[2]

中国科学技术大学源: https://mirrors.ustc.edu.cn/help/ubuntu-ports.html

[3]

i.MX6ULL 系统移植 | 使用 NXP MfgTool 烧写系统到 eMMC: https://mculover666.blog.csdn.net/article/details/123410363