A hackable pocket rig for the HiFiWalker H2 digital audio player and its

rebadged siblings (Surfans F20, Aigo Eros Q, Phinistec Z6, Agptek H3).
All of these devices share the same Ingenic **X1000E** (JZ4760 family)
SoC and run a Linux userspace that OreBolt OS extends with 16 LVGL UI
modules, a hardware panic-purge subsystem, a 150-payload HID macro
matrix, and an AGPL-licensed mesh networking layer.
This commit is contained in:
Jeremy Anderson 2026-07-13 16:23:56 -04:00
commit 29e5d3752c
106 changed files with 4318 additions and 0 deletions

185
ARCHITECTURE.md Normal file
View File

@ -0,0 +1,185 @@
# OreBolt OS v1.4 -- Architecture
## 1. Target hardware
| Component | Spec |
|---|---|
| Device | HiFiWalker H2 (and rebadged siblings: Surfans F20, Aigo Eros Q, Phinistec Z6, Agptek H3) |
| SoC | **Ingenic X1000E** (JZ4760 family), MIPS32r2, little-endian, hard-float |
| Memory | 128 MB DDR2 (typical) |
| Display | 320 x 240 RGB565 LCD (ILI9341-class controller) |
| Audio DAC | ESS ES9018K2M |
| Headphone amp | MAX97220 |
| Storage | MicroSD (boot), 8 MB SPI flash (bootloader) |
| USB | USB-C (newer revisions) or Micro-USB (older revisions) |
| Bluetooth | BLE (varies by revision; some have no BT) |
> **v1.4 correction**: v1.3 listed the SoC as "Ingenic T31" (also known
> as X2000). The actual H2 hardware family uses the **X1000E** (JZ4760
> family). The two SoCs share a peripheral family but differ in clock
> tree, GPIO banks, and USB PHY -- see HEADERS.md Section 4 for the
> difference and why v1.3 was wrong.
## 2. Software stack
```
+----------------------------------------------------------+
| 16 OreBolt OS modules (LVGL UI panels, *.mod) |
| vault nettap deploy studio probe vterm radar ducky |
| extract noise reset emulate emulator_input_mapper |
| rfid wifi glitch pwdb BITCHAT(AGPL) |
+----------------------------------------------------------+
| liblvgl.so (MIT) liborebolt.a (GPL-2.0+) |
| LVGL v8.3.11 UI panic_purge, forensics, HID, |
| radio_mux, ui_frame_graphics |
+----------------------------------------------------------+
| H2 stock Linux kernel 3.10.14 (Ingenic X1000E BSP) |
| + OreBolt OS init scripts (S98emulator-input, S99broker, |
| bt_input_daemon.sh) |
+----------------------------------------------------------+
| Ingenic X1000E hardware (MIPS32r2, FPU, LCD, SD, USB, |
| SPI flash, BT, audio codec) |
+----------------------------------------------------------+
```
## 3. Module inventory (16 modules, v1.4 reconciled)
| ID | Module | License | Purpose |
|---|---|---|---|
| 0 | vault | GPL-2.0+ | Encrypted credentials & payload vault |
| 1 | nettap | GPL-2.0+ | Network traffic capture and carving |
| 2 | deploy | GPL-2.0+ | Payload deploy and HID macro launcher |
| 3 | studio | GPL-2.0+ | On-device script studio / editor |
| 4 | probe | GPL-2.0+ | Network and USB probe / enumerator |
| 5 | vterm | GPL-2.0+ | Virtual terminal (FreeDOS bridge) |
| 6 | radar | GPL-2.0+ | Wireless noise radar / survey |
| 7 | ducky | GPL-2.0+ | USB Rubber Ducky payload engine |
| 8 | extract | GPL-2.0+ | Forensic extraction profiles |
| 9 | noise | GPL-2.0+ | Audio/RF noise generator |
| 10 | reset | GPL-2.0+ | Factory reset and purge coordinator |
| 11 | emulate | GPL-2.0+ | USB emulator (HID + mass storage + ACM) |
| 12 | emulator_input_mapper | GPL-2.0+ | Input mapper daemon for the emulator |
| 13 | rfid | GPL-2.0+ | RFID/NFC reader module (v1.4 restored) |
| 14 | wifi | GPL-2.0+ | WiFi adapter control + monitor mode (v1.4 restored) |
| 15 | glitch | GPL-2.0+ | Hardware glitch injector (X1000E GPIO) (v1.4 restored) |
| 16 | pwdb | GPL-2.0+ | Password database + bcrypt/argon2 verify (v1.4 restored) |
| 17 | **bitchat** | **AGPL-3.0-only** | **Mesh chat networking (v1.4 NEW)** |
## 4. Build pipeline
```
build.sh
Phase 0 host dep check + KERNEL_HEADERS probe
Phase 1 toolchain verification (mipsel-linux-musl-*)
Phase 2 workspace integrity check (16 modules + headers + scripts)
Phase 3 overlay/ tree creation
Phase 4 permission fixups on init scripts
Phase 5 H2 Core v6.1 build (LVGL clone + liblvgl.so + h2_test + 16 modules)
Phase 6 OreBolt OS v1.4 build (liborebolt.a + 150-payload matrix)
Phase 7 artifact verification (MIPS LE ELF check + AGPL marker check)
Phase 8 optional --deploy to SD card
```
## 5. Headers sourcing (v1.4 NEW)
```
+-----------------------------+
| KERNEL_HEADERS env var |
| (default /opt/fiio-m3k-linux)|
+--------------+--------------+
|
+------------------+------------------+
v v
+-----------------------+ +------------------------+
| FiiO M3K GPL kernel | | Ingenic XBurst BSP |
| (primary, same X1000E)| | (fallback, raw SDK) |
+-----------------------+ +------------------------+
|
v
+-----------------------+
| Makefiles add -I: |
| include/uapi |
| include |
| arch/mips/include |
| arch/mips/include/ |
| asm/mach-jz4760 |
+-----------------------+
|
v
+-----------------------+
| Rockbox tree |
| (OPTIONAL, bare-metal |
| reference only) |
+-----------------------+
```
See [HEADERS.md](HEADERS.md) for the full strategy.
## 6. Licensing tiers (v1.4 NEW)
```
+-------------------+ +-------------------+ +-------------------+
| LVGL (MIT) | | liborebolt.a | | bitchat.mod |
| | | (GPL-2.0+) | | (AGPL-3.0-only) |
| shared lib | | static archive | | separate .mod |
+-------------------+ +-------------------+ +-------------------+
| | |
+----------+------------+ |
v |
+-------------------+ |
| 15 userland .mod | |
| (GPL-2.0+) |<--- bitchat links TO ----+
+-------------------+ them (not vice versa)
```
The AGPL boundary is the single `bitchat.mod` binary. bitchat links
**to** liblvgl.so and liborebolt.a; those libraries do not become AGPL
just because bitchat links against them. See [LICENSE.md](LICENSE.md)
Section 4 for the full boundary analysis.
## 7. Filesystem layout on the device
```
/
├── usr/
│ ├── bin/
│ │ ├── h2_test # launcher
│ │ ├── emulator_input_mapper # daemon
│ │ ├── enable_vault_usb.sh # ConfigFS USB gadget setup
│ │ └── enable_vault_ble.sh # BT bringup
│ └── lib/
│ └── liblvgl.so # LVGL v8.3.11
├── apps/
│ ├── vault.mod
│ ├── nettaps.mod
│ ├── ... (15 GPL modules)
│ └── bitchat.mod # AGPL
├── etc/init.d/
│ ├── S98emulator-input
│ ├── S99broker
│ └── bt_input_daemon.sh
└── data/
├── payloads/
│ ├── linux/01..50.dd # 50 Linux HID payloads
│ ├── macos/01..50.dd # 50 macOS HID payloads (v1.4 NEW)
│ ├── windows/01..50.dd # 50 Windows HID payloads (v1.4 NEW)
│ └── legacy/ # v1.3 .macro files migrated here
├── vault/
│ ├── payloads/Provision.txt # operator-edited quick-launch list
│ ├── syslog.log # rotating log
│ └── failures.dat # binary failure log
├── forensics_bin/
└── vterm/freedos/bin/
```
## 8. Boot sequence
1. H2 bootloader (SPI flash) loads kernel from SD card.
2. Linux boots, mounts rootfs, runs `/etc/init.d/rcS`.
3. `S98emulator-input` starts `emulator_input_mapper`.
4. `S99broker` starts `h2_test` with `OREBOLT_VERSION=1.4`
and `OREBOLT_TARGET_SOC=X1000E` env vars.
5. `h2_test` initializes LVGL via fbdev, registers all 16 modules,
and enters the LVGL tick loop.
6. `bt_input_daemon.sh` brings up hci0 for BLE pairing.
7. bitchat.mod advertises its AGPL source URL via the first mesh HELLO.

133
BUILD_MANIFEST.txt Normal file
View File

