如何在yocto中应用dtsi(或dts)的补丁文件 [英] How to apply patch file of dtsi(or dts) in yocto
问题描述
我在 ubuntu 18.04 上使用 yocto(ver.rocko) 并尝试应用补丁文件,但我不能......
我的目标机器是 qemuarm64,linux 内核是 linux-yocto.
一旦执行$bitbake core-image-base
,内核源文件被解压,然后目标dtsi文件位于poky/build/tmp/work/aarch64-poky-linux/linux-libc-headers/4.12-r0/linux-4.12/arch/arm64/boot/dts/arm/juno-base.dtsi
我要修补的自定义元数据文件如下:
- poky/meta-custom/recipes-kernel/linux/linux-yocto_4.12.bbappend
- poky/meta-custom/recipes-kernel/linux/files/juno-base.dtsi.patch
# poky/meta-custom/recipes-kernel/linux/linux-yocto_4.12.bbappendFILESEXTRAPATHS_prepend := "${THISDIR}/files";SRC_URI += "file://juno-base.dtsi.patch";
但是在bitbake之后,补丁文件被创建在poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0/juno-base.dtsi.patch
和补丁应用程序不起作用
我不知道怎么了,该怎么办...请让我知道我该怎么办?
要为 Yocto 配方源创建一个简单的补丁,您可以通过简单的方式使用 git 命令:
您的 Linux 工作目录是:
<块引用>poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0
如你所见,它已经是一个git"了.目录,这意味着它已经用 git 初始化了.
这里有清晰的步骤让您了解该方法:
在将你的补丁(juno-base.dtsi.patch)添加到 SRC_URI 后,我认为你的 linux-yocto 工作目录搞砸了,所以跟我来:
清理构建
bitbake linux-yocto -c cleansstate
从 SRC_URI 中删除补丁
应用任何默认补丁
bitbake linux-yocto -c 补丁
前往
<块引用>
poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0
- 进行修改
<块引用>
poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0/arch/arm64/boot/dts/arm/juno-base.dtsi
而不是在
<块引用>poky/build/tmp/work/aarch64-poky-linux/linux-libc-headers/4.12-r0/linux-4.12/arch/arm64/boot/dts/arm/juno-base.dtsi
- 现在,打开终端并将目录更改为
<块引用>
poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0
- 运行:git status(您应该看到类似:修改的 arch/arm64/boot/dts/arm/juno-base.dtsi)
- 运行:git add arch/arm64/boot/dts/arm/juno-base.dtsi
- 运行:git commit -m "Patch for juni base dtsi"
- 运行:git format-patch -1
现在创建了一个名为Patch-for-juni-base-dtsi.patch"的新补丁,现在你可以将它添加到 linux-yocto_%.bbappend:
<块引用>SRC_URI_append = "file://Patch-for-juni-base-dtsi.patch"
如果 dtsi 不存在并且您想将其添加为补丁,请在运行git status"时执行相同的操作;你会看到一个新添加的文件,用git add"添加它;并继续执行命令.
完成所有这些之后,您可以使用以下命令继续构建过程:
bitbake linux-yocto -C 补丁
或者,如果您将补丁添加到 SRC_URI,则 linux-yocto 构建将从 do_fetch 开始.
I'm using yocto(ver.rocko) on ubuntu 18.04 and trying to apply patch file but I can't...
My target machine is qemuarm64 and linux kernel is linux-yocto.
Once do $ bitbake core-image-base
, kernel source files are unpacked then target dtsi file is located at poky/build/tmp/work/aarch64-poky-linux/linux-libc-headers/4.12-r0/linux-4.12/arch/arm64/boot/dts/arm/juno-base.dtsi
And my custom meta-data files to patch are below:
- poky/meta-custom/recipes-kernel/linux/linux-yocto_4.12.bbappend
- poky/meta-custom/recipes-kernel/linux/files/juno-base.dtsi.patch
# poky/meta-custom/recipes-kernel/linux/linux-yocto_4.12.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/files"
SRC_URI += "file://juno-base.dtsi.patch"
But after bitbake, patch file is created at poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0/juno-base.dtsi.patch
and patch-application doesn't work
I don't know what's wrong, what to do... Plz let me know what should I do?
To create a simple patch for Yocto recipe sources, you can use git command in a simple way:
Your Linux work directory is:
poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0
as you can see it is already a "git" directory which means that it is intialized with git already.
Here are clear steps for you to understand the method:
After adding your patch(juno-base.dtsi.patch) to SRC_URI I think your linux-yocto work directory is messed up, so follow me:
Clean the build
bitbake linux-yocto -c cleansstate
Remove the patch from SRC_URI
Apply any default patches
bitbake linux-yocto -c patch
Go to
poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0
- Make your modifications on
poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0/arch/arm64/boot/dts/arm/juno-base.dtsi
and not in
poky/build/tmp/work/aarch64-poky-linux/linux-libc-headers/4.12-r0/linux-4.12/arch/arm64/boot/dts/arm/juno-base.dtsi
- Now, open a terminal and change directory to
poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0
- Run: git status (You should see something like: modified arch/arm64/boot/dts/arm/juno-base.dtsi)
- Run: git add arch/arm64/boot/dts/arm/juno-base.dtsi
- Run: git commit -m "Patch for juni base dtsi"
- Run: git format-patch -1
Now a new patch is created with the name "Patch-for-juni-base-dtsi.patch", Now you can add it to linux-yocto_%.bbappend:
SRC_URI_append = " file://Patch-for-juni-base-dtsi.patch"
If the dtsi is not exist and you want to add it as a patch, do the same thing, when you run "git status" you will see a new added file, add it with "git add" and continue the commands.
After all of this, you can continue the build process with:
bitbake linux-yocto -C patch
Or, if you add the patch to SRC_URI the linux-yocto build will start from do_fetch.
这篇关于如何在yocto中应用dtsi(或dts)的补丁文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!