/arch-linux-star64

Create a disk image for the Star64

Primary LanguageShell

Create an image of Arch Linux to write onto a SD flash card or eMMC flash chip for the Star64 SBC. Try to do that using software that is typically available and keeping the product as close to upstream as possible. U-Boot is built for Starfive's VisionFive 2 board and the device tree is also for the VisionFive 2. The Star64 is not 100% compatible. The device tree could be updated and the kernel needs patching!

Run make to create an image file and use dd, Etcher, or so to install it. Supplying a block device as as DEV_OR_IMG (e.g. make "DEV_OR_IMG=/dev/mmcblkX") will cause the image to be written directly to the block device. This allows the root partition to use all available space, the amount of writes is reduced to a minimum because gaps don't have to be filled, and it's quicker.

requirements

  • util-linux
  • subuid/subgid entries for the user running make
    • only the first one is used
    • range needs to be big enough to hold all files from the base file system
    • 1000 should be enough but best be generous if possible (e.g. 10000) because tar doesn't stop (it only warns)
  • qemu-riscv64-static and the respective binfmt rules (to allow running riscv64 programs in the chroot)
  • enough RAM to hold the rootfs
  • riscv64-linux-gnu-gcc

overview

  • U-Boot SPL with OpenSBI
  • U-Boot payload (reads extlinux.conf)
  • extlinux.conf generated by (packaged) libalpm hook
  • Felix Yan's Arch Linux port for RISC-V (https://archriscv.felixc.at/)

customization

The filesystem can be altered by adding customization scripts in rootfs-hook.d/. Nothing stops you from calling sh from there and doing stuff interactively. Remember to add the executable bit.

.env.rootfs-customization can be used to pass environment variables to the hooks. The pre-existing scripts use these:

EDITOR
IMG_HOSTNAME
ROOT_PW
NO_ROOT_PW
ROOT_SSH_KEY
INSTALL_OPENSSH
KEEP_SSH_KBD_PW

other ideas

  • method to install tow-boot or EDK2 XSPI NOR
    • makes this repo obsolete
  • boot using EFI