How lcdyk0517/arkos4clone works
1. Repository purpose
- This is a build-and-customization repository for (d)ArkOS 4.4 kernel support on unsupported RK3326 handheld devices.
- The repo does not contain a single runtime application; it assembles a bootable SD-card image by combining a base ArkOS/dArkOS image with device-specific kernels, DTBs, firmware, modules, and launcher/game-emulator replacements.
2. Top-level build pipeline
- The main entry points are shell scripts such as build_image.sh, build_update_tar.sh, build_dtb_selector.sh, mount_arkos.sh, and grow_p2_plus.sh.
- These scripts orchestrate image unpacking/repacking, partition mounting, file replacement, DTB selection, and optional resize/update packaging.
- The build outputs are image artifacts like (d)ArkOS4Clone.img.xz, intended for flashing to SD cards.
3. Device selection and board-specific configuration
- The consoles/ directory is the primary device configuration catalog.
- Each device folder typically contains a boot.ini and one or more .dtb files, mapping that device to a specific display panel, touch/input layout, audio setup, and board variant.
- This is the key hardware-compatibility boundary: selecting the wrong DTB changes how the kernel sees the board.
4. Kernel boundary
- consoles/kernel/original/Image and consoles/kernel/arkos4clone_fix/Image provide alternative kernel images.
- The README states the user chooses between Original battery driver and arkos4clone_fix battery driver, so kernel selection is a user-facing compatibility switch rather than an internal build-time detail.
- The kernel itself is paired with the device DTB and is the core hardware abstraction layer.
5. Binary firmware and module payload
- replace_file/firmware/ contains a large firmware bundle for Wi-Fi, Bluetooth, GPU, audio, and assorted peripherals.
- replace_file/modules/4.4.189/ contains the kernel module tree and module metadata for the shipped 4.4.189 kernel.
- These assets are copied into the image to make the kernel usable on the targeted handheld hardware without relying on the host system’s package manager.
6. System overlay / replacement layer
- replace_file/ is the main overlay directory used during image construction.
- It contains replacement binaries, scripts, configs, emulator frontends, and system files that overwrite the base ArkOS/dArkOS contents.
- This is where most of the functional customization lives: launcher configs, emulator patches, device scripts, service files, and bundled tools.
7. Launcher, emulator, and frontend customization
- The repo ships customized packages or patched builds for tools such as emulationstation, retroarch, retrorun, ppsspp, scummvm, onscripter, flycast, gametank, pymo, and drastic.
- Many of these are placed under replace_file/<component>/ alongside patches or wrapper scripts, showing that the project modifies upstream emulator behavior to fit handheld controls, orientations, and device-specific quirks.
- mod_so/ contains modified libretro .info definitions and patches, indicating frontend/core metadata customization rather than emulator source changes alone.
8. Device-specific shell scripts and runtime helpers
- Root-level *.sh launchers and helper scripts in replace_file/ and sh/ are used to switch modes, expand storage, remap ports, and launch per-system workflows.
- Jason3_Scripte/ and bin/ contain additional helper utilities for Bluetooth, Wi‑Fi toggling, hotkey handling, LED control, ZRAM setup, and console detection.
- These helpers bridge the hardware layer and the UI/launcher layer, turning raw device inputs into user-facing features.
9. DTB selector toolchain
- dtb_selector.go is the source for the cross-platform dtb_selector utility, with built binaries checked in for Linux, macOS, and Windows.
- The README describes it as the main post-flash configuration tool: it copies the chosen boot.ini, DTB, logo bitmap, and kernel image into the SD card’s boot partition.
- This tool is the user-visible control point for selecting the correct hardware profile after flashing the image.
10. Boot branding and display variants
- consoles/logo/ and consoles/logo-darkos/ store resolution-specific boot logos as logo.bmp.
- The build process uses these assets to match the device’s screen resolution and rotation, so boot branding is part of the hardware compatibility layer, not just cosmetic content.
11. Packaging of platform support assets
- uboot/ contains bootloader-related binaries and flashing support files (idbloader.img, trust.img, uboot.img), indicating the repo also carries low-level boot assets for some device workflows.
- res/ and resources/ contain UI/localization assets and metadata, supporting the themed launcher environment and multi-language presentation.
12. CI/CD and release delivery
- GitHub Actions workflows in .github/workflows/ automate image builds, release publishing, and update-only builds.
- The repository’s delivery model is therefore: source overlays and binaries in Git, reproducible image assembly in CI, then published releases for end users to flash.
13. Overall data flow
- The architectural flow is: choose a base ArkOS/dArkOS image → overlay repo files via build scripts → inject kernel/modules/firmware/device configs → package and compress the final SD image → flash it to a device → run dtb_selector to finalize the board-specific DTB/kernel/logo selection.
- The important boundary is between the generic base OS and the per-device replacement set; almost everything in the repo exists to cross that boundary safely.
Main entry points: build_image.sh Build image · replace_file Overlay root · dtb_selector.go DTB selector · workflows GitHub Actions
Components 21
Build & package
Scripts and automation that assemble flashable images and update archives.
- Build image · Main image assembly entry point that repacks and customizes the SD-card image.
build_image.sh - Update tar · Builds update-only package artifacts for existing installs.
build_update_tar.sh - DTB selector build · Compiles the post-flash hardware profile selector utility.
build_dtb_selector.sh - Mount image · Mounts ArkOS partitions for overlay and inspection.
mount_arkos.sh - Grow partition · Expands the second partition for larger storage use.
grow_p2_plus.sh - DTB selector · Cross-platform utility that copies the selected boot.ini, DTB, logo, and kernel into the boot partition.
dtb_selector.go
Hardware profiles
Device-specific boot configuration, kernels, logos, and DTBs.
- Console configs · Per-device boot.ini and DTB selections that define the hardware compatibility boundary.
consoles - Original kernel · Default 4.4 kernel image with the original battery driver.
consoles/kernel/original/Image - Fix kernel · Alternate 4.4 kernel image with the arkos4clone_fix battery driver.
consoles/kernel/arkos4clone_fix/Image - Boot logos · Resolution-specific boot bitmaps used during startup.
consoles/logo - DarkOS logos · Alternate boot bitmaps for dArkOS-branded images.
consoles/logo-darkos
System overlay
Replacement files copied into the base ArkOS/dArkOS image.
- Overlay root · Primary replacement layer that overwrites the base OS contents.
replace_file - Helper scripts · Shell helpers for mode switching, device detection, hotkeys, and console workflows.
replace_file/tools
Launchers & emulators
Customized frontends, emulators, and per-system wrappers.
- Emulator builds · Customized packages for emulationstation, retroarch, retrorun, ppsspp, scummvm, flycast, drastic, and others.
replace_file/ppsspp - Drastic KK · Patched DraStic variant with device-specific resources, hotkeys, and rotation fixes.
replace_file/drastic-kk - Core metadata · Modified libretro .info definitions and patches for frontend/core compatibility.
mod_so
Support assets
Low-level firmware, modules, and bootloader payloads.
- Device binaries · Bundled helpers for Bluetooth, Wi‑Fi, LED, ZRAM, input mapping, and hardware services.
bin - Firmware bundle · Large firmware payload copied into the image for wireless, GPU, audio, and peripherals.
replace_file/firmware - Kernel modules · Shipped kernel module tree and metadata for the bundled kernel.
replace_file/modules/4.4.189 - U-Boot assets · Low-level bootloader images and flashing support files.
uboot
Release automation
GitHub Actions workflows for builds and publishing.
- GitHub Actions · Workflows that build images, create releases, and publish update-only artifacts.
.github/workflows
Connections 25
- Build image → Mount image: mounts · Prepares base image partitions before overlaying files.
- Build image → Overlay root: overlays · Copies customized files into the base OS image.
- Build image → Console configs: selects profile · Uses device folders as the hardware profile catalog.
- Build image → Original kernel: bundles · Can package the original kernel image.
- Build image → Fix kernel: bundles · Can package the battery-driver-fixed kernel image.
- Build image → Firmware bundle: injects · Adds firmware needed for wireless, audio, and GPU support.
- Build image → Kernel modules: injects · Adds the matching 4.4.189 kernel modules.
- Build image → U-Boot assets: includes · Carries bootloader assets for supported flashing workflows.
- Build image → Boot logos: brands · Places boot logos matching device resolution and rotation.
- Build image → DarkOS logos: brands · Uses dArkOS-specific boot logos when needed.
- Build image → Grow partition: resizes · Optionally expands the data partition during image preparation.
- Update tar → Overlay root: packages · Reuses overlay content for update-only deliverables.
- DTB selector build → DTB selector: compiles · Builds the selector tool from source.
- DTB selector → Console configs: applies profile · Copies the selected boot.ini and DTB for a specific device.
- DTB selector → Original kernel: writes kernel · Can install the chosen kernel image into boot media.
- DTB selector → Fix kernel: writes kernel · Can install the chosen fixed kernel image into boot media.
- DTB selector → Boot logos: writes logo · Installs the matching boot bitmap for the selected profile.
- Overlay root → Emulator builds: contains · Holds customized emulator and frontend payloads.
- Overlay root → Drastic KK: contains · Includes the DraStic-specific replacement bundle.
- Overlay root → Helper scripts: contains · Includes scripts used at runtime for device workflows.
- Overlay root → Device binaries: contains · Ships helper binaries and services for device features.
- Overlay root → Core metadata: references · Uses modified libretro metadata and patches.
- GitHub Actions → Build image: runs · Automates full image builds in CI.
- GitHub Actions → Update tar: runs · Automates update-only artifact generation.
- GitHub Actions → DTB selector build: publishes · Builds and releases the selector utility binaries.