# google/android-riscv64 architecture

> Architecture diagram of the GitHub repository google/android-riscv64, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/google/android-riscv64
- Repository: https://github.com/google/android-riscv64

## Overview

##### Project type and purpose
- This is *not* a code-heavy application but rather a *meta-project* for tracking, discussion, and documentation of Android support on the RISC-V 64-bit architecture within the AOSP ecosystem.
- Its purpose is to centralize issue tracking, document build/test instructions, and coordinate contributions via AOSP.

##### File structure
- Top level only contains:
- LICENSE, README.md
- docs/ (with contributing and code-of-conduct)
- No src/ or frontend/backend directories — this is purely documentation and coordination.
- No build scripts here; all build lives in AOSP.

##### README for additional insights
- Describes:
- Where the real work happens (AOSP upstream)
- How to download, configure, and build AOSP for riscv64
- Use of Cuttlefish (QEMU-based emulator) to run ART (Android Runtime) and shell tools
- How to connect (adb, VNC) and submit patches (mailing list, AOSP contribution process)

a. Main components to show:
- GitHub “Android/riscv64” documentation repo
- AOSP upstream repository (platform/system, build, external, etc.)
- Developer’s Host Build Environment (Linux) with cross-toolchain
- Cuttlefish emulator (QEMU) instance
- Android runtime components inside emulator (ART, shell & utilities)
- Android NDK (provisional riscv64 ABI)
- External services: SIG-Android mailing list, Google’s issue trackers, AOSP Gerrit
b. Relationships and interactions:
- Developer clones docs repo and reads instructions
- Developer runs `repo sync` to fetch AOSP source
- Build environment compiles AOSP for riscv64 (invoking build/envsetup.sh, lunch, make)
- The built system image is fed into Cuttlefish (launch_cvd)
- Within emulator, ART and shell tools execute; developer connects via adb/vnc to test
- Bugs/issues flow from developer → GitHub issues / SIG-Android mailing list → AOSP Gerrit → code reviews → AOSP master
- NDK updates flow from AOSP into Android ABIs documentation
c. Architectural patterns/design principles:
- *Separation of concerns*: documentation vs. code hosting
- *Upstream-downstream flow*: all patches go upstream to AOSP, not via this GitHub repo
- *Emulation layer*: cuttlefish/QEMU abstracts hardware
- *Modular Android layers*: build system, runtime (ART), shell utilities, libraries
d. Key technologies/frameworks:
- AOSP build system (Soong/Bazel-like, Android.bp)
- Cuttlefish emulator (QEMU 8.1+)
- ART (Android Runtime)
- Android shell and core libraries
- adb, vncviewer for connectivity
- RISC-V 64 toolchain (gcc/clang cross-compilers)
- Mailing list infrastructure (lists.riscv.org) and Google Gerrit

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Documentation Layer
    subgraph "Documentation Layer"
        DocRepo["Documentation Repository (GitHub Android/riscv64)"]:::doc
        DocsDir["docs/"]:::doc
        README["README.md"]:::doc
        LICENSE["LICENSE"]:::doc
        CodeOfConduct["Code of Conduct"]:::doc
        Contributing["Contributing Guide"]:::doc
    end

    %% AOSP Source Layer
    subgraph "AOSP Source"
        AOSPRepo["AOSP Upstream Repository"]:::build
    end

    %% Build Environment
    subgraph "Developer Host Build Environment (Linux)"
        Host["Host Build Env"]:::build
        NDK["Android NDK (riscv64 ABI)"]:::build
    end

    %% Build Output
    BuildOutput["Build Artifacts (system image, boot.img)"]:::build

    %% Emulation Layer
    subgraph "Emulator (Cuttlefish/QEMU)"
        Emulator["Cuttlefish VM"]:::runtime
        ART["ART (Android Runtime)"]:::runtime
        Shell["Android Shell & Utilities"]:::runtime
        Libraries["Core Libraries"]:::runtime
    end

    %% Upstream Contribution Flow
    subgraph "Upstream Contribution"
        MailingList["SIG-Android Mailing List"]:::external
        Gerrit["AOSP Gerrit"]:::external
        IssueTracker["Google Issue Tracker"]:::external
    end

    %% Relationships
    DocRepo -->|clone| Host
    AOSPRepo -->|repo sync| Host
    Host -->|invoke make| BuildOutput
    Host -->|launch_cvd| Emulator
    Host -->|adb / vnc| Emulator
    Host -->|use NDK| NDK
    Emulator --> ART
    Emulator --> Shell
    Emulator --> Libraries

    Host -->|submit patches| MailingList
    Host -->|submit patches| Gerrit
    MailingList -->|reports & patches| AOSPRepo
    Gerrit -->|merges code| AOSPRepo
    AOSPRepo -->|issues & bugs| IssueTracker

    %% Click Events
    click README "https://github.com/google/android-riscv64/blob/main/README.md"
    click LICENSE "https://github.com/google/android-riscv64/tree/main/LICENSE"
    click CodeOfConduct "https://github.com/google/android-riscv64/blob/main/docs/code-of-conduct.md"
    click Contributing "https://github.com/google/android-riscv64/blob/main/docs/contributing.md"
    click DocsDir "https://github.com/google/android-riscv64/tree/main/docs/"

    %% Styles
    classDef doc fill:#D0E6FF,stroke:#0366d6,color:#0366d6;
    classDef build fill:#DFFFE0,stroke:#28a745,color:#28a745;
    classDef runtime fill:#FFE6CC,stroke:#d1850c,color:#d1850c;
    classDef external fill:#E0E0E0,stroke:#888888,color:#444444;
```
