首页 > 解决方案 > Applying patch to a package outside of buildroot directory

问题描述

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?

标签: c++gitpatchbuildroot

解决方案


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

推荐阅读