0

I am trying to apply a patch to a package that is not located within buildroot/package but elsewhere.

I have added to my buildroot .config the following

BR2_GLOBAL_PATCH_DIR="absolute/path/to/folder"

The folder is correct because if the path wasn't correct, buildroot would error out. So the path to the directory is good.

Using the instructions here and here. I've added a subdirectory with the name that matches the package and adding the patch to that subdirectory but nothing happens.

Buildroot never outputs it's trying to apply patches which leads me to believe buildroot isn't even looking in the BR2_GLOBAL_PATCH_DIR or calling the apply-patches.sh in buildroot/support/scripts/.

Why isn't buildroot trying to apply the patch to my package?

RAZ_Muh_Taz
  • 4,059
  • 1
  • 13
  • 26

1 Answers1

2

Buildroot applies patches only to packages with downloaded source code. In other words, it doesn't apply patches to packages that are taken locally with FOO_SITE_METHOD = local or with FOO_OVERRIDE_SRCDIR = /path/to/foo.

If you see output like this:

>>> foo custom Syncing from source dir /path/to/foo

you are in this situation.

-EDIT-

Applying patches in this case is not supported by Buildroot. However, you can work around it with something like this:

define FOO_APPLY_PATCHES
        $(APPLY_PATCHES) $(@D) $(addsuffix /$(RAWNAME),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \*.patch
endef
FOO_POST_RSYNC_HOOKS += FOO_APPLY_PATCHES
Arnout
  • 2,927
  • 16
  • 24
  • Is there no way to apply patches to local packages? I am in a situation where I use code from another group that doesn't work for our software and so I need to modify it on another branch and use that branch instead. But what would be great is if i can just build off their tags and apply my patches before it builds... I feel like that would be possible... right? – RAZ_Muh_Taz Oct 08 '20 at 16:51
  • But you'll want a repository to maintain those patches anyway, right? So in the end, you end up making a fork of that other group's repo and apply your own patches to that in git, and you can use the normal git download method to get the source. – Arnout Oct 09 '20 at 09:01
  • I've added a workaround to the answer. I haven't tested it, so adaptations may be needed :-) – Arnout Oct 09 '20 at 09:07
  • So i have a repo that exists for my buildroot config and so forth, i'd just put those patches in that repo. It just feels like applying patches is a cleaner approach then creating an entirely new branch after every software release. But maybe that's normal? I appreciate the workaround and i'll give it a shot! – RAZ_Muh_Taz Oct 09 '20 at 14:35