xref: /openbmc/linux/arch/mips/boot/Makefile (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
11da177e4SLinus Torvalds#
21da177e4SLinus Torvalds# This file is subject to the terms and conditions of the GNU General Public
31da177e4SLinus Torvalds# License.  See the file "COPYING" in the main directory of this archive
41da177e4SLinus Torvalds# for more details.
51da177e4SLinus Torvalds#
61da177e4SLinus Torvalds# Copyright (C) 1995, 1998, 2001, 2002 by Ralf Baechle
71da177e4SLinus Torvalds# Copyright (C) 2004  Maciej W. Rozycki
81da177e4SLinus Torvalds#
91da177e4SLinus Torvalds
101da177e4SLinus Torvalds#
111da177e4SLinus Torvalds# Some DECstations need all possible sections of an ECOFF executable
121da177e4SLinus Torvalds#
131da177e4SLinus Torvaldsifdef CONFIG_MACH_DECSTATION
14961e196cSSam Ravnborg  e2eflag := -a
151da177e4SLinus Torvaldsendif
161da177e4SLinus Torvalds
171da177e4SLinus Torvalds#
181da177e4SLinus Torvalds# Drop some uninteresting sections in the kernel.
191da177e4SLinus Torvalds# This is only relevant for ELF kernels but doesn't hurt a.out
201da177e4SLinus Torvalds#
21961e196cSSam Ravnborgdrop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
22961e196cSSam Ravnborgstrip-flags   := $(addprefix --remove-section=,$(drop-sections))
231da177e4SLinus Torvalds
245f2fb52fSMasahiro Yamadahostprogs := elf2ecoff
251da177e4SLinus Torvalds
269d6b80faSMarkos Chandrassuffix-y			:= bin
279d6b80faSMarkos Chandrassuffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
289d6b80faSMarkos Chandrassuffix-$(CONFIG_KERNEL_GZIP)	:= gz
299d6b80faSMarkos Chandrassuffix-$(CONFIG_KERNEL_LZMA)	:= lzma
309d6b80faSMarkos Chandrassuffix-$(CONFIG_KERNEL_LZO)	:= lzo
319d6b80faSMarkos Chandras
32961e196cSSam Ravnborgtargets := vmlinux.ecoff
33961e196cSSam Ravnborgquiet_cmd_ecoff = ECOFF	  $@
34961e196cSSam Ravnborg      cmd_ecoff = $(obj)/elf2ecoff $(VMLINUX) $@ $(e2eflag)
35961e196cSSam Ravnborg$(obj)/vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) FORCE
36961e196cSSam Ravnborg	$(call if_changed,ecoff)
371da177e4SLinus Torvalds
38961e196cSSam Ravnborgtargets += vmlinux.bin
39961e196cSSam Ravnborgquiet_cmd_bin = OBJCOPY $@
40961e196cSSam Ravnborg      cmd_bin = $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $@
41961e196cSSam Ravnborg$(obj)/vmlinux.bin: $(VMLINUX) FORCE
42961e196cSSam Ravnborg	$(call if_changed,bin)
431da177e4SLinus Torvalds
44961e196cSSam Ravnborgtargets += vmlinux.srec
45961e196cSSam Ravnborgquiet_cmd_srec = OBJCOPY $@
46961e196cSSam Ravnborg      cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
47961e196cSSam Ravnborg$(obj)/vmlinux.srec: $(VMLINUX) FORCE
48961e196cSSam Ravnborg	$(call if_changed,srec)
494defe455SJames Hogan
504defe455SJames HoganUIMAGE_LOADADDR  = $(VMLINUX_LOAD_ADDRESS)
514defe455SJames HoganUIMAGE_ENTRYADDR = $(VMLINUX_ENTRY_ADDRESS)
524defe455SJames Hogan
539d6b80faSMarkos Chandras#
549d6b80faSMarkos Chandras# Compressed vmlinux images
559d6b80faSMarkos Chandras#
569d6b80faSMarkos Chandras
579d6b80faSMarkos Chandrasextra-y += vmlinux.bin.bz2
589d6b80faSMarkos Chandrasextra-y += vmlinux.bin.gz
599d6b80faSMarkos Chandrasextra-y += vmlinux.bin.lzma
609d6b80faSMarkos Chandrasextra-y += vmlinux.bin.lzo
619d6b80faSMarkos Chandras
629d6b80faSMarkos Chandras$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
639d6b80faSMarkos Chandras	$(call if_changed,bzip2)
649d6b80faSMarkos Chandras
654defe455SJames Hogan$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
664defe455SJames Hogan	$(call if_changed,gzip)
674defe455SJames Hogan
689d6b80faSMarkos Chandras$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
699d6b80faSMarkos Chandras	$(call if_changed,lzma)
709d6b80faSMarkos Chandras
719d6b80faSMarkos Chandras$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
729d6b80faSMarkos Chandras	$(call if_changed,lzo)
739d6b80faSMarkos Chandras
749d6b80faSMarkos Chandras#
759d6b80faSMarkos Chandras# Compressed u-boot images
769d6b80faSMarkos Chandras#
779d6b80faSMarkos Chandras
789d6b80faSMarkos Chandrastargets += uImage
799d6b80faSMarkos Chandrastargets += uImage.bin
809d6b80faSMarkos Chandrastargets += uImage.bz2
814defe455SJames Hogantargets += uImage.gz
829d6b80faSMarkos Chandrastargets += uImage.lzma
839d6b80faSMarkos Chandrastargets += uImage.lzo
849d6b80faSMarkos Chandras
859d6b80faSMarkos Chandras$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
869d6b80faSMarkos Chandras	$(call if_changed,uimage,none)
879d6b80faSMarkos Chandras
889d6b80faSMarkos Chandras$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE
899d6b80faSMarkos Chandras	$(call if_changed,uimage,bzip2)
909d6b80faSMarkos Chandras
914defe455SJames Hogan$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
924defe455SJames Hogan	$(call if_changed,uimage,gzip)
934defe455SJames Hogan
949d6b80faSMarkos Chandras$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
959d6b80faSMarkos Chandras	$(call if_changed,uimage,lzma)
969d6b80faSMarkos Chandras
979d6b80faSMarkos Chandras$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
989d6b80faSMarkos Chandras	$(call if_changed,uimage,lzo)
999d6b80faSMarkos Chandras
1009d6b80faSMarkos Chandras$(obj)/uImage: $(obj)/uImage.$(suffix-y)
1014defe455SJames Hogan	@ln -sf $(notdir $<) $@
1024defe455SJames Hogan	@echo '  Image $@ is ready'
103cf2a5e0bSPaul Burton
104cf2a5e0bSPaul Burton#
105cf2a5e0bSPaul Burton# Flattened Image Tree (.itb) images
106cf2a5e0bSPaul Burton#
107cf2a5e0bSPaul Burton
108eed0eabdSPaul Burtonifeq ($(ADDR_BITS),32)
109eed0eabdSPaul Burtonitb_addr_cells = 1
110eed0eabdSPaul Burtonendif
111eed0eabdSPaul Burtonifeq ($(ADDR_BITS),64)
112eed0eabdSPaul Burtonitb_addr_cells = 2
113eed0eabdSPaul Burtonendif
114eed0eabdSPaul Burton
11567e09db5SMasahiro Yamadatargets += vmlinux.its.S
116436c6a44SPaul Burton
11767e09db5SMasahiro Yamadaquiet_cmd_its_cat = CAT     $@
118afa974b7SMasahiro Yamada      cmd_its_cat = cat $(real-prereqs) >$@
11967e09db5SMasahiro Yamada
12067e09db5SMasahiro Yamada$(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE
121436c6a44SPaul Burton	$(call if_changed,its_cat)
122436c6a44SPaul Burton
12392b34a97SMasahiro Yamadatargets += vmlinux.its
12492b34a97SMasahiro Yamadatargets += vmlinux.gz.its
12592b34a97SMasahiro Yamadatargets += vmlinux.bz2.its
12616202c09SAlexander Lobakintargets += vmlinux.lzma.its
12792b34a97SMasahiro Yamadatargets += vmlinux.lzo.its
12892b34a97SMasahiro Yamada
129cf2a5e0bSPaul Burtonquiet_cmd_cpp_its_S = ITS     $@
130321f95b6SMasahiro Yamada      cmd_cpp_its_S = $(CPP) -P -C -o $@ $< \
131cf2a5e0bSPaul Burton		        -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
132cf2a5e0bSPaul Burton			-DVMLINUX_BINARY="\"$(3)\"" \
133cf2a5e0bSPaul Burton			-DVMLINUX_COMPRESSION="\"$(2)\"" \
134cf2a5e0bSPaul Burton			-DVMLINUX_LOAD_ADDRESS=$(VMLINUX_LOAD_ADDRESS) \
135eed0eabdSPaul Burton			-DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS) \
136eed0eabdSPaul Burton			-DADDR_BITS=$(ADDR_BITS) \
137eed0eabdSPaul Burton			-DADDR_CELLS=$(itb_addr_cells)
138cf2a5e0bSPaul Burton
139436c6a44SPaul Burton$(obj)/vmlinux.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
140321f95b6SMasahiro Yamada	$(call if_changed,cpp_its_S,none,vmlinux.bin)
141cf2a5e0bSPaul Burton
142436c6a44SPaul Burton$(obj)/vmlinux.gz.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
143321f95b6SMasahiro Yamada	$(call if_changed,cpp_its_S,gzip,vmlinux.bin.gz)
144cf2a5e0bSPaul Burton
145436c6a44SPaul Burton$(obj)/vmlinux.bz2.its: $(obj)/vmlinux.its.S $(VMLINUX)  FORCE
146321f95b6SMasahiro Yamada	$(call if_changed,cpp_its_S,bzip2,vmlinux.bin.bz2)
147cf2a5e0bSPaul Burton
148436c6a44SPaul Burton$(obj)/vmlinux.lzma.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
149321f95b6SMasahiro Yamada	$(call if_changed,cpp_its_S,lzma,vmlinux.bin.lzma)
150cf2a5e0bSPaul Burton
151436c6a44SPaul Burton$(obj)/vmlinux.lzo.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
152321f95b6SMasahiro Yamada	$(call if_changed,cpp_its_S,lzo,vmlinux.bin.lzo)
153cf2a5e0bSPaul Burton
154be462bd9SMasahiro Yamadatargets += vmlinux.itb
155be462bd9SMasahiro Yamadatargets += vmlinux.gz.itb
156be462bd9SMasahiro Yamadatargets += vmlinux.bz2.itb
157be462bd9SMasahiro Yamadatargets += vmlinux.lzma.itb
158be462bd9SMasahiro Yamadatargets += vmlinux.lzo.itb
159be462bd9SMasahiro Yamada
160cf2a5e0bSPaul Burtonquiet_cmd_itb-image = ITB     $@
161cf2a5e0bSPaul Burton      cmd_itb-image = \
162cf2a5e0bSPaul Burton		env PATH="$(objtree)/scripts/dtc:$(PATH)" \
163858805b3SMasahiro Yamada		$(BASH) $(MKIMAGE) \
164cf2a5e0bSPaul Burton		-D "-I dts -O dtb -p 500 \
165cf2a5e0bSPaul Burton			--include $(objtree)/arch/mips \
166cf2a5e0bSPaul Burton			--warning no-unit_address_vs_reg" \
167cf2a5e0bSPaul Burton		-f $(2) $@
168cf2a5e0bSPaul Burton
169cf2a5e0bSPaul Burton$(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE
170cf2a5e0bSPaul Burton	$(call if_changed,itb-image,$<)
171cf2a5e0bSPaul Burton
172be462bd9SMasahiro Yamada$(obj)/vmlinux.%.itb: $(obj)/vmlinux.%.its $(obj)/vmlinux.bin.% FORCE
173cf2a5e0bSPaul Burton	$(call if_changed,itb-image,$<)
174*8212f898SMasahiro Yamada
175*8212f898SMasahiro Yamada# for cleaning
176*8212f898SMasahiro Yamadasubdir- += compressed tools
177