Skip to main content

Source Code Management

TODO

This article is a work in progress.

Platform source code repositories are maintained exclusively in Gerrit.

We maintain a few distinct prefixes for repositories:

  • aosp/ for mirrored copies of upstream Android Open Source Project repositories 1

  • graphene/ for mirrored copies of the upstream GrapheneOS Project repositories 1 2

  • <hardware>/ prefixes for source codes from hardware manufacturers

  • <odm|idh>/ prefixes for Original Device Manufacturers and Independent Development Houses

  • <device>/ prefixes for any original work on the device, should such exist

  • aphy/ for in-house work

Repository Manifests

Not unlike many AOSP and AOSP-based projects, we utilize the repo utility for the management of multiple repositories.

This section is about the use of repo init -u <url> -b <branch>.

By convention, "current" or "next" releases reside on branches named "master", where everything that has been or is about to be released lives. All other topic development lives in branches prefixed with dev/<topic>. Topic development branches should adhere to a ticket number.

Step 1: The Board Support Package

The BSP comes in two parts, both based on the AOSP project, but does not provide commit history nor separation of repositories in to its constituent elements 3. One part is for the vendor firmware, and the other is the operating system.

This means Apostrophy initially imports the BSP in to a source code management system, and tracks subsequent changes to it in one or more very large monolithic repositories.

We then analyze each of the candidate constituent elements using AOSP upstream repositories, and compare source code. Typically, a single-release BSP package contains some ~700-800 copies to an older tag in the upstream repositories. These are removed from the BSP and instead incorporated from (our mirror of) AOSP upstream.

These upstream AOSP repositories are mirrored to our Gerrit server with the prefix aosp/. Note that we push to branches such as aosp-$x, where $x represents the generation of Android (i.e. 12, 13, 14, etc.), and include any tags.

Step 2: More Graphene Please

Graphene maintains forks of a relatively manageable sub-set of all AOSP repositories, meaning Apostrophy can now dissect the BSP further -- examination of where Graphene supplies its version.

Further repositories include Graphene original source code (such as the Camera application).

Each of these upstream Graphene repositories are mirrored to our Gerrit server with the prefix graphene/. Note that we push the relevant Graphene branches to graphene-$x, include any aosp-$x branches, and push tags from both Graphene and AOSP to our mirror.

Once the Graphene version of a repository is picked up (and successfully incorporated), we can eliminate our aosp/ mirror.

Step 3: A few sprinkles of Aphy

For any number of devices and product streams, Apostrophy patches existing software or adds software from repositories prefixed with <hardware>/, <device>/ or aphy/.

Some repositories that are otherwise "vanilla upstream" (i.e. AOSP or Graphene) require Aphy-specific modifications, which would be rebased again and again against vanilla upstream changes.

Step 4: Examine the Rest

Somewhere in the development process of Apostrophy OS, the following measurement was taken.

First, we examine the number of files tracked by the original BSP hierarchy:

$ git ls-files | wc -l
1432080

While the development process is still ongoing, we continue to reduce the number of such files:

$ git ls-files | wc -l
665263

Step 5: Bug-fixes & Security Patches

TODO.

Footnotes

  1. You may have experienced a 429 Too Many Requests response once or twice before. In mirroring, we avoid those rate-limiting shenanigans. 2

  2. Graphene upstream being hosted on GitHub poses authentication as well as rate limitation barriers at times.

  3. Ironically, the ~50 GB tarballs unpack to directory hierarchies prefixed with git-.