powerpc/boot: pass CONFIG options in a simpler and more robust way
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 5 Jul 2019 10:01:44 +0000 (19:01 +0900)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 10 Jul 2019 03:20:44 +0000 (13:20 +1000)
Commit 5e9dcb6188a4 ("powerpc/boot: Expose Kconfig symbols to wrapper")
was wrong, but commit e41b93a6be57 ("powerpc/boot: Fix build failures
with -j 1") was also wrong.

The correct dependency is:

  $(obj)/serial.o: $(obj)/autoconf.h

However, I do not see the reason why we need to copy autoconf.h to
arch/power/boot/. Nor do I see consistency in the way of passing
CONFIG options.

decompress.c references CONFIG_KERNEL_GZIP and CONFIG_KERNEL_XZ, which
are passed via the command line.

serial.c includes autoconf.h to reference a couple of CONFIG options,
but this is fragile because we often forget to include "autoconf.h"
from source files.

In fact, it is already broken.

ppc_asm.h references CONFIG_PPC_8xx, but utils.S is not given any way
to access CONFIG options. So, CONFIG_PPC_8xx is never defined here.

Pass $(LINUXINCLUDE) to make sure CONFIG options are accessible from
all .c and .S files in arch/powerpc/boot/.

I also removed the -traditional flag to make include/linux/kconfig.h
work. This flag makes the preprocessor imitate the behavior of the
pre-standard C compiler, but I do not understand why it is necessary.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190705100144.28785-2-yamada.masahiro@socionext.com
arch/powerpc/boot/.gitignore
arch/powerpc/boot/Makefile
arch/powerpc/boot/serial.c

index 32034a0cc55410d035ec6e0d32ad74a67d026eb5..6610665fcf5e951744020420a5a082824ab91cce 100644 (file)
@@ -44,5 +44,3 @@ fdt_sw.c
 fdt_wip.c
 libfdt.h
 libfdt_internal.h
-autoconf.h
-
index 36fb51a9329f906498d5e5beafa07f9c16c0524f..6841bd52738bd3a882d452b456c6cae2cfc4fe8a 100644 (file)
 
 all: $(obj)/zImage
 
-compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP
-compress-$(CONFIG_KERNEL_XZ)   := CONFIG_KERNEL_XZ
-compress-$(CONFIG_KERNEL_LZMA) := CONFIG_KERNEL_LZMA
-compress-$(CONFIG_KERNEL_LZO)   := CONFIG_KERNEL_LZO
-
 ifdef CROSS32_COMPILE
     BOOTCC := $(CROSS32_COMPILE)gcc
     BOOTAR := $(CROSS32_COMPILE)ar
@@ -36,7 +31,7 @@ endif
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
                 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
-                -D$(compress-y)
+                $(LINUXINCLUDE)
 
 ifdef CONFIG_PPC64_BOOT_WRAPPER
 BOOTCFLAGS     += -m64
@@ -53,7 +48,7 @@ BOOTCFLAGS    += -mlittle-endian
 BOOTCFLAGS     += $(call cc-option,-mabi=elfv2)
 endif
 
-BOOTAFLAGS     := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
+BOOTAFLAGS     := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
 
 BOOTARFLAGS    := -cr$(KBUILD_ARFLAGS)
 
@@ -204,14 +199,9 @@ $(obj)/empty.c:
 $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
        $(Q)cp $< $@
 
-$(srctree)/$(src)/serial.c: $(obj)/autoconf.h
-
-$(obj)/autoconf.h: $(obj)/%: $(objtree)/include/generated/%
-       $(Q)cp $< $@
-
 clean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \
                $(zlib-decomp-) $(libfdt) $(libfdtheader) \
-               autoconf.h empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
+               empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
 
 quiet_cmd_bootcc = BOOTCC  $@
       cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
index b0491b8c0199daa4542d81e32d142c279f75164f..9457863147f9b2d9dbdc470dfc6446d99cf4c4c8 100644 (file)
@@ -18,7 +18,6 @@
 #include "stdio.h"
 #include "io.h"
 #include "ops.h"
-#include "autoconf.h"
 
 static int serial_open(void)
 {