Back to home page

LXR

 
 

    


0001 #
0002 # linux/arch/arm/boot/compressed/Makefile
0003 #
0004 # create a compressed vmlinuz image from the original vmlinux
0005 #
0006 
0007 OBJS            =
0008 
0009 AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
0010 HEAD    = head.o
0011 OBJS    += misc.o decompress.o
0012 ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
0013 OBJS    += debug.o
0014 endif
0015 FONTC   = $(srctree)/lib/fonts/font_acorn_8x8.c
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 
0027 #
0028 # Architecture dependencies
0029 #
0030 ifeq ($(CONFIG_ARCH_ACORN),y)
0031 OBJS            += ll_char_wr.o font.o
0032 endif
0033 
0034 ifeq ($(CONFIG_ARCH_SA1100),y)
0035 OBJS            += head-sa1100.o
0036 endif
0037 
0038 ifeq ($(CONFIG_CPU_XSCALE),y)
0039 OBJS            += head-xscale.o
0040 endif
0041 
0042 ifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y)
0043 OBJS            += head-sharpsl.o
0044 endif
0045 
0046 ifeq ($(CONFIG_CPU_ENDIAN_BE32),y)
0047 ifeq ($(CONFIG_CPU_CP15),y)
0048 OBJS            += big-endian.o
0049 else
0050 # The endian should be set by h/w design.
0051 endif
0052 endif
0053 
0054 #
0055 # We now have a PIC decompressor implementation.  Decompressors running
0056 # from RAM should not define ZTEXTADDR.  Decompressors running directly
0057 # from ROM or Flash must define ZTEXTADDR (preferably via the config)
0058 # FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
0059 ifeq ($(CONFIG_ZBOOT_ROM),y)
0060 ZTEXTADDR       := $(CONFIG_ZBOOT_ROM_TEXT)
0061 ZBSSADDR        := $(CONFIG_ZBOOT_ROM_BSS)
0062 else
0063 ZTEXTADDR       := 0
0064 ZBSSADDR        := ALIGN(8)
0065 endif
0066 
0067 CPPFLAGS_vmlinux.lds := -DTEXT_START="$(ZTEXTADDR)" -DBSS_START="$(ZBSSADDR)"
0068 
0069 compress-$(CONFIG_KERNEL_GZIP) = gzip
0070 compress-$(CONFIG_KERNEL_LZO)  = lzo
0071 compress-$(CONFIG_KERNEL_LZMA) = lzma
0072 compress-$(CONFIG_KERNEL_XZ)   = xzkern
0073 compress-$(CONFIG_KERNEL_LZ4)  = lz4
0074 
0075 # Borrowed libfdt files for the ATAG compatibility mode
0076 
0077 libfdt          := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
0078 libfdt_hdrs     := fdt.h libfdt.h libfdt_internal.h
0079 
0080 libfdt_objs     := $(addsuffix .o, $(basename $(libfdt)))
0081 
0082 $(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
0083         $(call cmd,shipped)
0084 
0085 $(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \
0086         $(addprefix $(obj)/,$(libfdt_hdrs))
0087 
0088 ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
0089 OBJS    += $(libfdt_objs) atags_to_fdt.o
0090 endif
0091 
0092 targets       := vmlinux vmlinux.lds piggy_data piggy.o \
0093                  lib1funcs.o ashldi3.o bswapsdi2.o \
0094                  head.o $(OBJS)
0095 
0096 clean-files += piggy_data lib1funcs.S ashldi3.S bswapsdi2.S \
0097                 $(libfdt) $(libfdt_hdrs) hyp-stub.S
0098 
0099 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
0100 
0101 ifeq ($(CONFIG_FUNCTION_TRACER),y)
0102 ORIG_CFLAGS := $(KBUILD_CFLAGS)
0103 KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
0104 endif
0105 
0106 # -fstack-protector-strong triggers protection checks in this code,
0107 # but it is being used too early to link to meaningful stack_chk logic.
0108 nossp_flags := $(call cc-option, -fno-stack-protector)
0109 CFLAGS_atags_to_fdt.o := $(nossp_flags)
0110 CFLAGS_fdt.o := $(nossp_flags)
0111 CFLAGS_fdt_ro.o := $(nossp_flags)
0112 CFLAGS_fdt_rw.o := $(nossp_flags)
0113 CFLAGS_fdt_wip.o := $(nossp_flags)
0114 
0115 ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
0116 asflags-y := -DZIMAGE
0117 
0118 # Supply kernel BSS size to the decompressor via a linker symbol.
0119 KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \
0120                 awk 'END{print $$3}')
0121 LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
0122 # Supply ZRELADDR to the decompressor via a linker symbol.
0123 ifneq ($(CONFIG_AUTO_ZRELADDR),y)
0124 LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
0125 endif
0126 ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
0127 LDFLAGS_vmlinux += --be8
0128 endif
0129 # ?
0130 LDFLAGS_vmlinux += -p
0131 # Report unresolved symbol references
0132 LDFLAGS_vmlinux += --no-undefined
0133 # Delete all temporary local symbols
0134 LDFLAGS_vmlinux += -X
0135 # Next argument is a linker script
0136 LDFLAGS_vmlinux += -T
0137 
0138 # For __aeabi_uidivmod
0139 lib1funcs = $(obj)/lib1funcs.o
0140 
0141 $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S
0142         $(call cmd,shipped)
0143 
0144 # For __aeabi_llsl
0145 ashldi3 = $(obj)/ashldi3.o
0146 
0147 $(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
0148         $(call cmd,shipped)
0149 
0150 # For __bswapsi2, __bswapdi2
0151 bswapsdi2 = $(obj)/bswapsdi2.o
0152 
0153 $(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S
0154         $(call cmd,shipped)
0155 
0156 # We need to prevent any GOTOFF relocs being used with references
0157 # to symbols in the .bss section since we cannot relocate them
0158 # independently from the rest at run time.  This can be achieved by
0159 # ensuring that no private .bss symbols exist, as global symbols
0160 # always have a GOT entry which is what we need.
0161 # The .data section is already discarded by the linker script so no need
0162 # to bother about it here.
0163 check_for_bad_syms = \
0164 bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
0165 [ -z "$$bad_syms" ] || \
0166   ( echo "following symbols must have non local/private scope:" >&2; \
0167     echo "$$bad_syms" >&2; rm -f $@; false )
0168 
0169 check_for_multiple_zreladdr = \
0170 if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
0171         echo 'multiple zreladdrs: $(ZRELADDR)'; \
0172         echo 'This needs CONFIG_AUTO_ZRELADDR to be set'; \
0173         false; \
0174 fi
0175 
0176 efi-obj-$(CONFIG_EFI_STUB) := $(objtree)/drivers/firmware/efi/libstub/lib.a
0177 
0178 $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
0179                 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \
0180                 $(bswapsdi2) $(efi-obj-y) FORCE
0181         @$(check_for_multiple_zreladdr)
0182         $(call if_changed,ld)
0183         @$(check_for_bad_syms)
0184 
0185 $(obj)/piggy_data: $(obj)/../Image FORCE
0186         $(call if_changed,$(compress-y))
0187 
0188 $(obj)/piggy.o: $(obj)/piggy_data
0189 
0190 CFLAGS_font.o := -Dstatic=
0191 
0192 $(obj)/font.c: $(FONTC)
0193         $(call cmd,shipped)
0194 
0195 AFLAGS_hyp-stub.o := -Wa,-march=armv7-a
0196 
0197 $(obj)/hyp-stub.S: $(srctree)/arch/$(SRCARCH)/kernel/hyp-stub.S
0198         $(call cmd,shipped)