This topic shows how to make permanent changes to the kernel source tree and build it using Digi Embedded for Android.

The Android build system uses CLANG to build the kernel instead of C.

1. Change the Linux kernel configuration

Digi Embedded for Android uses a default configuration for the Linux kernel saved in file vendor/digi/kernel_imx/arch/arm64/configs/ccimx8_android_defconfig on the Linux source tree. You can create a custom default configuration file from your current configuration, and use menuconfig or xconfig to customize it.

  1. Go to the kernel source tree:

    $ cd /usr/local/dea-11.0-r2/vendor/digi/kernel_imx
  2. Android uses CLANG instead of C to compile the kernel, so you must include the CLANG binary in the PATH variable:

    $ export PATH=/usr/local/dea-11.0-r2/prebuilts/clang/host/linux-x86/clang-r383902b/bin:${PATH}
  3. Apply the default ccimx8_android_defconfig:

    $ make ARCH=arm64 CC=clang LD=ld.lld CROSS_COMPILE=aarch64-linux-gnu- ccimx8_android_defconfig
  4. Make your configuration changes, save, and quit the configuration tool:

    $ make ARCH=arm64 CC=clang LD=ld.lld CROSS_COMPILE=aarch64-linux-gnu- menuconfig
    Menuconfig is a terminal-oriented configuration tool (using ncurses). Wikipedia Menuconfig explains how to "navigate" within the configuration menu, and highlights main key strokes.

    You can access the configuration user interfaces using menuconfig. This builds and runs an ncurses-based configuration UI.

    You can also build and run a graphical QT-based UI using xconfig.

  5. Generate your custom configuration file. This step generates a default configuration file with your changes in the root directory of your kernel source tree.

    $ make ARCH=arm64 CC=clang LD=ld.lld CROSS_COMPILE=aarch64-linux-gnu- savedefconfig
  6. Copy your kernel defconfig file:

    $ cp defconfig arch/arm64/configs/ccimx8_android_defconfig

2. Rebuild new images

After customizing the kernel defconfig, generate new images. To do so:

  1. Clean the vendor/digi/kernel-imx kernel directory to avoid compilation errors.

    $ make ARCH=arm64 CC=clang LD=ld.lld CROSS_COMPILE=aarch64-linux-gnu- mrproper
  2. Build your images as usual. See Build your development images.

3. Deploy images on your target

After building new images, program the new firmware in your device. See Program firmware.