0
votes

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?

1

1 Answers

1
votes

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:

  1. Clean the build

    bitbake linux-yocto -c cleansstate

  2. Remove the patch from SRC_URI

  3. Apply any default patches

    bitbake linux-yocto -c patch

  4. Go to

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

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

  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

  1. Run: git status (You should see something like: modified arch/arm64/boot/dts/arm/juno-base.dtsi)
  2. Run: git add arch/arm64/boot/dts/arm/juno-base.dtsi
  3. Run: git commit -m "Patch for juni base dtsi"
  4. 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.