1#
2# linux/arch/sh/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
7HEAD = head.o
8SYSTEM = $(TOPDIR)/vmlinux
9
10OBJECTS = $(HEAD) misc.o
11
12ifdef CONFIG_SH_STANDARD_BIOS
13OBJECTS += ../../kernel/sh_bios.o
14endif
15
16ZLDFLAGS = -e startup -T $(TOPDIR)/arch/sh/vmlinux.lds
17
18#
19# ZIMAGE_OFFSET is the load offset of the compression loader
20#
21ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[0x80000000+0x$(CONFIG_MEMORY_START)+0x$(CONFIG_BOOT_LINK_OFFSET)])
22
23ZLINKFLAGS  = -Ttext $(ZIMAGE_OFFSET)  $(ZLDFLAGS)
24
25all: vmlinux
26
27vmlinux: piggy.o $(OBJECTS)
28	$(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
29
30head.o: head.S
31	$(CC) $(AFLAGS) -traditional -c head.S
32
33piggy.o:	$(SYSTEM)
34	tmppiggy=_tmp_$$$$piggy; \
35	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
36	$(OBJCOPY) -R .empty_zero_page $(SYSTEM) $$tmppiggy; \
37	gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
38	echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
39	$(LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-sh-linux -T $$tmppiggy.lnk; \
40	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
41
42clean:
43	rm -f vmlinux _tmp_*
44