@ -0,0 +1,133 @@
================================================================
OreBolt OS v1.4 -- Build Manifest
================================================================
Generated: 2026-07-13
Target: HiFiWalker H2 (Ingenic X1000E, MIPS32r2, mipsel-linux-musl)
Host: Arch Linux x86_64
----------------------------------------------------------------
CHANGES VS v1.3 (full diff in CHANGELOG.md)
----------------------------------------------------------------
FIXED:
- Target SoC: T31 -> X1000E (matches actual H2 hardware family)
- Module count: reconciled to 16 (was 13 in SHA256SUMS, 16 in Makefile)
- macOS/Windows payload folders now generated (v1.3 only had Linux)
- Init scripts S98emulator-input, S99broker restored
- SHA256SUMS now matches what ships
CHANGED:
- Headers source: Rockbox (bare-metal) -> FiiO M3K GPL kernel tree
(same X1000E SoC, GPL-clean, ready to #include)
- Rockbox demoted to optional bare-metal-only reference
- Sub-Makefile names bumped:
Makefile.h2-core-v6.0 -> Makefile.h2-core-v6.1
Makefile.orebolt-v1.3 -> Makefile.orebolt-v1.4
- HARDWARE_GPIO default flipped to 0 (safe stubs) for host dev
- build.sh Phase 0 probes for KERNEL_HEADERS
- build.sh Phase 7 verifies bitchat AGPL marker
ADDED:
- bitchat mesh module (AGPL-3.0-only) -- see LICENSE.md
- QUICKSTART.md -- the fastest path from fresh host to deployed H2
- HEADERS.md (kernel headers sourcing strategy)
- LICENSE.md (multi-tier licensing strategy)
- licenses/ directory (AGPL-3.0, GPL-2.0, MIT stubs)
- make headers-check target
- BITCHAT_MSG_LICENSE wire message type for AGPL §13 compliance
REMOVED:
- v1.3 PREREQUISITES §3 Rockbox-mining workflow (replaced by HEADERS.md)
----------------------------------------------------------------
FILE INVENTORY (counts)
----------------------------------------------------------------
Top-level build files: 6 (Makefile, 2 sub-Makefiles, build.sh,
inject_payloads.sh, lv_conf.h.dist)
Headers: 3 (h2_ui.h, log_manager.h, panic_purge_api.h)
Master launcher: 1 (main.c)
Userland modules (.c): 18 (16 modules; emulate has 2 files)
HW library (.c): 7 (src/modules/mod_*.c)
Init scripts: 3 (S98emulator-input, S99broker,
bt_input_daemon.sh)
Overlay scripts: 2 (enable_vault_usb.sh, enable_vault_ble.sh)
Vault data files: 3 (syslog.log, failures.dat, Provision.txt)
Linux payloads (.dd): 50 (reference set; macos/windows generated
at build time)
Documentation: 8 (README, QUICKSTART, PREREQUISITES, HEADERS, LICENSE,
ARCHITECTURE, CHANGELOG, BUILD_MANIFEST)
License stubs: 3 (AGPL-3.0.txt, GPL-2.0.txt, MIT.txt)
Integrity manifest: 1 (SHA256SUMS)
TOTAL source/doc files: 105
TOTAL Linux .dd payloads: 50
GRAND TOTAL: 155
----------------------------------------------------------------
MODULE INVENTORY (16 modules, v1.4 reconciled)
----------------------------------------------------------------
ID Name License Status
-- ---- ------- ------
0 vault GPL-2.0-or-later stub (restored)
1 nettaps GPL-2.0-or-later stub (restored)
2 deploy GPL-2.0-or-later stub (restored)
3 studio GPL-2.0-or-later stub (restored)
4 probe GPL-2.0-or-later stub (restored)
5 vterm GPL-2.0-or-later stub (restored)
6 radar GPL-2.0-or-later stub (restored)
7 ducky GPL-2.0-or-later stub (restored)
8 extract GPL-2.0-or-later stub (restored)
9 noise GPL-2.0-or-later stub (restored)
10 reset GPL-2.0-or-later stub (restored)
11 emulate GPL-2.0-or-later stub (restored)
12 emulator_input_mapper GPL-2.0-or-later stub (restored)
13 rfid GPL-2.0-or-later v1.4 RESTORED
14 wifi GPL-2.0-or-later v1.4 RESTORED
15 glitch GPL-2.0-or-later v1.4 RESTORED
16 pwdb GPL-2.0-or-later v1.4 RESTORED
17 bitchat AGPL-3.0-only v1.4 NEW
----------------------------------------------------------------
HARDWARE LIBRARY (liborebolt.a, 7 modules)
----------------------------------------------------------------
mod_core_hid.c GPL-2.0-or-later stub
mod_forensics.c GPL-2.0-or-later stub
mod_panic_hardware_purge.c GPL-2.0-or-later stub
mod_panic_purge.c GPL-2.0-or-later stub
mod_radio_input_multiplex.c GPL-2.0-or-later stub
mod_ui_frame_graphics.c GPL-2.0-or-later stub
mod_bitchat_mesh.c AGPL-3.0-only (full license header)
----------------------------------------------------------------
KNOWN LIMITATIONS
----------------------------------------------------------------
- All .c files except mod_bitchat_mesh.c are build-linkable stubs.
Real implementations must be restored from upstream source set.
Stubs log their init/deinit calls so the launcher UI works end-to-end.
- licenses/AGPL-3.0.txt is a stub. Run:
curl -o licenses/AGPL-3.0.txt https://www.gnu.org/licenses/agpl-3.0.txt
before shipping.
- BITCHAT_SOURCE_URL in mod_bitchat_mesh.c is a placeholder. Replace
with the real Written Offer URL before any bitchat deployment.
- macos/ and windows/ payload folders are populated at build time by
inject_payloads.sh; only linux/ is shipped as a reference set.
----------------------------------------------------------------
BUILD COMMANDS
----------------------------------------------------------------
./build.sh # full build
./build.sh --deploy # build + deploy to SD card
./build.sh --clean # remove build artifacts
make headers-check # verify KERNEL_HEADERS
make payloads # regenerate 150-payload matrix only
----------------------------------------------------------------
REFERENCES
----------------------------------------------------------------
PREREQUISITES.md -- host setup, toolchain, SD card prep (deep reference)
QUICKSTART.md -- fastest path from fresh host to deployed H2
HEADERS.md -- kernel headers sourcing (FiiO M3K + XBurst BSP)
LICENSE.md -- multi-tier licensing (AGPL for bitchat)
ARCHITECTURE.md -- module layout, SoC, build pipeline
CHANGELOG.md -- v1.3 -> v1.4 diff
SHA256SUMS -- per-file integrity manifest
================================================================

159
CHANGELOG.md Normal file
View File

@ -0,0 +1,159 @@
# Changelog
All notable changes to OreBolt OS are documented in this file.
Format roughly follows Keep-a-Changelog; dates are YYYY-MM-DD.
## [v1.4] -- 2026-07-13
### Rebrand: "Project Orebolt" -> "OreBolt OS"
The project has been rebranded from "Project Orebolt" to **OreBolt OS**.
All human-facing text (documentation, source comments, init-script
descriptions, banner messages, PDF reports, license docs) now uses the
new name. Technical identifiers are intentionally preserved as-is to
avoid breaking the build pipeline and to maintain filesystem
compatibility:
- `liborebolt.a` -- static archive name (lowercase, code-level)
- `Makefile.orebolt-v1.4` -- sub-makefile filename (lowercase, path)
- `modules/orebolt-*/` -- module directory names (lowercase, paths)
- `OREBOLT_VERSION`, `OREBOLT_TARGET_SOC` -- environment variables
- `orebolt-broker.pid` -- PID file name
This follows standard rebrand practice (cf. Firefox retaining `mozilla`
identifiers for years after the Firefox rebrand): user-visible names
change immediately; code-level identifiers migrate only when there is a
specific reason to do so.
The v1.4 release is a build-and-licensing cleanup pass driven by the
research file `h2-and-related-devices.text`. v1.3 shipped an overlay-only
drop with an internally inconsistent SHA256SUMS, the wrong target SoC, and
a headers-sourcing workflow that did not match the actual build path. v1.4
corrects all three and adds the AGPL-licensed bitchat mesh module.
### Fixed
- **Target SoC corrected: T31 -> X1000E.** The H2 and its rebadged
siblings (Surfans F20, Aigo Eros Q, Phinistec Z6, Agptek H3) all use
the Ingenic X1000E (JZ4760 family), not the T31/X2000. Updated the
master `Makefile` header comment, `PREREQUISITES.md` §1, and
`ARCHITECTURE.md` §1. Build flags unchanged (`-march=mips32r2
-mhard-float` is correct for both SoCs, but the register-level
headers differ).
- **Module count reconciled to 16.** v1.3 master Makefile line 55
advertised "(16 modules)" but SHA256SUMS only listed 13 module `.c`
files and PREREQUISITES §5.1 listed 16. v1.4 ships all 16: vault,
nettap, deploy, studio, probe, vterm, radar, ducky, extract, noise,
reset, emulate, emulator_input_mapper, rfid, wifi, glitch, pwdb
(restored), plus the new bitchat module (NEW).
- **macOS and Windows payload folders now exist.** v1.3's
`Provision.txt` itself flagged that "macos/63-100 and windows/101-150
sections were not generated in the source installer." v1.4's
`inject_payloads.sh` regenerates the canonical 50+50+50 layout under
`overlay/data/payloads/{linux,macos,windows}/`. Existing v1.3 flat
`.macro` files are migrated to `overlay/data/payloads/legacy/` on
first run.
- **SHA256SUMS now matches what ships.** v1.3's SHA256SUMS listed 38
files; only 3 of them were in the zip. v1.4 SHA256SUMS lists every
file in the tree and the build verifies them.
- **Init scripts restored.** `S98emulator-input`, `S99broker`, and
`bt_input_daemon.sh` are present. v1.3's SHA256SUMS listed
`bt_input_daemon.sh` but the zip did not ship it; the other two were
referenced by PREREQUISITES §5.1 but absent from both zip and
SHA256SUMS.
- **Headers/source stubs restored.** All files referenced by v1.3
SHA256SUMS but missing from the zip are present in v1.4:
`h2_ui.h`, `log_manager.h`, `lv_conf.h.dist`, `main.c`,
`panic_purge_api.h`, `build.sh`, `inject_payloads.sh`,
`Makefile.h2-core-v6.0` (renamed to `Makefile.h2-core-v6.1` in v1.4),
`Makefile.orebolt-v1.3` (renamed to `Makefile.orebolt-v1.4`), and
all module `.c` files.
### Changed
- **Headers source: Rockbox -> FiiO M3K GPL kernel tree.** v1.3
PREREQUISITES §3 asked operators to clone Rockbox as a header
reference and hand-write register definitions (because Rockbox is
GPL and OreBolt OS was proprietary). v1.4 vendors the FiiO M3K GPL
kernel tree (Linux 3.10.14, Ingenic BSP) as the canonical headers
source -- same X1000E SoC, GPL-clean, ships the exact uapi headers,
no reverse engineering. See the new `HEADERS.md` for the full
workflow and the XBurst BSP fallback.
- **Rockbox demoted to optional bare-metal reference.** v1.3 listed
Rockbox as the primary header reference; v1.4 explicitly scopes it
to a future bare-metal "OreBolt OS Native" port and notes that the
current Linux userspace build path does not use Rockbox at all.
- **Sub-Makefile names bumped to reflect the SoC correction.**
`Makefile.h2-core-v6.0` -> `Makefile.h2-core-v6.1`,
`Makefile.orebolt-v1.3` -> `Makefile.orebolt-v1.4`. Master `Makefile`
references updated.
- **HARDWARE_GPIO default flipped to 0.** v1.3 left the default
unspecified; v1.4 explicitly defaults to 0 (safe stubs) so host
development builds do not accidentally trigger real GPIO operations.
Set `HARDWARE_GPIO=1` only on real H2 hardware.
- **`build.sh` Phase 0 now probes for `KERNEL_HEADERS`.** Exits with a
clear error if the FiiO M3K tree is not at the expected path.
- **`build.sh` Phase 7 now verifies the bitchat AGPL marker.** Runs
`strings overlay/apps/bitchat.mod | grep -q AGPL_BITCHAT` and fails
the build if the marker is missing (i.e., bitchat was compiled
without `-DAGPL_BITCHAT`, which would mean it was compiled without
its AGPL license obligations enforced).
- **LVGL clone fallback baked into Phase 5.** v1.3 PREREQUISITES §8
documented an offline LVGL-clone fallback in the troubleshooting
section; v1.4 `build.sh` Phase 5 implements it inline.
### Added
- **bitchat mesh module (`modules/orebolt-bitchat/bitchat.c`,
`src/modules/mod_bitchat_mesh.c`)**. Licensed under AGPL-3.0-only.
See `LICENSE.md` for the multi-tier licensing strategy and the AGPL
boundary analysis. The bitchat module is the only OreBolt OS component
that runs as a networked service; AGPL v3 §13 closes the SaaS loophole
for mesh operators who fork and run modified bitchat nodes.
- **`HEADERS.md`** -- dedicated kernel-headers sourcing strategy doc.
Replaces v1.3 PREREQUISITES §3.
- **`LICENSE.md`** -- multi-tier licensing strategy. Documents the
AGPL boundary, operator obligations under AGPL v3 §13(d), and the
practical compliance checklist for deploying a modified H2 with
bitchat.
- **`licenses/` directory** -- AGPL-3.0.txt, GPL-2.0.txt, MIT.txt stub
files. Replace with full canonical texts before shipping (download
URLs in each file).
- **`make headers-check` target** -- verifies the kernel headers tree
is installed and exposes the expected JZ4760 SoC header path before
the build starts.
- **`BITCHAT_MSG_LICENSE` wire message type** -- every bitchat mesh
HELLO advertises the source-code Written Offer URL to peers, so
operators downstream of a modified node are automatically informed
of their AGPL v3 §13 source rights.
### Removed
- v1.3 PREREQUISITES §3 "Rockbox Headers for Ingenic T31" workflow --
replaced by `HEADERS.md`. The §3 section in v1.4 PREREQUISITES now
points operators to `HEADERS.md` instead of reproducing the (wrong)
Rockbox-mining workflow.
### Known limitations
- All module `.c` files (except `mod_bitchat_mesh.c`) are currently
build-linkable stubs with the correct SPDX headers and module
surface (init/deinit). Real implementation must be restored from
the upstream source set tracked in SHA256SUMS. Stubs log their
init/deinit calls so the launcher UI works end-to-end.
- `licenses/AGPL-3.0.txt` is a stub referencing the canonical URL.
Run `curl -o licenses/AGPL-3.0.txt https://www.gnu.org/licenses/agpl-3.0.txt`
before shipping.
- `BITCHAT_SOURCE_URL` in `mod_bitchat_mesh.c` is a placeholder
(`https://example.invalid/orebolt-bitchat-src`). Replace with the
real Written Offer URL before any bitchat deployment that other
operators will interact with over the mesh.
## [v1.3] -- 2026-07-13 (pre-cleanup)
Initial public drop. Shipped the overlay tree (payloads, init scripts,
vault data) but omitted the buildable source set. Targeted the wrong
SoC (T31 instead of X1000E). Listed Rockbox as the primary header
reference despite being a bare-metal OS unsuitable for the Linux
userspace build path. See `CHANGELOG.md` v1.4 entry for the full
cleanup.

211
HEADERS.md Normal file
View File

@ -0,0 +1,211 @@
# OreBolt OS v1.4 -- Kernel Headers Sourcing Strategy
> **TL;DR** -- vendor the **FiiO M3K GPL kernel tree** (Linux 3.10.14,
> Ingenic BSP) as the canonical headers source for the H2. Same SoC
> (X1000E), GPL-compatible, ships the exact uapi headers OreBolt OS needs.
> Use the **Ingenic XBurst BSP** as a fallback for any header FiiO
> stripped. Rockbox is **optional, bare-metal only** -- it is not a
> header set on top of Linux and the v1.3 workflow of "mine Rockbox for
> register definitions" was wrong for our Linux build path.
---
## 1. Why this is the v1.3 -> v1.4 change
v1.3 targeted the wrong SoC (T31 / X2000) and asked the operator to
"clone Rockbox for reference and hand-write register definitions" because
Rockbox's headers are GPL and OreBolt OS is (mostly) proprietary. That
workflow was:
- **Wrong target.** The H2 and its siblings (Surfans F20, Aigo Eros Q,
Phinistec Z6, Agptek H3) all use the **Ingenic X1000E** (JZ4760
family) -- not the T31. See `/upload/h2-and-related-devices.text`
line 53: "you are working with the Ingenic X1000 or X1000E SoC, which
is a MIPS32 architecture."
- **Wrong tool.** Rockbox is a **bare-metal OS replacement**, not a
header set you mine for register definitions on top of a Linux build.
v1.3 ships init.d scripts, ConfigFS USB gadget setup, `/usr/bin`
daemons, and `/data/payloads` -- that is a Linux userspace, not a
bare-metal environment.
- **Painful workflow.** Hand-writing register definitions from a GPL
reference is error-prone and easy to get wrong. The FiiO M3K GPL
kernel tree ships those exact definitions, GPL-licensed, ready to
`#include` -- no reverse engineering needed.
v1.4 corrects this by vendoring the FiiO M3K tree as the canonical
headers source.
## 2. The FiiO M3K GPL kernel tree (primary)
The FiiO M3K is a DAP that uses the **exact same Ingenic X1000E SoC as
the H2**. FiiO released their Linux kernel source under GPL. Because
the SoC is identical, the X1000E register definitions, GPIO mux tables,
clock tree headers, LCD controller register layouts, and DMA descriptor
formats in the FiiO tree are bit-for-bit applicable to the H2.
### 2.1 Where to get it
GitHub mirrors of the FiiO M3K kernel source are maintained by the DAP
hacking community. Common search terms:
```
github.com FiiO_M3K_Kernel_Source
github.com fiio m3k linux
```
Alternatively, FiiO publishes GPL source bundles as `.tar.gz` on their
official download page -- check `fiio.com` under Support -> M3K ->
Firmware, where the GPL source is usually linked alongside the binary
firmware.
### 2.2 Install it
```bash
# Clone (or extract the tarball) to /opt/fiio-m3k-linux
sudo mkdir -p /opt/fiio-m3k-linux
# Either:
git clone --depth 1 <fiio-m3k-mirror-url> /opt/fiio-m3k-linux
# Or:
sudo tar xzf fiio_m3k_kernel_*.tar.gz -C /opt/fiio-m3k-linux --strip-components=1
# Verify
ls /opt/fiio-m3k-linux/include/uapi/linux/kernel.h
ls /opt/fiio-m3k-linux/arch/mips/include/asm/mach-jz4760/jz4760.h
```
### 2.3 What OreBolt OS uses from it
The Makefiles add the following `-I` paths to every cross-compile:
| Include path | What it provides |
|---|---|
| `$(KERNEL_HEADERS)/include/uapi` | Linux userspace API headers (`<linux/kernel.h>`, `<linux/types.h>`, `<linux/ioctl.h>`, etc.) -- the clean, GPL-2.0-with-syscall-exception set |
| `$(KERNEL_HEADERS)/include` | Kernel-internal headers used by some driver shim layers (rarely needed, but kept for completeness) |
| `$(KERNEL_HEADERS)/arch/mips/include` | MIPS-architecture headers (`<asm/types.h>`, `<asm/io.h>`, `<asm/byteorder.h>`) |
| `$(KERNEL_HEADERS)/arch/mips/include/asm/mach-jz4760` | **X1000E SoC headers** -- `<mach-jz4760/jz4760.h>` (SoC register definitions), `<mach-jz4760/gpio.h>` (GPIO mux tables), `<mach-jz4760/cgu.h>` (clock generation unit), `<mach-jz4760/dmac.h>` (DMA descriptor format) |
### 2.4 GPL compliance
The FiiO M3K kernel tree is GPL-2.0. OreBolt OS's hardware library
(`liborebolt.a` and `src/modules/*.c`) is also GPL-2.0-or-later, so
`#include`-ing FiiO's headers is a clean GPL-to-GPL link. No license
boundary issue.
**Important**: do NOT copy FiiO's `.c` driver files verbatim into
OreBolt OS unless you are prepared to GPL-2.0-only those files (or track
the upstream so changes propagate). The headers are sufficient for
register-level access; full driver code brings more obligations than we
need.
## 3. Ingenic XBurst BSP (fallback)
If a header you need is missing from the FiiO tree (FiiO sometimes
strips headers for peripherals the M3K does not expose), the raw
Ingenic XBurst BSP is the next stop. Two known community mirrors:
- `YuanhuanLiang/X1000` -- X1000 SDK dump
- `acbits/kernel-xburst-bsp` -- broader XBurst BSP, useful for JZ47xx family
These are raw SDK dumps from Ingenic, including the `kernel/` directory
with the 3.10.14 base. They are noisier than the FiiO tree (more vendor
churn, less cleanup) but more complete.
### 3.1 When to use the BSP instead of FiiO
- A header FiiO references is missing (e.g., FiiO's M3K does not expose
NAND, so they may have stripped `<mach-jz4760/nand.h>`).
- You need a register definition that postdates the FiiO release (rare;
the X1000E is end-of-life from Ingenic).
- You are debugging a peripheral the M3K does not have but the H2 does
(e.g., the H2's Bluetooth chipset).
### 3.2 How to switch
Override `KERNEL_HEADERS` at build time:
```bash
export KERNEL_HEADERS=/opt/xburst-bsp/kernel
./build.sh
```
The build system accepts any path that contains
`include/uapi/linux/kernel.h` -- the `headers-check` target in the
master Makefile verifies this.
## 4. Rockbox (OPTIONAL, bare-metal only)
v1.3 listed Rockbox as the primary header reference. v1.4 demotes it to
optional and explicitly scopes it to the bare-metal build path -- which
OreBolt OS does not currently use, but a future "OreBolt OS Native" port might.
### 4.1 What Rockbox is actually good for
Rockbox is a **complete OS replacement** for the H2 and its siblings.
When you boot Rockbox on these devices, Rockbox IS the operating system
-- it does not run on top of Linux. This makes it useless as a header
source for a Linux userspace build, but extremely useful if you ever
decide to:
- Replace the H2's stock Linux firmware entirely with Rockbox + OreBolt OS
native code (no kernel, no init system, just Rockbox acting as the
OS).
- Cross-reference a register definition whose semantics are unclear from
the C struct alone (Rockbox's driver code shows how the register is
actually programmed, in real working code).
### 4.2 What Rockbox is NOT good for
- **Mining headers for use in a Linux userspace build.** Rockbox's
headers are bare-metal -- they define register addresses as physical
memory locations and access them via direct pointer dereference. In
a Linux userspace build, you access the same registers via `/dev/mem`
or kernel drivers, not by including Rockbox's headers.
- **Copy-pasting GPL code into a proprietary project.** Rockbox is
GPL-2.0; you cannot verbatim-copy its driver code into OreBolt OS
modules that are not GPL.
### 4.3 If you still want Rockbox for reference
```bash
git clone --depth 1 https://github.com/Rockbox/rockbox.git /opt/rockbox-ref
```
The relevant tree for the H2 is `firmware/target/mips/ingenic/jz4760/`
(the closest public match to the X1000E). Use it only as a semantic
reference for register behavior -- do not include its headers in the
OreBolt OS build path.
## 5. Decision matrix
| Build target | Headers source | Rockbox role |
|---|---|---|
| OreBolt OS on stock H2 Linux firmware (current v1.4 path) | **FiiO M3K GPL kernel** | None |
| OreBolt OS on a custom Buildroot Linux rootfs for H2 | **FiiO M3K GPL kernel** | None |
| OreBolt OS bare-metal on H2 (future "Native" port) | Rockbox `jz4760/` headers, FiiO headers as cross-reference | Primary |
| Any build needing a stripped header | **Ingenic XBurst BSP** as fallback | None |
## 6. Verification
Run `make headers-check` after setting `KERNEL_HEADERS` to verify the
tree is correctly installed:
```bash
make headers-check KERNEL_HEADERS=/opt/fiio-m3k-linux
# Expected:
# [OK] kernel headers root: /opt/fiio-m3k-linux
```
The check verifies:
- The path exists.
- `include/uapi/linux/kernel.h` exists (i.e., this is a Linux kernel tree).
- Warns (does not fail) if `arch/mips/include/asm/mach-jz4760/jz4760.h`
is missing -- this is the JZ4760 SoC header. If you are using the
XBurst BSP, the path may differ; in that case, the build will fail
later when it tries to `#include` a missing header, and you can
investigate from there.
## 7. v1.3 -> v1.4 PREREQUISITES.md delta
The v1.3 PREREQUISITES.md §3 "Rockbox Headers for Ingenic T31" is
**replaced** by this file in v1.4. The v1.4 PREREQUISITES.md §3 now
points operators here instead of reproducing the Rockbox workflow.

156
LICENSE.md Normal file
View File

@ -0,0 +1,156 @@
# OreBolt OS v1.4 -- Multi-Tier Licensing Strategy
> **TL;DR** -- bitchat mesh module is **AGPL-3.0-only**. Everything else in
> OreBolt OS is **GPL-2.0-or-later**. LVGL/lv_drivers stay **MIT** (upstream).
> The AGPL boundary is a single .mod binary; it does **not** virally relicense
> the rest of OreBolt OS because the rest of OreBolt OS is not a derivative work of
> bitchat. See §4 for the boundary analysis.
---
## 1. Why AGPL for the bitchat layer
The bitchat mesh layer is the only OreBolt OS component that runs as a
**networked service** -- every other module is a local LVGL UI panel that
talks to hardware through `/dev` or GPIO. When a bitchat node forwards a
message to another node, every operator downstream of that node is
"interacting with the software over a network" within the meaning of
AGPL v3 §13. Pure GPL would not require source disclosure for that kind of
network-only interaction; AGPL does.
This matters because the whole point of the bitchat layer is to let H2
devices form a mesh that survives the loss of any single node. If an
operator forks bitchat, hardens it, and runs the hardened version on their
node, every other mesh participant is effectively trusting that hardened
binary without being able to inspect it. AGPL v3 §13 closes that loophole
by requiring the operator to make their modified source available to anyone
who interacts with their node over the mesh, via the "Written Offer"
mechanism in §13(d).
AGPL v3 §6 (User Product) is the second reason this license fits the H2.
Section 6 requires that anyone distributing a "User Product" (consumer
device) running AGPL software must allow the user to install modified
versions of that software. This blocks **tivoization** -- the practice of
shipping GPL/AGPL software on locked-down hardware that refuses to run
user-modified builds. For a "hackable pocket rig" like the H2, that is
exactly the property we want: the user owns the device they carry, and the
firmware cannot lock them out of their own hardware.
## 2. License matrix
| Component | License | SPDX | Files |
|---|---|---|---|
| LVGL v8.3.11 (upstream) | MIT | `MIT` | `lvgl/**` (cloned at build time) |
| lv_drivers v8.3.0 (upstream) | MIT | `MIT` | `lv_drivers/**` (cloned at build time) |
| liblvgl.so (shared) | MIT | `MIT` | `overlay/usr/lib/liblvgl.so` |
| h2_test (launcher) | GPL-2.0+ | `GPL-2.0-or-later` | `overlay/usr/bin/h2_test`, `main.c` |
| emulator_input_mapper | GPL-2.0+ | `GPL-2.0-or-later` | `overlay/usr/bin/emulator_input_mapper` |
| liborebolt.a (static hw lib) | GPL-2.0+ | `GPL-2.0-or-later` | `liborebolt.a`, `src/modules/*.c` |
| 15 userland modules | GPL-2.0+ | `GPL-2.0-or-later` | `modules/orebolt-{vault,nettaps,...,pwdb}/*.c`, `overlay/apps/*.mod` |
| **bitchat mesh module** | **AGPL-3.0-only** | **`AGPL-3.0-only`** | `modules/orebolt-bitchat/bitchat.c`, `src/modules/mod_bitchat_mesh.c`, `overlay/apps/bitchat.mod` |
| Init scripts | GPL-2.0+ | `GPL-2.0-or-later` | `overlay/etc/init.d/*` |
| Documentation | CC-BY-4.0 | `CC-BY-4.0` | `*.md`, `*.txt` |
## 3. The AGPL boundary -- what is and is not covered
The AGPL v3 §13 "Modified Corresponding Source" obligation extends to:
- the bitchat module source (`mod_bitchat_mesh.c` and `modules/orebolt-bitchat/bitchat.c`)
- any modifications an operator makes to those files
- the corresponding source for any libraries bitchat links against **that
are themselves AGPL** (none, in our case -- it links against MIT LVGL and
GPL-2.0+ liborebolt.a)
The AGPL obligation does **not** extend to:
- The other 15 userland modules (vault, ducky, etc.) -- they are separate
programs that happen to share a launcher and a UI library. They are not
derivative works of bitchat.
- `liborebolt.a` -- bitchat links TO liborebolt.a, not the other way around.
A library that is linked against is not automatically a derivative work
of every program that links against it. See FSF FAQ on aggregate vs.
derivative works.
- `liblvgl.so` -- MIT, so AGPL's viral clause has nothing to grab onto.
- The H2 hardware itself -- software licenses do not license hardware. The
AGPL §6 User Product clause governs how the software may be installed on
the hardware, but does not place restrictions on the hardware design.
## 4. Operator obligations when modifying bitchat
If you modify `mod_bitchat_mesh.c` or `bitchat.c` and run the modified
version on an H2 that other operators interact with over the mesh, you
must, under AGPL v3 §13(d):
1. Make the modified source code available via a Written Offer, valid for
at least three years, to any operator who interacts with your node.
2. The Written Offer must specify a reasonable cost for physically
transmitting the source (no more than the actual cost).
3. The source must include the corresponding source of all libraries
bitchat links against that are themselves AGPL-licensed (in our case,
none beyond bitchat itself).
The build embeds `BITCHAT_SOURCE_URL` (defined in `mod_bitchat_mesh.c`) in
every `bitchat.mod` binary. Every mesh HELLO message advertises this URL
to peers via the `BITCHAT_MSG_LICENSE` message type -- so operators
downstream of a modified node are automatically informed of their source
rights. **Before shipping, replace the placeholder
`https://example.invalid/orebolt-bitchat-src` with the actual Written
Offer URL.**
## 5. Why not AGPL the whole stack?
Three reasons:
1. **Anti-tivoization is already covered by GPL-2.0+ for the other 15
modules.** GPL v2 §3(c) and GPL v3 §6 already require installable
source for User Products. AGPL's §6 is functionally identical to GPL
v3 §6 -- the only thing AGPL adds is §13 (the network-interaction
clause), which only matters for components that interact over a
network. Only bitchat does that.
2. **AGPL §13 would actually hurt the other modules' adoption.** If
vault.mod were AGPL, anyone who set up a vault "service" (e.g. a
network endpoint that returns credentials on authenticated request)
would have to disclose their modifications. That is not the threat
model for vault -- vault's threat model is "the device falls into the
wrong hands" (handled by panic_purge), not "someone operates a forked
vault server."
3. **Clean module boundaries are a feature, not a bug.** By isolating
the AGPL boundary to a single .mod binary, we make it trivial for an
operator to know exactly what they need to share source for. If
everything were AGPL, every operator would need to share source for
every modification, and the friction would discourage legitimate
device customization.
## 6. Practical compliance checklist
Before deploying a modified H2 with bitchat:
- [ ] Replaced `BITCHAT_SOURCE_URL` placeholder with a real URL pointing
to your modified bitchat source (tarball, git repo, or Written
Offer page).
- [ ] The URL is reachable from the mesh (or you have a Written Offer
ready for physical media delivery).
- [ ] The URL stays valid for at least 3 years from first deployment.
- [ ] You bumped `BITCHAT_PROTOCOL_VERSION` if you changed the wire
format (so unmodified nodes can refuse to interoperate cleanly
rather than silently misbehaving).
- [ ] `make core` succeeds and `build.sh` Phase 7 verifies that
`bitchat.mod` carries the `AGPL_BITCHAT` marker.
- [ ] The H2 firmware allows installing a modified `bitchat.mod` (i.e.,
the device is not tivoized against AGPL §6).
## 7. If you want to relicense the whole stack
If a future version of OreBolt OS decides to put everything under AGPL, the
only blockers are:
1. Any GPL-2.0-only code (we deliberately used GPL-2.0-or-later to permit
this upgrade path).
2. Any contributor who has not signed off on the upgrade -- you need
their consent or you need to rip their code. A `DCO` (Developer
Certificate of Origin) sign-off at contribution time makes this
tractable.
LVGL being MIT means there is no upstream-license blocker. The bitchat
module is already AGPL-3.0-only, which is one-way (you cannot downgrade
to GPL). Plan accordingly.

166
Makefile Normal file
View File

@ -0,0 +1,166 @@
# ==============================================================================
# OREBOLT OS -- UNIFIED MASTER BUILD ORCHESTRATOR (v1.4)
# ==============================================================================
#
# Target: HiFiWalker H2 (Ingenic X1000E / JZ4760 family, MIPS32r2,
# little-endian, hard-float, mipsel-linux-musl)
# Host: Arch Linux (x86_64) with mipsel-linux-musl cross-compiler
#
# v1.4 CHANGES (see CHANGELOG.md for full diff):
# * Corrected target SoC: T31 -> X1000E (matches the Aigo Eros Q / H2 / F20
# hardware family documented in /upload/h2-and-related-devices.text).
# * Kernel/uapi headers now sourced from the FiiO M3K GPL kernel tree
# (Linux 3.10.14, Ingenic BSP) -- same X1000E SoC as the H2. See
# HEADERS.md for the full sourcing strategy and the fallback to the
# raw Ingenic XBurst BSP for any header FiiO stripped.
# * Rockbox tree demoted from "primary header reference" to OPTIONAL
# bare-metal reference only. Rockbox is NOT used for the Linux build
# path -- it is the OS, not a header set on top of Linux.
# * Module count reconciled: 16 modules in Makefile, PREREQUISITES,
# SHA256SUMS, and ARCHITECTURE.
# * bitchat mesh module added under AGPL-3.0-only. See LICENSE.md and
# licenses/AGPL-3.0.txt for the multi-tier licensing strategy.
#
# Sub-builds:
#
# 1. H2 Core Platform v6.1 (Makefile.h2-core-v6.1)
# - LVGL v8.3.11 as liblvgl.so (shared library, ~200 KB)
# - 16 module binaries in modules/orebolt-*/ link dynamically
# - Master broker (main.c) + emulator input mapper daemon
# - Output: overlay/usr/lib/liblvgl.so, overlay/usr/bin/h2_test,
# overlay/apps/*.mod, overlay/usr/bin/emulator_input_mapper
#
# 2. OreBolt OS v1.4 (Makefile.orebolt-v1.4)
# - src/modules/*.c -> liborebolt.a (static archive)
# - 150-payload HID macro matrix via inject_payloads.sh
# - bitchat mesh module compiled with -DAGPL_BITCHAT
#
# Module layout (16 modules):
# modules/orebolt-vault/ vault.c
# modules/orebolt-nettap/ scalpel.c
# modules/orebolt-deploy/ deploy.c
# modules/orebolt-studio/ studio.c
# modules/orebolt-probe/ probe.c
# modules/orebolt-vterm/ vterm.c
# modules/orebolt-radar/ noise_radar.c
# modules/orebolt-ducky/ ducky.c
# modules/orebolt-extract/ extract.c
# modules/orebolt-noise/ noise.c
# modules/orebolt-reset/ reset.c
# modules/orebolt-emulate/ emulator.c, emulator_input_mapper.c
# modules/orebolt-rfid/ rfid.c [v1.4: restored]
# modules/orebolt-wifi/ wifi.c [v1.4: restored]
# modules/orebolt-glitch/ glitch.c [v1.4: restored]
# modules/orebolt-pwdb/ pwdb.c [v1.4: restored]
# modules/orebolt-bitchat/ bitchat.c [v1.4: NEW, AGPL-3.0]
#
# To add a new module:
# 1. mkdir modules/orebolt-<name>/
# 2. Write modules/orebolt-<name>/<name>.c (include h2_ui.h)
# 3. Add "<name>:modules/orebolt-<name>/<name>.c \" to MODULES
# in Makefile.h2-core-v6.1
# 4. Add "<name>.mod" to modules[] in main.c
# 5. make core
#
# License headers: every .c and .h file MUST carry an SPDX-License-Identifier
# line in its leading comment block. bitchat uses AGPL-3.0-only; everything
# else uses GPL-2.0-or-later unless LICENSE.md says otherwise.
# ==============================================================================
H2_CORE_MAKEFILE := Makefile.h2-core-v6.1
OREBOLT_MAKEFILE := Makefile.orebolt-v1.4
# v1.4: kernel headers root, sourced from the FiiO M3K GPL tree.
# Override with KERNEL_HEADERS=/path/to/fiio-m3k-linux if you cloned it
# somewhere other than the default. See HEADERS.md.
KERNEL_HEADERS ?= /opt/fiio-m3k-linux
.PHONY: all core orebolt payloads clean validate_env help headers-check
all: validate_env headers-check core orebolt
@echo "======================================================================"
@echo "[OK] OREBOLT OS v1.4 FULLY BUILT"
@echo " Target SoC: Ingenic X1000E (JZ4760 family, MIPS32r2 mipsel)"
@echo " Headers: $(KERNEL_HEADERS)"
@echo " LVGL shared: overlay/usr/lib/liblvgl.so"
@echo " Launcher: overlay/usr/bin/h2_test"
@echo " Mapper: overlay/usr/bin/emulator_input_mapper"
@echo " Modules: overlay/apps/*.mod (16 modules)"
@echo " HW archive: liborebolt.a"
@echo " Payloads: overlay/data/payloads/{linux,macos,windows}/"
@echo " Licensing: see LICENSE.md (bitchat = AGPL-3.0-only)"
@echo "======================================================================"
validate_env:
@if [ "$$(basename $$(pwd))" != "h2-workspace" ]; then \
echo "[-] CRITICAL: build must run inside h2-workspace/"; \
exit 1; \
fi
# v1.4 NEW: verify the FiiO M3K kernel headers tree exists and exposes the
# X1000E SoC headers we expect. Falls back to the Ingenic XBurst BSP if
# KERNEL_HEADERS points there instead. See HEADERS.md §3.
headers-check: validate_env
@if [ ! -d "$(KERNEL_HEADERS)" ]; then \
echo "[-] CRITICAL: KERNEL_HEADERS not found at $(KERNEL_HEADERS)"; \
echo " Clone the FiiO M3K GPL kernel tree (see HEADERS.md §2):"; \
echo " git clone --depth 1 https://github.com/...",
echo " $(KERNEL_HEADERS)"; \
exit 1; \
fi
@if [ ! -f "$(KERNEL_HEADERS)/include/uapi/linux/kernel.h" ]; then \
echo "[-] $(KERNEL_HEADERS) does not look like a Linux kernel tree"; \
echo " (missing include/uapi/linux/kernel.h)"; \
exit 1; \
fi
@if [ ! -f "$(KERNEL_HEADERS)/arch/mips/include/asm/mach-jz4760/jz4760.h" ]; then \
echo "[!] Warning: JZ4760 SoC header not found at expected path."; \
echo " If this is the XBurst BSP layout, set KERNEL_HEADERS accordingly."; \
echo " Continuing -- build will fail later if a needed header is missing."; \
fi
@echo "[OK] kernel headers root: $(KERNEL_HEADERS)"
core: validate_env
@echo ">>> Building H2 Core Platform v6.1 (shared LVGL + 16 modules)..."
$(MAKE) -f $(H2_CORE_MAKEFILE) all KERNEL_HEADERS=$(KERNEL_HEADERS)
orebolt: validate_env
@echo ">>> Building OreBolt OS v1.4 (liborebolt.a + payloads)..."
$(MAKE) -f $(OREBOLT_MAKEFILE) all HARDWARE_GPIO=$(HARDWARE_GPIO) \
KERNEL_HEADERS=$(KERNEL_HEADERS)
payloads: validate_env
@echo ">>> Regenerating 150-payload HID matrix only..."
@chmod +x inject_payloads.sh
@./inject_payloads.sh
clean:
-$(MAKE) -f $(H2_CORE_MAKEFILE) clean
-$(MAKE) -f $(OREBOLT_MAKEFILE) clean HARDWARE_GPIO=$(HARDWARE_GPIO)
help:
@echo "OREBOLT OS v1.4 MASTER BUILD"
@echo ""
@echo "Target SoC: Ingenic X1000E (JZ4760 family, MIPS32r2 mipsel-linux-musl)"
@echo "Headers: FiiO M3K GPL kernel tree ($(KERNEL_HEADERS))"
@echo ""
@echo "Targets:"
@echo " all Build everything (default)"
@echo " headers-check Verify kernel headers tree before build"
@echo " core Build LVGL shared lib + launcher + 16 modules"
@echo " orebolt Build liborebolt.a + payload matrix"
@echo " payloads Regenerate 150-payload HID macro matrix only"
@echo " clean Remove all build artifacts"
@echo " help This message"
@echo ""
@echo "Environment:"
@echo " KERNEL_HEADERS Path to FiiO M3K GPL kernel tree (default: /opt/fiio-m3k-linux)"
@echo " HARDWARE_GPIO Set to 1 to compile real GPIO panic-purge path"
@echo " CROSS_COMPILE Toolchain prefix (default: mipsel-linux-musl-)"
@echo ""
@echo "Adding a new module:"
@echo " 1. mkdir modules/orebolt-<name>/"
@echo " 2. Write modules/orebolt-<name>/<name>.c (include h2_ui.h)"
@echo " 3. Add '<name>:modules/orebolt-<name>/<name>.c' to MODULES"
@echo " 4. Add '<name>.mod' to modules[] in main.c"
@echo " 5. make core"

112
Makefile.h2-core-v6.1 Normal file
View File

@ -0,0 +1,112 @@
# ==============================================================================
# H2 CORE PLATFORM v6.1 -- LVGL + 16 OreBolt OS Modules
# ==============================================================================
# v1.4: bumped from v6.0 to v6.1 to reflect the X1000E SoC correction and
# the FiiO M3K kernel-headers integration. All -I paths now point at
# $(KERNEL_HEADERS)/include/uapi and arch/mips/include.
# ==============================================================================
CROSS ?= mipsel-linux-musl-
CC := $(CROSS)gcc
STRIP := $(CROSS)strip
AR := $(CROSS)ar
RANLIB := $(CROSS)ranlib
# v1.4: target the actual H2 SoC. -march=mips32r2 matches the X1000E core
# (the JZ4760 family). -mhard-float is required -- the X1000E has an FPU.
ARCHFLAGS := -march=mips32r2 -mhard-float -Os -fPIC -fno-strict-aliasing \
-fno-common -Wall -Wextra -Wno-unused-parameter
# v1.4: kernel headers root comes from the master Makefile (or env).
KERNEL_HEADERS ?= /opt/fiio-m3k-linux
# Header search path:
# 1. workspace-local include/ (project headers: h2_ui.h, log_manager.h)
# 2. $(KERNEL_HEADERS)/include/uapi (Linux uapi -- clean, GPL)
# 3. $(KERNEL_HEADERS)/include (kernel-internal headers used by some drivers)
# 4. $(KERNEL_HEADERS)/arch/mips/include
# 5. $(KERNEL_HEADERS)/arch/mips/include/asm/mach-jz4760 (X1000E SoC headers)
# 6. lvgl/ and lv_drivers/ (cloned by build.sh Phase 5)
INCLUDES := -Iinclude \
-I$(KERNEL_HEADERS)/include/uapi \
-I$(KERNEL_HEADERS)/include \
-I$(KERNEL_HEADERS)/arch/mips/include \
-I$(KERNEL_HEADERS)/arch/mips/include/asm/mach-jz4760 \
-Ilvgl -Ilvgl/src -Ilv_drivers
CFLAGS := $(ARCHFLAGS) $(INCLUDES) -DLV_CONF_INCLUDE_SIMPLE=1 \
-DLV_LVGL_H_INCLUDE_SIMPLE=1
LDFLAGS := -Loverlay/usr/lib -Wl,-rpath,/usr/lib
LDLIBS := -llvgl -lm -ldl -lpthread
# v1.4: 16 modules (was 13 in SHA256SUMS, advertised as 16 in master Makefile
# and PREREQUISITES). v1.4 reconciles to 16.
MODULES := \
vault:modules/orebolt-vault/vault.c \
nettap:modules/orebolt-nettap/scalpel.c \
deploy:modules/orebolt-deploy/deploy.c \
studio:modules/orebolt-studio/studio.c \
probe:modules/orebolt-probe/probe.c \
vterm:modules/orebolt-vterm/vterm.c \
radar:modules/orebolt-radar/noise_radar.c \
ducky:modules/orebolt-ducky/ducky.c \
extract:modules/orebolt-extract/extract.c \
noise:modules/orebolt-noise/noise.c \
reset:modules/orebolt-reset/reset.c \
emulate:modules/orebolt-emulate/emulator.c \
emulator_input_mapper:modules/orebolt-emulate/emulator_input_mapper.c \
rfid:modules/orebolt-rfid/rfid.c \
wifi:modules/orebolt-wifi/wifi.c \
glitch:modules/orebolt-glitch/glitch.c \
pwdb:modules/orebolt-pwdb/pwdb.c \
bitchat:modules/orebolt-bitchat/bitchat.c
.PHONY: all clean lvgl modules launcher mapper
all: lvgl launcher mapper modules
# --- LVGL shared library -----------------------------------------------------
lvgl:
@if [ ! -d lvgl/src ]; then \
echo "[-] lvgl/src not found. Run build.sh Phase 5 first, or:"; \
echo " git clone --depth 1 -b v8.3.11 https://github.com/lvgl/lvgl.git"; \
echo " git clone --depth 1 -b v8.3.0 https://github.com/lvgl/lv_drivers.git"; \
exit 1; \
fi
@echo ">>> Building liblvgl.so (v8.3.11)..."
$(CC) $(CFLAGS) -shared -fPIC \
lvgl/src/*.c lvgl/src/draw/*.c lvgl/src/draw/sw/*.c \
lvgl/src/font/*.c lvgl/src/misc/*.c lvgl/src/widgets/*.c \
lvgl/src/extra/*.c lvgl/src/extra/layouts/*.c lvgl/src/extra/themes/*.c \
-o overlay/usr/lib/liblvgl.so
$(STRIP) overlay/usr/lib/liblvgl.so
# --- Master launcher ---------------------------------------------------------
launcher: lvgl
@echo ">>> Building h2_test launcher..."
$(CC) $(CFLAGS) main.c -o overlay/usr/bin/h2_test $(LDFLAGS) $(LDLIBS)
$(STRIP) overlay/usr/bin/h2_test
# --- Emulator input mapper daemon --------------------------------------------
mapper: lvgl
@echo ">>> Building emulator_input_mapper..."
$(CC) $(CFLAGS) modules/orebolt-emulate/emulator_input_mapper.c \
-o overlay/usr/bin/emulator_input_mapper $(LDFLAGS) $(LDLIBS)
$(STRIP) overlay/usr/bin/emulator_input_mapper
# --- 16 module binaries ------------------------------------------------------
modules: lvgl
@for entry in $(MODULES); do \
name=$${entry%%:*}; \
src=$${entry#*:}; \
echo ">>> Building module: $$name"; \
$(CC) $(CFLAGS) $$src -o overlay/apps/$$name.mod \
$(LDFLAGS) $(LDLIBS) || exit 1; \
$(STRIP) overlay/apps/$$name.mod; \
done
clean:
rm -f overlay/usr/lib/liblvgl.so
rm -f overlay/usr/bin/h2_test
rm -f overlay/usr/bin/emulator_input_mapper
rm -f overlay/apps/*.mod

69
Makefile.orebolt-v1.4 Normal file
View File

@ -0,0 +1,69 @@
# ==============================================================================
# OREBOLT OS v1.4 -- Hardware Library + Payload Matrix
# ==============================================================================
# Builds liborebolt.a (static archive) from src/modules/*.c and runs
# inject_payloads.sh to regenerate the 150-payload HID macro matrix under
# overlay/data/payloads/{linux,macos,windows}/.
#
# v1.4 changes:
# * bitchat mesh module (mod_bitchat_mesh.c) added under AGPL-3.0-only.
# It is compiled with -DAGPL_BITCHAT so the source can self-identify at
# runtime for license-display purposes.
# * HARDWARE_GPIO default flipped to 0 (safe stubs). Set HARDWARE_GPIO=1
# ONLY on real H2 hardware -- the stubs are for host dev/testing.
# * Kernel headers now plumbed through from master Makefile.
# ==============================================================================
CROSS ?= mipsel-linux-musl-
CC := $(CROSS)gcc
AR := $(CROSS)ar
RANLIB := $(CROSS)ranlib
KERNEL_HEADERS ?= /opt/fiio-m3k-linux
HARDWARE_GPIO ?= 0
ARCHFLAGS := -march=mips32r2 -mhard-float -Os -fPIC -fno-strict-aliasing -Wall
INCLUDES := -Iinclude -Isrc/modules \
-I$(KERNEL_HEADERS)/include/uapi \
-I$(KERNEL_HEADERS)/arch/mips/include \
-I$(KERNEL_HEADERS)/arch/mips/include/asm/mach-jz4760
CFLAGS := $(ARCHFLAGS) $(INCLUDES) \
-DHARDWARE_GPIO=$(HARDWARE_GPIO)
# v1.4: source list aligned with src/modules/ on disk.
OREBOLT_SRCS := \
src/modules/mod_core_hid.c \
src/modules/mod_forensics.c \
src/modules/mod_panic_hardware_purge.c \
src/modules/mod_panic_purge.c \
src/modules/mod_radio_input_multiplex.c \
src/modules/mod_ui_frame_graphics.c \
src/modules/mod_bitchat_mesh.c
OREBOLT_OBJS := $(OREBOLT_SRCS:.c=.o)
.PHONY: all clean payloads
all: liborebolt.a payloads
liborebolt.a: $(OREBOLT_OBJS)
@echo ">>> Archiving liborebolt.a..."
$(AR) rcs $@ $(OREBOLT_OBJS)
$(RANLIB) $@
# Per-object rule so we can apply AGPL_BITCHAT define to the bitchat object
# only. All other objects use the project default (GPL-2.0-or-later).
src/modules/mod_bitchat_mesh.o: src/modules/mod_bitchat_mesh.c
$(CC) $(CFLAGS) -DAGPL_BITCHAT -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
payloads:
@echo ">>> Regenerating 150-payload HID matrix..."
@chmod +x inject_payloads.sh
@./inject_payloads.sh
clean:
rm -f $(OREBOLT_OBJS) liborebolt.a

538
PREREQUISITES.md Normal file
View File

@ -0,0 +1,538 @@
# OreBolt OS v1.4 -- Host & Toolchain Prerequisites
Everything you need to set up on your Arch Linux build machine **before**
running `./build.sh`. This guide covers the host OS, cross-compiler
toolchain, **kernel headers sourcing** (new in v1.4 -- see
[HEADERS.md](HEADERS.md)), optional Buildroot environment, and SD card
preparation.
> **v1.4 change**: the target SoC is now correctly identified as the
> **Ingenic X1000E** (JZ4760 family), not the T31/X2000. The headers
> source is now the **FiiO M3K GPL kernel tree** (same SoC as the H2),
> not Rockbox. Rockbox is now optional and scoped to bare-metal only.
> See [HEADERS.md](HEADERS.md) for the full strategy.
---
## Table of Contents
1. [Arch Linux Host Setup](#1-arch-linux-host-setup)
2. [Cross-Compiler Toolchain](#2-cross-compiler-toolchain)
3. [Kernel Headers (v1.4 -- FiiO M3K GPL tree)](#3-kernel-headers-v14--fiio-m3k-gpl-tree)
4. [Optional: Buildroot for X1000E Full Image](#4-optional-buildroot-for-x1000e-full-image)
5. [Workspace Clone & Verify](#5-workspace-clone--verify)
6. [SD Card Preparation](#6-sd-card-preparation)
7. [Environment Variables Reference](#7-environment-variables-reference)
8. [Troubleshooting](#8-troubleshooting)
9. [Licensing](#9-licensing)
10. [What `build.sh` Handles Automatically](#10-what-buildsh-handles-automatically)
---
## 1. Arch Linux Host Setup
OreBolt OS targets the HiFiWalker H2 (Ingenic **X1000E**, MIPS32r2,
mipsel) but builds entirely on a stock Arch Linux x86_64 workstation.
Arch is the only supported host because the build tooling, package
versions, and PATH layout are validated against it. Other distributions
may work but will require porting effort, particularly around `pacman`
dependency checks in Phase 0 of `build.sh`.
### 1.1 Install Base Build Toolchain
```bash
sudo pacman -Syu --needed base-devel git make python3
```
This pulls in `gcc`, `binutils`, `make`, `patch`, `tar`, `gzip`, `bzip2`,
`xz`, `sed`, `gawk`, `file`, and `which` -- the minimal set required by
both the host-side tools and the cross-compilation pipeline. The
`build.sh` script will check for these in Phase 0 and attempt to install
any missing ones via `pacman -S --noconfirm`.
### 1.2 Install SD Card Utilities
```bash
sudo pacman -S --needed rsync dosfstools e2fsprogs parted file
```
Required for partitioning, formatting, and verifying the SD card used to
deploy OreBolt OS to the H2 (see Section 6). `file` is also used by
`build.sh` Phase 7 to verify that produced binaries are MIPS
little-endian ELF.
### 1.3 Keep Arch Updated
```bash
sudo pacman -Syu
```
Arch Linux rolling release means you will always have a recent GCC,
binutils, and glibc. No pinned versions are required for the host
toolchain -- the cross-compiler is fully self-contained and does not
depend on the host GCC version.
### 1.4 User Permissions
You need `sudo` access for package installation and SD card mount
operations. The build scripts detect whether they are running as root
or can use passwordless sudo; if neither works, they print the manual
install command and exit.
```bash
sudo -n true 2>/dev/null && echo "passwordless sudo: OK" || echo "passwordless sudo: NO (will prompt)"
```
---
## 2. Cross-Compiler Toolchain
The build requires a `mipsel-linux-musl` cross-compiler targeting
MIPS32r2 little-endian with hard-float ABI and musl libc. The `build.sh`
script and all Makefiles expect the toolchain binaries to be named with
the prefix `mipsel-linux-musl-` (e.g., `mipsel-linux-musl-gcc`,
`mipsel-linux-musl-strip`, `mipsel-linux-musl-ar`,
`mipsel-linux-musl-ranlib`).
### 2.1 Toolchain Source: Rockbox (Recommended)
Rockbox maintains a tested MIPS cross-compiler specifically for Ingenic
JZ47xx and X1000-family SoCs. Since Rockbox has a port for this exact
device family, their toolchain is the most authoritative and
hardware-verified option available.
**Option A: Use Rockbox's prebuilt toolchain**
1. Visit the Rockbox toolchain downloads page:
`https://www.rockbox.org/wiki/CrossCompile`
2. Download the MIPS toolchain tarball.
3. Extract and install:
```bash
sudo mkdir -p /opt/mipsel-linux-musl
sudo tar xzf rockbox-mips-toolchain-*.tar.gz -C /opt/mipsel-linux-musl --strip-components=1
```
4. Add to PATH (see Section 2.4).
**Option B: Build the Rockbox toolchain from source**
```bash
git clone https://github.com/Rockbox/rockbox.git
cd rockbox/tools
# Follow instructions at https://www.rockbox.org/wiki/CrossCompile
```
> **v1.4 note**: Rockbox's toolchain is still the recommended
> cross-compiler even though Rockbox is no longer the recommended
> headers source. The toolchain (compiler + binutils + libc) is
> SoC-agnostic enough that it works for any MIPS32r2 target; the
> headers source is what was wrong in v1.3.
### 2.2 Toolchain Source: musl.cc (Fallback)
If the Rockbox toolchain is unavailable, musl.cc provides
community-built musl cross-compiler binaries. These are generic and not
tuned for Ingenic specifically.
```bash
wget https://musl.cc/mipsel-linux-musl-cross.tgz -O /tmp/mipsel-toolchain.tgz
sudo mkdir -p /opt/mipsel-linux-musl
sudo tar xzf /tmp/mipsel-toolchain.tgz -C /opt/mipsel-linux-musl --strip-components=1
```
**Caveat**: musl.cc toolchains may not include Ingenic-specific compiler
intrinsics or tune flags. If you encounter issues with floating-point
operations or scheduler behavior, switch to the Rockbox toolchain.
### 2.3 Toolchain Source: Buildroot Self-Build (Advanced)
Buildroot can generate a complete cross-compiler toolchain from source.
This is the most flexible option but also the slowest (build time: 15-45
minutes). See Section 4.
### 2.4 Add Toolchain to PATH
```bash
export PATH="/opt/mipsel-linux-musl/bin:$PATH"
mipsel-linux-musl-gcc --version
mipsel-linux-musl-gcc -dumpmachine # Should print: mipsel-linux-musl
```
If your toolchain uses a different prefix, set `CROSS_COMPILE`:
```bash
export CROSS_COMPILE=mips-linux-gnu-
./build.sh
```
### 2.5 Verify the Toolchain Works
```bash
echo '#include <stdio.h>
int main(void) { printf("hello mipsel\\n"); return 0; }' > /tmp/test.c
mipsel-linux-musl-gcc -march=mips32r2 -mhard-float -static -o /tmp/test_mips /tmp/test.c
file /tmp/test_mips
# Expected: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 ...
```
---
## 3. Kernel Headers (v1.4 -- FiiO M3K GPL tree)
> **Read [HEADERS.md](HEADERS.md) for the full strategy.** This section
> is a quick-start summary.
v1.4 sources kernel headers from the **FiiO M3K GPL kernel tree** (Linux
3.10.14, Ingenic BSP) because the M3K uses the **exact same Ingenic
X1000E SoC as the H2**. The FiiO tree ships the X1000E register
definitions, GPIO mux tables, clock tree headers, and DMA descriptor
formats -- all GPL-2.0, all directly `#include`-able, no reverse
engineering needed.
### 3.1 Install the FiiO M3K kernel tree
```bash
sudo mkdir -p /opt/fiio-m3k-linux
# Clone from a community mirror, or extract FiiO's official GPL tarball:
sudo tar xzf fiio_m3k_kernel_*.tar.gz -C /opt/fiio-m3k-linux --strip-components=1
# Verify
ls /opt/fiio-m3k-linux/include/uapi/linux/kernel.h
ls /opt/fiio-m3k-linux/arch/mips/include/asm/mach-jz4760/jz4760.h
```
### 3.2 Verify with `make headers-check`
```bash
make headers-check KERNEL_HEADERS=/opt/fiio-m3k-linux
# Expected:
# [OK] kernel headers root: /opt/fiio-m3k-linux
```
### 3.3 Fallback: Ingenic XBurst BSP
If a header is missing from the FiiO tree, use the raw Ingenic XBurst
BSP. See [HEADERS.md §3](HEADERS.md#3-ingenic-xburst-bsp-fallback).
### 3.4 What about Rockbox?
Rockbox is now **optional** and scoped to a future bare-metal "OreBolt OS
Native" port. The current Linux userspace build path does not use
Rockbox at all. See [HEADERS.md §4](HEADERS.md#4-rockbox-optional-bare-metal-only).
---
## 4. Optional: Buildroot for X1000E Full Image
Buildroot is not required for the module-level cross-compilation that
`build.sh` performs. However, if you want to produce a complete root
filesystem image for the H2 (kernel + initramfs + rootfs with all
OreBolt OS modules), Buildroot is the right tool.
### 4.1 Clone Buildroot
```bash
git clone https://github.com/buildroot/buildroot.git
cd buildroot
git checkout 2024.02 # or current stable
```
### 4.2 Configure for Ingenic X1000E
```bash
make menuconfig
```
**Target options:**
```
Target Architecture = MIPS (little endian)
Target Architecture Variant = mips32r2
Target ABI = 32 (soft-float) # override below for hard-float
```
**Toolchain:**
```
Toolchain type = External toolchain
Toolchain = Custom toolchain
Toolchain path = /opt/mipsel-linux-musl
Toolchain prefix = $(ARCH)-linux-musl-
```
**Hard-float note**: the X1000E has a hardware FPU. OreBolt OS compiles
with `-mhard-float`. If Buildroot does not expose a hard-float option
in menuconfig, force it via `BR2_TARGET_OPTIMIZATION="-mhard-float"` in
`.config`.
**System configuration:**
```
System hostname = h2-hifiwalker
System banner = Welcome to OreBolt OS
/dev management = Dynamic using devtmpfs
Init system = BusyBox init (SysVinit)
```
### 4.3 Integrate the OreBolt OS Overlay
In menuconfig: System configuration -> Root filesystem overlay directories
Add: `/path/to/h2-workspace/overlay`
Or edit `.config` directly:
```
BR2_ROOTFS_OVERLAY="/path/to/h2-workspace/overlay"
```
### 4.4 Build and Flash
```bash
make
# Output: output/images/{rootfs.ext4, zImage, sdcard.img}
sudo dd if=output/images/sdcard.img of=/dev/sdX bs=4M status=progress
sync
sudo eject /dev/sdX
```
---
## 5. Workspace Clone & Verify
```bash
git clone <repo-url> h2-workspace
cd h2-workspace
```
### 5.1 Verify Workspace Integrity
`build.sh` Phase 2 does this automatically, but you can check manually:
```bash
# Required top-level files
ls -1 Makefile Makefile.h2-core-v6.1 Makefile.orebolt-v1.4 \
build.sh inject_payloads.sh \
main.c include/h2_ui.h include/log_manager.h lv_conf.h.dist \
src/modules/panic_purge_api.h \
PREREQUISITES.md HEADERS.md LICENSE.md CHANGELOG.md \
ARCHITECTURE.md README.md BUILD_MANIFEST.txt SHA256SUMS
# All 16 module source files (v1.4: reconciled count)
ls -1 modules/orebolt-vault/vault.c \
modules/orebolt-nettap/scalpel.c \
modules/orebolt-deploy/deploy.c \
modules/orebolt-studio/studio.c \
modules/orebolt-probe/probe.c \
modules/orebolt-vterm/vterm.c \
modules/orebolt-radar/noise_radar.c \
modules/orebolt-ducky/ducky.c \
modules/orebolt-extract/extract.c \
modules/orebolt-noise/noise.c \
modules/orebolt-reset/reset.c \
modules/orebolt-emulate/emulator.c \
modules/orebolt-emulate/emulator_input_mapper.c \
modules/orebolt-rfid/rfid.c \
modules/orebolt-wifi/wifi.c \
modules/orebolt-glitch/glitch.c \
modules/orebolt-pwdb/pwdb.c \
modules/orebolt-bitchat/bitchat.c
# Init scripts
ls -1 overlay/etc/init.d/S98emulator-input \
overlay/etc/init.d/S99broker \
overlay/etc/init.d/bt_input_daemon.sh
# Hardware library sources (7 files in v1.4)
ls -1 src/modules/
```
### 5.2 Verify Toolchain
```bash
mipsel-linux-musl-gcc --version
mipsel-linux-musl-gcc -dumpmachine # Must contain "mips"
```
---
## 6. SD Card Preparation
The HiFiWalker H2 boots from an SD card. Minimum: a single FAT32
partition holding the firmware files.
### 6.1 Identify the SD Card
```bash
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
```
**WARNING**: Be absolutely certain you have identified the correct
device. `/dev/sda` is typically your system disk.
### 6.2 Single-Partition Layout
```bash
sudo umount /dev/sdX1 2>/dev/null || true
sudo parted /dev/sdX --script mklabel msdos
sudo parted /dev/sdX --script mkpart primary fat32 1MiB 100%
sudo parted /dev/sdX --script set 1 boot on
sudo mkfs.vfat -F 32 -n OREBOLT /dev/sdX1
```
### 6.3 Dual-Partition Layout (Full Rootfs)
```bash
sudo parted /dev/sdX --script mklabel msdos
sudo parted /dev/sdX --script mkpart primary fat32 1MiB 129MiB
sudo parted /dev/sdX --script set 1 boot on
sudo parted /dev/sdX --script mkpart primary ext4 129MiB 100%
sudo mkfs.vfat -F 32 -n H2_BOOT /dev/sdX1
sudo mkfs.ext4 -L H2_ROOT /dev/sdX2
```
### 6.4 Deploy
```bash
SD_CARD_MOUNT=/mnt/h2-sd ./build.sh --deploy
```
---
## 7. Environment Variables Reference
| Variable | Default | Description |
|---|---|---|
| `CROSS_COMPILE` | `mipsel-linux-musl-` | Toolchain binary prefix |
| `KERNEL_HEADERS` | `/opt/fiio-m3k-linux` | **v1.4 NEW**: FiiO M3K GPL kernel tree path |
| `HARDWARE_GPIO` | `0` | **v1.4 default flipped**: set to `1` only on real H2 hardware to compile real GPIO panic purge |
| `SD_CARD_MOUNT` | `/mnt/h2-sd` | SD card mount point for `--deploy` |
| `NO_COLOR` | (unset) | Set to `1` to disable ANSI color in build scripts |
| `PATH` | (system) | Must include `/opt/mipsel-linux-musl/bin` |
Recommended `~/.bashrc` additions:
```bash
export PATH="/opt/mipsel-linux-musl/bin:$PATH"
export KERNEL_HEADERS="/opt/fiio-m3k-linux"
# export SD_CARD_MOUNT="/run/media/$USER/OREBOLT"
# export HARDWARE_GPIO=0 # explicit on dev host; set to 1 on hardware
```
---
## 8. Troubleshooting
### Toolchain not found
```
[-] Missing toolchain binaries: mipsel-linux-musl-gcc
```
Verify `/opt/mipsel-linux-musl/bin/` is in `$PATH`. If your toolchain
uses a different prefix, set `CROSS_COMPILE`.
### Compiler target is not MIPS
```
[!] Compiler target 'x86_64-linux-gnu' does not look like MIPS
```
Run `which mipsel-linux-musl-gcc` and `mipsel-linux-musl-gcc
-dumpmachine`. Ensure the cross-compiler's `bin/` appears before
`/usr/bin/` in `$PATH`.
### KERNEL_HEADERS not found (v1.4 NEW)
```
[-] CRITICAL: KERNEL_HEADERS not found at /opt/fiio-m3k-linux
```
Install the FiiO M3K GPL kernel tree (Section 3.1) or set
`KERNEL_HEADERS` to point at the XBurst BSP fallback (HEADERS.md §3).
### musl.cc toolchain float ABI mismatch
```
error: cannot find -lm
```
or linker errors about `soft-float` vs `hard-float`. Switch to the
Rockbox toolchain (Section 2.1) which is configured for Ingenic's
hard-float ABI.
### LVGL clone fails
```
[*] Cloning LVGL v8.3.11 + lv_drivers v8.3.0...
fatal: unable to access 'https://github.com/lvgl/lvgl.git'
```
Pre-clone LVGL manually:
```bash
git clone --depth 1 -b v8.3.11 https://github.com/lvgl/lvgl.git
git clone --depth 1 -b v8.3.0 https://github.com/lvgl/lv_drivers.git
cp lv_conf.h.dist lv_conf.h
cp lv_drivers/lv_drv_conf_template.h lv_drv_conf.h
sed -i 's/#if 0/#if 1/' lv_drv_conf.h
sed -i 's/USE_FBDEV 0/USE_FBDEV 1/' lv_drv_conf.h
sed -i 's/USE_EVDEV 0/USE_EVDEV 1/' lv_drv_conf.h
```
`build.sh` Phase 5 will detect the existing `lvgl/src/` and skip
cloning.
### bitchat.mod missing AGPL_BITCHAT marker (v1.4 NEW)
```
[-] bitchat.mod missing AGPL_BITCHAT marker (license violation)
```
`mod_bitchat_mesh.c` was compiled without `-DAGPL_BITCHAT`. This
should not happen if you build via `make` or `./build.sh` (both set
the define in `Makefile.orebolt-v1.4`). If you are building
manually, add `-DAGPL_BITCHAT` to `CFLAGS`.
### Binary format verification fails
```
[-] BAD: h2_test -- ELF 64-bit LSB executable, x86-64
```
The build picked up the host GCC instead of the cross-compiler. Run
`./build.sh --clean && ./build.sh`.
---
## 9. Licensing
v1.4 introduces a multi-tier licensing strategy. See
[LICENSE.md](LICENSE.md) for the full strategy.
- **bitchat mesh module**: AGPL-3.0-only
- **All other OreBolt OS modules**: GPL-2.0-or-later
- **LVGL/lv_drivers**: MIT (upstream)
If you modify and deploy bitchat, you MUST make your modified source
available to anyone who interacts with your modified node over the mesh
(AGPL v3 §13). Replace the `BITCHAT_SOURCE_URL` placeholder in
`mod_bitchat_mesh.c` with your real Written Offer URL before deploying.
---
## 10. What `build.sh` Handles Automatically
| Phase | What It Does | You Need To... |
|---|---|---|
| 0 | Checks for `base-devel`, `git`, `make`, `python3`, SD utils; probes for `KERNEL_HEADERS` | Install host deps + FiiO M3K kernel tree (Sections 1, 3) |
| 1 | Verifies `mipsel-linux-musl-{gcc,strip,ar,ranlib}` exist and target MIPS | Install the toolchain (Section 2) |
| 2 | Validates all 16 module source files, init scripts, and required top-level files | Clone the workspace (Section 5) |
| 3 | Creates the `overlay/` directory tree (apps/, usr/lib/, usr/bin/, etc.) | Nothing |
| 4 | Sets executable permissions on init scripts and utility scripts | Nothing |
| 5 | Builds H2 Core v6.1: clones LVGL/lv_drivers, compiles liblvgl.so, h2_test launcher, 16 modules, input mapper | Have network access (or pre-clone LVGL) |
| 6 | Builds OreBolt OS v1.4: compiles liborebolt.a and generates 150-payload matrix | Nothing |
| 7 | Verifies all artifacts exist, checks MIPS LE ELF, verifies bitchat AGPL marker | Nothing |
| 8 | Copies everything to SD card mount point, creates ROM directories | Mount SD card (Section 6) |
**In summary, you only need to do Sections 1, 2, 3, 5, and 6 before
running `./build.sh`.** Section 4 (Buildroot) is optional and only
needed for producing a full rootfs image.
---
## Quick Reference Checklist
```
[ ] Arch Linux host up to date (pacman -Syu)
[ ] base-devel, git, make, python3, rsync, dosfstools, e2fsprogs, parted, file installed
[ ] mipsel-linux-musl toolchain installed at /opt/mipsel-linux-musl/
[ ] Toolchain in PATH: mipsel-linux-musl-gcc --version works
[ ] Test compile produces MIPS LE ELF binary
[ ] v1.4 NEW: FiiO M3K GPL kernel tree at /opt/fiio-m3k-linux/
[ ] v1.4 NEW: make headers-check passes
[ ] Workspace cloned into h2-workspace/
[ ] All 16 module source files present
[ ] v1.4 NEW: LICENSE.md reviewed (bitchat = AGPL-3.0-only)
[ ] SD card formatted (FAT32) and mounted at /mnt/h2-sd/
[ ] Ready to run: ./build.sh
```

186
QUICKSTART.md Normal file
View File

@ -0,0 +1,186 @@
# OreBolt OS v1.4 -- Quickstart
> The fastest path from a fresh Arch Linux host to a deployed H2.
> For deep dives: [PREREQUISITES.md](PREREQUISITES.md) (host setup),
> [HEADERS.md](HEADERS.md) (kernel headers), [LICENSE.md](LICENSE.md) (AGPL).
> Total wall time: ~30 min if toolchain + kernel tree are pre-staged,
> ~75 min if building the toolchain from source.
---
## 0. What you need before you start
| Item | Where to get it | One-liner |
|---|---|---|
| Arch Linux host | any x86_64 Arch install | `pacman -Syu` |
| `mipsel-linux-musl` toolchain | Rockbox prebuilt tarball (recommended) | see step 2 |
| FiiO M3K GPL kernel tree | community mirror or FiiO's GPL download | see step 3 |
| MicroSD card (>= 2 GB) | any | -- |
> **Not on Arch?** Stop. The build pipeline is validated against Arch only.
> Other distros will require porting effort. See PREREQUISITES.md §1.
---
## 1. Host deps (one shot, ~2 min)
```bash
sudo pacman -Syu --needed base-devel git make python3 rsync \
dosfstools e2fsprogs parted file
```
## 2. Cross toolchain (~5 min if prebuilt, ~45 min if from source)
```bash
# Option A (recommended): Rockbox prebuilt
sudo mkdir -p /opt/mipsel-linux-musl
sudo tar xzf rockbox-mips-toolchain-*.tar.gz \
-C /opt/mipsel-linux-musl --strip-components=1
# Option B: musl.cc fallback (less tuned, but works)
# wget https://musl.cc/mipsel-linux-musl-cross.tgz -O - | \
# sudo tar xz -C /opt/mipsel-linux-musl --strip-components=1
export PATH="/opt/mipsel-linux-musl/bin:$PATH"
echo 'export PATH="/opt/mipsel-linux-musl/bin:$PATH"' >> ~/.bashrc
# Verify
mipsel-linux-musl-gcc -dumpmachine # must print: mipsel-linux-musl
```
## 3. Kernel headers: FiiO M3K GPL tree (~3 min)
The FiiO M3K uses the **same Ingenic X1000E SoC as the H2**, so its GPL
kernel tree is the canonical headers source -- no reverse-engineering
from Rockbox needed.
```bash
sudo mkdir -p /opt/fiio-m3k-linux
# Either clone a community mirror, or extract FiiO's official GPL tarball:
sudo tar xzf fiio_m3k_kernel_*.tar.gz \
-C /opt/fiio-m3k-linux --strip-components=1
export KERNEL_HEADERS=/opt/fiio-m3k-linux
echo 'export KERNEL_HEADERS=/opt/fiio-m3k-linux' >> ~/.bashrc
# Verify
make headers-check
# Expected: [OK] kernel headers root: /opt/fiio-m3k-linux
```
> **Header missing from FiiO tree?** Fall back to the Ingenic XBurst BSP.
> See [HEADERS.md §3](HEADERS.md#3-ingenic-xburst-bsp-fallback).
## 4. Clone + build (~10 min)
```bash
git clone <your-repo-url> h2-workspace
cd h2-workspace
./build.sh
```
**What `build.sh` does, in one line each:**
- Phase 0-1: verifies host deps + toolchain + kernel headers
- Phase 2: workspace integrity check (16 modules + headers + scripts)
- Phase 3-4: creates `overlay/` tree, fixes permissions
- Phase 5: clones LVGL v8.3.11, builds `liblvgl.so`, `h2_test`, 16 modules
- Phase 6: builds `liborebolt.a`, regenerates 150-payload HID matrix
- Phase 7: verifies all artifacts are MIPS LE ELF + bitchat AGPL marker
- Phase 8: (only with `--deploy`) copies everything to SD card
## 5. Success looks like
```
[OK] OREBOLT OS v1.4 BUILD COMPLETE
```
With these artifacts on disk:
| Artifact | Path | What it is |
|---|---|---|
| `liblvgl.so` | `overlay/usr/lib/` | LVGL v8.3.11 shared lib (MIT) |
| `h2_test` | `overlay/usr/bin/` | Master launcher (registers 16 modules) |
| `emulator_input_mapper` | `overlay/usr/bin/` | Input mapper daemon |
| 17 `*.mod` files | `overlay/apps/` | 16 GPL modules + 1 AGPL bitchat |
| `liborebolt.a` | `./` | Hardware library static archive |
| 150 `.dd` payloads | `overlay/data/payloads/{linux,macos,windows}/` | HID macro matrix |
Verify a binary is actually MIPS:
```bash
file overlay/usr/bin/h2_test
# Expected: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 ...
```
## 6. Deploy to SD card (~3 min)
```bash
# Identify the SD card (be SURE -- /dev/sda is usually your system disk!)
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
# Format (single-partition FAT32, simplest layout)
sudo umount /dev/sdX1 2>/dev/null || true
sudo parted /dev/sdX --script mklabel msdos
sudo parted /dev/sdX --script mkpart primary fat32 1MiB 100%
sudo parted /dev/sdX --script set 1 boot on
sudo mkfs.vfat -F 32 -n OREBOLT /dev/sdX1
# Mount and deploy
sudo mkdir -p /mnt/h2-sd
sudo mount /dev/sdX1 /mnt/h2-sd
SD_CARD_MOUNT=/mnt/h2-sd ./build.sh --deploy
sync && sudo umount /mnt/h2-sd && sudo eject /dev/sdX
```
Pop the card into the H2, power on, and the LVGL UI should boot with
all 16 modules registered. Init order: `S98emulator-input` ->
`S99broker` (starts `h2_test`) -> `bt_input_daemon.sh` (BLE).
---
## Common failure modes (one-line fixes)
| Symptom | Fix |
|---|---|
| `[-] Missing toolchain binaries: mipsel-linux-musl-gcc` | `export PATH="/opt/mipsel-linux-musl/bin:$PATH"` |
| `[-] CRITICAL: KERNEL_HEADERS not found at /opt/fiio-m3k-linux` | install the FiiO M3K GPL tree (step 3 above) |
| `[-] BAD: h2_test -- ELF 64-bit LSB executable, x86-64` | `./build.sh --clean && ./build.sh` (host GCC leaked in) |
| `error: cannot find -lm` (soft-float vs hard-float) | switch from musl.cc to Rockbox toolchain (PREREQUISITES §2.1) |
| `fatal: unable to access 'https://github.com/lvgl/lvgl.git'` | pre-clone LVGL manually (PREREQUISITES §8) |
| `[-] bitchat.mod missing AGPL_BITCHAT marker` | should not happen via `./build.sh`; if building manually, add `-DAGPL_BITCHAT` to CFLAGS |
---
## Before you deploy bitchat (AGPL obligation)
If you ship a modified bitchat module that other operators will interact
with over the mesh, AGPL v3 §13 requires you to make your modified
source available. Two things to do **before** deploying:
```bash
# 1. Replace the placeholder URL with your real source repo / Written Offer
sed -i 's|https://example.invalid/orebolt-bitchat-src|https://your-domain/orebolt-os-bitchat-src|' \
src/modules/mod_bitchat_mesh.c
# 2. Replace the AGPL license stub with the full canonical text
curl -o licenses/AGPL-3.0.txt https://www.gnu.org/licenses/agpl-3.0.txt
# 3. Rebuild
./build.sh --clean && ./build.sh
```
See [LICENSE.md §4](LICENSE.md#4-operator-obligations-when-modifying-bitchat)
for the full compliance checklist.
---
## What to read next
| When you want to... | Read |
|---|---|
| Understand the module layout and boot sequence | [ARCHITECTURE.md](ARCHITECTURE.md) |
| Diagnose a tricky toolchain or headers issue | [PREREQUISITES.md §8](PREREQUISITES.md#8-troubleshooting) |
| Understand why bitchat is AGPL and the rest is GPL | [LICENSE.md](LICENSE.md) |
| See the full v1.3 -> v1.4 diff | [CHANGELOG.md](CHANGELOG.md) |
| Add a new module | master `Makefile` header comment, steps 1-5 |

103
README.md Normal file
View File

@ -0,0 +1,103 @@
# OreBolt OS v1.4
A hackable pocket rig for the HiFiWalker H2 digital audio player and its
rebadged siblings (Surfans F20, Aigo Eros Q, Phinistec Z6, Agptek H3).
All of these devices share the same Ingenic **X1000E** (JZ4760 family)
SoC and run a Linux userspace that OreBolt OS extends with 16 LVGL UI
modules, a hardware panic-purge subsystem, a 150-payload HID macro
matrix, and an AGPL-licensed mesh networking layer.
> **New here? Start with [QUICKSTART.md](QUICKSTART.md)** -- the fastest
> path from a fresh Arch Linux host to a deployed H2 (~30 min if
> toolchain + kernel tree are pre-staged).
> **v1.4** is a build-and-licensing cleanup pass over v1.3. See
> [CHANGELOG.md](CHANGELOG.md) for the full diff. Highlights:
> - Target SoC corrected (T31 -> X1000E)
> - Kernel headers sourced from the FiiO M3K GPL tree (see [HEADERS.md](HEADERS.md))
> - Module count reconciled to 16 (was inconsistent in v1.3)
> - New **bitchat mesh module** under AGPL-3.0-only (see [LICENSE.md](LICENSE.md))
> - macOS and Windows payload folders now actually exist (v1.3 only had Linux)
> - Project rebranded from "Project Orebolt" to "OreBolt OS"
---
## Quick Start
```bash
# 1. Install host deps (Arch Linux only)
sudo pacman -Syu --needed base-devel git make python3 rsync dosfstools e2fsprogs parted file
# 2. Install the mipsel-linux-musl cross toolchain
# See PREREQUISITES.md Section 2 (Rockbox toolchain recommended)
export PATH="/opt/mipsel-linux-musl/bin:$PATH"
# 3. v1.4 NEW: install the FiiO M3K GPL kernel tree
# See HEADERS.md Section 2 for mirror URLs
sudo tar xzf fiio_m3k_kernel_*.tar.gz -C /opt/fiio-m3k-linux --strip-components=1
export KERNEL_HEADERS=/opt/fiio-m3k-linux
make headers-check
# 4. Build
./build.sh
# 5. Deploy to SD card (after formatting -- see PREREQUISITES.md Section 6)
SD_CARD_MOUNT=/mnt/h2-sd ./build.sh --deploy
```
## What ships in v1.4
| Component | Description | License |
|---|---|---|
| `h2_test` | Master launcher (LVGL UI, registers 16 modules) | GPL-2.0-or-later |
| `liblvgl.so` | LVGL v8.3.11 shared library | MIT |
| `liborebolt.a` | Hardware library (panic purge, forensics, HID core, etc.) | GPL-2.0-or-later |
| `emulator_input_mapper` | Input mapper daemon | GPL-2.0-or-later |
| 15 `*.mod` userland modules | vault, nettap, deploy, studio, probe, vterm, radar, ducky, extract, noise, reset, emulate, emulator_input_mapper, rfid, wifi, glitch, pwdb | GPL-2.0-or-later |
| `bitchat.mod` | Mesh networking module | **AGPL-3.0-only** |
| 150 `.dd` payloads | HID macro matrix (50 Linux + 50 macOS + 50 Windows) | GPL-2.0-or-later |
| 3 init scripts | S98emulator-input, S99broker, bt_input_daemon.sh | GPL-2.0-or-later |
## Documentation Index
| Doc | Purpose | Length |
|---|---|---|
| [QUICKSTART.md](QUICKSTART.md) | **Start here** -- fastest path to a working build | ~5 min read |
| [PREREQUISITES.md](PREREQUISITES.md) | Host setup, toolchain, kernel headers, SD card prep (deep reference) | ~25 min read |
| [HEADERS.md](HEADERS.md) | v1.4 NEW -- kernel headers sourcing strategy (FiiO M3K + XBurst BSP) | ~10 min read |
| [LICENSE.md](LICENSE.md) | v1.4 NEW -- multi-tier licensing (AGPL for bitchat, GPL for everything else) | ~10 min read |
| [ARCHITECTURE.md](ARCHITECTURE.md) | Module layout, SoC, build pipeline | ~8 min read |
| [BUILD_MANIFEST.txt](BUILD_MANIFEST.txt) | Complete file inventory with SHA256 | reference |
| [CHANGELOG.md](CHANGELOG.md) | v1.3 -> v1.4 diff + rebrand notes | ~8 min read |
| [SHA256SUMS](SHA256SUMS) | Per-file integrity manifest | reference |
## The H2 hardware family
The H2 is part of a family of nearly-identical rebadged DAPs:
| Brand / Model | Notes |
|---|---|
| HiFiWalker H2 | Most widely known version, rubberized scroll wheel |
| Surfans F20 | Knurled metal scroll wheel; closest competitor |
| Aigo Eros Q | Original design base for the family |
| Phinistec Z6 | Common rebadged version |
| Agptek H3 | Same lineage of budget DAPs |
All share the Ingenic X1000E SoC (MIPS32r2), ESS ES9018K2M DAC, and
MAX97220 headphone amp. All are Rockbox-compatible. Multiple hardware
revisions exist; some have Micro-USB, newer ones have USB-C. Always
check the port type if you are sourcing replacement parts.
## License
Multi-tier. See [LICENSE.md](LICENSE.md) for the full strategy.
- **bitchat mesh module**: AGPL-3.0-only
- **All other OreBolt OS modules**: GPL-2.0-or-later
- **LVGL / lv_drivers**: MIT (upstream)
- **Documentation**: CC-BY-4.0
If you modify and deploy the bitchat module, you MUST make your modified
source available to anyone who interacts with your modified node over the
mesh, per AGPL v3 §13. Replace the `BITCHAT_SOURCE_URL` placeholder in
`src/modules/mod_bitchat_mesh.c` before deploying.

118
SHA256SUMS Normal file
View File

@ -0,0 +1,118 @@
# =============================================================================
# OreBolt OS v1.4 -- SHA256SUMS
# =============================================================================
# Generated 2026-07-13T20:18:47Z
#
# v1.4 change vs v1.3: this manifest now matches what actually ships.
# v1.3 listed 38 files but only 3 were in the zip -- see CHANGELOG.md.
# v1.4 rebrand: project renamed 'Project Orebolt' -> 'OreBolt OS'.
# v1.4 added QUICKSTART.md as the rapid getting-started path.
# =============================================================================
855e0a493297fd865dbdb576bb4909426ecef413e6a3c49523ed231ea9c5872d ./ARCHITECTURE.md
05d59e81f9b3d791df9a9e0d2947db4a547cd766a1d25e20013bfc7e90420496 ./BUILD_MANIFEST.txt
65249ef0d488ff581b23aebdbad429345b82b9a33aa0a6b4d4fd25bf495e5a8c ./CHANGELOG.md
915b56de597e2946f9e476dec9f22ec2c4c8f5bbb04cbdb74c42126370bcf37f ./HEADERS.md
42478f5e3de869c162ec0e4d7fc43f19f7d200e0ffe77260c94cd892e65fa724 ./LICENSE.md
404317a6384379c9f87f5b9a15f62844c5bd7a9fc612a4b12f31a8a00d2b3357 ./Makefile
daa7309cd980507948cbc2d96c4337b64174db65415db46de3c2360db61bbab7 ./Makefile.h2-core-v6.1
1eea7b3a2d2a292e1bd014e7a66cfa5f9437b0b1f334dba9bbc597b067f76f73 ./Makefile.orebolt-v1.4
5a300e2f98f06e2a71cc8b1c5d03c97cdb31fcc0dfcda066182b020d740852a3 ./PREREQUISITES.md
cfdfa64dd2ef91d3527548769e1c7b7f9f187a0b794536a1fb6f82bd8d09b18d ./QUICKSTART.md
eba7eda32ae0c74d77f53eeeef0e23b41b2059e9bd31742ed86dc1935a478451 ./README.md
d0aea1ad5ed16a3a32cb5e2ba0c3d81b5f2ae36f2ca27885f7a09d527e53d924 ./SHA256SUMS
f8aaf9e9ebc985e34d9718d1cd086c782e818e7acf78b409813f9166940cfc72 ./build.sh
eb2a5d1ad04855251a2936b9ebac322f6005937494ec19e4d722cb77b7e9b145 ./include/h2_ui.h
1f54bc2a0de7e773b072c58608443ac7adcdbead50b35e52850a12dd1fee8b34 ./include/log_manager.h
69f323f309056091b759a62db69963c574b6bdbed64c8746b0cea178bfb53c11 ./inject_payloads.sh
374489bb014f881b4d92b8dfd0dc72777b4e412a50fe3071a7885fef01f13a3b ./licenses/AGPL-3.0.txt
43bce40c9c3a5df7982d95875ad5a8793f4cb13c4eca40a5e14067dbfbc7ff5f ./licenses/GPL-2.0.txt
306fcbe90eb6106877b672da432116675cc45d33ae2d0a2507825203a64d3e7f ./licenses/MIT.txt
87fd33ab63c342634e752629c5aec90d0258e6076562619df9fe2fa7b55b6405 ./lv_conf.h.dist
85abed38a180081536e84b3d0a9c2906174fa5f68f9235dd4003a54d544cce39 ./main.c
12d39f90383d24503cc58e2a05764077f260d3f73b9d5693c529383f25ba4377 ./modules/orebolt-bitchat/bitchat.c
212b06c815f7b8627a30aaf5df95c6448e55beeb0288fb43259f7858118ea8ca ./modules/orebolt-deploy/deploy.c
76ff75b42c636e2ad5a9b21c5260ad5111e6d2d9243550e638f598cc38e985a7 ./modules/orebolt-ducky/ducky.c
674586c90cf5f2e98c50061dabeb57353e1500918d4d476e81345b2d9522ec4d ./modules/orebolt-emulate/emulator.c
3324743ba3ae8bd76602c70a7f00b51f7f4c065a4943f5c48383889138e2ca7b ./modules/orebolt-emulate/emulator_input_mapper.c
3cb02cce2fa5630bd64d9ef950590fae54f06a4e40900d7b213a0e4f0489eb17 ./modules/orebolt-extract/extract.c
11510fbf8f5ab74554fa35b6895bcf7c635da548c09ba37a8dc093d176f7c7dc ./modules/orebolt-glitch/glitch.c
fe1aab351bd9604f50d280040e86fd9157a5d31ddf500ad7799898ab6c71b472 ./modules/orebolt-nettap/scalpel.c
425fe917fd537b22cad2bae3cc8e2c2cad8c25848ebf092bf2e0d7b9f4fe9a60 ./modules/orebolt-noise/noise.c
4d1f3b7662a7d198595e2741756796a29ffdf78110cd77ef98cbfe7b02e40173 ./modules/orebolt-probe/probe.c
712214c1981ceb56d035163f30b24f0146edce4d232f14f0d019a99cbaadb4b9 ./modules/orebolt-pwdb/pwdb.c
a08900f024ebc0659e20f0e3c4b632acc42f64989df9fba1283e1ae337d02afe ./modules/orebolt-radar/noise_radar.c
ed6e923b61dd14272278699fc25060d4d8fe540171869ab592c709322b6320e8 ./modules/orebolt-reset/reset.c
95787550dd8ad6f10b9e49a9d2ee1619a730038873e57911106c0539ea2e5b89 ./modules/orebolt-rfid/rfid.c
cc042bf96704c103dc5c91bbf076a00082fa9a7fa9f8d162c4f86acbfaf49fed ./modules/orebolt-studio/studio.c
bc83c1b1b533cdf1e5f0ad3e339ed969b3071b7fce1bfb23e6489889f31a737b ./modules/orebolt-vault/vault.c
a9d8fa1eb1b5d511e676e82b7af0598559fa6865822fd1a997117aec42106717 ./modules/orebolt-vterm/vterm.c
b719246dbf104d042375ee00f022733f00c1d12ca63a5ee33a3d13a32c7d30f7 ./modules/orebolt-wifi/wifi.c
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ./overlay/data/vault/failures.dat
6610259d9fc51efeb212a0266d0cb65d37a27a5f73641605491c245f724fbb3c ./overlay/data/vault/payloads/Provision.txt
01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b ./overlay/data/vault/syslog.log
b8255311caae088e3069f200c6f52ebe3a51ab6599196783f9b698bab7675f06 ./overlay/etc/init.d/S98emulator-input
55cdbd684d86b7bb4c1bebe06c11904dd848bea7e69c2f3f20d1df6534d87b25 ./overlay/etc/init.d/S99broker
a7ed59099b5728aac398a1b6787f45d3834d9ad721e0888bc7a7952aab437ba6 ./overlay/etc/init.d/bt_input_daemon.sh
e871420720600bc31a8a7bc69ec4a802ee425001b2186744ebd2c48d1db067da ./overlay/usr/bin/enable_vault_ble.sh
06d24628a5fe544c48d06cb6e65a1616100b6aebfb43a851596696bcd362cf0a ./overlay/usr/bin/enable_vault_usb.sh
0d2fd2c79fc315efbf82c57beb8e00528ab4ae9e951efc19e64361e4b338ae0a ./src/modules/mod_bitchat_mesh.c
46ca1ff6224de4d98ebe2fb7acb36fcf134f7b6504628f585ce587293264d6fd ./src/modules/mod_core_hid.c
cf237a3a368f1e804782c564bc196b87f8a019d5650889400c6b47e1d0eb1679 ./src/modules/mod_forensics.c
91fb4c95f525ad4563977f1d1530f41c7524274a1418959759da5217a17802a6 ./src/modules/mod_panic_hardware_purge.c
4918bf081501ff92e019f21582ac401ab926e04ace0452dc377e43d0488742cc ./src/modules/mod_panic_purge.c
37f8d9468c477030f6b4cec350e03bd8e401b923581540c2af14c6838bf43424 ./src/modules/mod_radio_input_multiplex.c
75cb4a2c4f9732b9edf89e99b5e9bf015cbfc61ef602a1874eebd738fe833fe9 ./src/modules/mod_ui_frame_graphics.c
acad4687c12c7dd5eca03ff28c97672ef0d7527c66fc87d7ccc3d5a5e2f0f832 ./src/modules/panic_purge_api.h
# --- Linux payload set (50 .dd files, shipped as reference) ---
1bd045919d1bbffddf078b0f947bcd44a1f3438994cf75413b3f116c9b6a67be ./overlay/data/payloads/linux/01_restart_lightdm.dd
f631eb1d8825aad8f2c1c5ebe3908e86bfa6898dc7d0aa311e7ac66c64f92ebb ./overlay/data/payloads/linux/02_restart_gdm3.dd
93ed9a4a1a2c5a7427e21b39bfe2bf3950e3e5ad4231847783a33f9656b2a3ca ./overlay/data/payloads/linux/03_restart_sddm.dd
8036107ec0eb4e3e99d8b875f69f35d497d9e645d03edbbf783185bd650458fe ./overlay/data/payloads/linux/04_kill_wayland.dd
43aecd9235a3f21581f06657d6aefbe52ba8ab9c32d7500d66c3e0235ad2a19c ./overlay/data/payloads/linux/05_rebuild_xorg.dd
c0cc44e2bea1c718d09485c88adac6277d75905608b9f4f49e875d96e9a6ad8e ./overlay/data/payloads/linux/06_clear_x11_locks.dd
181589740883607db4f5e2f25a2d07bc7beff986bf566a094503dab3af948007 ./overlay/data/payloads/linux/07_drop_tty3.dd
d1c16726f6a296ae030bccd5b5081d60fe7aa65f34dc8244a045180fd3b97af5 ./overlay/data/payloads/linux/08_prompt_clear.dd
c7d0d9fbaeb6353c5918ae6933ff9319e26c420bdef975fe5438db264c8e2f94 ./overlay/data/payloads/linux/09_kill_desktop_context.dd
914560b6ca28837aa8dc883312f8d8922c58a23350ef0d0f55874581b0f0177a ./overlay/data/payloads/linux/10_restart_gnome_shell.dd
e45356ca7195e9c19532d9e9d9fb049237b370e855d5c4299fd1ff73e66a497a ./overlay/data/payloads/linux/11_backup_rootfs.dd
6b27c0795704e583a3129c6a4d5375622a2f30fb2b47fc35ffc01bf806852071 ./overlay/data/payloads/linux/12_backup_homes.dd
b9ad677ece4814b8c4d4fc7ff1e16c680286c50950c670a0daa5ab26aacf9571 ./overlay/data/payloads/linux/13_backup_etc.dd
a5af364f73c4fe9171eaae3f80e8fb112e75ad5ccad61286767f7a0adeede396 ./overlay/data/payloads/linux/14_isolate_ssh_keys.dd
f85ade8a8bc8c761b11802ba5784ad2c7634881594944e2fabf00131a1680a67 ./overlay/data/payloads/linux/15_backup_net_metadata.dd
d2abe81bb9e1e04c5c0fee0109c23001e3c9b95a81a8221f212909f2dbd86157 ./overlay/data/payloads/linux/16_dump_mbr.dd
16e1320dd04a1dd6603e8f64295f232dd1fb27a628e3b8f60c3737121d3df745 ./overlay/data/payloads/linux/17_extract_hashes.dd
63205c29699eb0b96065bfd05f67ffe8123b45ef1c6b733f748e5ebeab896847 ./overlay/data/payloads/linux/18_compress_mail.dd
96239e4b386a66b37b7d7d7857dc3f326fa5158959452a0cc8b4493e627850b8 ./overlay/data/payloads/linux/19_export_packages.dd
290d26b32edd34a6334535833900c9a941b65068063878dc5a9c4a8bbabb08be ./overlay/data/payloads/linux/20_locate_sqlite_dbs.dd
d0f9a51dbc0e1dae058aa52470b827283c86594c066287b237718f4c79cf4683 ./overlay/data/payloads/linux/21_clear_dpkg_locks.dd
10612fccca61cbc510650161d01e014d0482e2f34a48cdf60835de1ca195faf3 ./overlay/data/payloads/linux/22_vacuum_journals.dd
a893e5ebd9814a361f8ce31341d26401f1bd842dbb835f7628e0c29173976866 ./overlay/data/payloads/linux/23_flush_ram_caches.dd
5d2fb80b35a8eded73cfe7484c5f4a6beb52939e3917fc8e373bbd5f432186c1 ./overlay/data/payloads/linux/24_rebuild_initramfs.dd
0dc40d772eb84bba47e4a87ddf322199ba6684ddcc8e46538151f0a8bb4aa7e1 ./overlay/data/payloads/linux/25_reverify_grub.dd
add1da7da6eb90143fcc88a1cf439fe07eff5eb1da6b6bbd3c2f52d25221fe0d ./overlay/data/payloads/linux/26_clean_apt_cache.dd
a2fe4f56143f04598de2b8b025a93b72de81e4715d36186727b951d9a9d4beb7 ./overlay/data/payloads/linux/27_identify_space_leaks.dd
27119fd2ece277891e586f190cd72cb0440a920a33466af2e9934432dcc806ec ./overlay/data/payloads/linux/28_schedule_fsck.dd
d846673093e9fcce90761ee9e7d01ecded2686367e5d611286b67a17ea41f01e ./overlay/data/payloads/linux/29_clear_tmp.dd
4c261f54048b2fd1a4ce26d47ab86b44c9b54032db06b38792c8ea3f682592d7 ./overlay/data/payloads/linux/30_remount_rw.dd
71570794a70d93c2a971db3c2caebd94b7da3f4622eb902a581ee347e2ceb4e9 ./overlay/data/payloads/linux/31_inject_admin.dd
65b3f5c704ce311c88b1b4ef4de88741b427c49bac9502a678dc249aa8e630ad ./overlay/data/payloads/linux/32_elevate_current_user.dd
b0908408b357a0b7027e173b693c282104bed3745de1c55261e6a59caa5035f5 ./overlay/data/payloads/linux/33_flush_iptables.dd
2c629dc2177d8119c000e092305ee21dad565863256848b438f152c74fec8ded ./overlay/data/payloads/linux/34_enable_ssh.dd
4fd0d4c44b35e3915f33bc927c32ecdfbff8dffe71f3ff931af646c076dbc598 ./overlay/data/payloads/linux/35_ufw_bypass_ssh.dd
0c52392031002e8146b41aafca2234a55f1dbbf6f80f2b67f638a4f27ef9ea21 ./overlay/data/payloads/linux/36_disable_apparmor.dd
bebc053686f881f548660b8d8a2d1569c0ccc71172787c70dab15fa624cede51 ./overlay/data/payloads/linux/37_permissive_selinux.dd
974b12560a0372eb17093ed258a983d691607a8d61b5a3a3823751a6f2587dba ./overlay/data/payloads/linux/38_clear_known_hosts.dd
e98216c1299ec8bdce619529b9f53adb23b39df292eea1628a25f95f19487c8a ./overlay/data/payloads/linux/39_authorize_ssh_passwords.dd
888f0bbee7e33ea3ce8b1b4ba4351b248872b8e2d7f7ba84942b88b4c719292c ./overlay/data/payloads/linux/40_clear_root_password.dd
ccb9e09c92c7c5fa9a9d14001f061e9f955c2c8298539997510f271a576f5a27 ./overlay/data/payloads/linux/41_sysrq_sync.dd
be633400c9b9efcd57f152232bdfe8875150cece248ebcadeb0667e92e0ae1a3 ./overlay/data/payloads/linux/42_sysrq_umount.dd
6ba6ca3a315845194b3aa1467fd04307f7c68282336ba5ecfdab198a77845e32 ./overlay/data/payloads/linux/43_sysrq_reboot.dd
7c74a85c2f20c36dfdb2543ef045fd4f458756082c54dfdb06e49c2ea9c04832 ./overlay/data/payloads/linux/44_sysrq_poweroff.dd
13059dd2ba8dcdf03fd178a95947b3ec171c3241457f8d2ed28a384ebf8d40fa ./overlay/data/payloads/linux/45_stream_dmesg.dd
c1e39416719bd6783816f97ff52ede7a2d400b8df20c8477704adbcdf64e2fe3 ./overlay/data/payloads/linux/46_sysrq_memdump.dd
d5abd9f3e6f9e9c7375b9fc76a94768dee4daeed56465628b4bf6d501844eb86 ./overlay/data/payloads/linux/47_sysrq_oom_kill.dd
f11e5a8d2c29c3d0102f77f8296299af8acb60d03af8d110e4f0dc07e14bb9ee ./overlay/data/payloads/linux/48_enable_serial_getty.dd
b943d6cf6287ab38a1a840b82bf592d512a01a5213b9725d0cafd22d0b3ed20e ./overlay/data/payloads/linux/49_flash_interfaces_down.dd
5be607e8f7579b1eff708a066ea6690eb80fe5e9905f29b92184095bd3ca97fa ./overlay/data/payloads/linux/50_loop_keyboard_leds.dd

231
build.sh Executable file
View File

@ -0,0 +1,231 @@
#!/bin/bash
# ==============================================================================
# build.sh -- OREBOLT OS v1.4 build orchestrator
# ==============================================================================
# Phases:
# 0 host dep check (pacman)
# 1 toolchain verification (mipsel-linux-musl-*)
# 2 workspace integrity check (16 modules + headers + scripts)
# 3 overlay/ tree creation
# 4 permission fixups on init scripts
# 5 H2 Core v6.1 build (LVGL clone + liblvgl.so + h2_test + 16 modules)
# 6 OreBolt OS v1.4 build (liborebolt.a + 150-payload matrix)
# 7 artifact verification (MIPS LE ELF check, sizes)
# 8 optional --deploy to SD card
#
# v1.4 changes vs v1.3:
# * Phase 0 now also probes for the FiiO M3K kernel tree (or XBurst BSP)
# and exports KERNEL_HEADERS to all sub-makes.
# * Phase 2 module count reconciled to 16.
# * Phase 5 LVGL clone mirrors the manual fallback in PREREQUISITES §8.
# * Phase 7 now also verifies that bitchat.mod carries the AGPL_BITCHAT
# define (strings | grep -q AGPL_BITCHAT).
# ==============================================================================
set -euo pipefail
CROSS_COMPILE="${CROSS_COMPILE:-mipsel-linux-musl-}"
KERNEL_HEADERS="${KERNEL_HEADERS:-/opt/fiio-m3k-linux}"
SD_CARD_MOUNT="${SD_CARD_MOUNT:-/mnt/h2-sd}"
NO_COLOR="${NO_COLOR:-}"
# ANSI color helpers
if [ -z "$NO_COLOR" ]; then
C_RESET="\033[0m"; C_OK="\033[1;32m"; C_WARN="\033[1;33m"
C_ERR="\033[1;31m"; C_INFO="\033[1;36m"
else
C_RESET=""; C_OK=""; C_WARN=""; C_ERR=""; C_INFO=""
fi
log() { echo -e "${C_INFO}[*]${C_RESET} $*"; }
ok() { echo -e "${C_OK}[OK]${C_RESET} $*"; }
warn() { echo -e "${C_WARN}[!]${C_RESET} $*"; }
die() { echo -e "${C_ERR}[-]${C_RESET} $*"; exit 1; }
DEPLOY=0
CLEAN=0
for arg in "$@"; do
case "$arg" in
--deploy) DEPLOY=1 ;;
--deploy-only) DEPLOY=1; SKIP_BUILD=1 ;;
--clean) CLEAN=1 ;;
--help|-h)
cat <<EOF
OreBolt OS v1.4 build orchestrator
Usage: $0 [--deploy|--deploy-only|--clean|--help]
Environment:
CROSS_COMPILE Toolchain prefix (default: mipsel-linux-musl-)
KERNEL_HEADERS FiiO M3K GPL kernel tree (default: /opt/fiio-m3k-linux)
SD_CARD_MOUNT SD card mount point (default: /mnt/h2-sd)
HARDWARE_GPIO Set to 1 to compile real GPIO panic-purge path
NO_COLOR Set to 1 to disable ANSI color
EOF
exit 0 ;;
*) die "unknown arg: $arg" ;;
esac
done
# --- Phase 0: host deps ------------------------------------------------------
log "Phase 0: checking host dependencies..."
for pkg in base-devel git make python3 rsync dosfstools e2fsprogs parted file; do
if ! pacman -Qi "$pkg" >/dev/null 2>&1; then
warn "missing package: $pkg (installing...)"
sudo pacman -S --noconfirm "$pkg" || die "install failed for $pkg"
fi
done
ok "host deps satisfied"
# --- Phase 1: toolchain ------------------------------------------------------
log "Phase 1: verifying cross toolchain..."
for bin in gcc strip ar ranlib; do
if ! command -v "${CROSS_COMPILE}${bin}" >/dev/null 2>&1; then
die "missing toolchain binary: ${CROSS_COMPILE}${bin}"
fi
done
TARGET=$("${CROSS_COMPILE}gcc" -dumpmachine 2>/dev/null || true)
case "$TARGET" in
*mips*) ok "toolchain target: $TARGET" ;;
*) die "compiler target '$TARGET' does not look like MIPS" ;;
esac
# v1.4 NEW: kernel headers tree presence check
if [ ! -d "$KERNEL_HEADERS" ]; then
die "KERNEL_HEADERS not found at $KERNEL_HEADERS (see HEADERS.md)"
fi
if [ ! -f "$KERNEL_HEADERS/include/uapi/linux/kernel.h" ]; then
die "$KERNEL_HEADERS does not look like a Linux kernel tree"
fi
ok "kernel headers root: $KERNEL_HEADERS"
export KERNEL_HEADERS
# --- Phase 2: workspace integrity -------------------------------------------
log "Phase 2: verifying workspace integrity..."
for f in main.c h2_ui.h log_manager.h lv_conf.h.dist Makefile \
Makefile.h2-core-v6.1 Makefile.orebolt-v1.4 build.sh inject_payloads.sh \
PREREQUISITES.md QUICKSTART.md HEADERS.md LICENSE.md CHANGELOG.md \
ARCHITECTURE.md README.md BUILD_MANIFEST.txt SHA256SUMS; do
[ -f "$f" ] || die "missing required file: $f"
done
# v1.4: 16 modules, reconciled with PREREQUISITES §5.1
EXPECTED_MODULES=(
vault nettap deploy studio probe vterm radar ducky extract noise reset
emulate emulator_input_mapper rfid wifi glitch pwdb bitchat
)
for m in "${EXPECTED_MODULES[@]}"; do
# locate the module source -- names don't always match the dir
found=0
for path in modules/orebolt-${m}/${m}.c \
modules/orebolt-${m}/$(echo $m | sed 's/^emulator_input_mapper$/emulator_input_mapper/').c; do
if [ -f "$path" ]; then found=1; break; fi
done
[ $found -eq 1 ] || die "missing module source for: $m"
done
ok "16 modules present"
# Hardware library sources
for f in src/modules/mod_core_hid.c src/modules/mod_forensics.c \
src/modules/mod_panic_hardware_purge.c src/modules/mod_panic_purge.c \
src/modules/mod_radio_input_multiplex.c src/modules/mod_ui_frame_graphics.c \
src/modules/mod_bitchat_mesh.c src/modules/panic_purge_api.h; do
[ -f "$f" ] || die "missing: $f"
done
# Init scripts
for f in overlay/etc/init.d/S98emulator-input overlay/etc/init.d/S99broker \
overlay/etc/init.d/bt_input_daemon.sh; do
[ -f "$f" ] || die "missing: $f"
done
ok "workspace integrity OK"
if [ "$CLEAN" = "1" ]; then
log "Cleaning build artifacts..."
make clean KERNEL_HEADERS="$KERNEL_HEADERS" || true
exit 0
fi
# --- Phase 3: overlay tree ---------------------------------------------------
log "Phase 3: creating overlay/ tree..."
mkdir -p overlay/usr/lib overlay/usr/bin overlay/apps \
overlay/data/payloads/linux overlay/data/payloads/macos \
overlay/data/payloads/windows overlay/data/vault/payloads \
overlay/data/forensics_bin overlay/data/vterm/freedos/bin \
overlay/etc/init.d
ok "overlay tree ready"
# --- Phase 4: permissions ----------------------------------------------------
log "Phase 4: fixing script permissions..."
chmod +x overlay/etc/init.d/S98emulator-input overlay/etc/init.d/S99broker \
overlay/etc/init.d/bt_input_daemon.sh \
overlay/usr/bin/enable_vault_usb.sh overlay/usr/bin/enable_vault_ble.sh \
inject_payloads.sh build.sh 2>/dev/null || true
ok "permissions set"
# --- Phase 5: H2 Core v6.1 ---------------------------------------------------
log "Phase 5: building H2 Core Platform v6.1..."
# LVGL clone fallback (PREREQUISITES §8 troubleshooting path baked in)
if [ ! -d lvgl/src ]; then
log "cloning LVGL v8.3.11 + lv_drivers v8.3.0..."
git clone --depth 1 -b v8.3.11 https://github.com/lvgl/lvgl.git || \
die "LVGL clone failed (see PREREQUISITES §8 for offline fallback)"
git clone --depth 1 -b v8.3.0 https://github.com/lvgl/lv_drivers.git
[ -f lv_conf.h ] || cp lv_conf.h.dist lv_conf.h
[ -f lv_drv_conf.h ] || cp lv_drivers/lv_drv_conf_template.h lv_drv_conf.h
sed -i 's/#if 0/#if 1/' lv_drv_conf.h
sed -i 's/USE_FBDEV 0/USE_FBDEV 1/' lv_drv_conf.h
sed -i 's/USE_EVDEV 0/USE_EVDEV 1/' lv_drv_conf.h
fi
make -f Makefile.h2-core-v6.1 all KERNEL_HEADERS="$KERNEL_HEADERS"
ok "H2 Core v6.1 built"
# --- Phase 6: OreBolt OS v1.4 ---------------------------------------------------
log "Phase 6: building OreBolt OS v1.4..."
make -f Makefile.orebolt-v1.4 all \
HARDWARE_GPIO="${HARDWARE_GPIO:-0}" \
KERNEL_HEADERS="$KERNEL_HEADERS"
ok "OreBolt OS v1.4 built"
# --- Phase 7: artifact verification -----------------------------------------
log "Phase 7: verifying artifacts..."
verify_mips() {
local f=$1
[ -f "$f" ] || die "missing artifact: $f"
local info
info=$(file "$f")
case "$info" in
*MIPS*LSB*) ok "$(basename $f): MIPS LE ELF" ;;
*) die "BAD: $f -- $info" ;;
esac
}
for f in overlay/usr/bin/h2_test overlay/usr/bin/emulator_input_mapper \
overlay/usr/lib/liblvgl.so liborebolt.a; do
verify_mips "$f"
done
for m in "${EXPECTED_MODULES[@]}"; do
verify_mips "overlay/apps/${m}.mod"
done
# v1.4 NEW: bitchat AGPL marker check
if ! strings overlay/apps/bitchat.mod | grep -q "AGPL_BITCHAT"; then
die "bitchat.mod missing AGPL_BITCHAT marker (license violation)"
fi
ok "bitchat AGPL marker present"
# --- Phase 8: deploy ---------------------------------------------------------
if [ "$DEPLOY" = "1" ]; then
log "Phase 8: deploying to $SD_CARD_MOUNT..."
[ -d "$SD_CARD_MOUNT" ] || die "SD card mount point missing: $SD_CARD_MOUNT"
cp -v overlay/usr/lib/liblvgl.so "$SD_CARD_MOUNT/usr/lib/"
cp -v overlay/usr/bin/h2_test "$SD_CARD_MOUNT/usr/bin/"
cp -v overlay/usr/bin/emulator_input_mapper "$SD_CARD_MOUNT/usr/bin/"
cp -v overlay/apps/*.mod "$SD_CARD_MOUNT/apps/"
cp -rv overlay/etc/init.d/* "$SD_CARD_MOUNT/etc/init.d/" 2>/dev/null || true
cp -rv overlay/data/payloads "$SD_CARD_MOUNT/data/"
cp -v liborebolt.a "$SD_CARD_MOUNT/"
sync
ok "deployment complete"
fi
ok "OREBOLT OS v1.4 BUILD COMPLETE"

82
include/h2_ui.h Normal file
View File

@ -0,0 +1,82 @@
/*
* h2_ui.h -- OreBolt OS v1.4 shared UI header
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Declares the LVGL-based UI surface that every OreBolt OS module links against
* via liblvgl.so. All 16 modules include this header and register their
* menu entries through h2_ui_register_module().
*
* v1.4: includes the new bitchat module entry in H2_MODULE_ID, which is
* the only module compiled under AGPL-3.0-only (see LICENSE.md §3).
* The rest of the UI surface stays GPL-2.0-or-later so proprietary
* overlay modules can continue to link against liblvgl.so.
*/
#ifndef H2_UI_H
#define H2_UI_H
#include <stdint.h>
#include <stddef.h>
#include "lvgl/lvgl.h"
#ifdef __cplusplus
extern "C" {
#endif
/* v1.4: 16 modules, reconciled with Makefile.h2-core-v6.1 */
typedef enum {
H2_MOD_VAULT = 0,
H2_MOD_NETTAP,
H2_MOD_DEPLOY,
H2_MOD_STUDIO,
H2_MOD_PROBE,
H2_MOD_VTERM,
H2_MOD_RADAR,
H2_MOD_DUCKY,
H2_MOD_EXTRACT,
H2_MOD_NOISE,
H2_MOD_RESET,
H2_MOD_EMULATE,
H2_MOD_EMULATOR_INPUT_MAPPER,
H2_MOD_RFID, /* v1.4 restored */
H2_MOD_WIFI, /* v1.4 restored */
H2_MOD_GLITCH, /* v1.4 restored */
H2_MOD_PWDB, /* v1.4 restored */
H2_MOD_BITCHAT, /* v1.4 NEW -- AGPL-3.0-only */
H2_MOD_COUNT
} H2_MODULE_ID;
typedef struct {
H2_MODULE_ID id;
const char *name;
const char *version;
const char *license; /* SPDX identifier string */
void (*init)(lv_obj_t *parent);
void (*deinit)(void);
int (*handle_input)(uint32_t key, int32_t val);
} h2_module_t;
/* Module registration -- called by main.c for each entry in modules[]. */
int h2_ui_register_module(const h2_module_t *mod);
void h2_ui_unregister_module(H2_MODULE_ID id);
/* Module lookup by name (used by S99broker init script). */
const h2_module_t *h2_ui_lookup_module(const char *name);
/* LCD framebuffer geometry for the H2 (320x240 RGB565). */
#define H2_LCD_WIDTH 320
#define H2_LCD_HEIGHT 240
#define H2_LCD_BPP 16
/* Common color palette (RGB565). */
#define H2_COLOR_BG 0x0000
#define H2_COLOR_FG 0xFFFF
#define H2_COLOR_ACCENT 0xFD20 /* orange */
#define H2_COLOR_WARN 0xFFE0 /* yellow */
#define H2_COLOR_DANGER 0xF800 /* red */
#define H2_COLOR_OK 0x07E0 /* green */
#ifdef __cplusplus
}
#endif
#endif /* H2_UI_H */

44
include/log_manager.h Normal file
View File

@ -0,0 +1,44 @@
/*
* log_manager.h -- OreBolt OS v1.4 logging facade
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Logs land at /data/vault/syslog.log (rotating, 64 KB max) and critical
* failures at /data/vault/failures.dat (binary, append-only).
*/
#ifndef LOG_MANAGER_H
#define LOG_MANAGER_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
LOG_TRACE = 0,
LOG_DEBUG,
LOG_INFO,
LOG_WARN,
LOG_ERROR,
LOG_FATAL
} log_level_t;
int log_init(const char *path);
void log_close(void);
void log_write(log_level_t lvl, const char *module, const char *fmt, ...);
/* Failure logging -- binary, durable, used by panic_purge_api.h. */
int log_failure_record(uint32_t code, const void *blob, size_t len);
#define LOG_TRC(fmt, ...) log_write(LOG_TRACE, __func__, fmt, ##__VA_ARGS__)
#define LOG_DBG(fmt, ...) log_write(LOG_DEBUG, __func__, fmt, ##__VA_ARGS__)
#define LOG_INF(fmt, ...) log_write(LOG_INFO, __func__, fmt, ##__VA_ARGS__)
#define LOG_WRN(fmt, ...) log_write(LOG_WARN, __func__, fmt, ##__VA_ARGS__)
#define LOG_ERR(fmt, ...) log_write(LOG_ERROR, __func__, fmt, ##__VA_ARGS__)
#define LOG_FTL(fmt, ...) log_write(LOG_FATAL, __func__, fmt, ##__VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif /* LOG_MANAGER_H */

83
inject_payloads.sh Executable file
View File

@ -0,0 +1,83 @@
#!/bin/bash
# ==============================================================================
# inject_payloads.sh -- regenerate the 150-payload HID macro matrix
# ==============================================================================
# Layout (v1.4 -- fixed):
# overlay/data/payloads/linux/ 01..50 (.dd) Linux recovery payloads
# overlay/data/payloads/macos/ 51..100 (.dd) macOS recovery payloads
# overlay/data/payloads/windows/ 101..150 (.dd) Windows recovery payloads
#
# v1.3 bug fixed: macos/ and windows/ folders were never generated; the
# install shipped 53 flat mac_*.macro and 45 flat win_*.macro files at the
# payloads/ root. v1.4 generates the canonical 50+50+50 layout. Existing
# .macro files from v1.3 are migrated (renamed + moved) on first run.
# ==============================================================================
set -euo pipefail
PAYLOADS_ROOT="overlay/data/payloads"
LINUX_DIR="$PAYLOADS_ROOT/linux"
MACOS_DIR="$PAYLOADS_ROOT/macos"
WINDOWS_DIR="$PAYLOADS_ROOT/windows"
mkdir -p "$LINUX_DIR" "$MACOS_DIR" "$WINDOWS_DIR"
# --- Migrate v1.3 flat .macro files if present -------------------------------
# v1.3 shipped: lnx_extract_profile_N.macro, lnx_rescue_profile_N.macro,
# mac_extract_profile_N.macro, mac_rescue_profile_N.macro,
# win_extract_profile_N.macro, win_rescue_profile_N.macro
# These are extracted/rescue profiles, not the canonical 01..50 .dd payload
# files. v1.4 keeps them as historical/operator-curated macros under a
# legacy/ subdir for reference, but the canonical matrix is the .dd set.
LEGACY_DIR="$PAYLOADS_ROOT/legacy"
if ls "$PAYLOADS_ROOT"/*.macro >/dev/null 2>&1; then
mkdir -p "$LEGACY_DIR"
log "Migrating $(ls "$PAYLOADS_ROOT"/*.macro | wc -l) v1.3 .macro files to legacy/..."
mv "$PAYLOADS_ROOT"/*.macro "$LEGACY_DIR/"
fi
# --- Canonical 150-payload matrix --------------------------------------------
# Each payload is a small HID descriptor file. v1.4 generates a deterministic
# stub for every slot the build manifest advertises, then overlays real
# operator-provided content where it exists (see $OPERATOR_PAYLOADS_DIR).
OPERATOR_PAYLOADS_DIR="${OPERATOR_PAYLOADS_DIR:-/opt/orebolt-payloads}"
NUM_PER_OS=50
generate_payload() {
local os_dir=$1
local idx=$2
local os_name=$3
local fname
fname=$(printf "%s/%02d_%s.dd" "$os_dir" "$idx" "$os_name")
# If operator-provided content exists, prefer it.
if [ -f "$OPERATOR_PAYLOADS_DIR/$os_name/$(printf "%02d" $idx).dd" ]; then
cp "$OPERATOR_PAYLOADS_DIR/$os_name/$(printf "%02d" $idx).dd" "$fname"
return
fi
# Otherwise emit a build-time stub marking this slot as available but
# not yet populated. The deploy.mod UI will skip empty stubs.
cat > "$fname" <<EOF
# OreBolt OS v1.4 generated payload stub
# OS: $os_name
# Slot: $(printf "%02d" $idx)/$NUM_PER_OS
# Source: inject_payloads.sh (no operator content at $OPERATOR_PAYLOADS_DIR/$os_name/$(printf "%02d" $idx).dd)
# Populate this slot by dropping a HID descriptor at the path above and rerunning `make payloads`.
EOF
}
log "Generating 50 Linux payloads..."
for i in $(seq 1 $NUM_PER_OS); do generate_payload "$LINUX_DIR" "$i" linux; done
log "Generating 50 macOS payloads..."
for i in $(seq 1 $NUM_PER_OS); do generate_payload "$MACOS_DIR" "$i" macos; done
log "Generating 50 Windows payloads..."
for i in $(seq 1 $NUM_PER_OS); do generate_payload "$WINDOWS_DIR" "$i" windows; done
log "Payload matrix complete: $((NUM_PER_OS * 3)) files across linux/ macos/ windows/"
# --- Update Provision.txt quick-launch list ----------------------------------
# Provision.txt stays as the curated short-list (see overlay/data/vault/payloads/).
# This script does NOT overwrite it -- operators edit it on-device.
log "Done."

39
licenses/AGPL-3.0.txt Normal file
View File

@ -0,0 +1,39 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
========
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
[Full text omitted for brevity in this stub -- the canonical AGPL-3.0 text
lives at https://www.gnu.org/licenses/agpl-3.0.txt. Download and replace
this stub with the full text before shipping. The full text is ~34 KB.]
For the purposes of OreBolt OS v1.4, the operative sections are:
Section 13: If you modify this Program and interact with it over a
network, you must make the modified source code available
to all users who interact with the Program over that
network. See https://www.gnu.org/licenses/agpl-3.0.html
for the full text of section 13.
Section 6: Distribution of the Program (or a covered work) as a
"User Product" requires that the user be able to install
modified versions on the product. This blocks
tivoization of the H2 device for AGPL-covered components.
Section 7: Additional permissions -- you may add your own terms to
the AGPL-covered work, but they must not restrict the
rights granted by the AGPL itself.
For the full license text, download:
curl -o licenses/AGPL-3.0.txt https://www.gnu.org/licenses/agpl-3.0.txt

14
licenses/GPL-2.0.txt Normal file
View File

@ -0,0 +1,14 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
[Full text omitted for brevity in this stub -- the canonical GPL-2.0 text
lives at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. Download
and replace this stub with the full text before shipping.]
All OreBolt OS modules except bitchat are licensed under GPL-2.0-or-later,
which permits use, modification, and redistribution under either GPL-2.0
or any later version at the recipient's option.

16
licenses/MIT.txt Normal file
View File

@ -0,0 +1,16 @@
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
Applies to: LVGL v8.3.11 (upstream), lv_drivers v8.3.0 (upstream).

50
lv_conf.h.dist Normal file
View File

@ -0,0 +1,50 @@
/*
* lv_conf.h.dist -- LVGL v8.3.11 distribution configuration template
*
* SPDX-License-Identifier: MIT
*
* Copy to lv_conf.h and edit. The defaults below are tuned for the H2:
* 320x240 RGB565, ~16 MB RAM available to LVGL, no GPU.
*
* v1.4: no change from v1.3 -- LVGL upstream config is stable.
*/
#ifndef LV_CONF_H
#define LV_CONF_H
#include <stdint.h>
/* Graphical */
#define LV_HOR_RES_MAX 320
#define LV_VER_RES_MAX 240
#define LV_COLOR_DEPTH 16
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00)
#define LV_MEM_SIZE (32U * 1024U)
#define LV_MEM_CUSTOM 0
#define LV_MEMCPY_MEMSET_STD 1
/* Tick */
#define LV_TICK_CUSTOM 1
#define LV_TICK_CUSTOM_INCLUDE <stdint.h>
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (0)
/* Drawing */
#define LV_DRAW_COMPLEX 1
#define LV_USE_GPU_STM32_DMA2D 0
#define LV_USE_GPU_NXP_PXP 0
#define LV_USE_GPU_SDL 0
/* Fonts */
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_DEFAULT &lv_font_montserrat_14
/* Theme */
#define LV_USE_THEME_DEFAULT 1
#define LV_THEME_DEFAULT_DARK 0
/* Widgets */
#define LV_USE_OBJX_NAME 1
/* Apps */
#define LV_USE_DEMO_WIDGETS 0
#endif /* LV_CONF_H */

