[OpenWrt-Devel] [PATCH] kernel.mk: add KCFLAGS to make kmods reproducible

Paul Spooren mail at aparcar.org
Tue Oct 8 16:11:27 PDT 2019

Some kmods (gpio-hotplug, wireguard) store the build path in the
compiled files and therefore make it harder to rebuild the official
binaries. As the same "iremap" function is used as for other binaries,
the change is compatible with gcc7 and 8.

Tested with both gcc7 and gcc8 resulting in build path independent
reproducible builds.

Signed-off-by: Paul Spooren <mail at aparcar.org>
 include/kernel.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/kernel.mk b/include/kernel.mk
index 73645330fe..439e910ebf 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -104,6 +104,7 @@ endif
+	KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \
 	HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \

More information about the openwrt-devel mailing list