Skip to content

Repository files navigation

RG35HAXX Custom Linux Builder

Minimal Linux build and flashing workflow for Anbernic RG35XX H-class devices based on the Allwinner H700 platform.

This repo is intentionally Linux-first. The supported entrypoint is:

sudo ./run_ubuntu.sh

run_ubuntu.sh normalizes line endings, marks scripts executable, and delegates to build.sh.

Hardware target

Primary target: Anbernic RG35XX H.

Known hardware context:

  • SoC: Allwinner H700.
  • CPU: quad-core ARM Cortex-A53, up to 1.5 GHz.
  • GPU: Mali-G31 MP2 class GPU.
  • RAM: 1 GB.
  • Display: 3.5 inch IPS, 640x480.
  • Stock OS family: Linux 64-bit.
  • Connectivity: WiFi, Bluetooth, HDMI out, USB-C power/data.

The kernel DTS for sun50i-h700-anbernic-rg35xx-h exists in upstream Linux. Other H700 handhelds use related but different DTBs.

What this builds

  • ARM64 Linux kernel from the configured stable branch.
  • RG35XX H / related H700 DTB variants.
  • BusyBox userspace.
  • Minimal root filesystem.
  • Android-style boot image with RG35XX H page size handling.
  • Kernel modules copied into the target root filesystem.

What this tool can do

  • Install/check required build and flashing dependencies.
  • Build Linux kernel, DTBs and kernel modules.
  • Apply config_patch to the kernel config.
  • Build BusyBox with busybox_config_patch.
  • Create a minimal root filesystem.
  • Create boot images in catdt and with-dt packaging modes.
  • Enforce/verify RG35XX H boot image page size, default 2048.
  • Back up GPT, boot partition and rootfs/modules before flashing.
  • Flash boot and root filesystem partitions.
  • Try DTB/package combinations with dtb_fallback.sh.
  • Inspect target media and boot image metadata with sd_diagnostics.sh.
  • Restore backup artifacts with restore_backups.sh.

What this tool does not do

  • It does not build or replace U-Boot/bootloader firmware.
  • It does not provide a complete gaming firmware distribution.
  • It does not guarantee that every hardware feature works on every H700 board revision.
  • It does not auto-detect unknown partition layouts safely; always verify with lsblk.
  • It does not apply a changed DTB when using --skip-build; DTB changes require a rebuild/repackage.

Repository layout

.
├── run_ubuntu.sh              # Main Ubuntu launcher
├── build.sh                   # Main modular build/flash orchestrator
├── install_dependencies.sh    # Dependency installer/checker
├── dtb_fallback.sh            # Try DTB and boot packaging combinations
├── backup_sd.sh               # Explicit SD/eMMC backup helper
├── restore_backups.sh         # Restore latest backup set
├── sd_diagnostics.sh          # Inspect target media and boot image
├── config_patch               # Kernel config fragment
├── busybox_config_patch       # BusyBox config fragment
├── builders/                  # Kernel, BusyBox, rootfs, bootargs builders
├── config/                    # Shared constants
├── flash/                     # Flashing implementation
└── lib/                       # Shared shell libraries

Requirements

  • Ubuntu or Debian-like Linux environment.
  • Root access for mounting, formatting and flashing.
  • ARM64 cross compiler: aarch64-linux-gnu-*.
  • Build tools: git, make, gcc, dtc, rsync, cpio, gzip.
  • Boot image tools: preferably mkbootimg and abootimg.
  • Disk tools: lsblk, sgdisk, parted, dd, mkfs.ext4.

Install/check dependencies:

sudo ./install_dependencies.sh install
sudo ./install_dependencies.sh check

Main workflow

Full build with SD/eMMC detection, backup and flashing:

sudo ./run_ubuntu.sh

Build without requiring target media at startup:

sudo ./run_ubuntu.sh --skip-sd-check

Flash existing build outputs:

sudo ./run_ubuntu.sh --skip-build

Force a clean rebuild:

sudo ./run_ubuntu.sh --force-build

Fast flash without backup:

sudo ./run_ubuntu.sh --skip-build --skip-backup

Build options

--skip-build          Skip kernel build and flash existing outputs.
--force-build         Rebuild even if outputs already exist.
--skip-sd-check       Do not require target media before build.
--skip-backup         Skip pre-flash backups.
--dtb=N               Select DTB variant: 0, 1 or 2.
--package=MODE        Boot image packaging mode: catdt or with-dt.
--cmdline=STR         Override kernel command line.
--no-force-cmdline    Do not force CONFIG_CMDLINE.
--pagesize=N          Override boot image page size. Default is 2048.
--full-verify         Compute full SHA256 of boot partition after flashing.

Examples:

