18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#
38c2ecf20Sopenharmony_ci# linux/arch/sh/boot/compressed/Makefile
48c2ecf20Sopenharmony_ci#
58c2ecf20Sopenharmony_ci# create a compressed vmlinux image from the original vmlinux
68c2ecf20Sopenharmony_ci#
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_citargets		:= vmlinux vmlinux.bin vmlinux.bin.gz \
98c2ecf20Sopenharmony_ci		   vmlinux.bin.bz2 vmlinux.bin.lzma \
108c2ecf20Sopenharmony_ci		   vmlinux.bin.xz vmlinux.bin.lzo \
118c2ecf20Sopenharmony_ci		   head_32.o misc.o piggy.o
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciOBJECTS = $(obj)/head_32.o $(obj)/misc.o $(obj)/cache.o
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciGCOV_PROFILE := n
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#
188c2ecf20Sopenharmony_ci# IMAGE_OFFSET is the load offset of the compression loader
198c2ecf20Sopenharmony_ci#
208c2ecf20Sopenharmony_ciifeq ($(CONFIG_32BIT),y)
218c2ecf20Sopenharmony_ciIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
228c2ecf20Sopenharmony_ci		     $$[$(CONFIG_MEMORY_START)  + \
238c2ecf20Sopenharmony_ci			$(CONFIG_BOOT_LINK_OFFSET)]')
248c2ecf20Sopenharmony_cielse
258c2ecf20Sopenharmony_ciIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
268c2ecf20Sopenharmony_ci		     $$[$(CONFIG_PAGE_OFFSET)  + \
278c2ecf20Sopenharmony_ci			$(KERNEL_MEMORY) + \
288c2ecf20Sopenharmony_ci			$(CONFIG_BOOT_LINK_OFFSET)]')
298c2ecf20Sopenharmony_ciendif
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciccflags-remove-$(CONFIG_MCOUNT) += -pg
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciLDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
348c2ecf20Sopenharmony_ci		   -T $(obj)/../../kernel/vmlinux.lds
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#
378c2ecf20Sopenharmony_ci# Pull in the necessary libgcc bits from the in-kernel implementation.
388c2ecf20Sopenharmony_ci#
398c2ecf20Sopenharmony_cilib1funcs-y	:= ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S lshrsi3.S
408c2ecf20Sopenharmony_cilib1funcs-obj   := \
418c2ecf20Sopenharmony_ci	$(addsuffix .o, $(basename $(addprefix $(obj)/, $(lib1funcs-y))))
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cilib1funcs-dir		:= $(srctree)/arch/$(SRCARCH)/lib
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -I$(lib1funcs-dir) -DDISABLE_BRANCH_PROFILING
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci$(addprefix $(obj)/,$(lib1funcs-y)): $(obj)/%: $(lib1funcs-dir)/% FORCE
488c2ecf20Sopenharmony_ci	$(call cmd,shipped)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(lib1funcs-obj) FORCE
518c2ecf20Sopenharmony_ci	$(call if_changed,ld)
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin: vmlinux FORCE
548c2ecf20Sopenharmony_ci	$(call if_changed,objcopy)
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_civmlinux.bin.all-y := $(obj)/vmlinux.bin
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
598c2ecf20Sopenharmony_ci	$(call if_changed,gzip)
608c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
618c2ecf20Sopenharmony_ci	$(call if_changed,bzip2)
628c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
638c2ecf20Sopenharmony_ci	$(call if_changed,lzma)
648c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
658c2ecf20Sopenharmony_ci	$(call if_changed,xzkern)
668c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
678c2ecf20Sopenharmony_ci	$(call if_changed,lzo)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ciOBJCOPYFLAGS += -R .empty_zero_page
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciLDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
748c2ecf20Sopenharmony_ci	$(call if_changed,ld)
75