目录
背景:
步骤:
1、安装工具
2、创建安装系统用的目录
3、开始制作系统
4、制作系统第二阶段还需要qemu工具,将其拷贝到ubuntu-rootfs目录中
5、进行第二阶段的系统制作,主要是一些基本软件包的解压和安装
6、切换目录到新系统中
问题:执行上述命令时报错:qemu: Unsupported syscall: 403
7、新系统的一些设置和所需软件安装:
8、退出ubuntu20根文件系统
9、制作文件系统镜像文件
(1)新建 ext4 格式磁盘并格式化
(2)挂载磁盘并拷贝根文件系统
在ubuntu 18 64位虚拟机中制作ubuntu20的arm系统
sudo apt-get install binfmt-support qemu qemu-user-static debootstrap
mkdir ubuntu-rootfs
sudo debootstrap --arch=armhf --foreign focal ubuntu-rootfs/ https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/
#--arch:指定要制作文件系统的处理器体系结构,比如 armhf、arm64
#focal:指定 ubuntu 的版本。focal 是 ubuntu 20.04 系统,xenial表示16.04版本,bionic是指Ubuntu 18.04 LTS
#--foreign: 只执行引导的初始解包阶段,仅仅下载和解压
#https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/: 清华大学开源 ubuntu 镜像源地址
cp /usr/bin/qemu-aarch64-static /usr/bin/qemu-arm-static ubuntu-rootfs/usr/bin/
sudo chroot ubuntu-rootfs/ debootstrap/debootstrap --second-stage
chroot ubuntu-rootfs/
原因是制作的系统版本是20,而当前虚机是18,18上的qemu工具在20上使用会因为版本低而报上述出错。
次错误可以忽略,不影响后续操作。
#修改root密码
passwd root
#添加用户
adduser username
#设置编码类型
locale-gen zh_CN.UTF-8
#安装网络工具
apt update
apt install net-tools
apt install network-manager
apt install openssh-server
#安装其他常用软件
apt-get install -y psmisc
apt-get install ethtool
apt-get install tzdata
apt-get install busybox
sudo apt-get install isc-dhcp-server
直接执行exit
当前目录:/root/
dd if=/dev/zero of=ubuntu20_arm.img bs=1M count=2048 #创建一个空镜像文件
mkfs.ext4 ubuntu20_arm.img #格式化该镜像文件
mkdir /mnt/ubuntu20_arm/
mount ubuntu20_arm.img /mnt/ubuntu20_arm/
ls /mnt/ubuntu20_arm/
cp ubuntu-rootfs/* /mnt/ubuntu20_arm/
ls /mnt/ubuntu20_arm/
umount /mnt/ubuntu20_arm
我使用nfs挂载根文件系统,故此步忽略。
nfs挂载时将bootargs对应的挂载路径修改为/root/ubuntu-rootfs即可。
参考博客:https://blog.csdn.net/weixin_40837318/article/details/123688236
https://www.icxbk.com/article/detail/2622.html