# juantamadski/oxygenos-redefined architecture

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

- Interactive diagram: https://gitdiagram.com/juantamadski/oxygenos-redefined
- Repository: https://github.com/juantamadski/oxygenos-redefined

## Overview

Oxygen OS Redefined is presented as an automated custom-ROM builder for OnePlus 12R and Ace 3: users provide OEM firmware, which is unpacked, modified, repacked as a ROM, and optionally uploaded. The tree contains image and partition utilities, patchers, and versioned firmware payloads, but not the build orchestration described in the README. The graph therefore shows documented workflow stages and capabilities, plus the source-level image-extraction dependency; links to unsampled implementation are omitted.

Main entry points: [`bin`](https://github.com/juantamadski/oxygenos-redefined/tree/main/bin) (Partition Modification), [`bin/package`](https://github.com/juantamadski/oxygenos-redefined/tree/main/bin/package) (OS Payload Variants), [`bin/imgextractor/imgextractor.py`](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/imgextractor/imgextractor.py) (Image Extraction), [`bin/lpunpack.py`](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/lpunpack.py) (Logical Partitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_image_tools["Image Tools"]
  node_unpack["Firmware Unpack"]
  node_logical_partitions["Logical Partitions<br/>[lpunpack.py]"]
  node_sparse_convert["Sparse Conversion<br/>[sdat2img.py]"]
  node_image_extract["Image Extraction<br/>[imgextractor.py]"]
  node_ext4_reader["EXT4 Reader<br/>[ext4.py]"]
end

subgraph group_patch_tools["Patch Tools"]
  node_partition_changes["Partition Modification"]
  node_fs_config["Filesystem Config<br/>[fspatch.py]"]
  node_selinux_context["SELinux Contexts<br/>[contextpatch.py]"]
  node_vbmeta["VBMeta Flags<br/>[patch-vbmeta.py]"]
  node_toolbox_patch["KaoriOS Toolbox Patch<br/>[toolbox.py]"]
end

subgraph group_rom_payloads["ROM Payloads"]
  node_version_payloads["OS Payload Variants"]
  node_gapps["Google Apps"]
  node_droidspaces["Droidspaces Support"]
end

subgraph group_delivery["ROM Delivery"]
  node_repacked_rom["Packed ROM"]
  node_cloud(("Cloud Storage"))
end

node_builder(("ROM Builder User"))
node_oem_firmware["OEM Firmware"]

node_builder -->|"provides"| node_oem_firmware
node_oem_firmware -->|"unpacks"| node_unpack
node_unpack -.->|"uses for partitions"| node_logical_partitions
node_unpack -.->|"uses for conversion"| node_sparse_convert
node_unpack -.->|"extracts images"| node_image_extract
node_image_extract -->|"uses"| node_ext4_reader
node_unpack -->|"modifies partitions"| node_partition_changes
node_partition_changes -.->|"patches metadata"| node_fs_config
node_partition_changes -.->|"patches contexts"| node_selinux_context
node_partition_changes -.->|"patches verification"| node_vbmeta
node_partition_changes -.->|"applies toolbox"| node_toolbox_patch
node_version_payloads -.->|"includes"| node_gapps
node_version_payloads -.->|"includes"| node_droidspaces
node_partition_changes -->|"repackages"| node_repacked_rom
node_repacked_rom -->|"uploads"| node_cloud

click node_unpack "https://github.com/juantamadski/oxygenos-redefined/tree/main/bin"
click node_logical_partitions "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/lpunpack.py"
click node_sparse_convert "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/Linux/x86_64/sdat2img.py"
click node_image_extract "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/imgextractor/imgextractor.py"
click node_ext4_reader "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/imgextractor/ext4.py"
click node_partition_changes "https://github.com/juantamadski/oxygenos-redefined/tree/main/bin"
click node_fs_config "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/fspatch.py"
click node_selinux_context "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/contextpatch.py"
click node_vbmeta "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/patch-vbmeta.py"
click node_toolbox_patch "https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/package/FrameworkPatcher/KouseiPatcher/toolbox.py"
click node_version_payloads "https://github.com/juantamadski/oxygenos-redefined/tree/main/bin/package"
click node_gapps "https://github.com/juantamadski/oxygenos-redefined/tree/main/bin/package/Universal/GMS"
click node_droidspaces "https://github.com/juantamadski/oxygenos-redefined/tree/main/bin/package/Universal/MultiApps"

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_unpack,node_logical_partitions,node_sparse_convert,node_image_extract,node_ext4_reader,node_builder toneBlue
class node_partition_changes,node_fs_config,node_selinux_context,node_vbmeta,node_toolbox_patch toneAmber
class node_version_payloads,node_gapps,node_droidspaces toneMint
class node_repacked_rom,node_cloud toneRose
class node_oem_firmware toneIndigo
```

## Components

### Image Tools

- [Firmware Unpack](https://github.com/juantamadski/oxygenos-redefined/tree/main/bin): `bin`
- [Logical Partitions](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/lpunpack.py): `bin/lpunpack.py`
- [Sparse Conversion](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/Linux/x86_64/sdat2img.py): `bin/Linux/x86_64/sdat2img.py`
- [Image Extraction](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/imgextractor/imgextractor.py): `bin/imgextractor/imgextractor.py`
- [EXT4 Reader](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/imgextractor/ext4.py): `bin/imgextractor/ext4.py`

### Patch Tools

- [Partition Modification](https://github.com/juantamadski/oxygenos-redefined/tree/main/bin): `bin`
- [Filesystem Config](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/fspatch.py): `bin/fspatch.py`
- [SELinux Contexts](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/contextpatch.py): `bin/contextpatch.py`
- [VBMeta Flags](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/patch-vbmeta.py): `bin/patch-vbmeta.py`
- [KaoriOS Toolbox Patch](https://github.com/juantamadski/oxygenos-redefined/blob/main/bin/package/FrameworkPatcher/KouseiPatcher/toolbox.py): `bin/package/FrameworkPatcher/KouseiPatcher/toolbox.py`

### ROM Payloads

- [OS Payload Variants](https://github.com/juantamadski/oxygenos-redefined/tree/main/bin/package): `bin/package`
- [Google Apps](https://github.com/juantamadski/oxygenos-redefined/tree/main/bin/package/Universal/GMS): `bin/package/Universal/GMS`
- [Droidspaces Support](https://github.com/juantamadski/oxygenos-redefined/tree/main/bin/package/Universal/MultiApps): `bin/package/Universal/MultiApps`

### ROM Delivery

- **Packed ROM**
- **Cloud Storage**

### Other components

- **ROM Builder User**
- **OEM Firmware**

## Connections

- ROM Builder User → OEM Firmware: provides
- OEM Firmware → Firmware Unpack: unpacks
- Firmware Unpack → Logical Partitions: uses for partitions
- Firmware Unpack → Sparse Conversion: uses for conversion
- Firmware Unpack → Image Extraction: extracts images (evidence: `bin/imgextractor/imgextractor.py`)
- Image Extraction → EXT4 Reader: uses (evidence: `bin/imgextractor/imgextractor.py`)
- Firmware Unpack → Partition Modification: modifies partitions
- Partition Modification → Filesystem Config: patches metadata
- Partition Modification → SELinux Contexts: patches contexts
- Partition Modification → VBMeta Flags: patches verification
- Partition Modification → KaoriOS Toolbox Patch: applies toolbox
- OS Payload Variants → Google Apps: includes
- OS Payload Variants → Droidspaces Support: includes
- Partition Modification → Packed ROM: repackages
- Packed ROM → Cloud Storage: uploads
