- Notifications
You must be signed in to change notification settings - Fork241
🏗 Minimal Android AOSP build environment with handy automation wrapper scripts
License
kylemanna/docker-aosp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Minimal build environment for AOSP with handy automation wrapper scripts.
Developers can use the Docker image to build directly while running thedistribution of choice, without having to worry about breaking the delicateAOSP build due to package updates as is sometimes common on bleeding edgerolling distributions like Arch Linux.
Production build servers and integration test servers should also use the sameDocker image and environment. This eliminates most surprise breakages byby empowering developers and production builds to use the exact sameenvironment. The devs will catch the issues with build environment first.
This works well on Linux. Running this viaboot2docker
(and friends) willresult in a very painful performacne hit due to VirtualBox'svboxsf
sharedfolder service which works terrible forvery large file shares like AOSP.It might work, but consider yourself warned. If you're aware of another way toget around this, send a pull request!
For the terribly impatient.
Make a directory to work and go there.
Export the current directory as the persistent file store for the
aosp
wrapper.Run a self contained build script, which does:
Attempts to fetch the
aosp
wrapper if not found locally.Runs the
aosp
wrapper with an extra argument for the docker binary andhints to the same script that when run later it's running in the dockercontainer.The aosp wrapper then does it's magic which consists of fetching thedocker image if not found and forms all the necessary docker runarguments seamlessly.
The docker container runs the other half the build script whichinitializes the repo, fetches all source code, and builds.
In parallel you are expected to be drinking because I save you some time.
mkdir nougat ; cd nougat export AOSP_VOL=$PWD curl -O https://raw.githubusercontent.com/kylemanna/docker-aosp/master/tests/build-nougat.sh bash ./build-nougat.sh
This takes about 2 hours to download and build on i5-2500k with 100Mb/s network connection.
The Dockerfile contains the minimal packages necessary to build Android basedon the main Ubuntu base image.
Theaosp
wrapper is a simple wrapper to simplify invocation of the Dockerimage. The wrapper ensures that a volume mount is accessible and has validpermissions for theaosp
user in the Docker image (this unfortunatelyrequires sudo). It also forwards an ssh-agent in to the Docker containerso that private git repositories can be accessed if needed.
The intention is to useaosp
to prefix all commands one would run in theDocker container. For example to runrepo sync
in the Docker container:
aosp repo sync -j2
Theaosp
wrapper doesn't work well with setting up environments, but withsome bash magic, this can be side stepped with short little scripts. Seetests/build-nougat.sh
for an example of a complete fetch and build of AOSP.
ADocker Compose file is provided in the root of this repository, you can tweak it as need be:
version:"2"services:aosp:image:kylemanna/aosp:latestvolumes: -/tmp/ccache:/ccache -~/aosp:/aosp
Example run:docker-compose run --rm aosp repo sync -j4
-- your android build directory will be in~/aosp
.
There are some known issues with using Docker Toolbox on macOS and currentvirtualization technologies resulting in unusual user ID assignments and verypoor performing virtualization file sharing implementations with things likeVirtualBox. It's recommended to run this image completely in a virtual machinewith enough space to fit the entire build (80GB+) as opposed to mapping thebuild to the local macOS file system via VirtualBox or similar.
- Android Kitkat
android-4.4.4_r2.0.1
- Android Lollipop
android-5.0.2_r1
- Android Marshmallow
android-6.0.1_r80
- Android Nougat
android-7.0.0_r14