Dockerized environment to build Switchroot Android image
4.4K
This repo provides a set of scripts and a Dockerfile (build-scripts/Dockerfile) to create the basic environment for building Lineage and Switchroot Android.
This build environment is meant to automate the steps from the following guide: Q Tips Guide
Read and understand that guide before continuing.
Also, if you have built Switchroot Pie before, delete the whole ./android directory before starting with Q
After doing that, you can use this to generate the content of your SD card for flashing and installing via Hekate and TWRP.
docker (proper docker installation: apt install docker.io if on Ubuntu. It might work if installed via Snap with the latest changes, but it wasn't tested. It now requires --privileged mode)mkdir -p ./android/lineage
sudo chown -R 1000:1000 ./android
# Don't use the "latest" tag unless you know what you're doing.
# Use a versioned tag from https://hub.docker.com/r/pablozaiden/switchroot-android-build/tags
sudo docker run --privileged --rm -ti -e ROM_NAME=icosa -v "$PWD"/android:/build/android pablozaiden/switchroot-android-build:latest
./android/output to the root of your SD card (partitioned as a single FAT32-formatted volume; format with Hekate as it ensures proper cluster size for performance)DISABLE_DOCKER environment variable.BUILDBASE directory will be set to $(pwd)/build. To change this, set the BUILDBASE environment variable to the path of the base directory where the process will be executed.install-prerequisites-ubuntu.sh provided with this repository. It was only tested on Ubuntu)DISABLE_SYMLINK_TO_DOCKER_BUILD environment variable--mount feature is only available on developer insider builds of Windows 10). Also, make sure to configure WSL2 to have, at least 16GB of available RAM or 12GB and enough swap: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig)docker Either prepend sudo to the script execution, or allow the current user to run docker without sudo./build-android.sh --rom <icosa | foster | foster_tab> --rom-type <zip | images> --flags <nobuild | noupdate | nooutput>icosa, default for --rom-type is zip, default for --flags is emptyzip, the required output for installing via Hekate will be copied to ./android/output or $BUILDBASE/android/output, unless the nooutput flag is present./android/lineage or $BUILDBASE/android/lineage directoy contains files and will work under the assumption that the source code was already downloaded at least once. Then it will re-sync the repos, re-apply patches and re-buildImportant: The docker image builds everything in the /build/android directory, inside the container. The ./build-android.sh script mounts the host directory ./android as a volume to that directory in the container, so the sources and build output can live after the container is destroyed.
If that directory is not properly mounted, the build may fail.
To apply custom patches to your build, create the extra-content/patches.txt file and add lines with the <patch_base_dir>:<patch_path> format or add the extra-content/repopics.txt with one patch per line. The same format is being used for default patches and repopics in build-scripts/default-patches.txt and build-scripts/default-repopics.txt
The files must end with an empty line.
By default, the script will try to download the latest repopics main repository master branch and will generate the patches file based on the contents of the switchroot manifest. To avoid doing this and always use the local copy, add a non-empty LOCAL_REPOPICS_PATCHES environment variable. Keep in mind that it may not always be up to date.
When building with docker, make sure to also mount the extra-content directory to ${BUILDBASE}/extra-content (as it is done in build-in-docker.sh)
There are several .sh scripts in the repo root, for convenience. You can find usage documentation inside each script.
Content type
Image
Digest
Size
700.9 MB
Last updated
almost 5 years ago
docker pull pablozaiden/switchroot-android-build