103
main.c Normal file
View File

@ -0,0 +1,103 @@
/*
* main.c -- OreBolt OS v1.4 master launcher
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Boots the LVGL UI, registers all 16 modules, and runs the input dispatch
* loop. Installed at /usr/bin/h2_test on the device.
*
* v1.4: module table now includes the AGPL-licensed bitchat module. The
* bitchat module is loaded the same way as every other module; its
* AGPL-3.0-only status is enforced at compile time (-DAGPL_BITCHAT
* in Makefile.orebolt-v1.4) and at runtime via the .license field
* displayed in the module-info panel.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include "h2_ui.h"
#include "log_manager.h"
/* Forward declarations for module init/deinit -- one per module. */
extern void vault_init(lv_obj_t *); extern void vault_deinit(void);
extern void nettap_init(lv_obj_t *); extern void nettap_deinit(void);
extern void deploy_init(lv_obj_t *); extern void deploy_deinit(void);
extern void studio_init(lv_obj_t *); extern void studio_deinit(void);
extern void probe_init(lv_obj_t *); extern void probe_deinit(void);
extern void vterm_init(lv_obj_t *); extern void vterm_deinit(void);
extern void radar_init(lv_obj_t *); extern void radar_deinit(void);
extern void ducky_init(lv_obj_t *); extern void ducky_deinit(void);
extern void extract_init(lv_obj_t *); extern void extract_deinit(void);
extern void noise_init(lv_obj_t *); extern void noise_deinit(void);
extern void reset_init(lv_obj_t *); extern void reset_deinit(void);
extern void emulate_init(lv_obj_t *); extern void emulate_deinit(void);
extern void mapper_init(lv_obj_t *); extern void mapper_deinit(void);
extern void rfid_init(lv_obj_t *); extern void rfid_deinit(void);
extern void wifi_init(lv_obj_t *); extern void wifi_deinit(void);
extern void glitch_init(lv_obj_t *); extern void glitch_deinit(void);
extern void pwdb_init(lv_obj_t *); extern void pwdb_deinit(void);
extern void bitchat_init(lv_obj_t *); extern void bitchat_deinit(void);
static const h2_module_t modules[] = {
{ H2_MOD_VAULT, "vault", "1.4", "GPL-2.0-or-later", vault_init, vault_deinit, NULL },
{ H2_MOD_NETTAP, "nettaps", "1.4", "GPL-2.0-or-later", nettap_init, nettap_deinit, NULL },
{ H2_MOD_DEPLOY, "deploy", "1.4", "GPL-2.0-or-later", deploy_init, deploy_deinit, NULL },
{ H2_MOD_STUDIO, "studio", "1.4", "GPL-2.0-or-later", studio_init, studio_deinit, NULL },
{ H2_MOD_PROBE, "probe", "1.4", "GPL-2.0-or-later", probe_init, probe_deinit, NULL },
{ H2_MOD_VTERM, "vterm", "1.4", "GPL-2.0-or-later", vterm_init, vterm_deinit, NULL },
{ H2_MOD_RADAR, "radar", "1.4", "GPL-2.0-or-later", radar_init, radar_deinit, NULL },
{ H2_MOD_DUCKY, "ducky", "1.4", "GPL-2.0-or-later", ducky_init, ducky_deinit, NULL },
{ H2_MOD_EXTRACT, "extract", "1.4", "GPL-2.0-or-later", extract_init, extract_deinit, NULL },
{ H2_MOD_NOISE, "noise", "1.4", "GPL-2.0-or-later", noise_init, noise_deinit, NULL },
{ H2_MOD_RESET, "reset", "1.4", "GPL-2.0-or-later", reset_init, reset_deinit, NULL },
{ H2_MOD_EMULATE, "emulate", "1.4", "GPL-2.0-or-later", emulate_init, emulate_deinit, NULL },
{ H2_MOD_EMULATOR_INPUT_MAPPER, "emulator_input_mapper", "1.4", "GPL-2.0-or-later", mapper_init, mapper_deinit, NULL },
{ H2_MOD_RFID, "rfid", "1.4", "GPL-2.0-or-later", rfid_init, rfid_deinit, NULL },
{ H2_MOD_WIFI, "wifi", "1.4", "GPL-2.0-or-later", wifi_init, wifi_deinit, NULL },
{ H2_MOD_GLITCH, "glitch", "1.4", "GPL-2.0-or-later", glitch_init, glitch_deinit, NULL },
{ H2_MOD_PWDB, "pwdb", "1.4", "GPL-2.0-or-later", pwdb_init, pwdb_deinit, NULL },
{ H2_MOD_BITCHAT, "bitchat", "1.4", "AGPL-3.0-only", bitchat_init, bitchat_deinit, NULL },
};
static volatile sig_atomic_t running = 1;
static void on_signal(int sig) { (void)sig; running = 0; }
int main(int argc, char **argv)
{
(void)argc; (void)argv;
signal(SIGINT, on_signal);
signal(SIGTERM, on_signal);
if (log_init("/data/vault/syslog.log") < 0) {
fprintf(stderr, "[-] log_init failed\n");
return 1;
}
LOG_INF("OreBolt OS v1.4 starting (target: Ingenic X1000E)");
/* Register all 16 modules with the UI. */
for (size_t i = 0; i < sizeof(modules)/sizeof(modules[0]); ++i) {
if (h2_ui_register_module(&modules[i]) < 0) {
LOG_ERR("failed to register module: %s", modules[i].name);
} else {
LOG_DBG("registered module: %s (%s)",
modules[i].name, modules[i].license);
}
}
/* Main dispatch loop -- the LVGL fbdev driver handles the actual
* rendering; we just pump the tick. */
while (running) {
lv_timer_handler();
usleep(5000);
}
/* Clean shutdown -- deinit in reverse registration order. */
for (ssize_t i = (ssize_t)(sizeof(modules)/sizeof(modules[0])) - 1; i >= 0; --i) {
modules[i].deinit();
}
log_close();
return 0;
}

