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 python3-pip ninja-build \
           cryptsetup-bin cutils cmake pkg-config xorriso mtools
    
    $ sudo pip3 install meson==0.59.2
    $ sudo pip3 install mako==1.1.0
    

Build Celadon in VM with Android 13

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 below repo init command pulls the latest development CiV source code based on Android 13 (T Dessert) from the master branch.

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

    To continue working on the Android 12 (S Dessert) based CiV source code, use the following manifest instead:

    $ repo init -u https://github.com/projectceladon/manifest -b celadon/s/mr0/stable
    
  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

    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 and out/target/product/caas/caas-flashfiles-eng.$USER.iso.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.