Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0
0002 #
0003 # linux/arch/arm/boot/compressed/Makefile
0004 #
0005 # create a compressed vmlinuz image from the original vmlinux
0006 #
0007 
0008 OBJS            =
0009 
0010 HEAD    = head.o
0011 OBJS    += misc.o decompress.o
0012 ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
0013 OBJS    += debug.o
0014 AFLAGS_head.o += -DDEBUG
0015 endif
0016 
0017 # string library code (-Os is enforced to keep it much smaller)
0018 OBJS            += string.o
0019 CFLAGS_string.o := -Os
0020 
0021 ifeq ($(CONFIG_ARM_VIRT_EXT),y)
0022 OBJS            += hyp-stub.o
0023 endif
0024 
0025 GCOV_PROFILE            := n
0026 KASAN_SANITIZE          := n
0027 
0028 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
0029 KCOV_INSTRUMENT         := n
0030 
0031 #
0032 # Architecture dependencies
0033 #
0034 ifeq ($(CONFIG_ARCH_ACORN),y)
0035 OBJS            += ll_char_wr.o font.o
0036 endif
0037 
0038 ifeq ($(CONFIG_ARCH_SA1100),y)
0039 OBJS            += head-sa1100.o
0040 endif
0041 
0042 ifeq ($(CONFIG_CPU_XSCALE),y)
0043 OBJS            += head-xscale.o
0044 endif
0045 
0046 ifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y)
0047 OBJS            += head-sharpsl.o
0048 endif
0049 
0050 ifeq ($(CONFIG_CPU_ENDIAN_BE32),y)
0051 ifeq ($(CONFIG_CPU_CP15),y)
0052 OBJS            += big-endian.o
0053 else
0054 # The endian should be set by h/w design.
0055 endif
0056 endif
0057 
0058 #
0059 # We now have a PIC decompressor implementation.  Decompressors running
0060 # from RAM should not define ZTEXTADDR.  Decompressors running directly
0061 # from ROM or Flash must define ZTEXTADDR (preferably via the config)
0062 # FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
0063 ifeq ($(CONFIG_ZBOOT_ROM),y)
0064 ZTEXTADDR       := $(CONFIG_ZBOOT_ROM_TEXT)
0065 ZBSSADDR        := $(CONFIG_ZBOOT_ROM_BSS)
0066 else
0067 ZTEXTADDR       := 0
0068 ZBSSADDR        := ALIGN(8)
0069 endif
0070 
0071 MALLOC_SIZE     := 65536
0072 
0073 AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) -DMALLOC_SIZE=$(MALLOC_SIZE)
0074 CPPFLAGS_vmlinux.lds := -DTEXT_START="$(ZTEXTADDR)" -DBSS_START="$(ZBSSADDR)"
0075 CPPFLAGS_vmlinux.lds += -DTEXT_OFFSET="$(TEXT_OFFSET)"
0076 CPPFLAGS_vmlinux.lds += -DMALLOC_SIZE="$(MALLOC_SIZE)"
0077 
0078 compress-$(CONFIG_KERNEL_GZIP) = gzip
0079 compress-$(CONFIG_KERNEL_LZO)  = lzo_with_size
0080 compress-$(CONFIG_KERNEL_LZMA) = lzma_with_size
0081 compress-$(CONFIG_KERNEL_XZ)   = xzkern_with_size
0082 compress-$(CONFIG_KERNEL_LZ4)  = lz4_with_size
0083 
0084 libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o
0085 
0086 ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
0087 CFLAGS_REMOVE_atags_to_fdt.o += -Wframe-larger-than=${CONFIG_FRAME_WARN}
0088 CFLAGS_atags_to_fdt.o += -Wframe-larger-than=1280
0089 OBJS    += $(libfdt_objs) atags_to_fdt.o
0090 endif
0091 ifeq ($(CONFIG_USE_OF),y)
0092 OBJS    += $(libfdt_objs) fdt_check_mem_start.o
0093 endif
0094 
0095 OBJS    += lib1funcs.o ashldi3.o bswapsdi2.o
0096 
0097 targets       := vmlinux vmlinux.lds piggy_data piggy.o \
0098                  head.o $(OBJS)
0099 
0100 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
0101 
0102 ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
0103              -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
0104              -I$(obj) $(DISABLE_ARM_SSP_PER_TASK_PLUGIN)
0105 ccflags-remove-$(CONFIG_FUNCTION_TRACER) += -pg
0106 asflags-y := -DZIMAGE
0107 
0108 # Supply kernel BSS size to the decompressor via a linker symbol.
0109 KBSS_SZ = $(shell echo $$(($$($(NM) $(obj)/../../../../vmlinux | \
0110                 sed -n -e 's/^\([^ ]*\) [ABD] __bss_start$$/-0x\1/p' \
0111                        -e 's/^\([^ ]*\) [ABD] __bss_stop$$/+0x\1/p') )) )
0112 LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
0113 # Supply ZRELADDR to the decompressor via a linker symbol.
0114 ifneq ($(CONFIG_AUTO_ZRELADDR),y)
0115 LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
0116 endif
0117 ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
0118 LDFLAGS_vmlinux += --be8
0119 endif
0120 # Report unresolved symbol references
0121 LDFLAGS_vmlinux += --no-undefined
0122 # Delete all temporary local symbols
0123 LDFLAGS_vmlinux += -X
0124 # Report orphan sections
0125 ifdef CONFIG_LD_ORPHAN_WARN
0126 LDFLAGS_vmlinux += --orphan-handling=warn
0127 endif
0128 # Next argument is a linker script
0129 LDFLAGS_vmlinux += -T
0130 
0131 # We need to prevent any GOTOFF relocs being used with references
0132 # to symbols in the .bss section since we cannot relocate them
0133 # independently from the rest at run time.  This can be achieved by
0134 # ensuring that no private .bss symbols exist, as global symbols
0135 # always have a GOT entry which is what we need.
0136 # The .data section is already discarded by the linker script so no need
0137 # to bother about it here.
0138 check_for_bad_syms = \
0139 bad_syms=$$($(NM) $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
0140 [ -z "$$bad_syms" ] || \
0141   ( echo "following symbols must have non local/private scope:" >&2; \
0142     echo "$$bad_syms" >&2; false )
0143 
0144 check_for_multiple_zreladdr = \
0145 if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
0146         echo 'multiple zreladdrs: $(ZRELADDR)'; \
0147         echo 'This needs CONFIG_AUTO_ZRELADDR to be set'; \
0148         false; \
0149 fi
0150 
0151 efi-obj-$(CONFIG_EFI_STUB) := $(objtree)/drivers/firmware/efi/libstub/lib.a
0152 
0153 $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
0154                 $(addprefix $(obj)/, $(OBJS)) \
0155                 $(efi-obj-y) FORCE
0156         @$(check_for_multiple_zreladdr)
0157         $(call if_changed,ld)
0158         @$(check_for_bad_syms)
0159 
0160 $(obj)/piggy_data: $(obj)/../Image FORCE
0161         $(call if_changed,$(compress-y))
0162 
0163 $(obj)/piggy.o: $(obj)/piggy_data
0164 
0165 CFLAGS_font.o := -Dstatic=
0166 AFLAGS_hyp-stub.o := -Wa,-march=armv7-a