Search code examples
linuxyoctomdnsnxp-microcontroller

Do I need to edit the .patch files needed for building mdns 878.200.35 in Yocto?


This question follows on from:
Where can I obtain the mdns.service file needed for building mDNS in Yocto?

Looking at the "mdns 878.200.35" Yocto recipe:
https://layers.openembedded.org/layerindex/recipe/109743/
There are two .patch files linked:
build.patch
0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch .
Opening those links, their pages show minus and plus git-view change markings, with triple-minus and triple-plus markings in pink and green and header and footer text that sure don't look like they belong in code. StackOverflow won't let me type what I mean literally here.

To use these in the bitbake, should I edit-off that stuff? For example, in build.patch, it looks like I should delete the header lines:

(StackOverflow won't let me post these; first it says they need to be formatted as code and then it says it's bad code.)

and the two last footer lines.

(ditto)

Also delete the lines in pink beginning with "-" and replace the "+" signs at the beginning of the remaining green lines with a space each (StackOverflow allowed me to type a literal minus and plus here).
And do the similiar things in
0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch.
Is that right? Can you follow the blocks above? StackOverflow wouldn't let me format them in code blocks or even include them in this post, which tends to make me think they shouldn't be in the files to be used in the recipe.

I tried cloning: git://git.openembedded.org/meta-openembedded
and looking at the two files as downloaded to my computer:
root/meta-networking/recipes-protocols/mdns/files/build.patch
root/meta-networking/recipes-protocols/mdns/files/0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch

They still have the same - and + git-view change markings, --- and +++ markings and header and footer text that sure don't look like they belong in code.

Are those files really meant to be used as is like that or do I need to edit them as I described above?
Now I'm thinking that since they are that way in the actual repository, that Yocto bitbake can read that, skip over the non-code headers and footers and apply changes noted in git-view format. Do you think? They are ".patch" files, after all. Yocto really is a miracle when it works. That's the first thing that I'm going to try.

Continues!: How do I strip and objcopy a built .so file in the Yocto bitbake compile step?


Solution

  • Just download the plain files and put them in your layer.

    Those files are absolutely valid patches, otherwise they wouldn't be in the upstream layer in the first place.

    What's before the first --- is what's going to be the commit title (first line) and commit log of the git commit created when git applies the patch.

    The +++ and second --- are to identify the files to which the patch applies. The -- at the end is just to tell git tool to ignore what lies after, which is the version number of git that was used to create said patch (with git format-patch).