How to use an own kernel configuration for a raspberry pi in yocto?

谁说我不能喝 提交于 2021-01-27 17:49:43

问题


I like to remove some unused drivers for my RPI2 + custom board. For that I am creating an own configuration via:

bitbake linux-raspberrypi -c menuconfig

and save the new kernel preset to the file defconfig.

After this I created an append file for the linux-raspberryp recipe.

So I created the file

linux-raspberrypi%.bbappend

and filled it with:

FILESEXTRAPATHS_prepend := "${THISDIR}/linux-raspberrypi:"

SRC_URI += "file://defconfig"

PACKAGE_ARCH = "raspberrypi2"

I put the defconfig file to:

<meta-mylayer>/recipes-kernel/linux/linux-raspberrypi/raspberrypi2/defconfig

When recompiling the kernel via:

bitbake linux-raspberrypi -c clean
bitbake linux-raspberrypi

The standard RPI2 configuration is taken.

Any idea how to overcome this problem? I am working on the "actual" pyro branch of meta-raspberrypi and yocto.


回答1:


Well, unfortunately, the easiest way is probably to patch the kernel source... Or copy your defconfig over the in kernel-tree one.

The meta-raspberrypi layer does some unfortunate things in their kernel recipes, and even though this has become better with time, they're still not really nice...

If you take a look at recipes-kernel/linux/linux-raspberrypi.inc, the following lines explains the issue:

KERNEL_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig"

do_kernel_configme_prepend() {
    install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
}

Thus,they're copying the in-tree defconfig to ${WORKDIR}/defconfig, thereby overwriting your own defconfig.

You in you .bbappend, you could try to add:

do_kernel_configme_prepend() {
    install -m 0644 ${WORKDIR}/defconfig ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
}

Thus, first overwriting the in-kernel-tree one with your own defconfig.




回答2:


Please take a look at how to use devtool to modify source code for the jethro: http://www.yoctoproject.org/docs/2.0/dev-manual/dev-manual.html#using-devtool-in-your-workflow

I would start by having a fork at the git repository that it is using; http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/recipes-kernel/linux/linux-raspberrypi_4.9.bb

Using devtool in Yocto; in your build directory: create a my-linux-raspberry folder;

mkdir linux-raspberry-test
devtool modify -x linux-raspberry ./my-linux-raspberry

This will put unpack the source code into my-linux-raspberry for you to modify; It also create the git repository in there;

Then, modify the code in my-linux-raspberry; To test build, run devtool build linux-raspberry; Once you are satisfied, add this git repository to your fork;

git add .
git commit -m "my-linux-raspberry"
devtool update-recipe linux-raspberry

Optional: run devtool reset linux-raspberry to remove the bbappend file;



来源:https://stackoverflow.com/questions/45573078/how-to-use-an-own-kernel-configuration-for-a-raspberry-pi-in-yocto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!