# oosexgang/hakios-sm7325 architecture

> Architecture diagram of the GitHub repository oosexgang/hakios-sm7325, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oosexgang/hakios-sm7325
- Repository: https://github.com/oosexgang/hakios-sm7325

## Overview

This repository is a HakiOS device port for the POCO X5 Pro (redwood), with a shared SoC-family layer. Its main workflows are supplying device/SoC configuration and boot assets, and pulling vendor firmware from an attached Android phone for use outside the repository. It also provides read-only modem discovery and an offline modem-firmware validation tool. The README documents broader kernel-driver and SoC-argument workflows, but their implementations are not present in this tree; those are not represented as code nodes.

Main entry points: [`tools/modem_firmware.py`](https://github.com/oosexgang/hakios-sm7325/blob/main/tools/modem_firmware.py) (Modem firmware validation), [`uefi`](https://github.com/oosexgang/hakios-sm7325/tree/main/uefi) (Redwood UEFI port), [`uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.py`](https://github.com/oosexgang/hakios-sm7325/blob/main/uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.py) (Platform build settings), [`pull-firmware.sh`](https://github.com/oosexgang/hakios-sm7325/blob/main/pull-firmware.sh) (Firmware extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Device configuration"]
  node_device_config["Device settings<br/>[device.conf]"]
  node_device_configs["Device profiles"]
  node_soc_config["SoC configuration"]
  node_soc_args["SoC arguments<br/>[soc.args]"]
end

subgraph group_boot["Boot platform"]
  node_uefi_port["Redwood UEFI port"]
  node_uefi_build["Platform build settings<br/>[DeviceBuild.py]"]
  node_memory_map["Memory map<br/>[MemoryMapLib.c]"]
  node_config_map["Configuration map"]
  node_prebuilt_images["Prebuilt boot assets"]
  node_boot_image_tool["Boot image creator<br/>[mkbootimg.py]"]
end

subgraph group_firmware["Firmware"]
  node_firmware_pull["Firmware extraction<br/>[pull-firmware.sh]"]
  node_firmware_files["Pulled vendor firmware"]
end

subgraph group_discovery["Modem discovery"]
  node_dtb["Device tree blob<br/>[device-tree.dtb]"]
  node_cellular_probe["Cellular inventory<br/>[cellular_probe.py]"]
  node_modem_check["Modem firmware validation<br/>[modem_firmware.py]"]
end

node_maintainer(("Device maintainer"))
node_phone(("Android phone"))

node_maintainer -->|"configures"| node_device_config
node_maintainer -->|"configures"| node_device_configs
node_maintainer -->|"configures"| node_soc_config
node_maintainer -->|"maintains example"| node_soc_args
node_maintainer -->|"runs"| node_firmware_pull
node_firmware_pull -->|"pulls from"| node_phone
node_firmware_pull -->|"extracts"| node_firmware_files
node_maintainer -->|"ports"| node_uefi_port
node_uefi_port -.->|"includes platform"| node_uefi_build
node_uefi_port -.->|"provides port and images"| node_prebuilt_images
node_uefi_build -.->|"uses map"| node_memory_map
node_uefi_build -.->|"uses map"| node_config_map
node_maintainer -.->|"creates images"| node_boot_image_tool
node_cellular_probe -->|"reads by default"| node_dtb
node_maintainer -->|"runs"| node_cellular_probe
node_maintainer -->|"runs"| node_modem_check
node_modem_check -->|"reads"| node_dtb
node_modem_check -.->|"checks"| node_firmware_files
node_modem_check -->|"imports parser"| node_cellular_probe

click node_device_config "https://github.com/oosexgang/hakios-sm7325/blob/main/device.conf"
click node_device_configs "https://github.com/oosexgang/hakios-sm7325/tree/main/configs"
click node_soc_config "https://github.com/oosexgang/hakios-sm7325/tree/main/soc"
click node_soc_args "https://github.com/oosexgang/hakios-sm7325/blob/main/soc.args"
click node_uefi_port "https://github.com/oosexgang/hakios-sm7325/tree/main/uefi"
click node_uefi_build "https://github.com/oosexgang/hakios-sm7325/blob/main/uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.py"
click node_memory_map "https://github.com/oosexgang/hakios-sm7325/blob/main/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.c"
click node_config_map "https://github.com/oosexgang/hakios-sm7325/blob/main/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.c"
click node_prebuilt_images "https://github.com/oosexgang/hakios-sm7325/tree/main/prebuilt"
click node_boot_image_tool "https://github.com/oosexgang/hakios-sm7325/blob/main/prebuilt/mkbootimg.py"
click node_firmware_pull "https://github.com/oosexgang/hakios-sm7325/blob/main/pull-firmware.sh"
click node_dtb "https://github.com/oosexgang/hakios-sm7325/blob/main/prebuilt/device-tree.dtb"
click node_cellular_probe "https://github.com/oosexgang/hakios-sm7325/blob/main/tools/cellular_probe.py"
click node_modem_check "https://github.com/oosexgang/hakios-sm7325/blob/main/tools/modem_firmware.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_device_config,node_device_configs,node_soc_config,node_soc_args toneBlue
class node_uefi_port,node_uefi_build,node_memory_map,node_config_map,node_prebuilt_images,node_boot_image_tool toneAmber
class node_firmware_pull,node_firmware_files toneMint
class node_dtb,node_cellular_probe,node_modem_check toneRose
class node_maintainer,node_phone toneIndigo
```

## Components

### Device configuration

- [Device settings](https://github.com/oosexgang/hakios-sm7325/blob/main/device.conf): `device.conf`
- [Device profiles](https://github.com/oosexgang/hakios-sm7325/tree/main/configs): `configs`
- [SoC configuration](https://github.com/oosexgang/hakios-sm7325/tree/main/soc): `soc`
- [SoC arguments](https://github.com/oosexgang/hakios-sm7325/blob/main/soc.args): `soc.args`

### Boot platform

- [Redwood UEFI port](https://github.com/oosexgang/hakios-sm7325/tree/main/uefi): `uefi`
- [Platform build settings](https://github.com/oosexgang/hakios-sm7325/blob/main/uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.py): `uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.py`
- [Memory map](https://github.com/oosexgang/hakios-sm7325/blob/main/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.c): `uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.c`
- [Configuration map](https://github.com/oosexgang/hakios-sm7325/blob/main/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.c): `uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.c`
- [Prebuilt boot assets](https://github.com/oosexgang/hakios-sm7325/tree/main/prebuilt): `prebuilt`
- [Boot image creator](https://github.com/oosexgang/hakios-sm7325/blob/main/prebuilt/mkbootimg.py): `prebuilt/mkbootimg.py`

### Firmware

- [Firmware extraction](https://github.com/oosexgang/hakios-sm7325/blob/main/pull-firmware.sh): `pull-firmware.sh`
- **Pulled vendor firmware**

### Modem discovery

- [Device tree blob](https://github.com/oosexgang/hakios-sm7325/blob/main/prebuilt/device-tree.dtb): `prebuilt/device-tree.dtb`
- [Cellular inventory](https://github.com/oosexgang/hakios-sm7325/blob/main/tools/cellular_probe.py): `tools/cellular_probe.py`
- [Modem firmware validation](https://github.com/oosexgang/hakios-sm7325/blob/main/tools/modem_firmware.py): `tools/modem_firmware.py`

### Other components

- **Device maintainer**
- **Android phone**

## Connections

- Device maintainer → Device settings: configures (evidence: `README.md`)
- Device maintainer → Device profiles: configures (evidence: `README.md`)
- Device maintainer → SoC configuration: configures (evidence: `README.md`)
- Device maintainer → SoC arguments: maintains example (evidence: `README.md`)
- Device maintainer → Firmware extraction: runs (evidence: `README.md`)
- Firmware extraction → Android phone: pulls from (evidence: `README.md`)
- Firmware extraction → Pulled vendor firmware: extracts (evidence: `README.md`)
- Device maintainer → Redwood UEFI port: ports (evidence: `README.md`)
- Redwood UEFI port → Platform build settings: includes platform
- Redwood UEFI port → Prebuilt boot assets: provides port and images
- Platform build settings → Memory map: uses map
- Platform build settings → Configuration map: uses map
- Device maintainer → Boot image creator: creates images
- Cellular inventory → Device tree blob: reads by default (evidence: `tools/cellular_probe.py`)
- Device maintainer → Cellular inventory: runs (evidence: `tools/cellular_probe.py`)
- Device maintainer → Modem firmware validation: runs (evidence: `tools/modem_firmware.py`)
- Modem firmware validation → Device tree blob: reads (evidence: `tools/modem_firmware.py`)
- Modem firmware validation → Pulled vendor firmware: checks
- Modem firmware validation → Cellular inventory: imports parser (evidence: `tools/modem_firmware.py`)