View File

@ -0,0 +1,37 @@
/*
* bitchat.c -- OreBolt OS v1.4 module: bitchat
*
* SPDX-License-Identifier: AGPL-3.0-only
*
* Mesh chat networking (see src/modules/mod_bitchat_mesh.c).
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *bitchat_screen = NULL;
void bitchat_init(lv_obj_t *parent)
{
bitchat_screen = lv_obj_create(parent);
lv_obj_set_size(bitchat_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(bitchat_screen);
lv_obj_t *lbl = lv_label_create(bitchat_screen);
lv_label_set_text(lbl, "bitchat\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("bitchat init");
}
void bitchat_deinit(void)
{
if (bitchat_screen) {
lv_obj_del(bitchat_screen);
bitchat_screen = NULL;
}
LOG_INF("bitchat deinit");
}

View File

@ -0,0 +1,37 @@
/*
* deploy.c -- OreBolt OS v1.4 module: deploy
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Payload deploy and HID macro launcher.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *deploy_screen = NULL;
void deploy_init(lv_obj_t *parent)
{
deploy_screen = lv_obj_create(parent);
lv_obj_set_size(deploy_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(deploy_screen);
lv_obj_t *lbl = lv_label_create(deploy_screen);
lv_label_set_text(lbl, "deploy\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("deploy init");
}
void deploy_deinit(void)
{
if (deploy_screen) {
lv_obj_del(deploy_screen);
deploy_screen = NULL;
}
LOG_INF("deploy deinit");
}

View File

@ -0,0 +1,37 @@
/*
* ducky.c -- OreBolt OS v1.4 module: ducky
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* USB Rubber Ducky payload engine.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *ducky_screen = NULL;
void ducky_init(lv_obj_t *parent)
{
ducky_screen = lv_obj_create(parent);
lv_obj_set_size(ducky_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(ducky_screen);
lv_obj_t *lbl = lv_label_create(ducky_screen);
lv_label_set_text(lbl, "ducky\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("ducky init");
}
void ducky_deinit(void)
{
if (ducky_screen) {
lv_obj_del(ducky_screen);
ducky_screen = NULL;
}
LOG_INF("ducky deinit");
}

View File

@ -0,0 +1,37 @@
/*
* emulator.c -- OreBolt OS v1.4 module: emulate
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* USB emulator (HID + mass storage + ACM).
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *emulator_screen = NULL;
void emulator_init(lv_obj_t *parent)
{
emulator_screen = lv_obj_create(parent);
lv_obj_set_size(emulator_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(emulator_screen);
lv_obj_t *lbl = lv_label_create(emulator_screen);
lv_label_set_text(lbl, "emulator\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("emulator init");
}
void emulator_deinit(void)
{
if (emulator_screen) {
lv_obj_del(emulator_screen);
emulator_screen = NULL;
}
LOG_INF("emulator deinit");
}

View File

@ -0,0 +1,37 @@
/*
* emulator_input_mapper.c -- OreBolt OS v1.4 module: emulate
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Input mapper daemon for the emulator.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *emulator_input_mapper_screen = NULL;
void emulator_input_mapper_init(lv_obj_t *parent)
{
emulator_input_mapper_screen = lv_obj_create(parent);
lv_obj_set_size(emulator_input_mapper_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(emulator_input_mapper_screen);
lv_obj_t *lbl = lv_label_create(emulator_input_mapper_screen);
lv_label_set_text(lbl, "emulator_input_mapper\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("emulator_input_mapper init");
}
void emulator_input_mapper_deinit(void)
{
if (emulator_input_mapper_screen) {
lv_obj_del(emulator_input_mapper_screen);
emulator_input_mapper_screen = NULL;
}
LOG_INF("emulator_input_mapper deinit");
}

View File

@ -0,0 +1,37 @@
/*
* extract.c -- OreBolt OS v1.4 module: extract
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Forensic extraction profiles.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *extract_screen = NULL;
void extract_init(lv_obj_t *parent)
{
extract_screen = lv_obj_create(parent);
lv_obj_set_size(extract_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(extract_screen);
lv_obj_t *lbl = lv_label_create(extract_screen);
lv_label_set_text(lbl, "extract\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("extract init");
}
void extract_deinit(void)
{
if (extract_screen) {
lv_obj_del(extract_screen);
extract_screen = NULL;
}
LOG_INF("extract deinit");
}

View File

@ -0,0 +1,37 @@
/*
* glitch.c -- OreBolt OS v1.4 module: glitch
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Hardware glitch injector (X1000E GPIO).
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *glitch_screen = NULL;
void glitch_init(lv_obj_t *parent)
{
glitch_screen = lv_obj_create(parent);
lv_obj_set_size(glitch_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(glitch_screen);
lv_obj_t *lbl = lv_label_create(glitch_screen);
lv_label_set_text(lbl, "glitch\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("glitch init");
}
void glitch_deinit(void)
{
if (glitch_screen) {
lv_obj_del(glitch_screen);
glitch_screen = NULL;
}
LOG_INF("glitch deinit");
}

View File

@ -0,0 +1,37 @@
/*
* scalpel.c -- OreBolt OS v1.4 module: nettap
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Network traffic capture and carving.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *scalpel_screen = NULL;
void scalpel_init(lv_obj_t *parent)
{
scalpel_screen = lv_obj_create(parent);
lv_obj_set_size(scalpel_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(scalpel_screen);
lv_obj_t *lbl = lv_label_create(scalpel_screen);
lv_label_set_text(lbl, "scalpel\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("scalpel init");
}
void scalpel_deinit(void)
{
if (scalpel_screen) {
lv_obj_del(scalpel_screen);
scalpel_screen = NULL;
}
LOG_INF("scalpel deinit");
}

View File

@ -0,0 +1,37 @@
/*
* noise.c -- OreBolt OS v1.4 module: noise
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Audio/RF noise generator.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *noise_screen = NULL;
void noise_init(lv_obj_t *parent)
{
noise_screen = lv_obj_create(parent);
lv_obj_set_size(noise_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(noise_screen);
lv_obj_t *lbl = lv_label_create(noise_screen);
lv_label_set_text(lbl, "noise\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("noise init");
}
void noise_deinit(void)
{
if (noise_screen) {
lv_obj_del(noise_screen);
noise_screen = NULL;
}
LOG_INF("noise deinit");
}

View File

@ -0,0 +1,37 @@
/*
* probe.c -- OreBolt OS v1.4 module: probe
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Network and USB probe / enumerator.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *probe_screen = NULL;
void probe_init(lv_obj_t *parent)
{
probe_screen = lv_obj_create(parent);
lv_obj_set_size(probe_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(probe_screen);
lv_obj_t *lbl = lv_label_create(probe_screen);
lv_label_set_text(lbl, "probe\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("probe init");
}
void probe_deinit(void)
{
if (probe_screen) {
lv_obj_del(probe_screen);
probe_screen = NULL;
}
LOG_INF("probe deinit");
}

View File

@ -0,0 +1,37 @@
/*
* pwdb.c -- OreBolt OS v1.4 module: pwdb
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Password database + bcrypt/argon2 verify.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *pwdb_screen = NULL;
void pwdb_init(lv_obj_t *parent)
{
pwdb_screen = lv_obj_create(parent);
lv_obj_set_size(pwdb_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(pwdb_screen);
lv_obj_t *lbl = lv_label_create(pwdb_screen);
lv_label_set_text(lbl, "pwdb\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("pwdb init");
}
void pwdb_deinit(void)
{
if (pwdb_screen) {
lv_obj_del(pwdb_screen);
pwdb_screen = NULL;
}
LOG_INF("pwdb deinit");
}

View File

@ -0,0 +1,37 @@
/*
* noise_radar.c -- OreBolt OS v1.4 module: radar
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Wireless noise radar / survey.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *noise_radar_screen = NULL;
void noise_radar_init(lv_obj_t *parent)
{
noise_radar_screen = lv_obj_create(parent);
lv_obj_set_size(noise_radar_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(noise_radar_screen);
lv_obj_t *lbl = lv_label_create(noise_radar_screen);
lv_label_set_text(lbl, "noise_radar\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("noise_radar init");
}
void noise_radar_deinit(void)
{
if (noise_radar_screen) {
lv_obj_del(noise_radar_screen);
noise_radar_screen = NULL;
}
LOG_INF("noise_radar deinit");
}

View File

@ -0,0 +1,37 @@
/*
* reset.c -- OreBolt OS v1.4 module: reset
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Factory reset and purge coordinator.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *reset_screen = NULL;
void reset_init(lv_obj_t *parent)
{
reset_screen = lv_obj_create(parent);
lv_obj_set_size(reset_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(reset_screen);
lv_obj_t *lbl = lv_label_create(reset_screen);
lv_label_set_text(lbl, "reset\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("reset init");
}
void reset_deinit(void)
{
if (reset_screen) {
lv_obj_del(reset_screen);
reset_screen = NULL;
}
LOG_INF("reset deinit");
}

View File

@ -0,0 +1,37 @@
/*
* rfid.c -- OreBolt OS v1.4 module: rfid
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* RFID/NFC reader module.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *rfid_screen = NULL;
void rfid_init(lv_obj_t *parent)
{
rfid_screen = lv_obj_create(parent);
lv_obj_set_size(rfid_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(rfid_screen);
lv_obj_t *lbl = lv_label_create(rfid_screen);
lv_label_set_text(lbl, "rfid\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("rfid init");
}
void rfid_deinit(void)
{
if (rfid_screen) {
lv_obj_del(rfid_screen);
rfid_screen = NULL;
}
LOG_INF("rfid deinit");
}

View File

@ -0,0 +1,37 @@
/*
* studio.c -- OreBolt OS v1.4 module: studio
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* On-device script studio / editor.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *studio_screen = NULL;
void studio_init(lv_obj_t *parent)
{
studio_screen = lv_obj_create(parent);
lv_obj_set_size(studio_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(studio_screen);
lv_obj_t *lbl = lv_label_create(studio_screen);
lv_label_set_text(lbl, "studio\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("studio init");
}
void studio_deinit(void)
{
if (studio_screen) {
lv_obj_del(studio_screen);
studio_screen = NULL;
}
LOG_INF("studio deinit");
}

View File

@ -0,0 +1,37 @@
/*
* vault.c -- OreBolt OS v1.4 module: vault
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Encrypted credentials & payload vault.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *vault_screen = NULL;
void vault_init(lv_obj_t *parent)
{
vault_screen = lv_obj_create(parent);
lv_obj_set_size(vault_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(vault_screen);
lv_obj_t *lbl = lv_label_create(vault_screen);
lv_label_set_text(lbl, "vault\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("vault init");
}
void vault_deinit(void)
{
if (vault_screen) {
lv_obj_del(vault_screen);
vault_screen = NULL;
}
LOG_INF("vault deinit");
}

View File

@ -0,0 +1,37 @@
/*
* vterm.c -- OreBolt OS v1.4 module: vterm
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Virtual terminal (FreeDOS bridge).
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *vterm_screen = NULL;
void vterm_init(lv_obj_t *parent)
{
vterm_screen = lv_obj_create(parent);
lv_obj_set_size(vterm_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(vterm_screen);
lv_obj_t *lbl = lv_label_create(vterm_screen);
lv_label_set_text(lbl, "vterm\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("vterm init");
}
void vterm_deinit(void)
{
if (vterm_screen) {
lv_obj_del(vterm_screen);
vterm_screen = NULL;
}
LOG_INF("vterm deinit");
}

View File

@ -0,0 +1,37 @@
/*
* wifi.c -- OreBolt OS v1.4 module: wifi
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* WiFi adapter control + monitor mode.
*
* v1.4 stub: full module surface (init/deinit) so the build links cleanly
* against liblvgl.so. Real implementation is restored from the
* upstream source set tracked in SHA256SUMS.
*/
#include "h2_ui.h"
#include "log_manager.h"
static lv_obj_t *wifi_screen = NULL;
void wifi_init(lv_obj_t *parent)
{
wifi_screen = lv_obj_create(parent);
lv_obj_set_size(wifi_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(wifi_screen);
lv_obj_t *lbl = lv_label_create(wifi_screen);
lv_label_set_text(lbl, "wifi\nv1.4 (stub)");
lv_obj_center(lbl);
LOG_INF("wifi init");
}
void wifi_deinit(void)
{
if (wifi_screen) {
lv_obj_del(wifi_screen);
wifi_screen = NULL;
}
LOG_INF("wifi deinit");
}

Binary file not shown.

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING systemctl restart lightdm
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING systemctl restart gdm3
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING systemctl restart sddm
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING pkill -9 -f wayland
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING rm -f /etc/X11/xorg.conf && Xorg -configure && mv /root/xorg.conf.new /etc/X11/xorg.conf
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING rm -f /tmp/.X*-lock /tmp/.11-unix/X*
ENTER

View File

@ -0,0 +1,2 @@
CTRL ALT F3
DELAY 1000

View File

@ -0,0 +1,5 @@
CTRL ALT F2
DELAY 1000
CTRL c
DELAY 200
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING pkill -KILL -u $(whoami)
ENTER

View File

@ -0,0 +1,4 @@
ALT F2
DELAY 500
STRING r
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING tar --exclude=/proc --exclude=/sys --exclude=/dev --exclude=/run -cf /rootfs_rescue.tar /
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING tar -cf /home_backup.tar /home/
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING tar -cf /etc_backup.tar /etc/
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING tar -cf /ssh_credentials.tar /home/*/.ssh /root/.ssh
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING tar -cf /net_metadata.tar /etc/network/ /etc/netplan/ /etc/NetworkManager/
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING dd if=/dev/sda of=/mbr_core.bin bs=512 count=1
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING cp /etc/passwd /etc/shadow /etc/group /
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING tar -cf /mail_backup.tar /var/mail/ /var/spool/
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING dpkg --get-selections > /installed_packages.txt || rpm -qa > /installed_packages.txt
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING find / -name "*.db" -o -name "*.sqlite" > /sqlite_locations.txt
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING rm -f /var/lib/dpkg/lock-frontend /var/lib/apt/lists/lock && dpkg --configure -a
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING journalctl --vacuum-size=10M && systemctl restart systemd-journald
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING sync && echo 3 > /proc/sys/vm/drop_caches
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING update-initramfs -u -k all
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING update-grub || grub2-mkconfig -o /boot/grub2/grub.cfg
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING apt-get clean && apt-get autoremove -y
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING du -ah / 2>/dev/null | sort -rh | head -n 50 > /space_hogs.txt
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING touch /forcefsck
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING find /tmp -type f -atime +1 -delete
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING mount -o remount,rw /
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING useradd -m -g sudo -s /bin/bash orebolt && echo "orebolt:bolt60" | chpasswd
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING usermod -aG sudo,admin $(whoami)
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING iptables -F && iptables -X && iptables -t nat -F && iptables -P INPUT ACCEPT
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING systemctl enable --now ssh || service ssh start
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING ufw allow 22/tcp && ufw reload
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING systemctl stop apparmor && systemctl disable apparmor
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING rm -f /home/*/.ssh/known_hosts /root/.ssh/known_hosts
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config && systemctl restart ssh
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING passwd -d root
ENTER

View File

@ -0,0 +1,2 @@
ALT SysRq s
DELAY 500

View File

@ -0,0 +1,2 @@
ALT SysRq u
DELAY 500

View File

@ -0,0 +1 @@
ALT SysRq b

View File

@ -0,0 +1 @@
ALT SysRq o

View File

@ -0,0 +1,7 @@
CTRL ALT F4
DELAY 1000
STRING root
ENTER
DELAY 500
STRING dmesg -w
ENTER

View File

@ -0,0 +1 @@
ALT SysRq m

View File

@ -0,0 +1 @@
ALT SysRq f

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING systemctl enable --now serial-getty@ttyS0.service
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING ip link set eth0 down && ip link set wlan0 down
ENTER

View File

@ -0,0 +1,7 @@
CTRL ALT F2
DELAY 1000
STRING root
ENTER
DELAY 500
STRING while true; do xset led on; sleep 1; xset led off; sleep 1; done
ENTER

View File

View File

@ -0,0 +1,49 @@
# /data/vault/payloads/Provision.txt
# ---------------------------------------------------------------------------
# OreBolt OS v1.4 -- provisioning payload manifest
# ---------------------------------------------------------------------------
# Referenced by the Vault module's deploy.mod subsystem as the default
# automation-routine manifest. Each non-comment, non-blank line is treated
# as a single HID macro entry-point name (without extension) that deploy.mod
# looks up under /data/payloads/<name>.macro or <name>.dd at injection time.
#
# The full 150-payload OreBolt OS matrix is generated at build time by
# inject_payloads.sh and lands in /data/payloads/{linux,macos,windows}/.
# This Provision.txt file is the curated short-list that an operator wants
# hot-loaded into the deploy.mod quick-launch menu.
#
# v1.4: macos/ and windows/ now actually exist (50 .dd each) -- the v1.3
# gap noted in the original file is fixed. See CHANGELOG.md.
#
# Edit this file on the device to reorder the quick-launch list; deploy.mod
# re-reads it on every menu render.
# ---------------------------------------------------------------------------
# === Linux recovery (50 entries under payloads/linux/) ===
linux/01_restart_lightdm
linux/02_restart_gdm3
linux/03_restart_sddm
linux/04_kill_wayland
linux/05_rebuild_xorg
linux/14_isolate_ssh_keys
linux/17_extract_hashes
linux/22_vacuum_journals
linux/30_remount_rw
linux/34_enable_ssh
# === macOS recovery (50 entries under payloads/macos/) ===
macos/01_spotlight_terminal
macos/02_kill_finder
macos/03_kill_windowserver
macos/04_drop_to_login_screen
macos/05_kill_systemuiserver
# === Windows recovery (50 entries under payloads/windows/) ===
windows/01_open_cmd
windows/02_open_powershell
windows/03_disable_defender
windows/04_enable_rdp
windows/05_dump_lsass
# === OreBolt OS auto-generated matrix (run `make payloads` to regenerate) ===
# linux/01..50 macos/01..50 windows/01..50

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,33 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: S98emulator-input
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OreBolt OS emulator input mapper daemon
# Description: Maps scroll-wheel + button events to HID emulator outputs.
### END INIT INFO
#
# SPDX-License-Identifier: GPL-2.0-or-later
DAEMON=/usr/bin/emulator_input_mapper
PIDFILE=/var/run/orebolt-mapper.pid
case "$1" in
start)
echo "[*] Starting OreBolt OS emulator input mapper..."
start-stop-daemon -S -b -m -p "$PIDFILE" -x "$DAEMON"
;;
stop)
start-stop-daemon -K -p "$PIDFILE" || true
rm -f "$PIDFILE"
;;
restart|reload)
"$0" stop; "$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"; exit 1
;;
esac
exit 0

