瑞芯微Rockchip开发者社区
登录
直播中
张静
7年用户
1479经验值
私信
关注
[问答]
如何制作rk3399 arm64 ubuntu18.04 根文件系统?
开启该帖子的消息推送
RK3399
如何制作rk3399 arm64 ubuntu18.04 根文件系统?
回帖
(1)
庞书娟
2022-3-7 10:48:22
1、下载ARM64根文件系统 ubuntu-base-18.04.5-base-arm64.tar.gz
http://cdimage.ubuntu.com/ubuntu-base/releases/18.04/release/
2、制作根文件系统
安装qeum模拟器
sudo apt-get install qemu-user-static
解压文件
mkdir rootfs
tar -xvf ubuntu-base-18.04.5-base-arm64.tar.gz -C rootfs/
拷贝模拟器到文件系统
sudo cp /usr/bin/qemu-aarch64-static rootfs/usr/bin/
拷贝域名解析文件到根文件系统,为连网做准备
sudo cp -b /etc/resolv.conf rootfs/etc/resolv.conf
切换到到根文件系统进行操作
添加一个挂载的脚本
#!/bin/bash
function mnt() {
echo "MOUNTING"
sudo mount -t proc /proc ${2}/proc
sudo mount -t sysfs /sys ${2}/sys
sudo mount -o bind /dev ${2}/dev
sudo chroot ${2}
}
function umnt() {
echo "UNMOUNTING"
sudo umount ${2}/proc
sudo umount ${2}/sys
sudo umount ${2}/dev
}
if [ "$1" == "-m" ] && [ -n "$2" ] ;
then
mnt $1 $2
elif [ "$1" == "-u" ] && [ -n "$2" ];
then
umnt $1 $2
else
echo ""
echo "Either 1'st, 2'nd or both parameters were missing"
echo ""
echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
echo "2'nd parameter is the full path of rootfs directory(with trailing '/')"
echo ""
echo "For example: ch-mount -m /media/sdcard/"
echo ""
echo 1st parameter : ${1}
echo 2nd parameter : ${2}
fi
执行命令,将工作目录切换到rootfs中
sudo bash rootfs-mount.sh -m rootfs
根新下载源为华为源,这样下载速度比较快,打开/etc/apt/source.list,修改内容如下
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-backports main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-proposed main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-security main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-updates main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-backports main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-proposed main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-security main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-updates main multiverse restricted universe
apt-get update
下载所需要的软件
apt-get install language-pack-en-base sudo ssh net-tools ethtool wireless-tools ifupdown network-manager iputils-ping rsyslog bash-completion htop --no-install-recommends
添加用户及设置密码
useradd -s '/bin/bash' -m -G adm,sudo ubuntu
给用户设置密码
passwd ubuntu
给root用户设置密码
passwd root
修改完自己的根文件系统就可以退出了
exit
制作根文件系统
dd if=/dev/zero of=linuxroot.img bs=1M count=1024
sudo mkfs.ext4 linuxroot.img
mkdir hyrootfs
sudo mount linuxroot.img hyrootfs/
sudo cp -rfp rootfs/* hyrootfs/
sudo umount hyrootfs/
e2fsck -p -f linuxroot.img
resize2fs -M linuxroot.img
这样 linuxroot.img 就是最终的根文件系统映像文件了。
1、下载ARM64根文件系统 ubuntu-base-18.04.5-base-arm64.tar.gz
http://cdimage.ubuntu.com/ubuntu-base/releases/18.04/release/
2、制作根文件系统
安装qeum模拟器
sudo apt-get install qemu-user-static
解压文件
mkdir rootfs
tar -xvf ubuntu-base-18.04.5-base-arm64.tar.gz -C rootfs/
拷贝模拟器到文件系统
sudo cp /usr/bin/qemu-aarch64-static rootfs/usr/bin/
拷贝域名解析文件到根文件系统,为连网做准备
sudo cp -b /etc/resolv.conf rootfs/etc/resolv.conf
切换到到根文件系统进行操作
添加一个挂载的脚本
#!/bin/bash
function mnt() {
echo "MOUNTING"
sudo mount -t proc /proc ${2}/proc
sudo mount -t sysfs /sys ${2}/sys
sudo mount -o bind /dev ${2}/dev
sudo chroot ${2}
}
function umnt() {
echo "UNMOUNTING"
sudo umount ${2}/proc
sudo umount ${2}/sys
sudo umount ${2}/dev
}
if [ "$1" == "-m" ] && [ -n "$2" ] ;
then
mnt $1 $2
elif [ "$1" == "-u" ] && [ -n "$2" ];
then
umnt $1 $2
else
echo ""
echo "Either 1'st, 2'nd or both parameters were missing"
echo ""
echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
echo "2'nd parameter is the full path of rootfs directory(with trailing '/')"
echo ""
echo "For example: ch-mount -m /media/sdcard/"
echo ""
echo 1st parameter : ${1}
echo 2nd parameter : ${2}
fi
执行命令,将工作目录切换到rootfs中
sudo bash rootfs-mount.sh -m rootfs
根新下载源为华为源,这样下载速度比较快,打开/etc/apt/source.list,修改内容如下
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-backports main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-proposed main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-security main multiverse restricted universe
deb
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-updates main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-backports main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-proposed main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-security main multiverse restricted universe
deb-src
http://mirrors.huaweicloud.com/ubuntu-ports/
bionic-updates main multiverse restricted universe
apt-get update
下载所需要的软件
apt-get install language-pack-en-base sudo ssh net-tools ethtool wireless-tools ifupdown network-manager iputils-ping rsyslog bash-completion htop --no-install-recommends
添加用户及设置密码
useradd -s '/bin/bash' -m -G adm,sudo ubuntu
给用户设置密码
passwd ubuntu
给root用户设置密码
passwd root
修改完自己的根文件系统就可以退出了
exit
制作根文件系统
dd if=/dev/zero of=linuxroot.img bs=1M count=1024
sudo mkfs.ext4 linuxroot.img
mkdir hyrootfs
sudo mount linuxroot.img hyrootfs/
sudo cp -rfp rootfs/* hyrootfs/
sudo umount hyrootfs/
e2fsck -p -f linuxroot.img
resize2fs -M linuxroot.img
这样 linuxroot.img 就是最终的根文件系统映像文件了。
举报
更多回帖
rotate(-90deg);
回复
相关问答
RK3399
怎样在
RK3399
核心板上安装
ubuntu18.04
系统
呢
2022-03-07
2337
怎样在
RK3399
去安装
Ubuntu18.04
系统
呢
2022-03-07
2042
如何对
RK3399
CPU
arm64
的内核进行配置
2022-02-16
1623
请问
RK3399
Ubuntu18.04
下是否含uac驱动?
2021-12-30
1338
如何在Firefly-
RK3399
上编译和移植Linux内核和
Ubuntu
16.04 rootfs?
2022-03-07
2643
RK3399
使用dd命令备份
根
文件系统
的操作步骤是怎样的?
2022-03-07
1404
如何完成ROC-
RK
3328-PC设备基于
Ubuntu18.04
完整环境镜像的
制作
呢
2022-03-09
1234
如何在
RK3399
这一
Arm64
平台上搭建Tengine AI推理框架呢
2022-03-04
1961
怎样在
RK3399
平台上去
制作
一种linux
系统
呢
2022-03-07
1307
怎样去解决
RK3399
pro
文件
会进入不了
Ubuntu
系统
的问题呢
2022-02-11
2211
发帖
登录/注册
20万+
工程师都在用,
免费
PCB检查工具
无需安装、支持浏览器和手机在线查看、实时共享
查看
点击登录
登录更多精彩功能!
英国威廉希尔公司网站
william hill官网 版块
小组
免费开发板试用
ebook
直播
搜索
登录
×
20
完善资料,
赚取积分