[OpenWrt-Devel] [PATCH] [RESEND] target/imagebuilder: Add ability to override image generation options

openwrt at daniel.thecshore.com openwrt at daniel.thecshore.com
Tue Feb 16 03:27:10 EST 2016

From: Daniel Dickinson <openwrt at daniel.thecshore.com>

No comment on previous send, tested, working and I find quite handy,
hence resend.

For ImageBuilder add $(TOPDIR)/image-override.mk that defaults to
settings in .config, but which is a simple makefile snippet
in order to override image generation settings; the primary
advantage over editing the entire .config is that is limited to
image generation settings and it is therefore easier to find
the desired option.

It also may includes settings that would not appear in the
.config due to the choices made.

Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
 rules.mk                                    | 1 +
 target/imagebuilder/Makefile                | 3 +++
 target/imagebuilder/files/image-override.mk | 4 ++++
 3 files changed, 8 insertions(+)
 create mode 100644 target/imagebuilder/files/image-override.mk

diff --git a/rules.mk b/rules.mk
index 22807da..f5f692c 100644
--- a/rules.mk
+++ b/rules.mk
@@ -10,6 +10,7 @@ __rules_inc=1
 ifeq ($(DUMP),)
   -include $(TOPDIR)/.config
+  -include $(TOPDIR)/image-override.mk
 include $(TOPDIR)/include/debug.mk
 include $(TOPDIR)/include/verbose.mk
diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index 106ca3d..47d2940 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -76,6 +76,9 @@ endif
 	find $(STAGING_DIR_HOST)/bin -maxdepth 1 -type f -perm -u=x \
 	  | $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh $(PKG_BUILD_DIR)/staging_dir/host/bin/
 	STRIP=sstrip $(SCRIPT_DIR)/rstrip.sh $(PKG_BUILD_DIR)/staging_dir/host/bin/
+	$(CP) $(TOPDIR)/target/imagebuilder/files/image-override.mk $(PKG_BUILD_DIR)/
+	grep -E '^[[:space:]]+(config|menuconfig)[[:space:]]+' $(TOPDIR)/config/Config-images.in | sed -e 's/^\W*\(config\|menuconfig\)\W*\([[:alnum:]_-][[:alnum:]_-]*\)\W*$$/CONFIG_\2:=$$(CONFIG_\2)/' >>$(PKG_BUILD_DIR)/image-override.mk
+	-grep -E '[[:space:]]+(config|menuconfig)[[:space:]]+$(toupper $(ARCH))' $(TOPDIR)/target/linux/$(ARCH)/image/Config.in | sed -e 's/^\W*\(config\|menuconfig\)\W*\($(toupper $(ARCH))_[[:alnum:]_-][[:alnum:]_-]*\)\W*$$/CONFIG_\2:=$$(CONFIG_\2)/' >>$(PKG_BUILD_DIR)/image-override.mk
 	$(TAR) -cf - -C $(BUILD_DIR) $(IB_NAME) | bzip2 -c > $@
diff --git a/target/imagebuilder/files/image-override.mk b/target/imagebuilder/files/image-override.mk
new file mode 100644
index 0000000..72a4cdc
--- /dev/null
+++ b/target/imagebuilder/files/image-override.mk
@@ -0,0 +1,4 @@
+# Defaults to whatever is in .config; edit this file to change
+# settings from their defaults
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list