buildR64arch, info for all supported boards Ubuntu & ArchLinuxARM

Info for buildR64arch, all editions. This post may be corrected amended at any time.

https://github.com/ericwoud/buildR64arch

Currently supported boards: R64, R3, R3mini, R4.

Supported OS: ArchLinux-ARM and Ubuntu

The entire image is build around packages. All custom packages have .deb and .pkg.tar.xz versions for Ubuntu and Archlinux. The major difference (specially on headless systems) between Archlinux and Debian is the package manager. Other differences are really small. This makes the images for ArchLinux-ARM and Ubuntu almost identical. Because library versions can differ, all custom executables are build statically with musl, not depending on any library.

  • bpirXX-atf-git package contains ATF binairies, command needed for writing. Customized all-in-one (bl2 + bl31), booting U-Boot or linux from fip- or fat32-boot partition.
  • bpirXX-uboot-git package contains U-Boot binairies, command needed for writing. Customized to boot from extlinux conf or boot.scr.
  • linux-bpirXX-git package contains kernel, automatically written when upgrading. Multiple linux kernel packages can be installed.
  • hostapd-launch: helper for hostapd.conf, adding interface specifying bridge vlan id. Also implements bash substitution inside the .conf file.
  • ssh-fix-reboot: shutdown ssh session quickly at reboot

The entire system has had a major overhaul, so some bugs may need to be ironed out.

Prebuild images:

https://ftp.woudstra.mywire.org/images/

UARTboot images:

https://ftp.woudstra.mywire.org/uartboot/

Prebuild Nand images (still need to test, easier to use bpir-toolbox from sd-card instead):

https://ftp.woudstra.mywire.org/nandimages/

Command available from build-host as ./build.sh or from board as bpir-build in linux and initramfs. It is mostly menu driven.

Usage: build.sh [OPTION]...
  -F --format              format sd/emmc or image-file
  -l --loopdev             use image-file instead of sd-card
  -r --rootfs              setup rootfs on image
  -c --chroot              enter chroot on image
  -b --backup              backup rootfs
  -B --restore             restore rootfs
  -x --createxz            create bpir.img.xz
  -z --creategz            create bpir.img.gz
  -p --boot2fip            setup fip-partition bootchain (sd/emmc)
  -P --fip2boot            setup boot-partition (fat32) bootchain (sd/emmc)
  -p --creategz            create bpir.img.gz
  -u --uartboot            create uartboot image
  -d --cachedir            store packages in cachedir
  -R --clearrootfs         empty rootfs
  --imagefile [FILENAME]   image file name, default bpir.img
  --imagesize [FILESIZE]   image file size in Mib, default 7456
  --atfend [ATFEND]        sd/emmc: atf partition end in KiB, default 1024
  --fipsize [FIPSIZE]      sd/emmc: fip/boot-part size (mod erasesize) in MiB, default 190
  --rootend [ROOTEND]      sd/emmc: root partition end in MiB or %, default 100%
  --erasesize [SIZE]       sd/emmc: erasesize in MiB, default 4
  --bpirtoolbox [ARGS]     arguments for bpir-toolbox
  --brlanip [default|IP]   ip for brlan
  --ddrsize [default|8]    ddr size in GB
  --setup [AP|RT|...]      setup for network
  --target [bpir64|bpir3|bpir3m|bpir4]   specify target
  --atfdevice [sdmmc|emmc|nvme|sata]     specify device

Start with --format to format a sdcard/image. Use --loopdev to create an image instead of using a sd-card directly. Use --cachedir when trying multiple times, but not downloading packages multiple times.

After building use --chroot (with --loopdev) to enter the image and do some more setting up manually.

Custom commands available from board in linux and initramfs (and uartboot):

Usage: bpir-toolbox [OPTION]...
  --default-bootcfg        Restore default bootcfg, adds --write2fip
  --fip2boot               Convert fip partition to boot partition bootchain (sd/emmc)
  --boot2fip               Convert boot partition to fip partition bootchain (sd/emmc)
  --download2root          Download files needed for nand-image (when started from initrd)
  --nand-force-erase       Force erase nand, including bad blocks and wear history
  --nand-format            Format the nand, also runs update
  --nand-image             Create nand image, also runs update
  --nand-update            Updates all files on nand, only writes when needed
  --write2dtb              Combine dtbos with dtb and create one dtb file
  --write2atf              Write arm-trusted-firmware
  --write2fip              Create all files needed for fip and write it, adds --write2dtb
  --write2extlinux         Create a new /boot/extlinux/extlinux.conf
  --uboot-install          Copies U-Boot to /boot/u-boot.bin (writes to fip if necessary),
                             also creates /boot/extlinux/extlinux.conf if not present
  --uboot-remove           Removes /boot/u-boot.bin
  --uartboot               Create a uartboot image
  --pkgbase ...            Specify linuxpkg to create files for
  --set-atf-linuxpkg       Set linuxpkg atf will directly boot, specified in pkgbase
  --remove-dtb             Remove dtb file
Usage: bpir-rootfs [OPTION]...
  -b --bpirtoolbox [ARGS]                 specify arguments for bpir-toolbox
  -i --brlanip [IP]                       specify ip for brlan
  -d --ddrsize [default|8]                specify ddr size
  -s --setup [AP|RT|...]                  specify setup for network
  -t --target [bpir64|bpir3|bpir3m|bpir4] specify target
  -a --atfdevice [sdmmc|emmc|nvme|sata]   specify device
  -S --disable-sandbox     disable pacman sandbox download
  -m --menuonly            menu only
  -c --configonly          setup the rootfs only

bpir-rootfs is menu-driven, arguments can be used instead.

Usage: bpir-initrd [OPTION]...
  -p --preset [PRESET]       specify preset
  -P --allpresets            build all presets
  -m --modulesonly           build only when image holds modules [to be implemented]

All other linux commands available, including fiptool.

Commands available from board in initramfs (and uartboot):

bpir-dhcpc <interface>
bpir-synctime
bpir-build
bpir-toolbox
reboot
bash, debootstrap, nano, parted, etc

Building your own version of ATF, U-Boot or linux-kernel:

Basically all custom ATF, U-Boot or linux-kernel packages are build on Archlinux (aarch64 or x86_64). It can be done on a archlinux-chroot if preferred. Use https://github.com/tokland/arch-bootstrap to setup an archlinux chroot on a debian system.

After running makepkg, run makedeb to create the .deb (and possibly update a repo). See: makedeb

Support to install linux-image.deb created with other tool when running on Ubuntu is also implemented, but hardly tested (also supporting to extract Image from .itb from the package).