diff --git a/Makefile b/Makefile
index 3f967b2..29d3bd6 100644
--- a/Makefile
+++ b/Makefile
@@ -393,6 +393,12 @@ $(BUILD_DIR)/buildroot-config/auto.conf:
$(BUILDROOT_CONFI\
G)
        $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)"
HOSTCXX="$(HOSTCXX\
_NOCCACHE)" silentoldconfig

 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
+ifneq ($(BR2_ROOTFS_PRE_BUILD_SCRIPT),"")
+       @$(call MESSAGE,"Executing pre-build script\(s\)")
+       @$(foreach s, $(call qstrip,$(BR2_ROOTFS_PRE_BUILD_SCRIPT)), \
+               $(s) $(CONFIG_DIR)$(sep))
+endif
+

 toolchain: prepare dirs dependencies $(BASE_TARGETS)

diff --git a/system/Config.in b/system/Config.in
index 1e4fff3..df9e5ce 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -260,6 +260,19 @@ config BR2_ROOTFS_OVERLAY
          They are copied as-is into the rootfs, excluding files ending
with
          ~ and .git, .svn and .hg directories.

+config BR2_ROOTFS_PRE_BUILD_SCRIPT
+       string "Custom scripts to run before starting the build"
+       default ""
+       help
+         Specify a space-separated list of scripts to be run before the
build
+         has started.
+
+         This gives users the oportunity to do board-specific
preparation.
+
+         These scripts are called with $(CONFIG_DIR) as first and
+         only argument. Make sure the exit code of those scripts are 0,
+         otherwise make will stop after calling them.
+
