1#
2# linux/arch/i386/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
12IA32_CFLAGS := -O2 -DSTDC_HEADERS
13
14#
15# ZIMAGE_OFFSET is the load offset of the compression loader
16# BZIMAGE_OFFSET is the load offset of the high loaded compression loader
17#
18BZIMAGE_OFFSET = 0x100000
19
20BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS)
21
22all: vmlinux
23
24bvmlinux: piggy.o $(OBJECTS)
25	$(IA32_LD) $(BZLINKFLAGS) -o bvmlinux $(OBJECTS) piggy.o
26
27head.o: head.S
28	$(IA32_AS) -c head.S
29
30misc.o: misc.c
31	$(IA32_CC) $(IA32_CFLAGS) -fno-strict-aliasing -c misc.c
32
33piggy.o:	$(SYSTEM)
34	tmppiggy=_tmp_$$$$piggy; \
35	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
36	$(OBJCOPY) $(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	$(IA32_LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
40	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
41
42clean:
43	rm -f vmlinux bvmlinux _tmp_*
44