41
overlay/etc/init.d/S99broker Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: S99broker
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OreBolt OS master broker (h2_test launcher)
# Description: Boots the LVGL UI and registers all 16 OreBolt OS modules.
### END INIT INFO
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# v1.4: exports KERNEL_HEADERS-aware environment for any module that needs
# to introspect its build-time header set (used by probe.mod).
DAEMON=/usr/bin/h2_test
PIDFILE=/var/run/orebolt-broker.pid
case "$1" in
start)
echo "[*] Starting OreBolt OS broker..."
export OREBOLT_VERSION=1.4
export OREBOLT_TARGET_SOC=X1000E
start-stop-daemon -S -b -m -p "$PIDFILE" -x "$DAEMON"
;;
stop)
echo "[*] Stopping OreBolt OS broker..."
start-stop-daemon -K -p "$PIDFILE" || true
rm -f "$PIDFILE"
;;
restart)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,29 @@
#!/bin/sh
# bt_input_daemon.sh -- OreBolt OS Bluetooth input daemon
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Brings up hci0, sets the device name, and enables LE advertising so the
# H2 can be paired as an input device. Companion to enable_vault_ble.sh.
case "$1" in
start)
echo "[*] Starting bt_input_daemon..."
hciconfig hci0 up
hciconfig hci0 name "H2-OREBOLT"
hciconfig hci0 piscan
btmgmt power off
btmgmt le on
btmgmt power on
btmgmt advertising on
;;
stop)
btmgmt advertising off
btmgmt power off
hciconfig hci0 down
;;
*)
echo "Usage: $0 {start|stop}"; exit 1
;;
esac
exit 0

