kbuild: move bin2c back to scripts/ from scripts/basic/
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 25 Jun 2018 16:40:23 +0000 (01:40 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 17 Jul 2018 16:18:05 +0000 (01:18 +0900)
Commit 8370edea81e3 ("bin2c: move bin2c in scripts/basic") moved bin2c
to the scripts/basic/ directory, incorrectly stating "Kexec wants to
use bin2c and it wants to use it really early in the build process.
See arch/x86/purgatory/ code in later patches."

Commit bdab125c9301 ("Revert "kexec/purgatory: Add clean-up for
purgatory directory"") and commit d6605b6bbee8 ("x86/build: Remove
unnecessary preparation for purgatory") removed the redundant
purgatory build magic entirely.

That means that the move of bin2c was unnecessary in the first place.

fixdep is the only host program that deserves to sit in the
scripts/basic/ directory.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/powerpc/purgatory/Makefile
arch/s390/purgatory/Makefile
arch/x86/purgatory/Makefile
kernel/Makefile
scripts/.gitignore
scripts/Makefile
scripts/basic/.gitignore
scripts/basic/Makefile
scripts/basic/bin2c.c [deleted file]
scripts/bin2c.c [new file with mode: 0644]
security/tomoyo/Makefile

index 30e05decbb4cd8b381ab125ba52e8038ba566b3e..4314ba5baf435c70d3a78006adabba34367acaf9 100644 (file)
@@ -6,9 +6,8 @@ LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined
 $(obj)/purgatory.ro: $(obj)/trampoline.o FORCE
                $(call if_changed,ld)
 
-CMD_BIN2C = $(objtree)/scripts/basic/bin2c
 quiet_cmd_bin2c = BIN2C   $@
-      cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
+      cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
 
 $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
        $(call if_changed,bin2c)
index 1ace023cbdcec3a6462d753b0f39e678b23b1828..445c4603ce02fb2cc0fc895c42f16a4786f538d5 100644 (file)
@@ -27,9 +27,8 @@ KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
                $(call if_changed,ld)
 
-CMD_BIN2C = $(objtree)/scripts/basic/bin2c
 quiet_cmd_bin2c = BIN2C   $@
-      cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
+      cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
 
 $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
        $(call if_changed,bin2c)
index 81a8e33115ad5b72d53fc0829930d60238dbb0c2..3cf302b2633222ff45323b2528f3499233b650c5 100644 (file)
@@ -28,9 +28,8 @@ $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
 
 targets += kexec-purgatory.c
 
-CMD_BIN2C = $(objtree)/scripts/basic/bin2c
 quiet_cmd_bin2c = BIN2C   $@
-      cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
+      cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
 
 $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
        $(call if_changed,bin2c)
index 04bc07c2b42a9dfef399caea56a12b072f0ad028..7a63d567fdb571f357910a83cf3398df65876016 100644 (file)
@@ -123,7 +123,7 @@ targets += config_data.gz
 $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
        $(call if_changed,gzip)
 
-      filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/basic/bin2c; echo "MAGIC_END;")
+      filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;")
 targets += config_data.h
 $(obj)/config_data.h: $(obj)/config_data.gz FORCE
        $(call filechk,ikconfiggz)
index 0442c06eefcb2d19b1ddf2408539cf680094351c..12d302d70128f8a9ee2909d12b4d666c77b74c42 100644 (file)
@@ -1,6 +1,7 @@
 #
 # Generated files
 #
+bin2c
 conmakehash
 kallsyms
 pnmtologo
index 25ab143cbe148b3fcd04432b77ceb929c0dc5d8f..59c21ec49b844e25d3722c307ccb2e5a538294ad 100644 (file)
@@ -10,6 +10,7 @@
 
 HOST_EXTRACFLAGS += -I$(srctree)/tools/include
 
+hostprogs-$(CONFIG_BUILD_BIN2C)  += bin2c
 hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
 hostprogs-$(CONFIG_LOGO)         += pnmtologo
 hostprogs-$(CONFIG_VT)           += conmakehash
index 9528ec9e5adc4a89e901f3e9cdfe6140f8452573..a776371a350243330b14dc87b636146ba4ef2b16 100644 (file)
@@ -1,2 +1 @@
 fixdep
-bin2c
index 0372b33febe52f74978420c2c559adef5e815374..af49b446f17db786b4315a225138065dec683a38 100644 (file)
@@ -9,7 +9,6 @@
 # fixdep:       Used to generate dependency information during build process
 
 hostprogs-y    := fixdep
-hostprogs-$(CONFIG_BUILD_BIN2C)     += bin2c
 always         := $(hostprogs-y)
 
 # fixdep is needed to compile other host programs
diff --git a/scripts/basic/bin2c.c b/scripts/basic/bin2c.c
deleted file mode 100644 (file)
index c3d7eef..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Unloved program to convert a binary on stdin to a C include on stdout
- *
- * Jan 1999 Matt Mackall <mpm@selenic.com>
- *
- * This software may be used and distributed according to the terms
- * of the GNU General Public License, incorporated herein by reference.
- */
-
-#include <stdio.h>
-
-int main(int argc, char *argv[])
-{
-       int ch, total = 0;
-
-       if (argc > 1)
-               printf("const char %s[] %s=\n",
-                       argv[1], argc > 2 ? argv[2] : "");
-
-       do {
-               printf("\t\"");
-               while ((ch = getchar()) != EOF) {
-                       total++;
-                       printf("\\x%02x", ch);
-                       if (total % 16 == 0)
-                               break;
-               }
-               printf("\"\n");
-       } while (ch != EOF);
-
-       if (argc > 1)
-               printf("\t;\n\n#include <linux/types.h>\n\nconst size_t %s_size = %d;\n",
-                      argv[1], total);
-
-       return 0;
-}
diff --git a/scripts/bin2c.c b/scripts/bin2c.c
new file mode 100644 (file)
index 0000000..c3d7eef
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Unloved program to convert a binary on stdin to a C include on stdout
+ *
+ * Jan 1999 Matt Mackall <mpm@selenic.com>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+       int ch, total = 0;
+
+       if (argc > 1)
+               printf("const char %s[] %s=\n",
+                       argv[1], argc > 2 ? argv[2] : "");
+
+       do {
+               printf("\t\"");
+               while ((ch = getchar()) != EOF) {
+                       total++;
+                       printf("\\x%02x", ch);
+                       if (total % 16 == 0)
+                               break;
+               }
+               printf("\"\n");
+       } while (ch != EOF);
+
+       if (argc > 1)
+               printf("\t;\n\n#include <linux/types.h>\n\nconst size_t %s_size = %d;\n",
+                      argv[1], total);
+
+       return 0;
+}
index b7c6a7ffc058b42279dd224ca7efc6d42f1859ea..cca5a3012fee2e564ffa0ae293d1e8e223d80689 100644 (file)
@@ -4,7 +4,7 @@ obj-y = audit.o common.o condition.o domain.o environ.o file.o gc.o group.o load
 targets += builtin-policy.h
 define do_policy
 echo "static char tomoyo_builtin_$(1)[] __initdata ="; \
-$(objtree)/scripts/basic/bin2c <$(firstword $(wildcard $(obj)/policy/$(1).conf $(srctree)/$(src)/policy/$(1).conf.default) /dev/null); \
+$(objtree)/scripts/bin2c <$(firstword $(wildcard $(obj)/policy/$(1).conf $(srctree)/$(src)/policy/$(1).conf.default) /dev/null); \
 echo ";"
 endef
 quiet_cmd_policy  = POLICY  $@