162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci# Makefile for the Sparc boot stuff.
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
562306a36Sopenharmony_ci# Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciROOT_IMG	:= /usr/src/root.img
862306a36Sopenharmony_ciELFTOAOUT	:= elftoaout
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cihostprogs	:= piggyback
1162306a36Sopenharmony_citargets		:= tftpboot.img image zImage vmlinux.aout
1262306a36Sopenharmony_ciclean-files	:= System.map
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciquiet_cmd_elftoaout	= ELFTOAOUT $@
1562306a36Sopenharmony_ci      cmd_elftoaout	= $(ELFTOAOUT) $(obj)/image -o $@
1662306a36Sopenharmony_ciquiet_cmd_piggy		= PIGGY   $@
1762306a36Sopenharmony_ci      cmd_piggy		= $(obj)/piggyback $(BITS) $@ System.map $(ROOT_IMG)
1862306a36Sopenharmony_ciquiet_cmd_strip		= STRIP   $@
1962306a36Sopenharmony_ci      cmd_strip		= $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $< -o $@
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciifeq ($(CONFIG_SPARC64),y)
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci# Actual linking
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci$(obj)/zImage: $(obj)/image FORCE
2662306a36Sopenharmony_ci	$(call if_changed,gzip)
2762306a36Sopenharmony_ci	@echo '  kernel: $@ is ready'
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci$(obj)/vmlinux.aout: vmlinux FORCE
3062306a36Sopenharmony_ci	$(call if_changed,elftoaout)
3162306a36Sopenharmony_ci	@echo '  kernel: $@ is ready'
3262306a36Sopenharmony_cielse
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci$(obj)/zImage: $(obj)/image FORCE
3562306a36Sopenharmony_ci	$(call if_changed,strip)
3662306a36Sopenharmony_ci	@echo '  kernel: $@ is ready'
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci# The following lines make a readable image for U-Boot.
3962306a36Sopenharmony_ci#  uImage   - Binary file read by U-boot
4062306a36Sopenharmony_ci#  uImage.o - object file of uImage for loading with a
4162306a36Sopenharmony_ci#             flash programmer understanding ELF.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciOBJCOPYFLAGS_image.bin := -S -O binary -R .note -R .comment
4462306a36Sopenharmony_ci$(obj)/image.bin: $(obj)/image FORCE
4562306a36Sopenharmony_ci	$(call if_changed,objcopy)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci$(obj)/image.gz: $(obj)/image.bin FORCE
4862306a36Sopenharmony_ci	$(call if_changed,gzip)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciUIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR)
5162306a36Sopenharmony_ciUIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)
5262306a36Sopenharmony_ciUIMAGE_COMPRESSION = gzip
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciquiet_cmd_uimage.o = UIMAGE.O $@
5562306a36Sopenharmony_ci      cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \
5662306a36Sopenharmony_ci                     -r -b binary $@ -o $@.o
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_citargets += uImage
5962306a36Sopenharmony_ci$(obj)/uImage: $(obj)/image.gz FORCE
6062306a36Sopenharmony_ci	$(call if_changed,uimage)
6162306a36Sopenharmony_ci	$(call if_changed,uimage.o)
6262306a36Sopenharmony_ci	@echo '  Image $@ is ready'
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciendif
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci$(obj)/image: vmlinux FORCE
6762306a36Sopenharmony_ci	$(call if_changed,strip)
6862306a36Sopenharmony_ci	@echo '  kernel: $@ is ready'
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE
7162306a36Sopenharmony_ci	$(call if_changed,elftoaout)
7262306a36Sopenharmony_ci	$(call if_changed,piggy)
73