Cole Smith
January 22, 2022
This document will walk you through installing Arch Linux ARM on the DevTerm A06. At the time of writing, only Armbian is supported on the DevTerm.
We will create a root file system based on the rock64 architecture (rk3328). This will include patching our bootloader and kernel with the patches provided by ClockworkPi.
This guide assumes you are already using Arch Linux. Some package names or procedures may differ depending on your distribution.
We will start by creating an ARM chroot environment to build our root filesystem using this guide.
- Install the required packages
$ yay -S binfmt-qemu-static and qemu-user-static base-devel arch-install-scripts
# systemctl restart systemd-binfmt.service
- Verify that an
aarch64
executable exists in
$ ls /proc/sys/fs/binfmt_misc
- Download the base root FS to use. We will use the
aarch64
tarball from Arch Linux ARM
$ wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
- Create the mount point and extract the files as root (not via sudo)
$ mkdir root
$ sudo su
# bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C root
# mount --bind root root
- Chroot into the newly created environment
# arch-chroot root
- Inside the chroot, populate and init the pacman keyring
# pacman-key --init
# pacman-key --populate archlinuxarm
- Finally, update the packages
# pacman -Syu
We will start with lightly configuring our system before compiling the packges.
For this section, all commands will be run inside the chroot.
- Install some useful tools
# pacman -S git vim wget ranger sudo
- Set the Locale by editing
/etc/locale.gen
and uncommenting your required locales. - Run
# locale-gen
- We can avoid working with the root account by granting
alarm
, the default Arch Linux ARM user,sudo
privileges.
# EDITOR=/usr/bin/vim visudo
- And add the corresponding line for
alarm
after the one forroot
alarm ALL=(ALL) ALL
- Switch to the
alarm
user
# su alarm
$ cd
NOTE: The default password for the alarm user is alarm
We are now ready to compile versions of U-Boot and the Linux kernel that are compatible with the DevTerm. We will do this inside the chroot environment.
The Manjaro community has done a great job in porting both U-Boot and the Linux kernel to the DevTerm using AUR
packages. In the following sections, we will use their PKGBUILD
s.
For this section, all commands will be run inside the chroot.
U-Boot depends on the arm-none-eabi-gcc
executable to be built, and since this program is not available in the Arch
Linux ARM repositories, we will download it directly from
ARM's website.
- Download the binaries
$ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-arm-none-eabi.tar.xz
- Extract the binaries to another directory
$ mkdir gcc
$ tar -xJf gcc-arm-10.3-2021.07-aarch64-arm-none-eabi.tar.xz -C gcc
- Add the toolchain to your
PATH
$ cd gcc/gcc-arm-10.3-2021.07-aarch64-arm-none-eabi.tar.xz
$ export PATH=$PATH:$(pwd)
$ cd
- Download the git repository
$ git clone https://gitlab.manjaro.org/manjaro-arm/packages/core/linux-clockworkpi-a06.git
- Build the package. This can take a long time!! Especially since we are emulating an
aarch64
architecture. The package build toolmakepkg
, supports a flag calledMAKEFLAGS
. Below, we will appendMAKEFLAGS="-j$(nproc)"
to themakepkg
command to instruct the compiler to use one worker for each core.
$ cd linux-clockworkpi-a06
$ MAKEFLAGS="-j$(nproc)" makepkg -si
$ cd
- Download the git repository
$ git clone https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-clockworkpi-a06.git
- Build the package
$ cd uboot-clockworkpi-a06
$ MAKEFLAGS="-j$(nproc)" makepkg -si
$ cd
- Rebuild the initramfs (just in case)
# mkinitcpio -p linux-clockworkpi-a06
- Exit
alarm
$ exit
- Exit
root
# exit
# umonut root
We are now ready to package up the root filesystem into a compressed tarball.
# cd root
# tar cpJf ../arch-linux-devterm-a06-root-fs.tar.xz .
# cd ..
Change ownership of the tarball and exit the root
account
# chown <user>:<user> arch-linux-devterm-a06-root-fs.tar.xz
# exit
You now have a root filesystem tarball to bootstrap the SD card!
We will now put our prepared filesystem onto the SD card. We will follow Arch Linux ARM's guide for the rock64, but use our tarball in place of theirs.
- Zero the beginning of the SD card
# dd if=/dev/zero of=/dev/sdX bs=1M count=32
- Start fdisk to partition the SD card
# fdisk /dev/sdX
-
Inside fdisk,
- Type o. This will clear out any partitions on the drive
- Type p to list partitions. There should be no partitions left
- Type n, then p for primary, 1 for the first partition on the drive, 32768 for the first sector
- Press ENTER to accept the default last sector
- Write the partition table and exit by typing w
-
Create the ext4 filesystem without a Journal
# mkfs.ext4 -O ^has_journal /dev/sdX1
- Label the filesystem the following, since that is what the bootloader expects
# tune2fs -L ROOT_MNJRO /dev/sdX1
- Mount the filesystem
# mount /dev/sdX1 /mnt
- Install the root filesystem (as root not via sudo)
# sudo su
# bsdtar -xpf arch-linux-devterm-a06-root-fs.tar.xz -C /mnt
# exit
- Install the bootloader to the SD card
# cd /mnt/boot
# dd if=idbloader.img of=/dev/sdX seek=64 conv=notrunc,fsync
# dd if=u-boot.itb of=/dev/sdX seek=16384 conv=notrunc,fsync
- Unmount and eject the SD card
# cd
# umount /mnt
# eject /dev/sdX
The SD card is now ready to be booted by the DevTerm! Good luck!