Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # linux/arch/s390/boot/compressed/Makefile
  4. #
  5. # create a compressed vmlinux image from the original vmlinux
  6. #
  7. KCOV_INSTRUMENT := n
  8. GCOV_PROFILE := n
  9. UBSAN_SANITIZE := n
  10. KASAN_SANITIZE := n
  11. obj-y := $(if $(CONFIG_KERNEL_UNCOMPRESSED),,head.o misc.o) piggy.o
  12. targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
  13. targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
  14. targets += vmlinux.scr.lds $(obj-y) $(if $(CONFIG_KERNEL_UNCOMPRESSED),,sizes.h)
  15. KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
  16. KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
  17. OBJECTS := $(addprefix $(obj)/,$(obj-y))
  18. LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
  19. $(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE
  20. $(call if_changed,ld)
  21. # extract required uncompressed vmlinux symbols and adjust them to reflect offsets inside vmlinux.bin
  22. sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 (0x\1 - 0x100000)/p'
  23. quiet_cmd_sizes = GEN $@
  24. cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
  25. $(obj)/sizes.h: vmlinux
  26. $(call if_changed,sizes)
  27. AFLAGS_head.o += -I$(objtree)/$(obj)
  28. $(obj)/head.o: $(obj)/sizes.h
  29. CFLAGS_misc.o += -I$(objtree)/$(obj)
  30. $(obj)/misc.o: $(obj)/sizes.h
  31. OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
  32. $(obj)/vmlinux.bin: vmlinux
  33. $(call if_changed,objcopy)
  34. vmlinux.bin.all-y := $(obj)/vmlinux.bin
  35. suffix-$(CONFIG_KERNEL_GZIP) := .gz
  36. suffix-$(CONFIG_KERNEL_BZIP2) := .bz2
  37. suffix-$(CONFIG_KERNEL_LZ4) := .lz4
  38. suffix-$(CONFIG_KERNEL_LZMA) := .lzma
  39. suffix-$(CONFIG_KERNEL_LZO) := .lzo
  40. suffix-$(CONFIG_KERNEL_XZ) := .xz
  41. $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
  42. $(call if_changed,gzip)
  43. $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
  44. $(call if_changed,bzip2)
  45. $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
  46. $(call if_changed,lz4)
  47. $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
  48. $(call if_changed,lzma)
  49. $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
  50. $(call if_changed,lzo)
  51. $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
  52. $(call if_changed,xzkern)
  53. LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
  54. $(obj)/piggy.o: $(obj)/vmlinux.scr.lds $(obj)/vmlinux.bin$(suffix-y)
  55. $(call if_changed,ld)
  56. chkbss := $(filter-out $(obj)/misc.o $(obj)/piggy.o,$(OBJECTS))
  57. chkbss-target := $(obj)/vmlinux.bin
  58. include $(srctree)/arch/s390/scripts/Makefile.chkbss