繁体   English   中英

无效选择:yocto 构建中的“kernel_add_dts”

[英]invalid choice: 'kernel_add_dts' in yocto build

参数有什么问题,是没有 kernel_add_dts 子命令。

每当我尝试运行 $ recipetool kernel_add_dts meta-local /path/to/my.dts 时,我都会收到以下错误

recipetool: error: argument <subcommand>: invalid choice: 'kernel_add_dts' (choose from 'edit', 'create', 'newappend', 'appendfile', 'appendsrcfiles', 'appendsrcfile', 'setvar')
usage: recipetool [-d] [-q] [--color COLOR] [-h] <subcommand> ...

使用 recipetool 按照以下语法将新设备树添加到您的自定义层:

recipetool appendsrcfile -wm (MACHINE) (PATH/TO/LAYER) virtual/kernel (PATH/TO/DTS) 'arch/${ARCH}/boot/dts/(YOUR_DTS_NAME).dts'

细节:

  • (MACHINE) : 您的构建机器名称
  • (PATH/TO/LAYER) :将创建带有新 DTS 的 linux-xx_%.bbappend 文件所在层的路径
  • (PATH/TO/DTS) : 新 DTS 文件的路径
  • (YOUR_DTS_NAME) :DTS 文件名

重要的提示:

如果默认设备树名称与您添加的相同,这不是问题,如果不是,请确保将其添加到 KERNEL_DEVICETREE 变量,以便它与引导分区中的所有 DTS 文件一起提供。

KERNEL_DEVICETREE += "(NEW_DTS_NAME).dtb"

之后,您可以停止 Uboot(如果您正在使用 Uboot)并使用以下命令指定新的 DTS 文件:

setenv fdt_file (NEW_DTS_NAME).dtb
saveenv (If you want to save it for every boot)

请运行“ printenv ”以确保“ fdt_file ”变量的名称。

实际运行测试:

recipetool appendsrcfile -wm imx8mmddr3lval /home/talel/Desktop/final_git/meta-node virtual/kernel /home/talel/Desktop/example.dts 'arch/${ARCH}/boot/dts/example.dts'
...
NOTE: Writing append file /home/talel/Desktop/final_git/meta-node/recipes-kernel/linux/linux-imx_%.bbappend
NOTE: Copying /home/talel/Desktop/example.dts to /home/talel/Desktop/final_git/meta-node/recipes-kernel/linux/linux-imx/imx8mmddr3lval/example.dts

新的 bbappend 文件是:

$ cat /home/talel/Desktop/final_git/meta-node/recipes-kernel/linux/linux-imx_%.bbappend
 SRC_URI += "file://example.dts;subdir=git/arch/${ARCH}/boot/dts" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" PACKAGE_ARCH = "${MACHINE_ARCH}"

使用“虚拟/内核”,它将检测提供它的内容(linux-imx,linux-yocto,...)并创建 linux-imx_%.append 文件。

-w 标志将为任何版本号创建“_%”。

避免对 DTS 文件进行任何修补的解决方案:

如果您的 Linux 内核有补丁,如果您使用新的修改来更新 DTS,这些补丁会覆盖补丁所期望的某些行,那么它们将失败,因此您可以通过两种方式干净利落地做到这一点:

bitbake virtual/kernel -c cleansstate
bitbake virtual/kernel -c patch

现在应用了所有补丁,转到 tmp/work/../linux-(PROVIDER)/../git 并:

git add .
git commit -m "commiting old patches"

现在编辑 DTS 文件并:

git add arch/../boot/dts/../myplatform.dts
git commit -m "changes"
git format-patch -1 -o /path/to/meta-custom/recipes-kernel/linux/files

现在将它添加到 /path/to/meta-custom/recipes-kernel/linux/linux-(PROVIDER)_%.bbappend:

SRC_URI_append = " file://patch_file.patch"

或者,另一种方法是在补丁完成后添加您的最终 DTS:

SRC_URI_append = " file://myplatform.dts"
do_configure_append(){
  cp ${WORKDIR}/myplatform.dts ${S}/arch/(ARCH)/boot/dts/....
}

并将您的 myplatform.dts 复制到 /path/to/meta-custom/recipes-kernel/linux/files。

现在,这是您的最终 DTS 文件。

删除配方工具添加的内容:

其实recipetool中没有undo子命令,你只需要删除recipetool部署的文件,recipetool复制你指定的文件并创建一个bbappend文件,所以删除这两个文件。

示例:您使用 recipetool 添加example.dts文件,recipetool 将example.dts复制到:

meta-custom/recipes-kernel/linux/(MACHINE)/example.dts

并创建了 bbappend 文件,其中将example.dts添加到 SRC_URI 变量。

如果您需要保留 bbappend 文件,因为您正在以其他方式使用它,只需修改它并删除由 recipetool 添加的行,其中包含:

SRC_URI ... "file://example.dts ..."

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM