xref: /OK3568_Linux_fs/kernel/arch/h8300/boot/compressed/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# linux/arch/sh/boot/compressed/Makefile
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun# create a compressed vmlinux image from the original vmlinux
6*4882a593Smuzhiyun#
7*4882a593Smuzhiyun
8*4882a593Smuzhiyuntargets		:= vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunOBJECTS = $(obj)/head.o $(obj)/misc.o
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun#
13*4882a593Smuzhiyun# IMAGE_OFFSET is the load offset of the compression loader
14*4882a593Smuzhiyun# Assign dummy values if these 2 variables are not defined,
15*4882a593Smuzhiyun# in order to suppress error message.
16*4882a593Smuzhiyun#
17*4882a593SmuzhiyunCONFIG_MEMORY_START     ?= 0x00400000
18*4882a593SmuzhiyunCONFIG_BOOT_LINK_OFFSET ?= 0x00280000
19*4882a593SmuzhiyunIMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET))))
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunLIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name 2>/dev/null)
22*4882a593SmuzhiyunLDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup -T $(obj)/vmlinux.lds \
23*4882a593Smuzhiyun	--defsym output=$(CONFIG_MEMORY_START)
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
26*4882a593Smuzhiyun	$(call if_changed,ld)
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun$(obj)/vmlinux.bin: vmlinux FORCE
29*4882a593Smuzhiyun	$(call if_changed,objcopy)
30*4882a593Smuzhiyun
31*4882a593Smuzhiyunsuffix-$(CONFIG_KERNEL_GZIP)    := gzip
32*4882a593Smuzhiyunsuffix-$(CONFIG_KERNEL_LZO)     := lzo
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun$(obj)/vmlinux.bin.$(suffix-y): $(obj)/vmlinux.bin FORCE
35*4882a593Smuzhiyun	$(call if_changed,$(suffix-y))
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunLDFLAGS_piggy.o := -r --format binary --oformat elf32-h8300-linux -T
38*4882a593SmuzhiyunOBJCOPYFLAGS := -O binary
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
41*4882a593Smuzhiyun	$(call if_changed,ld)
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunCFLAGS_misc.o = -O0
44