18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# Makefile for the Sparc boot stuff.
38c2ecf20Sopenharmony_ci#
48c2ecf20Sopenharmony_ci# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
58c2ecf20Sopenharmony_ci# Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciROOT_IMG	:= /usr/src/root.img
88c2ecf20Sopenharmony_ciELFTOAOUT	:= elftoaout
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cihostprogs	:= piggyback
118c2ecf20Sopenharmony_citargets		:= tftpboot.img image zImage vmlinux.aout
128c2ecf20Sopenharmony_ciclean-files	:= System.map
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciquiet_cmd_elftoaout	= ELFTOAOUT $@
158c2ecf20Sopenharmony_ci      cmd_elftoaout	= $(ELFTOAOUT) $(obj)/image -o $@
168c2ecf20Sopenharmony_ciquiet_cmd_piggy		= PIGGY   $@
178c2ecf20Sopenharmony_ci      cmd_piggy		= $(obj)/piggyback $(BITS) $@ System.map $(ROOT_IMG)
188c2ecf20Sopenharmony_ciquiet_cmd_strip		= STRIP   $@
198c2ecf20Sopenharmony_ci      cmd_strip		= $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $< -o $@
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciifeq ($(CONFIG_SPARC64),y)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci# Actual linking
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci$(obj)/zImage: $(obj)/image
268c2ecf20Sopenharmony_ci	$(call if_changed,gzip)
278c2ecf20Sopenharmony_ci	@echo '  kernel: $@ is ready'
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci$(obj)/vmlinux.aout: vmlinux FORCE
308c2ecf20Sopenharmony_ci	$(call if_changed,elftoaout)
318c2ecf20Sopenharmony_ci	@echo '  kernel: $@ is ready'
328c2ecf20Sopenharmony_cielse
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci$(obj)/zImage: $(obj)/image
358c2ecf20Sopenharmony_ci	$(call if_changed,strip)
368c2ecf20Sopenharmony_ci	@echo '  kernel: $@ is ready'
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci# The following lines make a readable image for U-Boot.
398c2ecf20Sopenharmony_ci#  uImage   - Binary file read by U-boot
408c2ecf20Sopenharmony_ci#  uImage.o - object file of uImage for loading with a
418c2ecf20Sopenharmony_ci#             flash programmer understanding ELF.
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciOBJCOPYFLAGS_image.bin := -S -O binary -R .note -R .comment
448c2ecf20Sopenharmony_ci$(obj)/image.bin: $(obj)/image FORCE
458c2ecf20Sopenharmony_ci	$(call if_changed,objcopy)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci$(obj)/image.gz: $(obj)/image.bin
488c2ecf20Sopenharmony_ci	$(call if_changed,gzip)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciUIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR)
518c2ecf20Sopenharmony_ciUIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)
528c2ecf20Sopenharmony_ciUIMAGE_COMPRESSION = gzip
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciquiet_cmd_uimage.o = UIMAGE.O $@
558c2ecf20Sopenharmony_ci      cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \
568c2ecf20Sopenharmony_ci                     -r -b binary $@ -o $@.o
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_citargets += uImage
598c2ecf20Sopenharmony_ci$(obj)/uImage: $(obj)/image.gz
608c2ecf20Sopenharmony_ci	$(call if_changed,uimage)
618c2ecf20Sopenharmony_ci	$(call if_changed,uimage.o)
628c2ecf20Sopenharmony_ci	@echo '  Image $@ is ready'
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciendif
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci$(obj)/image: vmlinux FORCE
678c2ecf20Sopenharmony_ci	$(call if_changed,strip)
688c2ecf20Sopenharmony_ci	@echo '  kernel: $@ is ready'
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE
718c2ecf20Sopenharmony_ci	$(call if_changed,elftoaout)
728c2ecf20Sopenharmony_ci	$(call if_changed,piggy)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciinstall:
758c2ecf20Sopenharmony_ci	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(obj)/zImage \
768c2ecf20Sopenharmony_ci		System.map "$(INSTALL_PATH)"
77