How to use customized defconfig in Colibri imx6ull

I want to change the kernel config.
I ran the following to create fragment.cfg.
$ bitbake virtual/kernel -c menuconfig
$ bitbake virtual/kernel -c diffconfig

Please tell me how to make a recipe to reflect this.
Or provide a sample recipe.

Dear @C.T, welcome to the Toradex Community.

We have information here on how to modify the kernel configuration in Yocto:
https://developer.toradex.com/knowledge-base/custom-meta-layers-recipes-images-in-yocto-project#Customize_the_Kernel

Let us know if you need further help.

Kind regards,
Alvaro.

I created the following configuration.

.
├── COPYING.MIT
├── README
├── conf
│   └── layer.conf
└── recipes-kernel
    └── linux
        ├── linux-toradex
        │   └── fragment.cfg
        └── linux-toradex_%.bbappend

The bbappend file is described as follows.
FILESEXTRAPATHS_prepend := “${THISDIR}/${PN}:”

SRC_URI_append += "\
file://fragment.cfg
"

do_configure_append() {
cat …/*cfg >> ${B}/.config
}

bitbake

bitbake -b meta-customer/recipes-kernel/linux/linux-toradex_%.bbappend 

error

ERROR: Command execution failed: Traceback (most recent call last):
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/command.py", line 106, in runAsyncCommand
    commandmethod(self.cmds_async, self, options)
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/command.py", line 550, in buildFile
    command.cooker.buildFile(bfile, task)
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/cooker.py", line 1301, in buildFile
    self.buildFileInternal(buildfile, task)
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/cooker.py", line 1326, in buildFileInternal
    infos = bb_cache.parse(fn, self.collection.get_file_appends(fn))
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/cache.py", line 485, in parse
    datastores = self.load_bbfile(filename, appends)
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/cache.py", line 341, in load_bbfile
    datastores = parse_recipe(bb_data, bbfile, appends)
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/cache.py", line 300, in parse_recipe
    bb_data = bb.parse.handle(bbfile, bb_data)
  File "/home/****/work/yocto/test/layers/openembedded-core/bitbake/lib/bb/parse/__init__.py", line 108, in handle
    raise ParseError("not a BitBake file", fn)
bb.parse.ParseError: ParseError in /home/****/work/yocto/test/layers/meta-customer/recipes-kernel/linux/linux-toradex_%.bbappend: not a BitBake file

Question

・Why do you get such an error?
・Is the bbapend file correct?

Hi @C.T, thanks for the details.

You cannot build a bbappend, only a bb file.

To build the kernel, you should use the following:

bitbake virtual/kernel

Please note the error message mentions that this is not a Bitbake file:

raise ParseError("not a BitBake file", fn)
 bb.parse.ParseError: ParseError in /home/****/work/yocto/test/layers/meta-customer/recipes-kernel/linux/linux-toradex_%.bbappend: not a BitBake file 

The bbappend looks good by itself

I executed as below.
bitbake virtual/kernel

Can you confirm this change?(no Actual machine)

I understand that you added the content of fragment.cfg: What are the changes there? I checked the question but didn’t see it here.

In any case, testing would take a long time since we would have to recompile it here with your changes changes but you can do several things to test this without the machine:

  1. Check/Add changes with bitbake -c menuconfig virtual/kernel.
  2. Change the config and see if the kernel is recompiled. In this case, it is very likely that the changes are added.

Let us know how this goes and if it doesn’t show the changes, please post the changes and we will check.

Kind regards,
Alvaro.

test fragment.cfg (change CONFIG_COUNTER=y)

CONFIG_LOCALVERSION="-5.1.0-devel"
CONFIG_LOCALVERSION_AUTO=y
CONFIG_COUNTER=y
# CONFIG_FTM_QUADDEC is not set

Revert the changes for confirmation.

bitbake -c menuconfig virtual/kernel

CONFIG_COUNTER=n

Bitbake

bitbake virtual/kernel

Check

bitbake -c menuconfig virtual/kernel

But,CONFIG_COUNTER=n

meta-toradex-demos includes fstab.
Is it related?

Sorry for the delay. Could be that the prepend is not done correctly

Please try the supported method of creating a patch file like described here:
https://developer.toradex.com/knowledge-base/custom-meta-layers-recipes-images-in-yocto-project#Customize_the_Kernel

For this,

  1. Copy the kernel under tmp/work-shared/colibri-imx6ull/kernel-source/ in another folder.
  2. Make your changes to the defconfig/kernel on arch/arm/configs/colibri-imx6ull_defconfig
  3. Create a patch with “git diff HEAD > mypatch.patch”.
  4. Add this to the kernel recipe as SRC_URI like in the documentation.