If you want to make permanent kernel changes, you must apply them to the Yocto kernel recipe in one of the following ways:

Git-based workflow

You can use a git-based workflow to change the kernel recipe to take source code from your own fork of the Linux kernel source tree. This allows you to have full control of the repository while still using Digi Embedded Yocto for building it.

By using a fork of the kernel source tree, you won’t benefit from any updates released by Digi. You must manually check for released changes to merge into your forked repository.

To do this, modify the kernel recipe (linux-dey_<kernel version>.bb) by adding the URL of your git repo to it:

SRC_URI = "git://url/to/my/repo.git"

You can specify the branch you want to compile from by using the SRCBRANCH variable:

SRCBRANCH = "v3.14/master"
SRCREV = "${AUTOREV}"

Patch-based workflow

Generating patches for a recipe allows you to remain in sync with the original source code tree while still applying modifications to suit your needs. For this approach, you can generate the patches from a standalone/external build or the Yocto devshell.

  1. Make your changes in the source code.

  2. Commit them with git:

    git add <changed files>
    git commit -s -m 'This is a test patch'
  3. Keep making changes and commits as needed.

  4. Create the patches for the number of commits you have made and put them inside the kernel’s recipe folder. For example, if you have made five commits:

    git format-patch -5 -o /path/to/Yocto/sources/meta-digi/meta-digi-arm/recipes-kernel/linux/linux-dey-<kernel version>/<platform>
  5. Edit the kernel recipe (linux-dey_<kernel version>.bb) and add the patches to the sources. Follow the same example as above:

    SRC_URI_append_<platform> = " \
        file://0001-this-is-patch1.patch \
        file://0002-now-patch2.patch \
        file://0003-another-patch.patch \
        file://0004-yet-another-patch.patch \
        file://0005-this-is-the-final-patch.patch \
    "
  6. Rebuild the kernel:

    bitbake -c cleanall virtual/kernel
    bitbake virtual/kernel

Change the configuration

To make Yocto use your custom configuration, you must set the Yocto variable KERNEL_DEFCONFIG to:

  • the relative path to a kernel defconfig file inside the kernel repository.

    KERNEL_DEFCONFIG = "arch/arm/configs/my_custom_defconfig"
  • the full path to a kernel defconfig file in your workstation.

    KERNEL_DEFCONFIG = "/path/to/my_custom_defconfig"
  • nothing, then providing a kernel defconfig in the meta-digi layer (file must be named 'defconfig').

    KERNEL_DEFCONFIG = ""
    cp /path/to/my_custom_defconfig /path/to/Yocto/sources/meta-digi/meta-digi-arm/recipes-kernel/linux/linux-dey-<version>/<platform>/defconfig
To create a defconfig file from your current configuration, run make savedefconfig from the kernel source tree or bitbake -c savedefconfig virtual/kernel from your Yocto project folder.