简体   繁体   English

如何在 yocto 中应用 dtsi(或 dts)的补丁文件

[英]How to apply patch file of dtsi(or dts) in yocto

I'm using yocto(ver.rocko) on ubuntu 18.04 and trying to apply patch file but I can't...我在 ubuntu 18.04 上使用 yocto(ver.rocko) 并尝试应用补丁文件,但我不能...


My target machine is qemuarm64 and linux kernel is linux-yocto.我的目标机器是 qemuarm64 和 linux kernel 是 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一旦执行$ bitbake core-image-base , kernel 源文件被解压,然后目标 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


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/linux-yocto_4.12.bbappend
  • poky/meta-custom/recipes-kernel/linux/files/juno-base.dtsi.patch 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但是在 bitbake 之后,补丁文件在poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+gitAUTOINC+2ae65226f6_e562267bae-r0/juno-base.dtsi.patch和 patch-application 没有创建不工作


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:要为 Yocto 配方源创建一个简单的补丁,您可以使用 git 命令以一种简单的方式:

Your Linux work directory is:你的 Linux 工作目录是:

poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+ git AUTOINC+2ae65226f6_e562267bae-r0 poky/build/tmp/work/qemuarm64-poky-linux/linux-yocto/4.12.28+ git AUTOINC+2ae65226f6_e562267bae-r0

as you can see it is already a "git" directory which means that it is intialized with git already.如您所见,它已经是一个“git”目录,这意味着它已经用 git 进行了初始化。

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:将你的补丁(juno-base.dtsi.patch)添加到 SRC_URI 后,我认为你的 linux-yocto 工作目录搞砸了,所以跟我来:

  1. Clean the build清理构建

    bitbake linux-yocto -c cleansstate bitbake linux-yocto -c cleansstate

  2. Remove the patch from SRC_URI从 SRC_URI 中删除补丁

  3. Apply any default patches应用任何默认补丁

    bitbake linux-yocto -c patch bitbake linux-yocto -c 补丁

  4. Go to Go 至

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

  1. 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 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 poky/build/tmp/work/aarch64-poky-linux/linux-libc-headers/4.12-r0/linux-4.12/arch/arm64/boot/dts/arm/juno-base.dtsi

  1. Now, open a terminal and change directory to现在,打开一个终端并将目录更改为

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

  1. Run: git status (You should see something like: modified arch/arm64/boot/dts/arm/juno-base.dtsi)运行: git 状态(您应该看到类似:修改的 arch/arm64/boot/dts/arm/juno-base.dtsi)
  2. Run: git add arch/arm64/boot/dts/arm/juno-base.dtsi运行: git 添加arch/arm64/boot/dts/arm/juno-base.dtsi
  3. Run: git commit -m "Patch for juni base dtsi"运行: git commit -m "Juni base dtsi 补丁"
  4. Run: git format-patch -1运行: git 格式补丁-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:现在创建了一个名为“Patch-for-juni-base-dtsi.patch”的新补丁,现在您可以将其添加到 linux-yocto_%.bbappend:

SRC_URI_append = " file://Patch-for-juni-base-dtsi.patch" 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.如果 dtsi 不存在并且您想将其添加为补丁,请执行相同的操作,当您运行“git status”时,您将看到一个新添加的文件,使用“git add”添加它并继续执行命令。

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.或者,如果您将补丁添加到 SRC_URI,则 linux-yocto 构建将从 do_fetch 开始。

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

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