diff mbox

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

Message ID 1453314294-5721-1-git-send-email-openwrt@daniel.thecshore.com
State Changes Requested
Delegated to: Felix Fietkau
Headers show

Commit Message

Daniel Dickinson Jan. 20, 2016, 6:24 p.m. UTC
From: Daniel Dickinson <openwrt@daniel.thecshore.com>

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@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 mbox

Patch

diff --git a/rules.mk b/rules.mk
index b5be5b2..2d1f733 100644
--- a/rules.mk
+++ b/rules.mk
@@ -10,6 +10,7 @@  __rules_inc=1
 
 ifeq ($(DUMP),)
   -include $(TOPDIR)/.config
+  -include $(TOPDIR)/image-override.mk
 endif
 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 > $@
 
 download:
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
+