# erlla/sony-a7m4-custom-firmware architecture

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

- Interactive diagram: https://gitdiagram.com/erlla/sony-a7m4-custom-firmware
- Repository: https://github.com/erlla/sony-a7m4-custom-firmware

## Overview

This repository combines A7M4 firmware modification, two installation/maintenance routes, and a computer-side LUT training workflow. The principal user path is choosing either the ordinary-USB installer or Fastboot maintenance, then preparing, validating, applying, and verifying a firmware change; LUT training is a separate path producing camera-importable filter data. The graph includes documented feature families even where their implementation was not sampled. Edges are limited to excerpt/index references or README statements; unsampled feature internals are represented at their supported directory paths.

Main entry points: [`no-fastboot-install/software/app/workflow/install_controller.py`](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/install_controller.py) (Install controller), [`no-fastboot-install/software/app/workflow/user_provider.py`](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/user_provider.py) (USB provider), [`training/run.py`](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/training/run.py) (Training workflow), [`no-fastboot-install/software/app/workflow/integrity_backend.py`](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/integrity_backend.py) (Integrity workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_install["USB Installer"]
  node_desktop_ui["Installer interface"]
  node_install_controller["Install controller"]
  node_custom_controller["Custom install controller"]
  node_provider["USB provider<br/>[user_provider.py]"]
  node_integrity_backend["Integrity workflow"]
  node_receiver["Stock receiver<br/>[orchestrator.py]"]
  node_release_integrity["Release verification"]
  node_operation_state[("Operation state<br/>[state_io.py]")]
  node_install_engine["Patch engine<br/>[engine.py]"]
end

subgraph group_fastboot["Fastboot Maintenance"]
  node_fastboot_payload["Fastboot payload<br/>[main.c]"]
  node_payload_io["Payload I/O<br/>[io.h]"]
  node_fastboot_cli["Maintenance CLI<br/>[cli.py]"]
end

subgraph group_mods["Firmware Features"]
  node_firmware_patches["Firmware patch families"]
  node_custom_sounds["Custom sound runtime"]
  node_persistent_cache[("Persistent cache")]
  node_aspect_preview["Aspect preview<br/>[preview.c]"]
end

subgraph group_training["LUT Training"]
  node_training_runner["Training workflow<br/>[run.py]"]
  node_training_fit["LUT fitting<br/>[fit_grid.py]"]
  node_training_eval["Fit evaluation<br/>[evaluation.py]"]
  node_filter_file["Camera LUT JSON"]
end

node_user(("Camera owner"))
node_agent(("AI agent"))
node_camera(("A7M4 camera"))

node_user -->|"starts install"| node_desktop_ui
node_agent -.->|"guides workflow"| node_install_controller
node_desktop_ui -.->|"submits install"| node_install_controller
node_install_controller -->|"uses provider"| node_provider
node_custom_controller -->|"uses provider"| node_provider
node_install_controller -->|"runs integrity workflow"| node_integrity_backend
node_custom_controller -->|"runs integrity workflow"| node_integrity_backend
node_install_controller -->|"checks release"| node_release_integrity
node_install_controller -.->|"persists state"| node_operation_state
node_provider -->|"validates files"| node_release_integrity
node_provider -->|"invokes engine"| node_install_engine
node_integrity_backend -->|"creates provider"| node_provider
node_integrity_backend -->|"loads receiver"| node_receiver
node_receiver -->|"uses state I/O"| node_operation_state
node_user -->|"starts maintenance"| node_fastboot_cli
node_fastboot_cli -.->|"runs operations"| node_install_engine
node_camera -->|"boots payload"| node_fastboot_payload
node_fastboot_payload -->|"uses I/O"| node_payload_io
node_install_engine -.->|"applies patch"| node_firmware_patches
node_user -->|"selects features"| node_firmware_patches
node_user -->|"imports sound files"| node_custom_sounds
node_custom_sounds -.->|"uses cache"| node_persistent_cache
node_user -->|"starts training"| node_training_runner
node_training_runner -->|"fits LUT"| node_training_fit
node_training_runner -->|"evaluates fit"| node_training_eval
node_training_runner -->|"produces JSON"| node_filter_file
node_user -.->|"views preview"| node_aspect_preview

click node_desktop_ui "https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/no-fastboot-install/software/app/ui"
click node_install_controller "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/install_controller.py"
click node_custom_controller "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/install_controller_custom.py"
click node_provider "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/user_provider.py"
click node_integrity_backend "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/integrity_backend.py"
click node_receiver "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/receiver_stock/orchestrator.py"
click node_release_integrity "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/product_integrity.py"
click node_operation_state "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/state_io.py"
click node_install_engine "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/a7m4/engine.py"
click node_fastboot_payload "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/fastboot/source/payload/src/main.c"
click node_payload_io "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/fastboot/source/payload/include/io.h"
click node_fastboot_cli "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/a7m4/cli.py"
click node_firmware_patches "https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/a7m4"
click node_custom_sounds "https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/native/custom-sounds"
click node_persistent_cache "https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/native/persistent-cache"
click node_aspect_preview "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/native/aspect-autoreview/ap/preview.c"
click node_training_runner "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/training/run.py"
click node_training_fit "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/training/source/fit_grid.py"
click node_training_eval "https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/training/source/evaluation.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_desktop_ui,node_install_controller,node_custom_controller,node_provider,node_integrity_backend,node_receiver,node_release_integrity,node_operation_state,node_install_engine toneBlue
class node_fastboot_payload,node_payload_io,node_fastboot_cli toneAmber
class node_firmware_patches,node_custom_sounds,node_persistent_cache,node_aspect_preview toneMint
class node_training_runner,node_training_fit,node_training_eval,node_filter_file toneRose
class node_user,node_agent,node_camera toneIndigo
```

## Components

### USB Installer

- [Installer interface](https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/no-fastboot-install/software/app/ui): `no-fastboot-install/software/app/ui`
- [Install controller](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/install_controller.py): `no-fastboot-install/software/app/workflow/install_controller.py`
- [Custom install controller](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/install_controller_custom.py): `no-fastboot-install/software/app/workflow/install_controller_custom.py`
- [USB provider](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/user_provider.py): `no-fastboot-install/software/app/workflow/user_provider.py`
- [Integrity workflow](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/workflow/integrity_backend.py): `no-fastboot-install/software/app/workflow/integrity_backend.py`
- [Stock receiver](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/receiver_stock/orchestrator.py): `no-fastboot-install/software/app/receiver_stock/orchestrator.py`
- [Release verification](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/product_integrity.py): `no-fastboot-install/software/app/product_integrity.py`
- [Operation state](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/no-fastboot-install/software/app/state_io.py): `no-fastboot-install/software/app/state_io.py`
- [Patch engine](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/a7m4/engine.py): `a7m4/engine.py`

### Fastboot Maintenance

- [Fastboot payload](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/fastboot/source/payload/src/main.c): `fastboot/source/payload/src/main.c`
- [Payload I/O](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/fastboot/source/payload/include/io.h): `fastboot/source/payload/include/io.h`
- [Maintenance CLI](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/a7m4/cli.py): `a7m4/cli.py`

### Firmware Features

- [Firmware patch families](https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/a7m4): `a7m4`
- [Custom sound runtime](https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/native/custom-sounds): `native/custom-sounds`
- [Persistent cache](https://github.com/erlla/sony-a7m4-custom-firmware/tree/main/native/persistent-cache): `native/persistent-cache`
- [Aspect preview](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/native/aspect-autoreview/ap/preview.c): `native/aspect-autoreview/ap/preview.c`

### LUT Training

- [Training workflow](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/training/run.py): `training/run.py`
- [LUT fitting](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/training/source/fit_grid.py): `training/source/fit_grid.py`
- [Fit evaluation](https://github.com/erlla/sony-a7m4-custom-firmware/blob/main/training/source/evaluation.py): `training/source/evaluation.py`
- **Camera LUT JSON**

### Other components

- **Camera owner**
- **AI agent**
- **A7M4 camera**

## Connections

- Camera owner → Installer interface: starts install
- AI agent → Install controller: guides workflow
- Installer interface → Install controller: submits install
- Install controller → USB provider: uses provider (evidence: `no-fastboot-install/software/app/workflow/install_controller.py`)
- Custom install controller → USB provider: uses provider (evidence: `no-fastboot-install/software/app/workflow/install_controller_custom.py`)
- Install controller → Integrity workflow: runs integrity workflow (evidence: `no-fastboot-install/software/app/workflow/install_controller.py`)
- Custom install controller → Integrity workflow: runs integrity workflow (evidence: `no-fastboot-install/software/app/workflow/install_controller_custom.py`)
- Install controller → Release verification: checks release (evidence: `no-fastboot-install/software/app/workflow/install_controller.py`)
- Install controller → Operation state: persists state
- USB provider → Release verification: validates files (evidence: `no-fastboot-install/software/app/workflow/user_provider.py`)
- USB provider → Patch engine: invokes engine (evidence: `no-fastboot-install/software/app/workflow/user_provider.py`)
- Integrity workflow → USB provider: creates provider (evidence: `no-fastboot-install/software/app/workflow/integrity_backend.py`)
- Integrity workflow → Stock receiver: loads receiver (evidence: `no-fastboot-install/software/app/workflow/integrity_backend.py`)
- Stock receiver → Operation state: uses state I/O (evidence: `no-fastboot-install/software/app/receiver_stock/orchestrator.py`)
- Camera owner → Maintenance CLI: starts maintenance
- Maintenance CLI → Patch engine: runs operations
- A7M4 camera → Fastboot payload: boots payload
- Fastboot payload → Payload I/O: uses I/O (evidence: `fastboot/source/payload/src/main.c`)
- Patch engine → Firmware patch families: applies patch (evidence: `a7m4/engine.py`)
- Camera owner → Firmware patch families: selects features
- Camera owner → Custom sound runtime: imports sound files
- Custom sound runtime → Persistent cache: uses cache (evidence: `native/persistent-cache/sound_cache.c`)
- Camera owner → Training workflow: starts training
- Training workflow → LUT fitting: fits LUT (evidence: `training/run.py`)
- Training workflow → Fit evaluation: evaluates fit (evidence: `training/run.py`)
- Training workflow → Camera LUT JSON: produces JSON
- Camera owner → Aspect preview: views preview
