# peridio/meta-avocado architecture

> Architecture diagram of the GitHub repository peridio/meta-avocado, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/peridio/meta-avocado
- Repository: https://github.com/peridio/meta-avocado

## Overview

##### Main Components

a) Layer Structure (Top Level):
- meta-avocado (core layer)
- meta-avocado-arm
- meta-avocado-atmel
- meta-avocado-meson
- meta-avocado-nvidia
- meta-avocado-nxp
- meta-avocado-raspberrypi
- meta-avocado-example

b) Build System Components:
- kas build configuration system
- Yocto/BitBake build system
- Board Support Package (BSP) configurations

##### Key Architectural Elements

a) Boot Chain:
- U-Boot (bootloader)
- Trusted Firmware-A (for secure boot)
- Linux Kernel
- InitramFS

b) Runtime Components:
- Base System
- Peridio Management Daemon
- Security Components (OPTEE, secure boot)
- Package Groups

##### Workflow and Relationships

- Build flow from kas configuration → Yocto build → final image
- Boot sequence flow
- Runtime component interactions

##### Specific Implementation Details

- Supported hardware platforms (QEMU, RPi, i.MX, etc.)
- Configuration management (fwup)
- Security features (secure boot, TLS)

##### Notes for Implementation

- Keep the bootloader configuration and environment separate
- Overlay filesystem structure
- Where machine-specific configurations are applied
- Security features, especially for secure boot capable platforms

- The layered architecture of the Yocto project
- The build system flow
- Runtime component interaction
- Security features
- Hardware support diversity

Remember to include version control integration points and build artifact flows, as these are crucial for understanding the system's lifecycle management.

This will provide a comprehensive view of the AvocadOS system while maintaining clarity about how different components interact and relate to each other.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Layer Structure"
        CoreLayer["Meta Avocado Core"]:::core
        ARMBSP["ARM BSP Layer"]:::bsp
        AtmelBSP["Atmel BSP Layer"]:::bsp
        MesonBSP["Meson BSP Layer"]:::bsp
        NVIDIABSP["NVIDIA BSP Layer"]:::bsp
        NXPBSP["NXP BSP Layer"]:::bsp
        RaspberryPiBSP["Raspberry Pi BSP Layer"]:::bsp
        ExampleLayer["Example Layer"]:::example
    end

    subgraph "Build System"
        KAS["KAS Build Configuration"]:::build
        Yocto["Yocto/BitBake"]:::build
        BSPConfig["BSP Configurations"]:::build
    end

    subgraph "Boot Chain"
        UBoot["U-Boot"]:::boot
        TFA["Trusted Firmware-A"]:::boot
        Kernel["Linux Kernel"]:::boot
        InitramFS["InitramFS"]:::boot
    end

    subgraph "Runtime Components"
        BaseSystem["Base System"]:::runtime
        PeridioD["Peridio Management Daemon"]:::runtime
        Security["Security Components"]:::security
        PackageGroups["Package Groups"]:::runtime
    end

    subgraph "Security Features"
        OPTEE["OPTEE OS"]:::security
        SecureBoot["Secure Boot"]:::security
        TLS["TLS Components"]:::security
    end

    subgraph "System Images"
        BaseImage["Base Image"]:::image
        InitramFSImage["InitramFS Image"]:::image
    end

    %% Relationships
    KAS --> Yocto
    Yocto --> BaseImage
    Yocto --> InitramFSImage
    
    UBoot --> TFA
    TFA --> Kernel
    Kernel --> InitramFS
    InitramFS --> BaseSystem

    BaseSystem --> PeridioD
    Security --> BaseSystem
    OPTEE --> Security
    SecureBoot --> Security
    TLS --> Security

    PackageGroups --> BaseImage

    %% Click Events
    click CoreLayer "https://github.com/peridio/meta-avocado/tree/main/meta-avocado/"
    click ARMBSP "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-arm/"
    click AtmelBSP "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-atmel/"
    click MesonBSP "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-meson/"
    click NVIDIABSP "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-nvidia/"
    click NXPBSP "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-nxp/"
    click RaspberryPiBSP "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-raspberrypi/"
    click ExampleLayer "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-example/"
    click KAS "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-example/conf/kas/"
    click BSPConfig "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-example/conf/kas/bsp/"
    click UBoot "https://github.com/peridio/meta-avocado/tree/main/meta-avocado/recipes-bsp/u-boot/"
    click TFA "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-meson/recipes-bsp/trusted-firmware-a/"
    click Kernel "https://github.com/peridio/meta-avocado/tree/main/meta-avocado/recipes-kernel/linux/"
    click InitramFS "https://github.com/peridio/meta-avocado/blob/main/meta-avocado/recipes-avocado/images/avocado-image-initramfs.bb"
    click BaseSystem "https://github.com/peridio/meta-avocado/tree/main/meta-avocado/recipes-avocado/base-files/"
    click PeridioD "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-example/recipes-peridio/peridiod/"
    click OPTEE "https://github.com/peridio/meta-avocado/tree/main/meta-avocado-arm/recipes-security/optee/"
    click PackageGroups "https://github.com/peridio/meta-avocado/tree/main/meta-avocado/recipes-avocado/packagegroups/"
    click SecureBoot "https://github.com/peridio/meta-avocado/blob/main/meta-avocado-example/conf/kas/machine/qemuarm64-secureboot.yml"
    click TLS "https://github.com/peridio/meta-avocado/blob/main/meta-avocado/recipes-avocado/packagegroups/packagegroup-avocado-tls.bb"
    click BaseImage "https://github.com/peridio/meta-avocado/blob/main/meta-avocado/recipes-avocado/images/avocado-image-base.bb"
    click InitramFSImage "https://github.com/peridio/meta-avocado/blob/main/meta-avocado/recipes-avocado/images/avocado-image-initramfs.bb"

    %% Styles
    classDef core fill:#e1f5fe,stroke:#01579b
    classDef bsp fill:#c8e6c9,stroke:#2e7d32
    classDef example fill:#fff3e0,stroke:#ef6c00
    classDef build fill:#e8eaf6,stroke:#1a237e
    classDef boot fill:#fff9c4,stroke:#f57f17
    classDef runtime fill:#f3e5f5,stroke:#4a148c
    classDef security fill:#ffebee,stroke:#b71c1c
    classDef image fill:#fce4ec,stroke:#880e4f
```
