# hackerhouse-opensource/pyongyang_2407 architecture

> Architecture diagram of the GitHub repository hackerhouse-opensource/pyongyang_2407, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hackerhouse-opensource/pyongyang_2407
- Repository: https://github.com/hackerhouse-opensource/pyongyang_2407

## Overview

The Pyongyang 2407 project is an Android ROM build and flashing ecosystem targeting MTK6582–based hardware (WBW5511_MAINBOARD_P2) devices. Its purpose is to reassemble a modified Android JellyBean 4.2.2 environment that includes special modifications (like surveillance–tracking functions and a jailbreak bypass for the native digital signature checking) to run on these Chinese hardware platforms. The repository not only provides a set of instructions for preparing the native host (for flashing using SP Flash Tool and other MTK utilities) but also includes an enormous collection of source code and build scripts (mainly in the “make_ext4fs” directory) for many critical Android system components such as adb, fastboot, system utilities (init, fs_mgr, etc.), and low–level libraries shared with the Android ROM.

- Host Environment Tools:
– Linux (native host) setup running tools like SP Flash Tool, adb, and flashing scripts.
– USB connectivity interface (note the special handling of the preloader on /dev/ttyACM0).
- Device Hardware Layer:
– The MTK6582–based hardware platform (WBW5511_MAINBOARD_P2) is the physical device.
– Mention supporting peripherals (USB port, flash memory such as EMMC/NAND/SDMMC).
- Boot and Preloader Layer:
– The preloader (provided by MediaTek and shown in the dmesg logs) that enables a backdoor for download and RAM boot.
– Early boot chain elements which use the “make_ext4fs” build tools.
- Firmware/Bootloader Stage:
– The initial bootloader and recovery components (using fastboot, debug tools, etc.), compiled from the extensive “make_ext4fs” source.
- Android ROM (System and Data Partitions):
– The installed ROM containing Android JellyBean 4.2.2 and modifications using the provided system.tar and data.ext4.
– Key integration points that include replacing system files (such as kernel modules, and the inclusion of additional “jailbreak” utilities and apps like com.mobileuncle.apk).
- Modified and Supplementary Components:
– The patched components like the libmedianatsign.so (guaranteeing that all file accesses bypass the digital signature check).
– In–ROM utilities (busybox-android, gnutar) and the tools for system file extraction and flashing.
– Optional monitoring/surveillance modules contained in the Android user space.

##### Data flows and interactions
– Show the boot process starting with the preloader stage that uses low–level flashing commands.
– Once booted, indicate how adb and fastboot (built from the “make_ext4fs” libraries) allow subsequent operations; for example, pushing files (data.ext4, system.tar) and executing root shell commands.
– Indicate the replacement operations within the Android ROM: the removal of /system and /data content followed by extraction using gnutar, installation of busybox, and setting up of the jailbreaking modifications.
– Finally, illustrate the override mechanism by the custom library (libmedianatsign.so) as it interjects into Android system routines (e.g., during file access digital signature checks).

##### Architectural patterns and design principles
– Modular separation: The project splits host–side flashing utilities (including binary tools) from the device’s operating system and low–level bootloader components.
– Layered boot architecture: Clearly separate the early boot (preloader), bootloader, and then the Android system with user space.
– Integration points: Mark where the project’s custom modifications (security bypass, signal patching) integrate into the standard Android architecture.
– Extensibility through separate components: The “make_ext4fs” directory with its many submodules emphasizes a build–and–integration style where firmware, system utilities, and libraries are compiled independently and then integrated.

##### Technology and libraries
– Specifically label components like adb, fastboot, init, fs_mgr, and low–level libraries (libcutils, libpixelflinger, etc.) found in the “make_ext4fs” tree.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Host Environment & Flashing Tools"
        H1["Linux Native Host"]:::host
        H2["SP Flash Tool"]:::host
        ME["Make_ext4fs (Flashing)"]:::build
        SBS["Split Boot Img Script"]:::build
        RD["README Instructions"]:::build
        ADB["ADB Module"]:::host
        FB["Fastboot Module"]:::host
        INIT["Init Service"]:::host
        FSM["FS_MGR Service"]:::host
        BLD["Build Scripts"]:::build
    end

    subgraph "Device Boot Process"
        DB1["MTK6582 Hardware (WBW5511_MAINBOARD_P2)"]:::device
        USB["USB Interface (/dev/ttyACM0)"]:::device
        PRE["Preloader (USB Backdoor)"]:::device
        BL["Bootloader & Recovery"]:::device
        KNL["Kernel Boot"]:::device
    end

    subgraph "Android ROM Environment"
        ROM["Android ROM (JellyBean 4.2.2)"]:::rom
        SYS["System Partition"]:::rom
        DATA["Data Partition"]:::rom
        PATCH["Signature Bypass (libmedianatsign.so)"]:::patch
        UTIL["In-ROM Utilities (busybox,gnutar)"]:::rom
        JB["Jailbreak Utilities"]:::patch
        APK["Mobile Uncle APK"]:::patch
    end

    H1 --> H2
    H2 -->|"flash_command"| USB
    ADB -->|"adb_communication"| ROM
    FB -->|"fastboot_commands"| BL
    INIT -->|"init_process"| ROM
    FSM -->|"fs_management"| ROM
    BLD -->|"build_dependency"| ME
    ME --> SBS
    SBS --> RD

    DB1 --> USB
    USB --> PRE
    PRE --> BL
    BL --> KNL
    KNL --> ROM
    ROM --> SYS
    ROM --> DATA
    SYS --> PATCH
    DATA --> UTIL
    UTIL --> JB
    JB --> APK

classDef host fill:#AED6F1,stroke:#2980B9,stroke-width:2px;
classDef device fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
classDef rom fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
classDef build fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
classDef patch fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;

click ME "https://github.com/hackerhouse-opensource/pyongyang_2407/tree/master/bin/make_ext4fs"
click SBS "https://github.com/hackerhouse-opensource/pyongyang_2407/blob/master/bin/split_boot_img.py"
click RD "https://github.com/hackerhouse-opensource/pyongyang_2407/blob/master/README.md"
click ADB "https://github.com/hackerhouse-opensource/pyongyang_2407/tree/master/make_ext4fs/core/adb"
click FB "https://github.com/hackerhouse-opensource/pyongyang_2407/tree/master/make_ext4fs/core/fastboot"
click INIT "https://github.com/hackerhouse-opensource/pyongyang_2407/tree/master/make_ext4fs/core/init"
click FSM "https://github.com/hackerhouse-opensource/pyongyang_2407/tree/master/make_ext4fs/core/fs_mgr"
click BLD "https://github.com/hackerhouse-opensource/pyongyang_2407/tree/master/make_ext4fs"
click JB "https://github.com/hackerhouse-opensource/pyongyang_2407/tree/master/jailbreak"
click APK "https://github.com/hackerhouse-opensource/pyongyang_2407/blob/master/com.mobileuncle.apk"
```
