[yocto] kernel config and meta-altera

Bruce Ashfield bruce.ashfield at windriver.com
Tue Feb 17 11:05:06 PST 2015


On 15-02-17 07:55 AM, PIEWALD Georg wrote:
> Hi all,
> I'm rather new to the Yocto world so please bear with me. I built a Linux kernel using the Altera "Golden System Reference Design" [1], which is a 1GB tarball containing all required layers and all source code. Works fine.
>
> Now I'd like to customize the image. Particularly I want to change the kernel config to include the xHCI driver as a module [2]. I created a layer containing a bbappend-file and a "config fragment" file. No success. Reading tons of threads in the mailing list archive I figured that config fragments will not work, because apparently the meta-altera layer inherits from "kernel" rather than "linux-yocto".
>
> So I tried the "defconfig" way, which I thought should work always. It turned out that the defconfig file is correctly picked up and copied to $WORKDIR, but simply not applied to .config there. After a long time of searching I figured out that linux-altera.inc [3] apparently overwrites the do_configure task and ignores any defconfig.
>
> Eventually, the only solution I came up with, was a new task in my bbappend file:
>    do_change_config() {
>        sed -i "s|^.*CONFIG_USB_XHCI_HCD.*$|CONFIG_USB_XHCI_HCD=m\\n# CONFIG_USB_XHCI_HCD_DEBUGGING is not set|" .config
>    }
>    addtask change_config before do_compile after do_configure
>
> This works, but I find it somehow ugly. Can you think of a better way to handle this? Can I somehow add the "defconfig" or (even better) the "config fragments" features to the meta-altera layer?

I'm not familiar with the build process in meta-altera, but I went and had
a look. Everything that follows is from my 10 minutes of looking ....

Did you try setting ${KERNEL_DEFCONFIG} to point to your defconfig ?
You would have to arrange for the defconfig to be within the kernel tree,
since the kernel build is being invoked to process that config. You could
do that positioning of your config from a task that runs before 
do_configure().

Barring that there's not a lot that you can do when a recipe has a custom
configure phase, other than what you've already done. You need  to run after
it completes, so you can ensure that your options are applied last.

Anything that jumps to mind would be a variation on what you've tried. You
could avoid modifying the .config directly and simply re-do the defconfig
processing step from the kernel.bbclass's default routine or you could
change the recipe to inherit linux-yocto, and then define your own fragments
.. but there's no guarantee that that conversion is simple to do.

Alternatively, what's the important thing to maintain for you build ? 
The source
tree and patches that are applied, or the configuration ? You could always
create your own kernel recipe, point it at the source tree + patches and 
have
your own configuration routines do the work.

.. just a few thoughts.

Cheers,

Bruce

>
> BR, Georg
>
>
> [1] http://www.rocketboards.org/foswiki/Documentation/GSRD131YoctoUserManual
> [2] CONFIG_USB_XHCI_HCD=m
> [3] https://github.com/kraj/meta-altera/blob/master/recipes-kernel/linux/linux-altera.inc




More information about the yocto mailing list