The title says it, this is all about installing ArchLinuxARM on Le Potato, a Single Board Computer by Libre Computer. Well… what can I say. I’ve got ArchLinux booting, but I’m not happy with the results yet. The thing is, I wanted to build my own U-Boot and create a package of it, and that’s the part still failing…

So, for what I’ve got now, I’ve downloaded an image of theirs (A Debian image), and replaced the partitions with my own. That way, I’ve got their U-boot build, booting the kernel I provided. It boots, so that’s fine. However… I want to be able to create an U-Boot build of my own, and be able to install it as a package. No luck with that.

First, I guess, I’ll note down the steps to create a bootable TF (aka micro SD) card for the thing. I have the bootloader fail using a 2 GB TF card, but with two different 8 GB cards these instructions create a bootable card.

Requirements: wget, uboot-tools

Create a file boot.txt with the following contant:

setenv fdtfile amlogic/meson-gxl-s905x-libretech-cc.dtb 
setenv distro_bootpart 2
setenv devtype mmc

test -n "${distro_bootpart}" || setenv distro_bootpart 1
part uuid ${devtype} ${devnum}:${distro_bootpart} uuid
setenv bootargs "console=ttyAML0,115200n8 root=PARTUUID=${uuid} rw rootwait earlycon"

if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /boot/Image; then
  if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
    if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
      booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
    else
      booti ${kernel_addr_r} - ${fdt_addr_r};
    fi;
  fi;
fi
mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr
wget http://share.loverpi.com/board/libre-computer-project/libre-computer-board-aml-s905x-cc/image/debian/libre-computer-aml-s905x-cc-debian-stretch-headless-4.19.55%2B-2019-06-24.zip
unzip libre-computer-aml-s905x-cc-debian-stretch-headless-4.19.55%2B-2019-06-24.zip
wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
su
dd if=libre-computer-aml-s905x-cc-debian-stretch-headless-4.19.55+-2019-06-24.img of=/dev/mmcblk0 bs=1M count=2
fdisk /dev/mmcblk0

Type “o” to create a new MSDOS partition table
Type “n” to create a new partiton
Type “p” for primary
Type “1” for number 1
Press “Enter” for the default start
Type “+100M” for a 100 MiB partition size
— If you are prompted to delete a signature, say yes
Type “t” to change the type
Type “C” to set the type to FAT32
Type “n” to create a new parition
Press “Enter” a couple of times to accept the defaults
— If you are prompted to delete a signature, say yes
Type “w” to write the changes

mkfs.fat /dev/mmcblk0p1
mkfs.ext4 -O ^metadata_csum,^64bit /dev/mmcblk0p2
mkdir /tmp/boot
mkdir /tmp/root
mount /dev/mmcblk0p1 /tmp/boot
mount /dev/mmcblk0p2 /tmp/root
bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /tmp/root
cp boot.* /tmp/boot
umount /tmp/root
umount /tmp/boot
sync
exit

Connect a USB-TTL-UART to the TTL pins (next to the UART connector) and open it using for example PuTTY at 115200 bps
Apply power to the board using the micro USB connector.

The board should boot into ArchLinuxARM.


Now… although this works… I still wish to be able to build my own u-boot.
Since this board is Amlogic based, I’d figure I’d start at an Amlogic board already supported, the Odroid C2.
I have not succeeded in this. I will write about my attempts another time.