如何在yocto中为树莓派使用自己的内核配置?

Ste*_*itz 2 linux linux-kernel raspberry-pi yocto

我想为RPI2 +自定义板删除一些未使用的驱动程序。为此,我通过以下方式创建自己的配置:

bitbake linux-raspberrypi -c menuconfig
Run Code Online (Sandbox Code Playgroud)

并将新的内核预设保存到文件中defconfig

之后,我为linux-raspberryp配方创建了一个附加文件。

所以我创建了文件

linux-raspberrypi%.bbappend
Run Code Online (Sandbox Code Playgroud)

并填充:

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

SRC_URI += "file://defconfig"

PACKAGE_ARCH = "raspberrypi2"
Run Code Online (Sandbox Code Playgroud)

我将defconfig文件放到:

<meta-mylayer>/recipes-kernel/linux/linux-raspberrypi/raspberrypi2/defconfig
Run Code Online (Sandbox Code Playgroud)

通过以下方式重新编译内核时:

bitbake linux-raspberrypi -c clean
bitbake linux-raspberrypi
Run Code Online (Sandbox Code Playgroud)

采用标准RPI2配置。

任何想法如何克服这个问题?我正在研究meta-raspberrypi和yocto的“实际” pyro分支。

And*_*ers 5

好吧,不幸的是,最简单的方法可能是修补内核源代码……或者将defconfig复制到内核树中。

meta-raspberrypi层在其内核配方中做了一些不幸的事情,尽管随着时间的流逝它已经变得更好,但它们仍然不是很好。

如果您查看一下recipes-kernel/linux/linux-raspberrypi.inc,以下几行说明了该问题:

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."
}
Run Code Online (Sandbox Code Playgroud)

因此,他们将树内defconfig复制到${WORKDIR}/defconfig,从而覆盖了您自己的defconfig。

您在自己中.bbappend,您可以尝试添加:

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

因此,首先用您自己的覆盖内核树中的一个defconfig