generic: Kconfig: exit on unset symbol
authorDavid Bauer <mail@david-bauer.net>
Thu, 22 Jul 2021 23:32:38 +0000 (01:32 +0200)
committerDavid Bauer <mail@david-bauer.net>
Tue, 10 Aug 2021 11:14:52 +0000 (13:14 +0200)
When a target configuration has unser Kconfig symbols, the build will
fail when OpenWrt is compiled with V=s and stdin is connected to a tty.

In case OpenWrt is compiled without either of these preconditions, the
build will uscceed with the symbols in question being unset.

Modify the kernel configuration in a way it fails on unset symbols
regardless of the aformentioned preconditions.

Signed-off-by: David Bauer <mail@david-bauer.net>
include/kernel-build.mk
target/linux/generic/hack-5.10/205-kconfig-exit.patch [new file with mode: 0644]
target/linux/generic/hack-5.4/205-kconfig-exit.patch [new file with mode: 0644]

index 66a9f64c802959061bceae23266688cbeb91b439..80da4455bc04fccd1c7834fe8b94c29399289bd2 100644 (file)
@@ -132,6 +132,7 @@ define BuildKernel
   $(LINUX_DIR)/.modules: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
   $(LINUX_DIR)/.modules: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
   $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
+  $(LINUX_DIR)/.modules: export FAIL_ON_UNCONFIGURED=1
   $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
        $(Kernel/CompileModules)
        touch $$@
diff --git a/target/linux/generic/hack-5.10/205-kconfig-exit.patch b/target/linux/generic/hack-5.10/205-kconfig-exit.patch
new file mode 100644 (file)
index 0000000..8931ad3
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/scripts/kconfig/conf.c
++++ b/scripts/kconfig/conf.c
+@@ -212,6 +212,8 @@ static int conf_sym(struct menu *menu)
+                               break;
+                       continue;
+               case 0:
++                      if (!sym_has_value(sym) && !tty_stdio && getenv("FAIL_ON_UNCONFIGURED"))
++                              exit(1);
+                       newval = oldval;
+                       break;
+               case '?':
diff --git a/target/linux/generic/hack-5.4/205-kconfig-exit.patch b/target/linux/generic/hack-5.4/205-kconfig-exit.patch
new file mode 100644 (file)
index 0000000..8931ad3
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/scripts/kconfig/conf.c
++++ b/scripts/kconfig/conf.c
+@@ -212,6 +212,8 @@ static int conf_sym(struct menu *menu)
+                               break;
+                       continue;
+               case 0:
++                      if (!sym_has_value(sym) && !tty_stdio && getenv("FAIL_ON_UNCONFIGURED"))
++                              exit(1);
+                       newval = oldval;
+                       break;
+               case '?':