18c2ecf20Sopenharmony_ci# 28c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci# License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci# for more details. 58c2ecf20Sopenharmony_ci# 68c2ecf20Sopenharmony_ci# Copyright (C) 1995, 1998, 2001, 2002 by Ralf Baechle 78c2ecf20Sopenharmony_ci# Copyright (C) 2004 Maciej W. Rozycki 88c2ecf20Sopenharmony_ci# 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci# 118c2ecf20Sopenharmony_ci# Some DECstations need all possible sections of an ECOFF executable 128c2ecf20Sopenharmony_ci# 138c2ecf20Sopenharmony_ciifdef CONFIG_MACH_DECSTATION 148c2ecf20Sopenharmony_ci e2eflag := -a 158c2ecf20Sopenharmony_ciendif 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci# 188c2ecf20Sopenharmony_ci# Drop some uninteresting sections in the kernel. 198c2ecf20Sopenharmony_ci# This is only relevant for ELF kernels but doesn't hurt a.out 208c2ecf20Sopenharmony_ci# 218c2ecf20Sopenharmony_cidrop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options 228c2ecf20Sopenharmony_cistrip-flags := $(addprefix --remove-section=,$(drop-sections)) 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cihostprogs := elf2ecoff 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cisuffix-y := bin 278c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_BZIP2) := bz2 288c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_GZIP) := gz 298c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_LZMA) := lzma 308c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_LZO) := lzo 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_citargets := vmlinux.ecoff 338c2ecf20Sopenharmony_ciquiet_cmd_ecoff = ECOFF $@ 348c2ecf20Sopenharmony_ci cmd_ecoff = $(obj)/elf2ecoff $(VMLINUX) $@ $(e2eflag) 358c2ecf20Sopenharmony_ci$(obj)/vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) FORCE 368c2ecf20Sopenharmony_ci $(call if_changed,ecoff) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_citargets += vmlinux.bin 398c2ecf20Sopenharmony_ciquiet_cmd_bin = OBJCOPY $@ 408c2ecf20Sopenharmony_ci cmd_bin = $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $@ 418c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin: $(VMLINUX) FORCE 428c2ecf20Sopenharmony_ci $(call if_changed,bin) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_citargets += vmlinux.srec 458c2ecf20Sopenharmony_ciquiet_cmd_srec = OBJCOPY $@ 468c2ecf20Sopenharmony_ci cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@ 478c2ecf20Sopenharmony_ci$(obj)/vmlinux.srec: $(VMLINUX) FORCE 488c2ecf20Sopenharmony_ci $(call if_changed,srec) 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciUIMAGE_LOADADDR = $(VMLINUX_LOAD_ADDRESS) 518c2ecf20Sopenharmony_ciUIMAGE_ENTRYADDR = $(VMLINUX_ENTRY_ADDRESS) 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci# 548c2ecf20Sopenharmony_ci# Compressed vmlinux images 558c2ecf20Sopenharmony_ci# 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.bz2 588c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.gz 598c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.lzma 608c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.lzo 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE 638c2ecf20Sopenharmony_ci $(call if_changed,bzip2) 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 668c2ecf20Sopenharmony_ci $(call if_changed,gzip) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE 698c2ecf20Sopenharmony_ci $(call if_changed,lzma) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE 728c2ecf20Sopenharmony_ci $(call if_changed,lzo) 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci# 758c2ecf20Sopenharmony_ci# Compressed u-boot images 768c2ecf20Sopenharmony_ci# 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_citargets += uImage 798c2ecf20Sopenharmony_citargets += uImage.bin 808c2ecf20Sopenharmony_citargets += uImage.bz2 818c2ecf20Sopenharmony_citargets += uImage.gz 828c2ecf20Sopenharmony_citargets += uImage.lzma 838c2ecf20Sopenharmony_citargets += uImage.lzo 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE 868c2ecf20Sopenharmony_ci $(call if_changed,uimage,none) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE 898c2ecf20Sopenharmony_ci $(call if_changed,uimage,bzip2) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE 928c2ecf20Sopenharmony_ci $(call if_changed,uimage,gzip) 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE 958c2ecf20Sopenharmony_ci $(call if_changed,uimage,lzma) 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE 988c2ecf20Sopenharmony_ci $(call if_changed,uimage,lzo) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci$(obj)/uImage: $(obj)/uImage.$(suffix-y) 1018c2ecf20Sopenharmony_ci @ln -sf $(notdir $<) $@ 1028c2ecf20Sopenharmony_ci @echo ' Image $@ is ready' 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci# 1058c2ecf20Sopenharmony_ci# Flattened Image Tree (.itb) images 1068c2ecf20Sopenharmony_ci# 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciifeq ($(ADDR_BITS),32) 1098c2ecf20Sopenharmony_ciitb_addr_cells = 1 1108c2ecf20Sopenharmony_ciendif 1118c2ecf20Sopenharmony_ciifeq ($(ADDR_BITS),64) 1128c2ecf20Sopenharmony_ciitb_addr_cells = 2 1138c2ecf20Sopenharmony_ciendif 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_citargets += vmlinux.its.S 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ciquiet_cmd_its_cat = CAT $@ 1188c2ecf20Sopenharmony_ci cmd_its_cat = cat $(real-prereqs) >$@ 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci$(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE 1218c2ecf20Sopenharmony_ci $(call if_changed,its_cat) 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_citargets += vmlinux.its 1248c2ecf20Sopenharmony_citargets += vmlinux.gz.its 1258c2ecf20Sopenharmony_citargets += vmlinux.bz2.its 1268c2ecf20Sopenharmony_citargets += vmlinux.lzma.its 1278c2ecf20Sopenharmony_citargets += vmlinux.lzo.its 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ciquiet_cmd_cpp_its_S = ITS $@ 1308c2ecf20Sopenharmony_ci cmd_cpp_its_S = $(CPP) -P -C -o $@ $< \ 1318c2ecf20Sopenharmony_ci -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \ 1328c2ecf20Sopenharmony_ci -DVMLINUX_BINARY="\"$(3)\"" \ 1338c2ecf20Sopenharmony_ci -DVMLINUX_COMPRESSION="\"$(2)\"" \ 1348c2ecf20Sopenharmony_ci -DVMLINUX_LOAD_ADDRESS=$(VMLINUX_LOAD_ADDRESS) \ 1358c2ecf20Sopenharmony_ci -DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS) \ 1368c2ecf20Sopenharmony_ci -DADDR_BITS=$(ADDR_BITS) \ 1378c2ecf20Sopenharmony_ci -DADDR_CELLS=$(itb_addr_cells) 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci$(obj)/vmlinux.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE 1408c2ecf20Sopenharmony_ci $(call if_changed,cpp_its_S,none,vmlinux.bin) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci$(obj)/vmlinux.gz.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE 1438c2ecf20Sopenharmony_ci $(call if_changed,cpp_its_S,gzip,vmlinux.bin.gz) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci$(obj)/vmlinux.bz2.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE 1468c2ecf20Sopenharmony_ci $(call if_changed,cpp_its_S,bzip2,vmlinux.bin.bz2) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci$(obj)/vmlinux.lzma.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE 1498c2ecf20Sopenharmony_ci $(call if_changed,cpp_its_S,lzma,vmlinux.bin.lzma) 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci$(obj)/vmlinux.lzo.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE 1528c2ecf20Sopenharmony_ci $(call if_changed,cpp_its_S,lzo,vmlinux.bin.lzo) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_citargets += vmlinux.itb 1558c2ecf20Sopenharmony_citargets += vmlinux.gz.itb 1568c2ecf20Sopenharmony_citargets += vmlinux.bz2.itb 1578c2ecf20Sopenharmony_citargets += vmlinux.lzma.itb 1588c2ecf20Sopenharmony_citargets += vmlinux.lzo.itb 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ciquiet_cmd_itb-image = ITB $@ 1618c2ecf20Sopenharmony_ci cmd_itb-image = \ 1628c2ecf20Sopenharmony_ci env PATH="$(objtree)/scripts/dtc:$(PATH)" \ 1638c2ecf20Sopenharmony_ci $(BASH) $(MKIMAGE) \ 1648c2ecf20Sopenharmony_ci -D "-I dts -O dtb -p 500 \ 1658c2ecf20Sopenharmony_ci --include $(objtree)/arch/mips \ 1668c2ecf20Sopenharmony_ci --warning no-unit_address_vs_reg" \ 1678c2ecf20Sopenharmony_ci -f $(2) $@ 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci$(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE 1708c2ecf20Sopenharmony_ci $(call if_changed,itb-image,$<) 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci$(obj)/vmlinux.%.itb: $(obj)/vmlinux.%.its $(obj)/vmlinux.bin.% FORCE 1738c2ecf20Sopenharmony_ci $(call if_changed,itb-image,$<) 174