ARCH R

Build from source

Reproducible Docker build of both image variants

ArchR's build system is fully reproducible — make docker-RK3326 produces both image variants from a clean checkout, identical to the GitHub release. No hidden steps, no closed-source artifacts.


Requirements

  • Docker (recommended) or a native Linux build environment
  • ~40 GB free disk space (cached source + build trees)
  • ~8 GB RAM recommended (the kernel build is the spike)
  • A x86_64 host (cross-toolchain targets aarch64)

A native build takes ~2 h on a 12-core x86; Docker adds ~5 % overhead.


Quick build

git clone https://github.com/archr-linux/Arch-R.git
cd Arch-R

# First time only: build the Docker build environment
make docker-image-build

# Build both image variants for R36S
make docker-RK3326

Output in target/:

ArchR-R36S.aarch64-YYYYMMDD-original.img.gz
ArchR-R36S.aarch64-YYYYMMDD-clone.img.gz
*.sha256                                    # checksums for the flasher
ArchR-R36S.aarch64-YYYYMMDD.tar             # rootfs only (for re-imaging)

All commands

CommandWhat it does
make docker-RK3326Full Docker build, both variants
make RK3326Native build (toolchain on host)
make docker-image-build(Re)build the Docker build container
make cleanrm -rf build.* target
make distcleanclean + nuke source caches

For other devices: make docker-RK3588, make docker-S922X, etc. — see the per-device options under projects/ArchR/devices/.


Incremental rebuilds

The build system uses stamps in build.ArchR-RK3326.aarch64/.stamps/<package> to skip already-built packages. To force a rebuild of a specific package:

rm -rf build.ArchR-RK3326.aarch64/.stamps/<pkg>
make docker-RK3326

Common ones:

linux             kernel + DTS + modules
mali-bifrost      libmali kernel module
mesa              Mesa Panfrost
retroarch         RetroArch frontend + libretro frame
ppsspp-sa         PPSSPP standalone
flycast-sa        Flycast standalone
archr             scripts / configs / runemu.sh
emulators         es_systems.cfg generation

After a stamp removal, make docker-RK3326 rebuilds just that package and re-images.


Project layout

Arch-R/
├── packages/                       upstream LibreELEC-style package recipes
│   ├── compress/zlib/              (ArchR uses zlib-ng compat — see PKG_NAME)
│   ├── graphics/mesa/
│   ├── linux/
│   └── ...
├── projects/ArchR/
│   ├── devices/RK3326/             RK3326-specific patches, DTS, kernel config
│   │   ├── linux/                  kernel config + DTS overrides
│   │   ├── patches/linux/          per-version kernel patches
│   │   └── options                 device-level vars (BOOT_SIZE, ROOT_SIZE…)
│   ├── packages/                   ArchR-specific packages on top of upstream
│   │   ├── archr/                  scripts/runemu.sh, profile.d/, autostart/
│   │   ├── linux-drivers/mali-bifrost/   libmali kernel patch
│   │   ├── graphics/gpudriver/     panfrost ↔ libmali switch
│   │   ├── apps/portmaster/        PortMaster + scripts/start_portmaster.sh
│   │   ├── emulators/standalone/   PPSSPP/Flycast/melonDS/DraStic per-device cfg
│   │   └── ui/emulationstation/    ES patches
│   └── options                     project-level vars
├── distributions/ArchR/
│   ├── options                     distro-level vars (BOOT_SIZE=272, ROOT_SIZE=4608…)
│   └── config/
├── config/
│   ├── archr-dts/                  43 motherboard revisions × {original/clone/soysauce}
│   └── mipi-generator/             generator.sh + archr-dtbo.py (DTS → DTBO)
├── scripts/
│   ├── build                       per-package build driver
│   ├── extract                     tarball extract
│   ├── image                       wraps mkimage
│   └── mkimage                     partition layout, FAT32 BOOT, ext4 ROOT, ext4 STORAGE
├── tools/
│   ├── bench.sh                    on-device benchmark (PSI, freq, temp)
│   ├── audit-build.sh              on-device build audit
│   └── ...
└── docs/                           internal design docs / decision logs

Common edits

Tune a kernel option:

projects/ArchR/devices/RK3326/linux/linux.aarch64.conf

Then rm -rf build.ArchR-RK3326.aarch64/.stamps/linux && make docker-RK3326.

Tune CPU OPP / regulator:

projects/ArchR/devices/RK3326/patches/linux/000-rk3326-dts.patch
projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r3xs.dtsi

Add an emulator default:

projects/ArchR/packages/virtual/emulators/package.mk
projects/ArchR/packages/emulators/standalone/<emu-sa>/scripts/start_<emu>.sh

Edit the autostart trace path:

projects/ArchR/packages/sysutils/autostart/sources/autostart

Validating a build

tools/audit-build.sh runs on the device and verifies:

bash /flash/audit-build.sh

…that no kernel debug flags slipped through, that all libretro cores are stripped, that no sanitizer symbols leaked into binaries. Use it in CI.

tools/bench.sh collects PSI / freq / temp / vmstat / dmesg for a 60 s window:

bash /flash/bench.sh psp 60
# launch a PSP game in a separate terminal / TTY
# results land in /storage/bench-results/<timestamp>-psp/

On this page