Docker/Podman provides a uniform build environment, without external dependencies, that you have to set up manually.
The goal is to make building properly with ota and signing easy for everyone.
This project targets Android 7 up to the most recent version.
Initial Setup
- Podman
- podman-docker or alias
- or Docker
- SSH
- GitConfig
- ZRam (highly recommended): Debian, Fedora, Ubuntu, Arch and others
We need to manually create the required folders for the respective volumes
mkdir --parents ~/docker_droid/src ~/docker_droid/dotfiles ~/docker_droid/ccache ~/docker_droid/logs ~/docker_droid/keys
Copy the required dotfiles from the host machines
cp ~/.gitconfig ~/docker_droid/dotfiles/
cp --recursive ~/.ssh ~/docker_droid/dotfiles/
and clone this repo
git clone https://github.com/SirRGB/dockdroid ~/docker_droid/minideb
Then we need to chown that directory to the Docker user:
Variables
DEVICE: Codename(s) of your device(s)ROM_DIR: Only change the last part after src/. Defines the source path within the containerROM_MANIFEST: URL of the rom manifest you want to syncROM_BRANCH: Branch of the rom you want to sync
These variables should be defined in the target.env.
cp ~/docker_droid/minideb/example.env ~/docker_droid/minideb/target.env
DEVICE=cheeseburger,dumpling,TP1803
ROM_DIR=/droid_workdir/src/Los15
ROM_MANIFEST=https://github.com/LineageOS/android.git
ROM_BRANCH=lineage-22.2
- Device tree sources for unofficial support
LOCAL_MANIFEST: Direct link to the local manifest(s) orCLONE_REPOS: Links to the repo(s) to clone. Repo name MUST have the following pattern https://github.com/user/android_dir1_dir2_dir3/tree/branch, https://github.com/user/dir1_dir2_dir3/tree/branch or https://github.com/user/proprietary_dir1_dir2_dir3/tree/branch. Not recommended.FETCH_MUPPETS: Whether to fetch the official TheMuppets vendor repos. Only works on LineageOS 21 and above due to the respective manifest groups. Any non-empty value is true. Only works with CLONE_REPOS.BL_RELOCK: Signs vbmeta and uploads pkmd custom key. Untested, use at your own risk.
- Fallbacks
LUNCH_PREFIX_FALLBACK: Prefix for lunching, i.e. lineage_ for LineageOS. Needed when neitherLOCAL_MANIFESTorCLONE_REPOSare specified.ROM_PREFIX_FALLBACK: Prefix for naming, i.e. lineage will result in a package name like lineage-extraversion(if set)-version-date-device-signed.zip. Needed when _TARGET_PACKAGE is not defined in vendor//build/tasks/* or build/core/Makefile.ROM_VERSION_FALLBACK: Version fallback for package name. Needed when rom does not specify PRODUCT_VERSION_MINOR/PRODUCT_VERSION_MAJOR in vendor/*/config/.ROM_OTA_BRANCH_FALLBACK: Ota branch fallback. Needed when roms have conflicting branch names and ota updates are set up.RELEASETOOL_EXTRA_FLAGS: Releasetool flags for setting up legacy quirks i.e. skip certain vintf checks.
- GitHub Upload
GITHUB_TOKEN: Github Token for upload (and/or push) authentificationOTA_REPO_URL: for example git@github.com:user/ota_config, will also be used for uploading- Requires
GITHUB_TOKENor passwordless ssh keys added to your GitHub account
- SourceForge Upload
SF_USER: Username of your accountSF_RELEASES_REPO: Project name- Requires passwordless ssh keys added to your SourceForge account
- SSH Upload
SSH_USER: Username on the ssh serverSSH_UPLOAD_URL: ssh server domain or ipSSH_DOWNLOAD_URL: Direct download url excluding filename to ssh server- Requires passwordless ssh keys with respective public keys authorized on your ssh server
- Telegram logging
TELEGRAM_TOKEN: Telegram Token. Needed when telegram logging is set up.TELEGRAM_CHAT: either as @xyz or the id
TIME_ZONE: either as in the format UTC+2 or CETROM_BUILD_FLAGS: if you want to define values likeWITH_GMS=trueyou can do this in here, even with multiple of them separated by comma for separate builds or space for the same build- OTA Updates
- At least one file provider mentioned above
OTA_REPO_URL: Any git hoster using ssh authentification i.e. GitHub, GitLab, CodeBerg,...
- Repopick
REPOPICK_PICKS: Fetch changes from respective Gerrit instance using short-form change-idREPOPICK_TOPICS: Fetch changes from respective Gerrit instance using topicsREPOPICK_PULLS: Pull changes from respective Gerrit instance using short-form change-id
These variables should be defined in config.env.
GITHUB_TOKEN=thing1234
OTA_REPO_URL=git@github.com:user/ota_config
You can use config.env for all variables, that span across more than one device. To include this run:
bash dockdroid -r target.env -c config.env
--config can also be used. Your config file can be named however you please.
dotfiles: .gitconfig for syncing and .ssh for authentification. Needs to be copied from the host manually.keys: Contains keys for signing the build. Will be generated automatically if not provided.logs: Contains logs and error messages. Logs older than a day will be deleted on a rerun.ccache: Used for build caching to speed up compilation. Set to 40GB by default. Can be disabled by overwriting the value with 0 for space-saving.
- After setting everything up you should do a test build with the default variables for testing. (Be sure to be in ~/docker_droid/minideb)
bash dockdroid -r target.env
- Look up known issues in TODO.md
- If the error is undocumented you can set DEBUG=true in the target.env and send the part of the logs, where things go overboard via the issues or debug it on your own and send a pull request.
You can further speed up build times by using tmpfs as described here
- GitHub releases enforces a maximum file size of 2 GiB in their releases
- SourceForge restricts project size to 5-30 GiB depending on the download throughput
- GitLab releases are not feasible due to their 100 MiB attachment size limit
- CodeBerg releases are not feasible due to their 100 MiB size limit as well