compile bug about banner and version macros.

Kevin Du Huanpeng u74147 at gmail.com
Tue Sep 15 04:49:15 PDT 2015


this patch fix a tiny compile bug.
1. how to reproduce the bug.
        $ export ARCH=mips
        $ export CROSS_COMPILE=mips-linux-gnu-
        $ make allnoconfig
- - - error msg - - -
du at L64:~/source/barebox$ make
  CHK     include/generated/version.h
  CHK     include/generated/utsrelease.h
  AS      arch/mips/boot/start.o
arch/mips/boot/start.S:25:31: fatal error: generated/compile.h: No
such file or directory
 #include <generated/compile.h>
                               ^
compilation terminated.
make[1]: *** [arch/mips/boot/start.o] Error 1
make: *** [arch/mips/boot] Error 2
- - - error msg - - -

2. huntting the bug.
after use grep, I find the file is depends on version.o in
        $ vi common/Makefile +81
                81 $(obj)/version.o: include/generated/compile.h
when the CONFIG_BANNER is not enabled, the version.o is not exsist,
so, the file was never genated.
                13 obj-$(CONFIG_BANNER)            += version.o
3. fix it.
add condition compile, or anyone have better sulotion?
----
diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S
index 7e2ae5e..2b0ffa8 100644
--- a/arch/mips/boot/start.S
+++ b/arch/mips/boot/start.S
@@ -22,7 +22,9 @@
 #include <asm/mipsregs.h>
 #include <asm/asm.h>
 #include <asm-generic/memory_layout.h>
+#ifdef CONFIG_BANNER
 #include <generated/compile.h>
+#endif
 #include <generated/utsrelease.h>

        /*
@@ -56,7 +58,10 @@ EXPORT(_start)
         nop

        .org    0x10
-       .ascii  "barebox " UTS_RELEASE " " UTS_VERSION
+       .ascii  "barebox " UTS_RELEASE
+#ifdef CONFIG_BANNER
+       .ascii  " " UTS_VERSION
+#endif
        .byte   0

        .align 4

----
4. better sulotion?
I grep-ed compile.h, more than one source code use this file without
check the CONFIG_BANNER macro. so... maybe my patch need improved.
or allways genate compile.h? this just waste some time when compiling.



More information about the barebox mailing list