Setup Build Server
This guide gets a shared Linux machine ready to build Android Automotive images for the NXP i.MX8 QuadMax MEK.
This machine is treated as a build server, not the day-to-day development workstation.
Use the build server to:
- Store the large NXP source tree and release bundles.
- Build Android images and related artifacts.
- Publish those artifacts somewhere the team can retrieve them.
Use your laptop to:
- Flash hardware with
adb,fastboot, oruuuas needed. - Deploy app changes.
- Capture logs and debug the target device.
This guide focuses on the build-server side:
- Prepare the host machine.
- Copy the shared
justfileonto the server. - Download the NXP release package.
- Sync and build the source tree.
- Store the resulting artifacts in a predictable shared location.
Host requirements
Section titled “Host requirements”This workflow assumes a dedicated build server with:
- Ubuntu 24.04
- 4 CPU cores
- 32 GB RAM
- 16 GB or more of swap configured
- 450 GB of free disk space before the source bundle is extracted
- Docker installed and usable by the build users
What you need before you start
Section titled “What you need before you start”Make sure you have access to:
- The NXP Android Automotive BSP for your target release
- Credentials or portal access required to download NXP release artifacts
- A shared location or convention for publishing completed build outputs
Install host tools
Section titled “Install host tools”Install the tools required to run the shared build workflow:
sudo apt updatesudo apt install -y \ git \ curl \ unzip \ justInstall Docker separately using the official Install Docker Engine on Ubuntu instructions.
Add your user to the Docker group if needed:
sudo usermod -aG docker "$USER"newgrp dockerConfigure swap
Section titled “Configure swap”Android Automotive builds can exhaust memory during Soong bootstrap even when the
main build runs with -j1. On a 32 GB build server, configure at least 16 GB of
swap before running the first full build.
One straightforward Ubuntu setup is a swapfile:
sudo fallocate -l 16G /swapfilesudo chmod 600 /swapfilesudo mkswap /swapfilesudo swapon /swapfileecho '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstabVerify that swap is active:
swapon --showfree -hIf this machine is shared or you continue to see build processes get killed, raise the swap size further or move the build to a host with more RAM.
Create a shared workspace
Section titled “Create a shared workspace”sudo groupadd --system android-buildsudo usermod -aG android-build "$USER"sudo mkdir -p /srv/android-automotivesudo chgrp -R android-build /srv/android-automotivesudo chmod -R 2775 /srv/android-automotivecd /srv/android-automotiveAdd any future build-server users to the android-build group as well so they can work in the shared workspace.
This directory will hold downloaded release archives, the extracted source tree, and generated build artifacts.
Verify workspace access
Section titled “Verify workspace access”After running sudo usermod -aG android-build "$USER", start a fresh shell in the new group before continuing. The simplest option is:
newgrp android-buildBefore moving on, verify that this shell can write to the shared workspace:
touch /srv/android-automotive/test.txtrm /srv/android-automotive/test.txtIf touch fails, run newgrp android-build again and repeat the check before running any just recipes inside /srv/android-automotive.
Copy the build server justfile
Section titled “Copy the build server justfile”This repo includes a dedicated build-server justfile here.
Run this recipe from the repo root on your laptop to copy that file onto the build server:
just push-build-server-file user@host docs/public/build-server/justfileThat recipe copies the given file into /srv/android-automotive/ on the build server.
The intended usage on the build server is:
cd /srv/android-automotivejustThis will list the available build server recipes.
Install repo
Section titled “Install repo”From /srv/android-automotive, run the remaining one-time setup recipe:
cd /srv/android-automotivejust install-repoDownload the NXP release bundle
Section titled “Download the NXP release bundle”Download the Android Automotive release package from the NXP Android Automotive software page
Then click the Downloads button.
Find 16.0.0_1.1.0_ANDROID_Automotive_SOURCE, click the Download button, and follow the short form until you have downloaded the .tar.gz file.
You can also download the matching Documentation package and any release notes you want to keep with the build, but the source package above is the key artifact for the build server workflow.
Extract the source bundle
Section titled “Extract the source bundle”Run this recipe from the repo root on your laptop to copy the source bundle onto the build server:
just push-build-server-file user@host /path/to/imx-automotive-16.0.0_1.1.0.tar.gzAfter copying the source bundle to the build server, your workspace should look like this:
/srv/android-automotive/├── justfile└── imx-automotive-16.0.0_1.1.0.tar.gzThen extract it on the build server:
cd /srv/android-automotivejust extract-bspAfter extraction, you should have a source tree at:
/srv/android-automotive/imx-automotive-16.0.0_1.1.0Verify the extracted source directory:
ls -lah /srv/android-automotive/imx-automotive-16.0.0_1.1.0Initialize the Android source tree
Section titled “Initialize the Android source tree”Configure Git identity for the build user:
git config --global user.name "Your Name"git config --global user.email "you@example.com"Then source the setup script included in the release:
cd /srv/android-automotive/imx-automotive-16.0.0_1.1.0source ./imx_android_setup.shThis step will take a long time because it performs the initial source fetch and repository setup. Expect it to take at least an hour.
After it completes, the Android source tree used for the build will be under:
/srv/android-automotive/imx-automotive-16.0.0_1.1.0/android_buildPush OS customizations
Section titled “Push OS customizations”This repo includes OS customizations under os/. Push them to the build server before building:
just push-os-customizations user@hostThis copies the entire os/ tree to /srv/android-automotive/os/ on the build server. The just build recipe automatically syncs it into the source tree at device/mrs/, then patches device/nxp/imx8q/mek_8q/mek_8q_car2.mk to include device/mrs/mrs.mk, which is the single integration entry point for MRS OS customizations.
If you have not pushed these customizations yet, the build still works, but it produces a stock NXP image without the MRS OS customizations.
First, you need to build the docker container. This creates a docker container image that you can use for containerized Android Automotive builds. This build takes around 20 minutes.
cd /srv/android-automotivejust build-containerStart the Android Automotive build from /srv/android-automotive:
cd /srv/android-automotivejust buildThis recipe starts the build in the background. It does not require you to keep the SSH session open while the build runs.
The build workflow handles:
- building the Docker image from
/srv/android-automotive/imx-automotive-16.0.0_1.1.0/android_build - starting a detached container with that
android_buildtree mounted at/work/android_src - running
lunch mek_8q_car2-nxp_stable-userdebug - running
./imx-make.sh -j1
To check whether the detached container is still running, use docker ps. To inspect the latest build output, use docker logs -f android-automotive-build.
When the build completes, the output images should be under:
/srv/android-automotive/imx-automotive-16.0.0_1.1.0/android_build/out/target/product/mek_8q
Publish build outputs
Section titled “Publish build outputs”Publishing build outputs should mean creating a stable release directory on the build server that the laptop can pull from later.
For the current shared justfile, the publish target is:
/srv/android-automotive/releases/imx-automotive-16.0.0_1.1.0
Run:
cd /srv/android-automotivejust publish-artifactsThat should produce a directory shaped roughly like this:
/srv/android-automotive/releases/imx-automotive-16.0.0_1.1.0/└── mek_8q/ ├── boot.img ├── boot-imx.img ├── init_boot.img ├── vendor_boot.img ├── vendor_boot-debug.img ├── super.img ├── super_empty.img ├── partition-table.img ├── partition-table-13GB.img ├── partition-table-dual.img ├── partition-table-13GB-dual.img ├── dtbo.img ├── dtbo-*.img ├── vbmeta.img ├── vbmeta-*.img ├── u-boot-imx8qm-mek-uuu.imx └── uuu_imx_android_flash.shThese files are copied from:
/srv/android-automotive/imx-automotive-16.0.0_1.1.0/android_build/out/target/product/mek_8q
Verify the published release directory with:
cd /srv/android-automotivejust verify-artifactsClean up
Section titled “Clean up”To remove build outputs from the source tree:
cd /srv/android-automotivejust clean-buildTo remove published artifacts:
cd /srv/android-automotivejust clean-artifactsCommon failure points
Section titled “Common failure points”If setup or builds stall, check these first:
- Not enough free disk space
- Build host runs out of memory
- Wrong NXP release bundle or manifest for the target image
- Workspace created inside one user’s home directory
- Build tools installed in user-local paths instead of shared system paths
- Build server does not have the current
docs/public/build-server/justfile - Docker permissions not configured for the build users
Next step
Section titled “Next step”After the build server is producing published images, continue with the laptop-side deployment and app workflow: