1 # SPDX-License-Identifier: GPL-2.0
3 # linux/arch/s390/boot/compressed/Makefile
5 # create a compressed vmlinux image from the original vmlinux
13 obj-y
:= $(if
$(CONFIG_KERNEL_UNCOMPRESSED
),,decompressor.o
) info.o
14 obj-all
:= $(obj-y
) piggy.o syms.o
15 targets
:= vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
16 targets
+= vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
17 targets
+= info.bin syms.bin vmlinux.syms
$(obj-all
)
19 KBUILD_AFLAGS
:= $(KBUILD_AFLAGS_DECOMPRESSOR
)
20 KBUILD_CFLAGS
:= $(KBUILD_CFLAGS_DECOMPRESSOR
)
23 OBJECTS
:= $(addprefix $(obj
)/,$(obj-y
))
24 OBJECTS_ALL
:= $(addprefix $(obj
)/,$(obj-all
))
26 LDFLAGS_vmlinux
:= --oformat
$(LD_BFD
) -e startup
--build-id
=sha1
-T
27 $(obj
)/vmlinux
: $(obj
)/vmlinux.lds
$(objtree
)/arch
/s390
/boot
/startup.a
$(OBJECTS_ALL
) FORCE
30 LDFLAGS_vmlinux.syms
:= --oformat
$(LD_BFD
) -e startup
-T
31 $(obj
)/vmlinux.syms
: $(obj
)/vmlinux.lds
$(objtree
)/arch
/s390
/boot
/startup.a
$(OBJECTS
) FORCE
34 quiet_cmd_dumpsyms
= DUMPSYMS
$<
36 $(NM
) -n
-S
--format
=bsd
"$<" |
$(PERL
) -ne
'/(\w+)\s+(\w+)\s+[tT]\s+(\w+)/ and printf "%x %x %s\0",hex $$1,hex $$2,$$3' > "$@"
39 $(obj
)/syms.bin
: $(obj
)/vmlinux.syms FORCE
40 $(call if_changed
,dumpsyms
)
42 OBJCOPYFLAGS_syms.o
:= -I binary
-O elf64-s390
-B s390
:64-bit
--rename-section .data
=.decompressor.syms
43 $(obj
)/syms.o
: $(obj
)/syms.bin FORCE
44 $(call if_changed
,objcopy
)
46 OBJCOPYFLAGS_info.bin
:= -O binary
--only-section
=.vmlinux.
info --set-section-flags .vmlinux.
info=load
47 $(obj
)/info.bin
: vmlinux FORCE
48 $(call if_changed
,objcopy
)
50 OBJCOPYFLAGS_info.o
:= -I binary
-O elf64-s390
-B s390
:64-bit
--rename-section .data
=.vmlinux.
info
51 $(obj
)/info.o
: $(obj
)/info.bin FORCE
52 $(call if_changed
,objcopy
)
54 OBJCOPYFLAGS_vmlinux.bin
:= -O binary
--remove-section
=.comment
--remove-section
=.vmlinux.
info -S
55 $(obj
)/vmlinux.bin
: vmlinux FORCE
56 $(call if_changed
,objcopy
)
58 vmlinux.bin.all-y
:= $(obj
)/vmlinux.bin
60 suffix-
$(CONFIG_KERNEL_GZIP
) := .gz
61 suffix-
$(CONFIG_KERNEL_BZIP2
) := .bz2
62 suffix-
$(CONFIG_KERNEL_LZ4
) := .lz4
63 suffix-
$(CONFIG_KERNEL_LZMA
) := .lzma
64 suffix-
$(CONFIG_KERNEL_LZO
) := .lzo
65 suffix-
$(CONFIG_KERNEL_XZ
) := .xz
67 $(obj
)/vmlinux.bin.gz
: $(vmlinux.bin.all-y
) FORCE
68 $(call if_changed
,gzip
)
69 $(obj
)/vmlinux.bin.bz2
: $(vmlinux.bin.all-y
) FORCE
70 $(call if_changed
,bzip2
)
71 $(obj
)/vmlinux.bin.lz4
: $(vmlinux.bin.all-y
) FORCE
72 $(call if_changed
,lz4
)
73 $(obj
)/vmlinux.bin.lzma
: $(vmlinux.bin.all-y
) FORCE
74 $(call if_changed
,lzma
)
75 $(obj
)/vmlinux.bin.lzo
: $(vmlinux.bin.all-y
) FORCE
76 $(call if_changed
,lzo
)
77 $(obj
)/vmlinux.bin.xz
: $(vmlinux.bin.all-y
) FORCE
78 $(call if_changed
,xzkern
)
80 OBJCOPYFLAGS_piggy.o
:= -I binary
-O elf64-s390
-B s390
:64-bit
--rename-section .data
=.vmlinux.bin.compressed
81 $(obj
)/piggy.o
: $(obj
)/vmlinux.bin
$(suffix-y
) FORCE
82 $(call if_changed
,objcopy
)