# openembedded/bitbake architecture

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

- Interactive diagram: https://gitdiagram.com/openembedded/bitbake
- Repository: https://github.com/openembedded/bitbake

## Overview

BitBake is a task execution engine: users invoke builds through its command interface, which configures and runs a cooker; metadata is parsed and cached, then build tasks are scheduled and executed. The repository also includes layer-management tools, hash and PR services, and Toaster’s build-management web application. The graph follows documented and indexed dependencies; several runtime internals are unsampled, so their uncertain links are omitted rather than inferred.

Main entry points: [`lib/bb/cooker.py`](https://github.com/openembedded/bitbake/blob/master/lib/bb/cooker.py) (Build cooker), [`lib/bb/main.py`](https://github.com/openembedded/bitbake/blob/master/lib/bb/main.py) (BitBake CLI), [`lib/bb/cookerdata.py`](https://github.com/openembedded/bitbake/blob/master/lib/bb/cookerdata.py) (Cooker data), [`lib/bb/parse/__init__.py`](https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/__init__.py) (Parser dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Build engine"]
  node_cli["BitBake CLI<br/>[main.py]"]
  node_cooker["Build cooker<br/>[cooker.py]"]
  node_runqueue["Task scheduler<br/>[runqueue.py]"]
  node_build["Task execution<br/>[build.py]"]
  node_server["Build server<br/>[process.py]"]
  node_xmlclient["XML-RPC client<br/>[xmlrpcclient.py]"]
end

subgraph group_metadata["Metadata processing"]
  node_data["Metadata datastore<br/>[data_smart.py]"]
  node_parse["Parser dispatch<br/>[__init__.py]"]
  node_recipe["Recipe parser<br/>[BBHandler.py]"]
  node_config["Config parser<br/>[ConfHandler.py]"]
  node_ast["Metadata AST<br/>[ast.py]"]
  node_cache[("Metadata cache<br/>[cache.py]")]
  node_fetch["Source fetchers<br/>[__init__.py]"]
  node_cookerdata["Cooker data<br/>[cookerdata.py]"]
end

subgraph group_services["Build services"]
  node_hashserv["Hash equivalence<br/>[server.py]"]
  node_hashdb[("Hash database<br/>[sqlite.py]")]
  node_prserv["PR service<br/>[serv.py]"]
end

subgraph group_layers["Layer tools"]
  node_layercli["Layer commands<br/>[action.py]"]
  node_layerquery["Layer queries<br/>[query.py]"]
end

subgraph group_toaster["Toaster"]
  node_toasterui["Toaster web UI<br/>[views.py]"]
  node_toastercontrol["Build controller"]
  node_toastermodels[("Build records<br/>[models.py]")]
end

node_user(("Build user"))

node_user -->|"invokes"| node_cli
node_cli -->|"starts"| node_cooker
node_cli -->|"connects"| node_server
node_cli -->|"connects"| node_xmlclient
node_cooker -.->|"configures"| node_data
node_cooker -.->|"schedules"| node_runqueue
node_runqueue -.->|"dispatches"| node_build
node_cooker -.->|"uses"| node_cache
node_cooker -.->|"uses"| node_fetch
node_cooker -.->|"queries hashes"| node_hashserv
node_parse -->|"dispatches"| node_recipe
node_parse -->|"dispatches"| node_config
node_recipe -->|"builds statements"| node_ast
node_config -->|"parses includes"| node_parse
node_cookerdata -->|"loads metadata"| node_parse
node_cookerdata -->|"uses datastore"| node_data
node_cookerdata -->|"uses cache"| node_cache
node_toasterui -.->|"requests builds"| node_toastercontrol
node_toastercontrol -->|"reads records"| node_toastermodels
node_toastercontrol -->|"controls build"| node_xmlclient
node_layercli -->|"loads config"| node_cookerdata
node_layerquery -->|"shares helpers"| node_layercli
node_hashserv -.->|"reads and writes"| node_hashdb

click node_cli "https://github.com/openembedded/bitbake/blob/master/lib/bb/main.py"
click node_cooker "https://github.com/openembedded/bitbake/blob/master/lib/bb/cooker.py"
click node_runqueue "https://github.com/openembedded/bitbake/blob/master/lib/bb/runqueue.py"
click node_build "https://github.com/openembedded/bitbake/blob/master/lib/bb/build.py"
click node_server "https://github.com/openembedded/bitbake/blob/master/lib/bb/server/process.py"
click node_data "https://github.com/openembedded/bitbake/blob/master/lib/bb/data_smart.py"
click node_parse "https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/__init__.py"
click node_recipe "https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/parse_py/BBHandler.py"
click node_config "https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/parse_py/ConfHandler.py"
click node_ast "https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/ast.py"
click node_cache "https://github.com/openembedded/bitbake/blob/master/lib/bb/cache.py"
click node_fetch "https://github.com/openembedded/bitbake/blob/master/lib/bb/fetch/__init__.py"
click node_cookerdata "https://github.com/openembedded/bitbake/blob/master/lib/bb/cookerdata.py"
click node_hashserv "https://github.com/openembedded/bitbake/blob/master/lib/hashserv/server.py"
click node_hashdb "https://github.com/openembedded/bitbake/blob/master/lib/hashserv/sqlite.py"
click node_prserv "https://github.com/openembedded/bitbake/blob/master/lib/prserv/serv.py"
click node_layercli "https://github.com/openembedded/bitbake/blob/master/lib/bblayers/action.py"
click node_layerquery "https://github.com/openembedded/bitbake/blob/master/lib/bblayers/query.py"
click node_toasterui "https://github.com/openembedded/bitbake/blob/master/lib/toaster/toastergui/views.py"
click node_toastercontrol "https://github.com/openembedded/bitbake/blob/master/lib/toaster/bldcontrol/localhostbecontroller.py"
click node_toastermodels "https://github.com/openembedded/bitbake/blob/master/lib/toaster/orm/models.py"
click node_xmlclient "https://github.com/openembedded/bitbake/blob/master/lib/bb/server/xmlrpcclient.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_cli,node_cooker,node_runqueue,node_build,node_server,node_xmlclient,node_user toneBlue
class node_data,node_parse,node_recipe,node_config,node_ast,node_cache,node_fetch,node_cookerdata toneAmber
class node_hashserv,node_hashdb,node_prserv toneMint
class node_layercli,node_layerquery toneRose
class node_toasterui,node_toastercontrol,node_toastermodels toneIndigo
```

## Components

### Build engine

- [BitBake CLI](https://github.com/openembedded/bitbake/blob/master/lib/bb/main.py): `lib/bb/main.py`
- [Build cooker](https://github.com/openembedded/bitbake/blob/master/lib/bb/cooker.py): `lib/bb/cooker.py`
- [Task scheduler](https://github.com/openembedded/bitbake/blob/master/lib/bb/runqueue.py): `lib/bb/runqueue.py`
- [Task execution](https://github.com/openembedded/bitbake/blob/master/lib/bb/build.py): `lib/bb/build.py`
- [Build server](https://github.com/openembedded/bitbake/blob/master/lib/bb/server/process.py): `lib/bb/server/process.py`
- [XML-RPC client](https://github.com/openembedded/bitbake/blob/master/lib/bb/server/xmlrpcclient.py): `lib/bb/server/xmlrpcclient.py`

### Metadata processing

- [Metadata datastore](https://github.com/openembedded/bitbake/blob/master/lib/bb/data_smart.py): `lib/bb/data_smart.py`
- [Parser dispatch](https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/__init__.py): `lib/bb/parse/__init__.py`
- [Recipe parser](https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/parse_py/BBHandler.py): `lib/bb/parse/parse_py/BBHandler.py`
- [Config parser](https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/parse_py/ConfHandler.py): `lib/bb/parse/parse_py/ConfHandler.py`
- [Metadata AST](https://github.com/openembedded/bitbake/blob/master/lib/bb/parse/ast.py): `lib/bb/parse/ast.py`
- [Metadata cache](https://github.com/openembedded/bitbake/blob/master/lib/bb/cache.py): `lib/bb/cache.py`
- [Source fetchers](https://github.com/openembedded/bitbake/blob/master/lib/bb/fetch/__init__.py): `lib/bb/fetch/__init__.py`
- [Cooker data](https://github.com/openembedded/bitbake/blob/master/lib/bb/cookerdata.py): `lib/bb/cookerdata.py`

### Build services

- [Hash equivalence](https://github.com/openembedded/bitbake/blob/master/lib/hashserv/server.py): `lib/hashserv/server.py`
- [Hash database](https://github.com/openembedded/bitbake/blob/master/lib/hashserv/sqlite.py): `lib/hashserv/sqlite.py`
- [PR service](https://github.com/openembedded/bitbake/blob/master/lib/prserv/serv.py): `lib/prserv/serv.py`

### Layer tools

- [Layer commands](https://github.com/openembedded/bitbake/blob/master/lib/bblayers/action.py): `lib/bblayers/action.py`
- [Layer queries](https://github.com/openembedded/bitbake/blob/master/lib/bblayers/query.py): `lib/bblayers/query.py`

### Toaster

- [Toaster web UI](https://github.com/openembedded/bitbake/blob/master/lib/toaster/toastergui/views.py): `lib/toaster/toastergui/views.py`
- [Build controller](https://github.com/openembedded/bitbake/blob/master/lib/toaster/bldcontrol/localhostbecontroller.py): `lib/toaster/bldcontrol/localhostbecontroller.py`
- [Build records](https://github.com/openembedded/bitbake/blob/master/lib/toaster/orm/models.py): `lib/toaster/orm/models.py`

### Other components

- **Build user**

## Connections

- Build user → BitBake CLI: invokes (evidence: `README`)
- BitBake CLI → Build cooker: starts (evidence: `lib/bb/main.py`)
- BitBake CLI → Build server: connects (evidence: `lib/bb/main.py`)
- BitBake CLI → XML-RPC client: connects (evidence: `lib/bb/main.py`)
- Build cooker → Metadata datastore: configures
- Build cooker → Task scheduler: schedules
- Task scheduler → Task execution: dispatches
- Build cooker → Metadata cache: uses
- Build cooker → Source fetchers: uses
- Build cooker → Hash equivalence: queries hashes
- Parser dispatch → Recipe parser: dispatches (evidence: `lib/bb/parse/__init__.py`)
- Parser dispatch → Config parser: dispatches (evidence: `lib/bb/parse/__init__.py`)
- Recipe parser → Metadata AST: builds statements (evidence: `lib/bb/parse/parse_py/BBHandler.py`)
- Config parser → Parser dispatch: parses includes (evidence: `lib/bb/parse/parse_py/ConfHandler.py`)
- Cooker data → Parser dispatch: loads metadata (evidence: `lib/bb/cookerdata.py`)
- Cooker data → Metadata datastore: uses datastore (evidence: `lib/bb/cookerdata.py`)
- Cooker data → Metadata cache: uses cache (evidence: `lib/bb/cookerdata.py`)
- Toaster web UI → Build controller: requests builds
- Build controller → Build records: reads records (evidence: `lib/toaster/bldcontrol/localhostbecontroller.py`)
- Build controller → XML-RPC client: controls build (evidence: `lib/toaster/bldcontrol/bbcontroller.py`)
- Layer commands → Cooker data: loads config (evidence: `lib/bblayers/action.py`)
- Layer queries → Layer commands: shares helpers (evidence: `lib/bblayers/query.py`)
- Hash equivalence → Hash database: reads and writes
