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 head.o misc.o piggy.o
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciOBJECTS = $(obj)/head.o $(obj)/misc.o
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#
138c2ecf20Sopenharmony_ci# IMAGE_OFFSET is the load offset of the compression loader
148c2ecf20Sopenharmony_ci# Assign dummy values if these 2 variables are not defined,
158c2ecf20Sopenharmony_ci# in order to suppress error message.
168c2ecf20Sopenharmony_ci#
178c2ecf20Sopenharmony_ciCONFIG_MEMORY_START     ?= 0x00400000
188c2ecf20Sopenharmony_ciCONFIG_BOOT_LINK_OFFSET ?= 0x00280000
198c2ecf20Sopenharmony_ciIMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET))))
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciLIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name 2>/dev/null)
228c2ecf20Sopenharmony_ciLDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup -T $(obj)/vmlinux.lds \
238c2ecf20Sopenharmony_ci	--defsym output=$(CONFIG_MEMORY_START)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
268c2ecf20Sopenharmony_ci	$(call if_changed,ld)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin: vmlinux FORCE
298c2ecf20Sopenharmony_ci	$(call if_changed,objcopy)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_GZIP)    := gzip
328c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_LZO)     := lzo
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.$(suffix-y): $(obj)/vmlinux.bin FORCE
358c2ecf20Sopenharmony_ci	$(call if_changed,$(suffix-y))
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciLDFLAGS_piggy.o := -r --format binary --oformat elf32-h8300-linux -T
388c2ecf20Sopenharmony_ciOBJCOPYFLAGS := -O binary
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
418c2ecf20Sopenharmony_ci	$(call if_changed,ld)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciCFLAGS_misc.o = -O0
44