Archive | Sierpień 2016

Yocto, kernel Customization.

Playing with Yocto projects, there is a fair chance that, you will need to configure Linux kernel. In my project, I had to add overlay files system to embedded Linux kernel.

Let’s begin:

bitbake virtual/kernel -c menuconfig

Kernel configuration menu appears. Navigate to File system, enter inside, select Overlayfs and press y. Save changes, and exit menu.

Note, that menuconfig tries to allocate new terminal, if you using ssh for example, this could fail.

Now, build image:

bitbake core-image-minimal

Trivial right?

No.

There is fair of chance, that generated kernel does not contain modifications.

Kernel configuration is saved in .config file. Unfortunately bitbake is unable to detect file change, and does not start kernel recompilation.

Let’s force kernel recompilation then:

bitbake virtual/kernel -c compile -f

and now:

bitbake core-image-minimal

Now, kernel should contain changes.

Unfortunately .config file gets deleted quite often. For example:

  • bitbake virtual/kernel -c clean
  • bitbake virtual/kernel -c cleanall (removing also kernel sources)
  • Not sure about downloading new version of kernel

So be prepared, and check your kernel configuration often.

You may want to add some features as kernel-module, not directly compiled into kernel.

Again, start confguration menu:

bitbake virtual/kernel -c menuconfig

Inside kernel configuration menu, press m on overlayfs, instead y. Save, close, and:

bitbake core-image-minimal 

Now, module is preassumbly compiled, but not present in the image. It’s because none of recipes includes kernel-module. One of the receipes should contain fallowing lines:

RDEPENDS_${PN} += " kernel-modules"
RDEPENDS_${PN} += " kernel-module-overlay"

And then:

bitbake virtual/kernel -c compile -f
bitbake core-image-minimal

Search inside subdirectories inside tmp directory. Find rootfs dir, lib dir should contain modules directory.

The good thing of „module” way, is that, whenever .config file will be overwriten, and module will not be created – bitbake will complain on kernel-module-overlay line.

Reklamy