Build Celadon From Source

This page explains the prerequisites and steps to set up your environment, download source code, and build Celadon from source.

Prerequisites

  • A 64-bit development workstation running Ubuntu* 18.04 (Bionic Beaver) operating system.
  • One of the supported versions of python*, either 2.7 or 3.5.6, with python 2.7 as the default.
  • Around 350GB of free disk space on your workstation is required to checkout the source code and to store the build artifacts.

Note

  1. Although Android* is typically built with a GNU/Linux* or macOS* operating system, we recommend you build Celadon images on Ubuntu* 18.04. For setup instructions using other operating systems, refer to the Establishing a Build Environment section on the AOSP website.
  2. Also, note the Android prerequisites for build.

Set up the development environment

Celadon and Android source code consist of multiple Git* repositories. The repo tool makes it easier to work with those repositories.

  1. Create a local bin/ directory, download the repo tool to that directory, and make the binary executable with the following commands:

    $ mkdir -p ~/bin
    $ curl https://storage.googleapis.com/git-repo-downloads/repo >  ~/bin/repo
    $ chmod a+x ~/bin/repo
    $ export PATH=~/bin:$PATH
    
  2. Install the following required packages on your 64-bit Ubuntu 18.04 LTS development workstation prior to the compilation:

    $ sudo apt-get update
    $ sudo apt-get install openjdk-8-jdk git ccache automake \
           lzop bison gperf build-essential zip curl \
           zlib1g-dev g++-multilib python3-networkx \
           libxml2-utils bzip2 libbz2-dev libbz2-1.0 \
           libghc-bzlib-dev squashfs-tools pngcrush \
           schedtool dpkg-dev liblz4-tool make optipng maven \
           libssl-dev bc bsdmainutils gettext python3-mako \
           libelf-dev sbsigntool dosfstools mtools efitools \
           python3-pystache git-lfs python3 flex clang libncurses5 \
           fakeroot ncurses-dev xz-utils
    
    $ sudo apt install cryptsetup-bin
    
  3. CiC requires Docker to build the images. The following instructions install Docker* on your Ubuntu development workstation:

    1. Install the following packages before performing the CiC build:
    $ sudo apt-get install apt-transport-https ca-certificates curl
    
    1. Run the following commands to add the Docker’s official GPG key, set up the repository, and install the Docker Engine - Community from the repository:
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    $ sudo apt-get update
    $ sudo apt-get install -y docker-ce docker-ce-cli containerd.io
    
    1. You may run Docker as a non-root user by adding your user ID to the docker group. For more information, refer to the Get Docker Engine - Community for Ubuntu installation guide.
    $ sudo usermod -aG docker $USER
    

Build Celadon in VM with Android 12

Download the source

  1. Enter the following commands to create an empty directory to hold the Celadon source files and serve as the working directory, and to bring down the latest version of repo tool, including its most recent fixes.

    Note

    The URL specifies the manifest that refers to various repositories used by Celadon, which are placed within the working directory. For now, a .repo/ folder is created to store the manifest and the metadata of the source repositories.

    $ mkdir civ
    $ cd civ
    $ repo init -u https://github.com/projectceladon/manifest -b master -m default.xml
    

    Note, the last repo init command pulls the latest development CiV source code based on Android 12 from the master branch. To continue working on the Android 11 based CiV source code, use the following manifest instead:

    $ repo init -u https://github.com/projectceladon/manifest  -b celadon/r/mr0/stable -m default.xml
    
  2. Enter the following command to pull down the Celadon Android source tree to your working directory. The repo sync operation might take time depending on your Internet download speed. Refer to the Downloading the Source section of the AOSP website for tips to download the source behind a proxy.

    $ repo sync -c
    

Build Celadon in VM image

  1. Optionally, delete existing output of any previous build with the following command in the top-most Celadon source directory:

    $ make clobber
    
  2. Enter the following command to initialize the build variables with the envsetup.sh script:

    $ source build/envsetup.sh
    
  3. Specify your Celadon lunch target using the lunch command. You can run lunch with no arguments to choose different build variants, and select a lunch target from a list of available options. For example, the following commands configure the build system to build the installer files for Celadon in VM images:

    $ lunch caas-userdebug
    $ make flashfiles -j $(nproc)
    

    Note

    1. This is needed for the Tiger Lake Intel® NUC platform.
    2. The -j $(nproc) argument instructs the builder to compile the source code with parallel tasks. The generated kernelflinger executables .ZIP file (out/target/product/caas/caas-flashfiles-eng.$USER.zip) is available after the build. You can refer to Run Celadon in a virtual machine section to prepare the host environment and boot the CiV image with QEMU.
    3. The ‘BUILD_CPU_ARCH’ variable instructs the builder to generate images that leverage Intel® Advanced Vector Extensions (Intel® AVX) and Intel® Advanced Vector Extensions 2 (Intel® AVX2) instructions on the target device. It’s recommended to specify BUILD_CPU_ARCH=kabylake’ while building the images for Comet Lake platform.

Build Celadon in Container with Android 9

Download the source

  1. Enter the following commands to create an empty directory to hold the Celadon source files and serve as the working directory, and to bring down the latest version of repo tool, including its most recent fixes.

    Note

    The URL specifies the manifest that refers to various repositories used by Celadon, which are placed within the working directory. For now, a .repo/ folder is created to store the manifest and the metadata of the source repositories.

    $ mkdir cic
    $ cd cic
    $ repo init -u https://github.com/projectceladon/manifest -b celadon/p/mr0/master -m cic
    

    Note, the last repo init command pulls the latest development CiC source code from the the master branch. To checkout the source code of the PMR0 March-31-2020 release that passed the Platform Exit criteria, run the following command instead:

    $ repo init -u https://github.com/projectceladon/manifest -b celadon/p/mr0/2020q1 -m cic
    
  2. Enter the following command to pull down the Celadon Android source tree to your working directory. The repo sync operation might take time depending on your Internet download speed. Refer to the Downloading the Source section of the AOSP website for tips to download the source behind a proxy.

    $ repo sync -c
    

Build Celadon in Container package

  1. Optionally, delete existing output of any previous build with the following command in the top-most Celadon source directory:

    $ make clobber
    
  2. Enter the following command to initialize the build variables with the envsetup.sh script:

    $ source build/envsetup.sh
    
  3. Specify your Celadon lunch target using the lunch command. You can run lunch with no arguments to choose different build variants, and select a lunch target from a list of available options. For example, the following commands configure the build system to build the package containing Celadon in Container images:

    $ lunch cic-userdebug
    $ make cic -j $(nproc)
    

    Note

    The -j $(nproc) argument instructs the builder to compile the source code with parallel tasks. The generated CiC package (out/target/product/cic/cic-aic-eng.$USER.<time code>.tar.gz) is available after the build. You can follow Deploy on Target of this guide to deploy and start the CiC container on the target device.