如何在 yocto 中为 raspberry pi 使用自己的内核配置?
How to use an own kernel configuration for a raspberry pi in yocto?
我想为我的 RPI2 + 定制板删除一些未使用的驱动程序。为此,我正在通过以下方式创建自己的配置:
bitbake linux-raspberrypi -c menuconfig
并将新的内核预设保存到文件defconfig
。
在此之后,我为 linux-raspberryp 配方创建了一个附加文件。
所以我创建了文件
linux-raspberrypi%.bbappend
并填入:
FILESEXTRAPATHS_prepend := "${THISDIR}/linux-raspberrypi:"
SRC_URI += "file://defconfig"
PACKAGE_ARCH = "raspberrypi2"
我把defconfig文件放到:
<meta-mylayer>/recipes-kernel/linux/linux-raspberrypi/raspberrypi2/defconfig
通过以下方式重新编译内核时:
bitbake linux-raspberrypi -c clean
bitbake linux-raspberrypi
采用标准 RPI2 配置。
知道如何克服这个问题吗?
我正在研究 meta-raspberrypi 和 yocto 的 "actual" pyro 分支。
请看一下如何使用devtool修改jethro的源代码:
http://www.yoctoproject.org/docs/2.0/dev-manual/dev-manual.html#using-devtool-in-your-workflow
我会首先在它正在使用的 git 存储库中创建一个分支;
http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/recipes-kernel/linux/linux-raspberrypi_4.9.bb
在 Yocto 中使用 devtool
;
在您的构建目录中:创建一个 my-linux-raspberry 文件夹;
mkdir linux-raspberry-test
devtool modify -x linux-raspberry ./my-linux-raspberry
这会将源代码解压到my-linux-raspberry
中,供您修改;它还在其中创建 git 存储库;
然后,修改my-linux-raspberry
中的代码;要测试构建,运行 devtool build linux-raspberry
;满意后,将此 git 存储库添加到您的复刻中;
git add .
git commit -m "my-linux-raspberry"
devtool update-recipe linux-raspberry
可选:运行 devtool reset linux-raspberry
删除bbappend文件;
嗯,不幸的是,最简单的方法可能是修补内核源代码...或者将您的 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."
}
因此,他们正在将树内 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."
}
因此,首先用你自己的defconfig
覆盖内核树中的那个。
我想为我的 RPI2 + 定制板删除一些未使用的驱动程序。为此,我正在通过以下方式创建自己的配置:
bitbake linux-raspberrypi -c menuconfig
并将新的内核预设保存到文件defconfig
。
在此之后,我为 linux-raspberryp 配方创建了一个附加文件。
所以我创建了文件
linux-raspberrypi%.bbappend
并填入:
FILESEXTRAPATHS_prepend := "${THISDIR}/linux-raspberrypi:"
SRC_URI += "file://defconfig"
PACKAGE_ARCH = "raspberrypi2"
我把defconfig文件放到:
<meta-mylayer>/recipes-kernel/linux/linux-raspberrypi/raspberrypi2/defconfig
通过以下方式重新编译内核时:
bitbake linux-raspberrypi -c clean
bitbake linux-raspberrypi
采用标准 RPI2 配置。
知道如何克服这个问题吗? 我正在研究 meta-raspberrypi 和 yocto 的 "actual" pyro 分支。
请看一下如何使用devtool修改jethro的源代码: http://www.yoctoproject.org/docs/2.0/dev-manual/dev-manual.html#using-devtool-in-your-workflow
我会首先在它正在使用的 git 存储库中创建一个分支; http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/recipes-kernel/linux/linux-raspberrypi_4.9.bb
在 Yocto 中使用 devtool
;
在您的构建目录中:创建一个 my-linux-raspberry 文件夹;
mkdir linux-raspberry-test
devtool modify -x linux-raspberry ./my-linux-raspberry
这会将源代码解压到my-linux-raspberry
中,供您修改;它还在其中创建 git 存储库;
然后,修改my-linux-raspberry
中的代码;要测试构建,运行 devtool build linux-raspberry
;满意后,将此 git 存储库添加到您的复刻中;
git add .
git commit -m "my-linux-raspberry"
devtool update-recipe linux-raspberry
可选:运行 devtool reset linux-raspberry
删除bbappend文件;
嗯,不幸的是,最简单的方法可能是修补内核源代码...或者将您的 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."
}
因此,他们正在将树内 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."
}
因此,首先用你自己的defconfig
覆盖内核树中的那个。