This topic explains how to build the Linux kernel externally, without using Digi Embedded Yocto.

Pros and cons

  • Pros

    • Faster build of your kernel and device tree changes without the overhead of the Yocto build process.

  • Cons

    • Fixes released by Digi to the Linux kernel on GitHub are not automatically applied. You must manually check for released changes to merge into (or rebase) your forked repository.

    • Resulting binaries are not integrated in Digi Embedded Yocto images. You have to manually deploy the binaries to your target.

Instructions

Prepare the sources and build environment

  1. Clone the Linux kernel repository in a directory of your choice and specify the appropriate branch to check out:

    $ cd <your-chosen-path>
    $ git clone git@github.com:digi-embedded/linux.git -b v5.15/nxp/dey-4.0/maint
    You can also create new branches for your own development needs, but you must periodically merge them with the official branches to get source code updates.
  2. Set up the build environment so your current shell session has the variables needed for the build, such as toolchain path, cross-compile prefixes, and target architecture.

    1. If you don’t already have it, download the Digi Embedded Yocto toolchain for your platform from the Digi support page and install it. See Download and install the toolchain.

    2. Source the environment setup script:

      $ source /path/to/toolchain/environment-setup-cortexa35-dey-linux

Change the Linux kernel configuration

Now that the environment is ready, configure the kernel for the ConnectCore 8X:

$ make ccimx8_defconfig

After running this command, you can modify the default configuration via an ncurses interface with:

$ make menuconfig

Change the kernel configuration as needed, then save and close the configuration tool.

If you wish to save your custom configuration for future builds, save it as a defconfig, copy the generated file to arch/arm64/configs, and name it as you like:

$ make savedefconfig
$ cp defconfig arch/arm64/configs/my_custom_defconfig

Compile the kernel

Once you have configured the kernel, you can compile it. To build a kernel image and the device tree blobs, run:

$ make -j8
The -j8 flag specifies the number of parallel jobs to run during the build. Set it to twice the number of cores on your development machine to speed up compilation.

You can find the final kernel Image.gz in arch/arm64/boot and the device tree blobs in arch/arm64/boot/dts/digi.

You can choose to compile only the device tree blobs with:

$ make dtbs

For information on additional make commands, run:

$ make help

Deploy the kernel on your target

After you build your kernel and device tree, proceed to deploy them. See Deploy the kernel on your target.