Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # linux/arch/sh/boot/compressed/Makefile
  4. #
  5. # create a compressed vmlinux image from the original vmlinux
  6. #
  7. targets := vmlinux vmlinux.bin vmlinux.bin.gz \
  8. vmlinux.bin.bz2 vmlinux.bin.lzma \
  9. vmlinux.bin.xz vmlinux.bin.lzo \
  10. head_$(BITS).o misc.o piggy.o
  11. OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o
  12. GCOV_PROFILE := n
  13. #
  14. # IMAGE_OFFSET is the load offset of the compression loader
  15. #
  16. ifeq ($(CONFIG_32BIT),y)
  17. IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
  18. $$[$(CONFIG_MEMORY_START) + \
  19. $(CONFIG_BOOT_LINK_OFFSET)]')
  20. else
  21. IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
  22. $$[$(CONFIG_PAGE_OFFSET) + \
  23. $(KERNEL_MEMORY) + \
  24. $(CONFIG_BOOT_LINK_OFFSET)]')
  25. endif
  26. ifeq ($(CONFIG_MCOUNT),y)
  27. ORIG_CFLAGS := $(KBUILD_CFLAGS)
  28. KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
  29. endif
  30. LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
  31. -T $(obj)/../../kernel/vmlinux.lds
  32. #
  33. # Pull in the necessary libgcc bits from the in-kernel implementation.
  34. #
  35. lib1funcs-$(CONFIG_SUPERH32) := ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S \
  36. lshrsi3.S
  37. lib1funcs-obj := \
  38. $(addsuffix .o, $(basename $(addprefix $(obj)/, $(lib1funcs-y))))
  39. lib1funcs-dir := $(srctree)/arch/$(SRCARCH)/lib
  40. ifeq ($(BITS),64)
  41. lib1funcs-dir := $(addsuffix $(BITS), $(lib1funcs-dir))
  42. endif
  43. KBUILD_CFLAGS += -I$(lib1funcs-dir) -DDISABLE_BRANCH_PROFILING
  44. $(addprefix $(obj)/,$(lib1funcs-y)): $(obj)/%: $(lib1funcs-dir)/% FORCE
  45. $(call cmd,shipped)
  46. $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(lib1funcs-obj) FORCE
  47. $(call if_changed,ld)
  48. $(obj)/vmlinux.bin: vmlinux FORCE
  49. $(call if_changed,objcopy)
  50. vmlinux.bin.all-y := $(obj)/vmlinux.bin
  51. $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
  52. $(call if_changed,gzip)
  53. $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
  54. $(call if_changed,bzip2)
  55. $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
  56. $(call if_changed,lzma)
  57. $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
  58. $(call if_changed,xzkern)
  59. $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
  60. $(call if_changed,lzo)
  61. OBJCOPYFLAGS += -R .empty_zero_page
  62. LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
  63. $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
  64. $(call if_changed,ld)