sudo ./run_ubuntu.sh --dtb=1 --package=with-dt
sudo ./run_ubuntu.sh --cmdline="console=tty0 loglevel=7" --no-force-cmdline
sudo ./run_ubuntu.sh --full-verify

Build outputs

Generated files are written under build/:

build/Image              Raw ARM64 kernel image
build/dtb                Selected DTB copy
build/dtb.img            DTB used for with-dt packaging
build/dtb-all.img        Concatenated H700 DTB bundle, if available
build/dtbs/              Available H700 DTBs copied from the kernel tree
build/zImage-dtb         Kernel image concatenated with selected DTB
build/boot-catdt.img     Boot image using concatenated kernel+DTB
build/boot-with-dt.img   Boot image using separate --dt DTB
build/boot-new.img       Final boot image selected for flashing
build/rootfs.tar.gz      Minimal root filesystem archive
build/modules.tar.gz     Kernel modules archive

If you use --skip-build, these outputs must already exist.

DTB variants

--dtb=N selects the DTB used while packaging the boot image.

0    sun50i-h700-anbernic-rg35xx-h.dtb
1    sun50i-h700-anbernic-rg35xx-h-rev6-panel.dtb
2    sun50i-h700-rg40xx-h.dtb

Use 0 first for RG35XX H. If the display is black, garbled, or the device boot loops around display init, try 1. Use 2 only for RG40XX H or deliberate cross-device testing.

DTB and boot packaging fallback

If the device reaches a splash screen, boot loops, or the display stays black, try the fallback helper:

sudo ./dtb_fallback.sh

It cycles the supported DTB indexes and packaging modes. Each attempt forces a rebuild because DTB selection affects boot image creation.

  • catdt: kernel image concatenated with DTB.
  • with-dt: DTB passed separately to boot image tooling.

Common manual attempts:

sudo ./run_ubuntu.sh --dtb=1
sudo ./run_ubuntu.sh --package=with-dt
sudo ./run_ubuntu.sh --dtb=1 --package=with-dt

Target partitions

The main flasher auto-detects target media by partition labels:

boot      boot partition
rootfs    root filesystem partition

Typical internal RG35XX H eMMC layouts also use:

p4    Android boot partition
p5    Linux/rootfs partition

backup_sd.sh and sd_diagnostics.sh use p4/p5 when you pass --device=/dev/.... They support both /dev/sdc4 style devices and /dev/mmcblk0p4 / /dev/nvme0n1p4 style devices.

Inspect media before flashing:

sudo ./sd_diagnostics.sh
sudo ./sd_diagnostics.sh --device=/dev/sdc

Backups and recovery

The main flash flow creates backups unless --skip-backup is used.

Create an explicit backup:

sudo ./backup_sd.sh
sudo ./backup_sd.sh --device=/dev/sdc

Restore the latest backup set:

sudo ./restore_backups.sh

Manual restore commands are printed by the backup/restore helpers. Review device paths carefully before writing with dd.

Boot image notes

RG35XX H boot images normally require page size 2048. The build flow creates and verifies boot images through lib/bootimg.sh.

Useful flags:

sudo ./run_ubuntu.sh --pagesize=2048
sudo ./run_ubuntu.sh --full-verify

If boot image tooling is missing, install dependencies first:

sudo ./install_dependencies.sh install

Configuration

Kernel options live in:

config_patch

BusyBox overrides live in:

busybox_config_patch

Edit those files before running the build if you need different kernel features or BusyBox applets.

Known limitations

  • Mainline DTB support for H700 devices is evolving; stock firmware DTBs may differ.
  • Rev6-panel devices may need the rev6 DTB.
  • RG40XX H is related H700 hardware but not the same handheld as RG35XX H.
  • Full rebuilds are expected when changing DTB, packaging mode, kernel cmdline or page size.
  • --skip-backup is faster but removes the easiest recovery path.

References

  • Anbernic RG35XX H product/spec page: https://anbernic.com/products/rg35xx-h
  • Upstream Linux RG35XX H DTS: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-h.dts
  • ROCKNIX H700 DTB mapping: https://rocknix.org/configure/h700-installation/

Safety

This project writes directly to block devices. Before flashing:

  • Confirm the target disk with lsblk.
  • Keep backups unless you are intentionally doing a fast flash.
  • Avoid running destructive operations against your host OS disk.
  • Prefer --skip-sd-check only when you are building artifacts without attached target media.

If the current version breaks

If a newer repo state stops working, you can go back to a previous commit:

git log --oneline
git checkout <commit-sha>

Use this only after saving or committing your own local changes. To return to the main branch later:

git switch main

License

No repository-level license is currently declared. Check upstream components for their own licenses.

About

Custom Linux kernel builder for RG35XX_H handheld with WiFi, Bluetooth, USB gadgets. Automated build system with progress bars and resume capabilities.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages