Back to home page

OSCL-LXR

 
 

    


0001 #
0002 # This file is subject to the terms and conditions of the GNU General Public
0003 # License.  See the file "COPYING" in the main directory of this archive
0004 # for more details.
0005 #
0006 # Copyright (C) 1995, 1998, 2001, 2002 by Ralf Baechle
0007 # Copyright (C) 2004  Maciej W. Rozycki
0008 #
0009 
0010 #
0011 # Some DECstations need all possible sections of an ECOFF executable
0012 #
0013 ifdef CONFIG_MACH_DECSTATION
0014   e2eflag := -a
0015 endif
0016 
0017 #
0018 # Drop some uninteresting sections in the kernel.
0019 # This is only relevant for ELF kernels but doesn't hurt a.out
0020 #
0021 drop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
0022 strip-flags   := $(addprefix --remove-section=,$(drop-sections))
0023 
0024 hostprogs := elf2ecoff
0025 
0026 suffix-y                        := bin
0027 suffix-$(CONFIG_KERNEL_BZIP2)   := bz2
0028 suffix-$(CONFIG_KERNEL_GZIP)    := gz
0029 suffix-$(CONFIG_KERNEL_LZMA)    := lzma
0030 suffix-$(CONFIG_KERNEL_LZO)     := lzo
0031 
0032 targets := vmlinux.ecoff
0033 quiet_cmd_ecoff = ECOFF   $@
0034       cmd_ecoff = $(obj)/elf2ecoff $(VMLINUX) $@ $(e2eflag)
0035 $(obj)/vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) FORCE
0036         $(call if_changed,ecoff)
0037 
0038 targets += vmlinux.bin
0039 quiet_cmd_bin = OBJCOPY $@
0040       cmd_bin = $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $@
0041 $(obj)/vmlinux.bin: $(VMLINUX) FORCE
0042         $(call if_changed,bin)
0043 
0044 targets += vmlinux.srec
0045 quiet_cmd_srec = OBJCOPY $@
0046       cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
0047 $(obj)/vmlinux.srec: $(VMLINUX) FORCE
0048         $(call if_changed,srec)
0049 
0050 UIMAGE_LOADADDR  = $(VMLINUX_LOAD_ADDRESS)
0051 UIMAGE_ENTRYADDR = $(VMLINUX_ENTRY_ADDRESS)
0052 
0053 #
0054 # Compressed vmlinux images
0055 #
0056 
0057 extra-y += vmlinux.bin.bz2
0058 extra-y += vmlinux.bin.gz
0059 extra-y += vmlinux.bin.lzma
0060 extra-y += vmlinux.bin.lzo
0061 
0062 $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
0063         $(call if_changed,bzip2)
0064 
0065 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
0066         $(call if_changed,gzip)
0067 
0068 $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
0069         $(call if_changed,lzma)
0070 
0071 $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
0072         $(call if_changed,lzo)
0073 
0074 #
0075 # Compressed u-boot images
0076 #
0077 
0078 targets += uImage
0079 targets += uImage.bin
0080 targets += uImage.bz2
0081 targets += uImage.gz
0082 targets += uImage.lzma
0083 targets += uImage.lzo
0084 
0085 $(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
0086         $(call if_changed,uimage,none)
0087 
0088 $(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE
0089         $(call if_changed,uimage,bzip2)
0090 
0091 $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
0092         $(call if_changed,uimage,gzip)
0093 
0094 $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
0095         $(call if_changed,uimage,lzma)
0096 
0097 $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
0098         $(call if_changed,uimage,lzo)
0099 
0100 $(obj)/uImage: $(obj)/uImage.$(suffix-y)
0101         @ln -sf $(notdir $<) $@
0102         @echo '  Image $@ is ready'
0103 
0104 #
0105 # Flattened Image Tree (.itb) images
0106 #
0107 
0108 ifeq ($(ADDR_BITS),32)
0109 itb_addr_cells = 1
0110 endif
0111 ifeq ($(ADDR_BITS),64)
0112 itb_addr_cells = 2
0113 endif
0114 
0115 targets += vmlinux.its.S
0116 
0117 quiet_cmd_its_cat = CAT     $@
0118       cmd_its_cat = cat $(real-prereqs) >$@
0119 
0120 $(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE
0121         $(call if_changed,its_cat)
0122 
0123 targets += vmlinux.its
0124 targets += vmlinux.gz.its
0125 targets += vmlinux.bz2.its
0126 targets += vmlinux.lzma.its
0127 targets += vmlinux.lzo.its
0128 
0129 quiet_cmd_cpp_its_S = ITS     $@
0130       cmd_cpp_its_S = $(CPP) -P -C -o $@ $< \
0131                         -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
0132                         -DVMLINUX_BINARY="\"$(3)\"" \
0133                         -DVMLINUX_COMPRESSION="\"$(2)\"" \
0134                         -DVMLINUX_LOAD_ADDRESS=$(VMLINUX_LOAD_ADDRESS) \
0135                         -DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS) \
0136                         -DADDR_BITS=$(ADDR_BITS) \
0137                         -DADDR_CELLS=$(itb_addr_cells)
0138 
0139 $(obj)/vmlinux.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
0140         $(call if_changed,cpp_its_S,none,vmlinux.bin)
0141 
0142 $(obj)/vmlinux.gz.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
0143         $(call if_changed,cpp_its_S,gzip,vmlinux.bin.gz)
0144 
0145 $(obj)/vmlinux.bz2.its: $(obj)/vmlinux.its.S $(VMLINUX)  FORCE
0146         $(call if_changed,cpp_its_S,bzip2,vmlinux.bin.bz2)
0147 
0148 $(obj)/vmlinux.lzma.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
0149         $(call if_changed,cpp_its_S,lzma,vmlinux.bin.lzma)
0150 
0151 $(obj)/vmlinux.lzo.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
0152         $(call if_changed,cpp_its_S,lzo,vmlinux.bin.lzo)
0153 
0154 targets += vmlinux.itb
0155 targets += vmlinux.gz.itb
0156 targets += vmlinux.bz2.itb
0157 targets += vmlinux.lzma.itb
0158 targets += vmlinux.lzo.itb
0159 
0160 quiet_cmd_itb-image = ITB     $@
0161       cmd_itb-image = \
0162                 env PATH="$(objtree)/scripts/dtc:$(PATH)" \
0163                 $(BASH) $(MKIMAGE) \
0164                 -D "-I dts -O dtb -p 500 \
0165                         --include $(objtree)/arch/mips \
0166                         --warning no-unit_address_vs_reg" \
0167                 -f $(2) $@
0168 
0169 $(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE
0170         $(call if_changed,itb-image,$<)
0171 
0172 $(obj)/vmlinux.%.itb: $(obj)/vmlinux.%.its $(obj)/vmlinux.bin.% FORCE
0173         $(call if_changed,itb-image,$<)
0174 
0175 # for cleaning
0176 subdir- += compressed tools