Skip to content

Commit 22750d9

Browse files
oohalmpe
authored andcommitted
powerpc/boot: Use CONFIG_KERNEL_GZIP
Most architectures allow the compression algorithm used to produced the vmlinuz image to be selected as a kernel config option. In preperation for supporting algorithms other than gzip in the powerpc boot wrapper the makefile needs to be modified to use these config options. Signed-off-by: Oliver O'Halloran <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 1a13de6 commit 22750d9

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ config PPC
162162
select GENERIC_CPU_AUTOPROBE
163163
select HAVE_VIRT_CPU_ACCOUNTING
164164
select HAVE_ARCH_HARDENED_USERCOPY
165+
select HAVE_KERNEL_GZIP
165166

166167
config GENERIC_CSUM
167168
def_bool CPU_LITTLE_ENDIAN

arch/powerpc/boot/Makefile

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@
1919

2020
all: $(obj)/zImage
2121

22+
compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP
23+
2224
BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
2325
-fno-strict-aliasing -Os -msoft-float -pipe \
2426
-fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
25-
-isystem $(shell $(CROSS32CC) -print-file-name=include)
27+
-isystem $(shell $(CROSS32CC) -print-file-name=include) \
28+
-D$(compress-y)
29+
2630
ifdef CONFIG_PPC64_BOOT_WRAPPER
2731
BOOTCFLAGS += -m64
2832
endif
@@ -59,13 +63,15 @@ $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
5963
$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
6064
$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
6165

66+
# the kernel's version of zlib pulls in a lot of other kernel headers
67+
# which we don't provide inside the wrapper.
68+
zlib-$(CONFIG_KERNEL_GZIP) := inffast.c inflate.c inftrees.c
69+
zlibheader-$(CONFIG_KERNEL_GZIP) := inffast.h inffixed.h inflate.h inftrees.h infutil.h
70+
zliblinuxheader-$(CONFIG_KERNEL_GZIP) := zlib.h zconf.h zutil.h
6271

63-
zlib := inffast.c inflate.c inftrees.c
64-
zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
65-
zliblinuxheader := zlib.h zconf.h zutil.h
66-
67-
$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o): \
68-
$(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
72+
$(addprefix $(obj)/,$(zlib-y) cuboot-c2k.o gunzip_util.o main.o): \
73+
$(addprefix $(obj)/,$(zliblinuxheader-y)) \
74+
$(addprefix $(obj)/,$(zlibheader-y))
6975

7076
libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
7177
libfdtheader := fdt.h libfdt.h libfdt_internal.h
@@ -76,7 +82,7 @@ $(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o): \
7682
src-wlib-y := string.S crt0.S crtsavres.S stdio.c main.c \
7783
$(libfdt) libfdt-wrapper.c \
7884
ns16550.c serial.c simple_alloc.c div64.S util.S \
79-
gunzip_util.c elf_util.c $(zlib) devtree.c stdlib.c \
85+
gunzip_util.c elf_util.c $(zlib-y) devtree.c stdlib.c \
8086
oflib.c ofconsole.c cuboot.c mpsc.c cpm-serial.c \
8187
uartlite.c mpc52xx-psc.c opal.c opal-calls.S
8288
src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
@@ -128,13 +134,13 @@ obj-plat: $(libfdt)
128134
quiet_cmd_copy_kern_src = COPY $@
129135
cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@
130136

131-
$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
137+
$(addprefix $(obj)/,$(zlib-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
132138
$(call cmd,copy_kern_src)
133139

134-
$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
140+
$(addprefix $(obj)/,$(zlibheader-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
135141
$(call cmd,copy_kern_src)
136142

137-
$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
143+
$(addprefix $(obj)/,$(zliblinuxheader-y)): $(obj)/%: $(srctree)/include/linux/%
138144
$(call cmd,copy_kern_src)
139145

140146
quiet_cmd_copy_libfdt = COPY $@
@@ -153,7 +159,7 @@ $(obj)/zImage.lds: $(obj)/%: $(srctree)/$(src)/%.S
153159
$(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
154160
$(Q)cp $< $@
155161

156-
clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
162+
clean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \
157163
$(libfdt) $(libfdtheader) \
158164
empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
159165

0 commit comments

Comments
 (0)