The Ten64 documentation highlights that ArchLinux as a guest requires “some assembly […]”. Does it run? - Traverse Ten64 Documentation For this matter, I layed out all the steps required to get one in place. Maybe that could be useful for you as well.
Prerequesites
Assumption: x86 host, but could be aarch64 as well
Packages:
- ArchLinux:
sudo pacman --noconfirm -S qemu-headless parted dosfstools
- Ubuntu:
sudo apt -y install qemu-utils parted dosfstools libarchive-tools
Steps
Create qcow2 image (16GB):
qemu-img create -f qcow2 ArchLinuxARM-aarch64-latest.qcow2 16G
Treat qcow2 image as a proper device:
modprobe nbd max_part=8
qemu-nbd --connect=/dev/nbd0 ArchLinuxARM-aarch64-latest.qcow2
Partition qcow2 image and create filesystem (512MB /boot, rest /):
parted /dev/nbd0 mktable gpt \
mkpart ESP fat32 1MiB 513MiB \
set 1 boot on \
mkpart primary ext4 513MiB 100% \
print
mkfs.vfat -F 32 -n "AARCH64_EFI" "/dev/nbd0p1"
mkfs.ext4 -m 1 "/dev/nbd0p2"
Mount filesystem:
mkdir ArchLinuxARM-aarch64-latest-sysroot
mount /dev/nbd0p2 ArchLinuxARM-aarch64-latest-sysroot
mkdir ArchLinuxARM-aarch64-latest-sysroot/boot
mount /dev/nbd0p1 ArchLinuxARM-aarch64-latest-sysroot/boot
Download ArchLinuxARM aarch64 latest, and install into filesystem:
curl -O http://de4.mirror.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C ArchLinuxARM-aarch64-latest-sysroot
sync
Setup fstab:
# on aarch64 host: genfstab -Up ArchLinuxARM-aarch64-latest-sysroot >> ArchLinuxARM-aarch64-latest-sysroot/etc/fstab
# on x86 host:
VDA_BOOT=$(blkid -s PARTUUID -o value /dev/nbd0p1)
VDA_ROOT=$(blkid -s PARTUUID -o value /dev/nbd0p2)
cat << EOF > ArchLinuxARM-aarch64-latest-sysroot/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
PARTUUID=${VDA_BOOT} /boot vfat rw,defaults 0 2
PARTUUID=${VDA_ROOT} / ext4 rw,relatime 0 1
EOF
Setup booloader systemd-boot:
# on aarch64 host: arch-chroot and then bootctl install, see Archlinux
# on x86 host hack:
mkdir -p ArchLinuxARM-aarch64-latest-sysroot/boot/EFI/systemd
cp ArchLinuxARM-aarch64-latest-sysroot/usr/lib/systemd/boot/efi/systemd-bootaa64.efi ArchLinuxARM-aarch64-latest-sysroot/boot/EFI/systemd/systemd-bootaa64.efi
mkdir -p ArchLinuxARM-aarch64-latest-sysroot/boot/EFI/BOOT
cp ArchLinuxARM-aarch64-latest-sysroot/usr/lib/systemd/boot/efi/systemd-bootaa64.efi ArchLinuxARM-aarch64-latest-sysroot/boot/EFI/BOOT/BOOTAA64.EFI
As this is a hack for now, run bootctl install
the first time the image boots.
Setup loader.conf, arch-efi.conf and arch-fallback-efi.conf for systemd-boot:
mkdir -p ArchLinuxARM-aarch64-latest-sysroot/boot/loader/entries
cat << EOF > ArchLinuxARM-aarch64-latest-sysroot/boot/loader/loader.conf
default arch-efi
timeout 0
editor no
console-mode max
auto-entries 0
auto-firmware 1
EOF
VDA_BOOT=$(blkid -s PARTUUID -o value /dev/nbd0p1)
VDA_ROOT=$(blkid -s PARTUUID -o value /dev/nbd0p2)
cat << EOF > ArchLinuxARM-aarch64-latest-sysroot/boot/loader/entries/arch-efi.conf
title Arch Linux (EFI)
linux /Image
initrd /initramfs-linux.img
options root=PARTUUID=${VDA_ROOT} rw quiet
EOF
cat << EOF > ArchLinuxARM-aarch64-latest-sysroot/boot/loader/entries/arch-fallback-efi.conf
title Arch Linux - Fallback (EFI)
linux /Image
initrd /initramfs-linux-fallback.img
options root=PARTUUID=${VDA_ROOT} rw
EOF
Optional: automatic update of system-boot (systemd-boot - ArchWiki):
cat << EOF > ArchLinuxARM-aarch64-latest-sysroot/usr/share/libalpm/hooks/95-systemd-boot.hook
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd
[Action]
Description = Updating systemd-boot
When = PostTransaction
Exec = /usr/bin/bootctl update
EOF
Optional: in case you want to load kernel and ramfs from external:
mkdir -p ArchLinuxARM-aarch64-latest-kernel
cp ArchLinuxARM-aarch64-latest-sysroot/boot/{Image,initramfs-linux.img} ArchLinuxARM-aarch64-latest-kernel/.
Cleanup:
umount ArchLinuxARM-aarch64-latest-sysroot/boot
umount ArchLinuxARM-aarch64-latest-sysroot
rmdir ArchLinuxARM-aarch64-latest-sysroot
qemu-nbd --disconnect /dev/nbd0
Optional: decrease image size
qemu-img convert -c -O qcow2 ArchLinuxARM-aarch64-latest.qcow2 ArchLinuxARM-aarch64-latest.c.qcow2
Transfer the qcow2 image onto the Ten64.
Get it up running (4 cores, 4 GB RAM), either:
muvirt-createvm ArchLinuxARM 4096 4 lan ABSOLUTE_PATH_TO_QCOW2_IMAGE.qcow2
or:
cat << EOF >> /etc/config/virt
option memory '4096'
option numprocs '4'
list disks 'ABSOLUTE_PATH_TO_QCOW2_IMAGE.qcow2'
# option kernel 'ABSOLUTE_PATH_TO_IMAGE' # optional
# option append 'root=/dev/vda2 rw' # optional
# option initrd 'ABSOLUTE_PATH_TO_RAMFS' # optional
list network 'lan'
option mac '52:ad:00:af:91:1d'
option enable '1'
option provisioned '1'
EOF
Start ArchLinux on Ten64 and check if running:
/etc/init.d/muvirt start ArchLinuxARM
/etc/init.d/muvirt status ArchLinuxARM # shows 'running'
Console:
muvirt-console ArchLinuxARM
Users/password:
root/root
alarm/alarm
When booting first time:
bootctl install # just to ensure systemd-boot is properly installed
pacman-key --init
pacman-key --populate archlinuxarm
Helpful tools:
pacman --noconfirm -S efibootmgr dosfstools vim htop
In case all of this is just too long:
Open ToDos:
- Build patched linux kernel with Traverse Ten64 patches
- Get DPAA2 working in the image
- Host qcow2-image somewhere for distribution (currently: github actions)