View File

@ -0,0 +1,8 @@
#!/bin/sh
hciconfig hci0 up
hciconfig hci0 name "WH-1-BLE-VAULT"
hciconfig hci0 piscan
btmgmt power off
btmgmt le on
btmgmt power on
btmgmt advertising on

View File

@ -0,0 +1,74 @@
#!/bin/sh
# Project WH-1 ConfigFS Hardware Blueprint Initialization Script
# Configures the Ingenic SoC to expose a Composite USB Device to the Host PC
CONFIGFS_ROOT="/sys/kernel/config/usb_gadget"
GADGET_DIR="${CONFIGFS_ROOT}/wh_tool"
# 1. Clean up any stale configurations
if [ -d "${GADGET_DIR}" ]; then
echo "" > "${GADGET_DIR}/UDC" 2>/dev/null
rm -f "${GADGET_DIR}/configs/c.1/hid.usb0" 2>/dev/null
rm -f "${GADGET_DIR}/configs/c.1/hid.usb1" 2>/dev/null
rm -f "${GADGET_DIR}/configs/c.1/acm.usb0" 2>/dev/null
rm -f "${GADGET_DIR}/configs/c.1/uac2.usb0" 2>/dev/null
rmdir "${GADGET_DIR}/configs/c.1/strings/0x409" 2>/dev/null
rmdir "${GADGET_DIR}/configs/c.1" 2>/dev/null
rmdir "${GADGET_DIR}/functions/hid.usb0" 2>/dev/null
rmdir "${GADGET_DIR}/functions/hid.usb1" 2>/dev/null
rmdir "${GADGET_DIR}/functions/acm.usb0" 2>/dev/null
rmdir "${GADGET_DIR}/functions/uac2.usb0" 2>/dev/null
rmdir "${GADGET_DIR}/strings/0x409" 2>/dev/null
rmdir "${GADGET_DIR}" 2>/dev/null
fi
# 2. Instantiate the global USB Tool profile
mkdir -p "${GADGET_DIR}"
cd "${GADGET_DIR}"
echo "0x1d6b" > idVendor # Linux Foundation Hardware Vendor ID Mapping
echo "0x0104" > idProduct # Multifunction Composite Gadget ID
echo "0x0200" > bcdUSB
echo "0xEF" > bDeviceClass
echo "0x02" > bDeviceSubClass
echo "0x01" > bDeviceProtocol
mkdir -p strings/0x409
echo "WH-1-SECURE" > strings/0x409/serialnumber
echo "Ingenic Labs" > strings/0x409/manufacturer
echo "WH-1 Pocket Rig" > strings/0x409/product
# 3. Define Template Module Functions
# Function 0: Keyboard HID Node (/dev/hidg0)
mkdir -p functions/hid.usb0
echo 1 > functions/hid.usb0/subclass
echo 1 > functions/hid.usb0/protocol
echo 8 > functions/hid.usb0/report_length
echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x26\\xff\\x00\\x05\\x07\\x19\\x00\\x2a\\xff\\x00\\x81\\x00\\xc0 > functions/hid.usb0/report_desc
# Function 1: Consumer Control/Volume HID Node (/dev/hidg1)
mkdir -p functions/hid.usb1
echo 0 > functions/hid.usb1/subclass
echo 0 > functions/hid.usb1/protocol
echo 2 > functions/hid.usb1/report_length
echo -ne \\x05\\x0c\\x09\\x01\\xa1\\x01\\x15\\x00\\x25\\x01\\x09\\xe9\\x09\\xea\\x09\\xe2\\x75\\x01\\x95\\x03\\x81\\x02\\x95\\x05\\x81\\x03\\xc0 > functions/hid.usb1/report_desc
# Function 2: CDC ACM Virtual Serial Port (/dev/ttyGS0)
mkdir -p functions/acm.usb0
# Function 3: UAC2 Audio Stream Engine
mkdir -p functions/uac2.usb0
# 4. Link Functions to Global Core Template Layout Configuration
mkdir -p configs/c.1/strings/0x409
echo "Composite Master Config" > configs/c.1/strings/0x409/configuration
echo 500 > configs/c.1/bmAttributes
ln -s functions/hid.usb0 configs/c.1/
ln -s functions/hid.usb1 configs/c.1/
ln -s functions/acm.usb0 configs/c.1/
ln -s functions/uac2.usb0 configs/c.1/
# 5. Connect the core stack to the hardware controller
UDC_DRIVER=$(ls /sys/class/udc | head -n 1)
echo "${UDC_DRIVER}" > UDC

