Working with RK3326-based retro handheld consoles (R36S, R40XX, RG351 and clones) running ArkOS / dArkOS / ArkOS4Clone / ROCKNIX. Hardware identification, firmware selection and flashing, thermal and memory diagnostics, emulator configuration, SD card layout. Use when the task involves a retro handheld, ArkOS, .dtb files, ROM cards, or emulators on such a device.
2 stars
0 votes
0 copies
3 views
Added November 7, 2026
ai-agentsgoshellbashgitfrontendperformance
Works with
cli
Security analysis
B88/100
criticalAccesses sensitive system or user directories
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of rk3326-handheld?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/kislonfreak-rk3326-handheld)
---
name: rk3326-handheld
description: Working with RK3326-based retro handheld consoles (R36S, R40XX, RG351 and clones) running ArkOS / dArkOS / ArkOS4Clone / ROCKNIX. Hardware identification, firmware selection and flashing, thermal and memory diagnostics, emulator configuration, SD card layout. Use when the task involves a retro handheld, ArkOS, .dtb files, ROM cards, or emulators on such a device.
---
# RK3326 retro handhelds
Derived from a real repair session on an R40XX device. Every number and pitfall
below was verified by measurement, not assumed.
## First principle: identify before you change
These devices are undocumented clones. The product name tells you nothing about
what is inside — an R40XX and an Anbernic RG40XX H use entirely different SoCs
(RK3326 vs Allwinner H700), and firmware for one will brick the other.
**Never rely on the model name.**
Identification order:
1. `/sys/class/graphics/fb0/virtual_size` — the actual framebuffer resolution
2. `boot.ini` on the BOOT partition — which `.dtb` is loaded
3. Parse that `.dtb` — see `references/dtb-parser.ps1`
4. `uname -a`, `/etc/os-release`, `hostname`
Hostname is misleading: clone images are built on an RG351MP base and often keep
`hostname rg351mp` on completely different hardware.
## Pitfall number one: BOM and CRLF
Piping scripts from Windows to the console via `Get-Content | ssh` **prepends a BOM**,
which eats the first line of the script. Symptom: `bash: line 1: : command not found`,
and the first command silently never runs — no logical error, just a missing effect.
Workaround: write the script with `[System.Text.UTF8Encoding]::new($false)` **and**
start the content with a blank line or comment so the BOM lands somewhere harmless:
```powershell
[System.IO.File]::WriteAllText($f, "`n" + $body + "`n", [System.Text.UTF8Encoding]::new($false))
Get-Content $f -Raw | ssh -i $key ark@$ip "bash -s"
```
CRLF endings produce `bash: line N: $'\r': command not found` — noisy but usually
harmless, since they land at end of line.
Never put `<`, `>` or `|` directly in an `ssh` argument from PowerShell — the local
shell interprets them first. Always go through stdin.
## SSH access
- User `ark`, default password `ark`. **Do not handle the password** — install a key.
- ArkOS **does not persist remote services across reboots**. After every restart:
Options → Enable Remote Services.
- Services can also drop when a game launches (the system frees memory).
- `sudo` works without a password.
Key installation — a command **the user runs**, not the agent:
```
Get-Content key.pub | ssh ark@IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys"
```
## The device is fragile — size your commands accordingly
897 MB RAM, four Cortex-A35 cores. The SSH session loses the fight for memory and
drops without warning. **Do not run:**
- `find /` across the whole filesystem
- `grep -r` over directories in the tens of megabytes
- anything processing tens of thousands of files
Use specific paths, `head`, and counters instead. When a longer measurement is
needed, leave a detached logger on the console (`setsid nohup`) writing to a file
and read the result afterwards. Measuring through a link that the process under
test tears down itself cannot work.
## Diagnostics: what to look for
### Thermal
```
cat /sys/class/thermal/thermal_zone0/temp # millidegrees
cat /sys/class/thermal/thermal_zone0/trip_point_*_temp # trip points
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
```
Typical trip points: **70 / 85 / 115 °C**. Above the first one the SoC drops the
clock from 1296 to 1008 MHz. Idle temperature in the menu should be **below 70 °C**.
A monotonically rising curve at idle is a fault, not a hardware characteristic.
### Known bug: runaway `imageshift.sh`
Factory images on some clones ship `/home/ark/.config/imageshift.sh`, which picks a
random boot logo from `/boot/BMPs/`. If **that directory is missing or holds a single
file**, the loop `while [ "$image" = "$lastimage" ]` has no exit condition and spins
the CPU forever. Symptoms: a steady ~7.5% CPU, `load average` around 2 at idle,
temperature creeping toward 90 °C, dozens of zombie processes.
Reversible fix: `chmod -x` the script (back it up first). To restore: `chmod +x`.
### Memory
```
free -m; cat /proc/swaps; cat /sys/block/zram0/disksize
```
Some images include the zram module but leave `disksize = 0` — meaning **no swap at all**.
To enable persistently: a systemd unit running `echo 536870912 > /sys/block/zram0/disksize`,
`mkswap /dev/zram0`, `swapon -p 100 /dev/zram0`.
### Processes
```
ps -eo pcpu,pmem,time,comm --sort=-pcpu | head
ps -eo stat | grep -c "^Z"
```
EmulationStation can occupy 40%+ of RAM with a heavy theme and leak child processes
(zombies). Zombies cost neither CPU nor RAM — do not panic over them.
## Settings that actually pay off
RetroArch, `/home/ark/.config/retroarch/retroarch.cfg`:
| Key | Should be | Why |
|---|---|---|
| `video_shader_enable` | `false` | Shaders are invisible on this screen and cost frames |
| `video_scale_integer` | `true` | Sharper image, cheaper scaling |
| `video_smooth` | `false` | No bilinear filtering |
| `video_threaded` | `true` | Usually already set |
**Check `config_save_on_exit`.** If `true`, RetroArch overwrites the file on exit
and your edit is lost.
EmulationStation, `/home/ark/.emulationstation/es_settings.cfg`:
- `ScreenSaverBehavior` → `dim` instead of `random video`
- `ThemeSet` — a 5 MB theme can save ~245 MB of RAM versus an 89 MB one, but a theme
without per-system directories looks broken. Check `ls -d /roms/themes/X/*/ | wc -l`
before recommending the switch.
**ES writes `es_settings.cfg` on exit.** Editing the file while the frontend is
running must be followed by an ES restart, or the change is reverted.
PPSSPP (`~/.config/ppsspp/PSP/SYSTEM/ppsspp.ini`): `InternalResolution = 1`.
Often already correct — verify before proposing a change.
Governor: when temperature is above the first trip point, **do not set `performance`** —
it deepens throttling instead of helping. Remove the heat source first.
## Firmware
| Project | Repository | Notes |
|---|---|---|
| ArkOS | `christianhaitian/arkos` | The base, Ubuntu 19.10 (EOL) |
| dArkOS | `christianhaitian/dArkOS` | Debian, `apt`, heavier |
| **ArkOS4Clone** | `lcdyk0517/arkos4clone` | **Prebuilt images + `dtb_selector` for clones** |
| dArkOS4Clone | `xunicatt/darkos4clone` | Requires building it yourself on Linux |
| ROCKNIX | `ROCKNIX/distribution` | Newer kernel, images target 640×480 panels |
**For clones, start with `lcdyk0517/arkos4clone`** — it ships prebuilt images as
multi-part `.img.xz.7z.00N` archives and a `dtb_selector` tool covering over a
hundred devices. ROCKNIX and stock ArkOS images assume 640×480; on a 1024×768 panel
they produce a black screen unless the correct `.dtb` is transplanted.
After flashing: run `dtb_selector`, pick brand and model, decline overclocking.
Then **verify** that `boot.ini` in the BOOT root loads the expected `.dtb`, and parse
that file to confirm the resolution.
## Flashing an image on Windows
**Raw disk writes from PowerShell do not work** — `UnauthorizedAccessException`
persists even after `Clear-Disk`, taking the disk offline, and opening the stream
with exclusive access. Do not try further variants; Windows blocks this at a level
PowerShell cannot reach.
Use **Rufus** (`pbatard/rufus`, portable build ~2 MB, DD Image mode), Raspberry Pi
Imager, or balenaEtcher. Verify the downloaded binary's digital signature.
Before writing, **confirm the disk number with the user**. Guards worth scripting:
`BusType -eq 'USB'`, size within an expected range, `-not IsSystem`, and the presence
of both `BOOT` and `EASYROMS` labels.
## Card layout — check before you erase
Some devices use a **single card** with three partitions:
```
part1 ~110 MB BOOT FAT32 ← boot.ini, Image, uInitrd, *.dtb
part2 ~10 GB (system) ext4 ← invisible to Windows
part3 remainder EASYROMS exFAT ← /roms
```
Others use two separate cards. **Always verify with `Get-Partition -DiskNumber N`
before any destructive operation** — assuming that system and games live on separate
media can be false, and the mistake costs the entire collection.
After a fresh install `/roms` may be small; first boot runs `expandtoexfat.sh` and
grows it into the remaining space. Do not interrupt it.
## ROM structure
Directories under `/roms` (exFAT, visible from Windows). Format notes:
- Arcade (`mame2003`, `cps1/2/3`, `neogeo`) — `.zip` **romsets, never unpack them**;
the romset version must match the core (MAME 2003-Plus → 0.78)
- N64 — `.n64`/`.z64`/`.v64` **without archives**; standalone `mupen64plus` cannot read zip
- Disc-based (PS1, Dreamcast, Saturn, Sega CD) — prefer `.chd`; a `.cue` needs all
its `.bin` files alongside
- Everything else — native extension or `.zip`
Files named `.hi`, `.nv`, `.fs` inside arcade directories are hiscore and NVRAM saves,
**not games** — filter them out when counting, or you will overstate the library by
thousands of entries.
Converting `.cdi` (Dreamcast) to CHD: **`chdman` does not support that format** and
hangs at 0%. The required path is `.cdi` → `.gdi` → `.chd` using separate tools.
Do not promise space savings before checking the actual file extensions.
## Boundaries
**Do not download ROMs or BIOS files.** They are copyrighted material. Firmware ships
only freely redistributable components (EmuTOS, freej2me, ScummVM). The user supplies
their own dumps — then help place and verify them, since emulators are picky about
exact filenames and sizes.
What needs **no** BIOS: NES, SNES, Mega Drive, GBA, GB/GBC, N64, CPS.
PS1 runs on HLE in PCSX ReARMed. Strictly required for: Dreamcast, Saturn, Neo Geo,
PSP, Amiga, NDS.
## Performance in context
Cortex-A35 is an efficiency core, weaker than A53. The ceiling: Dreamcast and PSP
hit-or-miss, N64 with frame drops, everything up to and including PS1 smooth.
**PS2, GameCube and newer are physically out of reach** — there is no `ps2` directory
and one cannot be added. The presence of a PS2 BIOS in a `bios` pack changes nothing.
A 1024×768 panel is 2.5× the pixels of a typical 640×480. Irrelevant for 2D games —
that is a single blit. For 3D emulators that derive internal render resolution from
the output size (PPSSPP, N64) the difference is real, and that is where the actual
knob lives — not in the `.dtb`.
**Never change resolutions in the `.dtb`** — those values describe the physical panel
for the MIPI-DSI driver, they are not a quality setting. Writing a smaller value
produces a garbled display, not higher framerates.