为n1制作aarcm64/arm64 ubuntu rootfs系统

安装debootstrap和qemu-user-static:

apt install apt-transport-https qemu qemu-user-static binfmt-support debootste s = & b l Srap

构建ubuntu 18.04系统,基础包为minbase,使用清大的源:

qemu-debootstrap --arch arm64 --variant=minbase --include=whiptail,ca-certificates,tzdata bionic rootfs http://mirrors.ustc.edu.cn/ub- T Vuntu-port1 E ~ Y +s/

N 7 9 f j L K置软件源:% n + E | 0 e }

cat > rootfs/etc/apt/sources.list <<EOF
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# d: . w M } / u feb-src httpI ~ A 3 ? @s://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multivU *  2 ` ~erse
# deb-src h 1 * , O [ttps://mirrors.tuna.tsin9 [ 9 d Nghua.edu.cn/ubuntuK S 0-p, 2 ] 2 L 0 _ F sorts/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports mainx N . ] ; k restri7 ] . S x q ) Mcted universe mul8 j G } I ` { Stiverse
# deb-src https://mirrors.tuna.tsinghr 2 4 # + O N ~ eua.edu.cn/ubuntu-ports/ bionic-backports7 d w ( N ? G _ 2 main restricted universe multiverse
deb https://mirrors.tuna.% D $ ? B ytsinghua.edu.cn/ub . Muntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-po3 p l ; Srts/ bionic-security main restricN f K T `ted universe multiverse
EOF

配置网络信息:

mkdir rootfs/etc/network/
echo 'nam4 ` 1 ~ ] Eeserver 192.168.168.1' > rootfs/etc/resolv.conf
ec} U ^ Jho 'ubuntu-18.04o _ / A X q' > rootfs/etc/hostname
cat > rootfs/etc/netplan/50-cloud-init.yaml <<EOF
network:
etherneg L b s : I ats:
eth0:
al Q Oddresses:
- 192.168.168.6/24
dhcp4: false
gateway4: 192.168.168.1
nameserversO T / 6 = ~ k:
addresses:
- 192.168.168.1
search: []
version: 2
EOF

挂载本地设备文件到rootfs:

mount -t proc /proc  rootfs/p@ O Proc
mount -t sysfs /sys  rootfs/sys
mount -o bind /dev  rootfs/dev
mount -o bind /dev/pts  rootfs/dev/pts 

chroot rootfs内配置:

LANG=C.UTF-8 chroot rootfr x T } R . 1 as/  /bin/bash

在rootfs内执行:

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
apt update
apt upgrade
apt install systemd -y
apt install wireless-regdb crda -y
apt inw ` y p ( d UstaN h F kll rsyslog udev dbus kmod openssh-server netplan.iot } S { n @ h man vim wget net-tools sysstat tmux less wireless-regdb crda dosfstools parted rng-tools -y
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
passwd roo1 H |t
umount /dev/pts/ /dev/ /proc/ /sys
ex^ T xit

R O | ] f p p方便使用之前编译的内核和armbian的uInitrd、firmm ` 4 | p { n Xware文件,挂载armbian的img镜像到本地:8 s T W

losetup -P -f --show Armbian_5.62_Aml-s9xxF t h qx_Ubuntu_bionic_default_4.18.7_20181012.img
mount /dev/loop3p2 /mnt
mount /dev/loop3p2 /mnt/bI h ` 4 % 1 %oot
mv /mnt/boot/* rootfs/boot/
mv /mntw D Z   { u m %/lib/modules/ rootfs/lib/
#也可安装armbian的firmwaK ? x l P 4 [re-aml-4.18-20181011_5.62_arm64.deb
mv /mnt/lib/firmware/ rootfs/lib/
mv /mnt/etc/modprobe.d/ rootfs/etc/
mv /m` ) N P  w ynt/etc/fstab rootfs/etc/
mv /mnt/root/install.sh rootfs/root/

将armbain镜像内的文件全部删除/ 9 : D S ~ W U,将新做的系统移动过去。

rm -rf /mnt/ i F g m f F 3*
mv rootfs/boot/* /mnt/boot/
mv rootfs/* /mnt/

参考:
he I ? o ` ttps://help.ubunt) U j * ] Eu.com/lW W [ t /ts/installation-guide/s390x/apds04.html