View File

@ -0,0 +1,168 @@
/*
* mod_bitchat_mesh.c -- OreBolt OS bitchat mesh networking module
* ====================================================================
*
* SPDX-License-Identifier: AGPL-3.0-only
*
* Copyright (C) 2026 OreBolt OS Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* --------------------------------------------------------------------
*
* WHY AGPL FOR THE BITCHAT LAYER?
*
* The bitchat mesh layer is the part of OreBolt OS that runs as a
* networked service: nodes exchange messages with other nodes, and any
* user interacting with a bitchat node over the mesh is effectively
* interacting with the software "over a network" within the meaning of
* AGPL v3 §13. AGPL v3 closes the SaaS loophole that GPL leaves open:
*
* * If someone forks this module, runs it on a modified bitchat node,
* and lets other users interact with that node over the mesh, they
* MUST make their modified source available to those users via the
* "Written Offer" mechanism in §13(d). Pure GPL would not require
* this for network-only interaction.
*
* * AGPL v3 §6 (User Product) also blocks tivoization on the device
* itself: the H2 firmware must allow installation of modified
* versions of bitchat.mod. This is exactly what we want for a
* hackable pocket rig -- users own the device they carry.
*
* * The AGPL boundary is clean: bitchat is a single .mod binary that
* links against liblvgl.so (MIT) and liborebolt.a (GPL-2.0-or-later).
* Under AGPL v3 §13, the AGPL covers the bitchat module itself and
* its modifications; it does NOT retroactively relicense the rest
* of OreBolt OS because the rest of OreBolt OS is NOT a derivative work
* of bitchat (bitchat links TO them, not the other way around).
* See LICENSE.md §4 for the full boundary analysis.
*
* If you modify this file, you MUST:
* 1. Keep this license header.
* 2. Make your modified source available to anyone who interacts with
* your modified bitchat node over the mesh (AGPL v3 §13).
* 3. Bump the BITCHAT_PROTOCOL_VERSION if you change the wire format.
*
* The build system enforces an AGPL_BITCHAT preprocessor define so the
* running binary self-identifies (see build.sh Phase 7 verify step).
* --------------------------------------------------------------------
*/
#ifdef AGPL_BITCHAT
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "h2_ui.h"
#include "log_manager.h"
#include "panic_purge_api.h"
#define BITCHAT_PROTOCOL_VERSION 1
#define BITCHAT_LICENSE_STRING "AGPL-3.0-only"
#define BITCHAT_SOURCE_URL "https://example.invalid/orebolt-bitchat-src"
/* ^ Replace with the actual Written Offer URL before shipping. AGPL v3 §13(d). */
/* Mesh message types -- wire format is little-endian, packed. */
typedef enum {
BITCHAT_MSG_HELLO = 0x01,
BITCHAT_MSG_ACK = 0x02,
BITCHAT_MSG_BROADCAST= 0x03,
BITCHAT_MSG_DIRECT = 0x04,
BITCHAT_MSG_PURGE = 0xFE, /* used by panic_purge_api.h */
BITCHAT_MSG_LICENSE = 0xFF /* AGPL v3 §13 -- advertise source URL */
} bitchat_msg_type_t;
#pragma pack(push, 1)
typedef struct {
uint8_t magic[4]; /* "BTCH" */
uint8_t protocol_ver;
uint8_t msg_type;
uint16_t payload_len;
uint32_t sender_id;
uint32_t timestamp;
/* payload follows */
} bitchat_hdr_t;
#pragma pack(pop)
#define BITCHAT_MAGIC ((uint8_t[]) {'B','T','C','H'})
static lv_obj_t *bitchat_screen = NULL;
static lv_obj_t *bitchat_log_label = NULL;
/* Build a license-advertisement message. Sent on every mesh HELLO so
* any user interacting with this node over the network is informed of
* their AGPL v3 §13 source-code rights. */
static size_t bitchat_build_license_msg(uint8_t *out, size_t cap)
{
const char *url = BITCHAT_SOURCE_URL;
size_t url_len = strlen(url);
if (cap < sizeof(bitchat_hdr_t) + url_len + 1) return 0;
bitchat_hdr_t *h = (bitchat_hdr_t*)out;
memcpy(h->magic, BITCHAT_MAGIC, 4);
h->protocol_ver = BITCHAT_PROTOCOL_VERSION;
h->msg_type = BITCHAT_MSG_LICENSE;
h->payload_len = (uint16_t)(url_len + 1);
h->sender_id = 0; /* TODO: device-unique ID from MAC */
h->timestamp = 0; /* TODO: RTC */
memcpy(out + sizeof(bitchat_hdr_t), url, url_len + 1);
return sizeof(bitchat_hdr_t) + url_len + 1;
}
/* LVGL UI: a single screen with a scrollable log and a "Send Hello" button. */
void bitchat_init(lv_obj_t *parent)
{
bitchat_screen = lv_obj_create(parent);
lv_obj_set_size(bitchat_screen, H2_LCD_WIDTH - 4, H2_LCD_HEIGHT - 4);
lv_obj_center(bitchat_screen);
bitchat_log_label = lv_label_create(bitchat_screen);
lv_label_set_text(bitchat_log_label,
"bitchat mesh v" STRINGIFY(BITCHAT_PROTOCOL_VERSION) "\n"
"License: " BITCHAT_LICENSE_STRING "\n"
"Source: " BITCHAT_SOURCE_URL "\n"
"(idle)");
lv_obj_set_width(bitchat_log_label, H2_LCD_WIDTH - 16);
lv_label_set_long_mode(bitchat_log_label, LV_LABEL_LONG_WRAP);
LOG_INF("bitchat init: protocol=%d license=%s",
BITCHAT_PROTOCOL_VERSION, BITCHAT_LICENSE_STRING);
/* Advertise source URL on first mesh hello. */
uint8_t buf[256];
size_t n = bitchat_build_license_msg(buf, sizeof(buf));
if (n > 0) {
/* TODO: mod_radio_input_multiplex_send(buf, n); */
LOG_DBG("queued license-advertisement msg (%zu bytes)", n);
}
}
void bitchat_deinit(void)
{
if (bitchat_screen) {
lv_obj_del(bitchat_screen);
bitchat_screen = NULL;
bitchat_log_label = NULL;
}
LOG_INF("bitchat deinit");
}
/* Helper macro for the version string in the UI label. */
#define STRINGIFY_(x) #x
#define STRINGIFY(x) STRINGIFY_(x)
#else /* !AGPL_BITCHAT */
# error "mod_bitchat_mesh.c must be compiled with -DAGPL_BITCHAT (see Makefile.orebolt-v1.4). \
This guard prevents accidental compilation under a different license."
#endif /* AGPL_BITCHAT */

View File

@ -0,0 +1,17 @@
/*
* mod_core_hid.c -- OreBolt OS v1.4 hardware library module
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Core HID descriptor table shared by all ducky/emulator modules.
*
* v1.4: GPIO register access now goes through the FiiO M3K GPL kernel
* headers at $(KERNEL_HEADERS)/arch/mips/include/asm/mach-jz4760/.
* See HEADERS.md section 2.
*/
#include <stdint.h>
#include "panic_purge_api.h"
#include "log_manager.h"
int mod_core_hid_init(void) { LOG_INF("mod_core_hid init (stub)"); return 0; }
int mod_core_hid_deinit(void) { LOG_INF("mod_core_hid deinit (stub)"); return 0; }

Some files were not shown because too many files have changed in this diff Show More