[U-Boot] [PATCH] HACK: DO NOT MERGE: Simple program to printout preprocessed values

Tom Rini trini at konsulko.com
Tue Jul 18 19:48:38 UTC 2017


When migrating to Kconfig there may be cases where the symbol to be
migrated depends on a preprocessed or calculated value, and thus
moveconfig.py will not migrate it correctly.  Introduce an easily
hackable tool, tools/printvars.c that will give the final value.  Hack
the main Makefile to only build this tool, and buildman to save this
tool.  Thus it becomes "quick" to have buildman build this tool for
every board in U-Boot today.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 Makefile                        |  2 +-
 tools/Makefile                  |  3 +++
 tools/buildman/builderthread.py |  4 +---
 tools/printvars.c               | 18 ++++++++++++++++++
 4 files changed, 23 insertions(+), 4 deletions(-)
 create mode 100644 tools/printvars.c

diff --git a/Makefile b/Makefile
index 452596485dd3..40542e9db077 100644
--- a/Makefile
+++ b/Makefile
@@ -851,7 +851,7 @@ quiet_cmd_cfgcheck = CFGCHK  $2
 cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
 		$(srctree)/scripts/config_whitelist.txt $(srctree)
 
-all:		$(ALL-y)
+all:		tools
 ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
diff --git a/tools/Makefile b/tools/Makefile
index cb1683e1539c..a0a5d71f608c 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -55,6 +55,9 @@ HOSTCFLAGS_xway-swap-bytes.o := -pedantic
 hostprogs-y += mkenvimage
 mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
 
+hostprogs-y += printvars
+printvars-objs := printvars.o
+
 hostprogs-y += dumpimage mkimage
 hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
 
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 9e8ca80c5b53..3992f5fcd4cf 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -364,9 +364,7 @@ class BuilderThread(threading.Thread):
 
         # Now write the actual build output
         if keep_outputs:
-            self.CopyFiles(result.out_dir, build_dir, '', ['u-boot*', '*.bin',
-                '*.map', '*.img', 'MLO', 'SPL', 'include/autoconf.mk',
-                'spl/u-boot-spl*'])
+            self.CopyFiles(result.out_dir, build_dir, '', ['tools/printvars'])
 
     def CopyFiles(self, out_dir, build_dir, dirname, patterns):
         """Copy files from the build directory to the output.
diff --git a/tools/printvars.c b/tools/printvars.c
new file mode 100644
index 000000000000..95ae065ab62f
--- /dev/null
+++ b/tools/printvars.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+/* HACK: Give us typedefs so we can proceed */
+typedef uint32_t u32;
+typedef uint16_t u16;
+typedef uint8_t u8;
+typedef int32_t s32;
+typedef int16_t s16;
+typedef int8_t s8;
+#include <generated/autoconf.h>
+#include <config.h>
+
+int main(int argc, char **argv) {
+#ifdef CONFIG_WHATEVER
+	printf("CONFIG_WHATEVER=whatever");
+#endif
+
+	return 0;
+}
-- 
1.9.1



More information about the U-Boot mailing list