1#
2# linux/arch/unicore32/boot/compressed/Makefile
3#
4# create a compressed vmlinuz image from the original vmlinux
5#
6# This file is subject to the terms and conditions of the GNU General Public
7# License.  See the file "COPYING" in the main directory of this archive
8# for more details.
9#
10# Copyright (C) 2001~2010 GUAN Xue-tao
11#
12
13ccflags-y	:= -fpic -fno-builtin
14asflags-y	:= -Wa,-march=all
15
16OBJS		:= misc.o
17
18# font.c and font.o
19CFLAGS_font.o	:= -Dstatic=
20$(obj)/font.c: $(srctree)/lib/fonts/font_8x8.c
21	$(call cmd,shipped)
22
23# piggy.S and piggy.o
24suffix_$(CONFIG_KERNEL_GZIP)	:= gzip
25suffix_$(CONFIG_KERNEL_BZIP2)	:= bz2
26suffix_$(CONFIG_KERNEL_LZO)	:= lzo
27suffix_$(CONFIG_KERNEL_LZMA)	:= lzma
28
29$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
30	$(call if_changed,$(suffix_y))
31
32SEDFLAGS_piggy	= s/DECOMP_SUFFIX/$(suffix_y)/
33$(obj)/piggy.S: $(obj)/piggy.S.in
34	@sed "$(SEDFLAGS_piggy)" < $< > $@
35
36$(obj)/piggy.o:  $(obj)/piggy.$(suffix_y) $(obj)/piggy.S FORCE
37
38targets		:= vmlinux vmlinux.lds font.o font.c head.o misc.o \
39			piggy.$(suffix_y) piggy.o piggy.S \
40
41# Make sure files are removed during clean
42extra-y		+= piggy.gzip piggy.bz2 piggy.lzo piggy.lzma
43
44# ?
45LDFLAGS_vmlinux += -p
46# Report unresolved symbol references
47LDFLAGS_vmlinux += --no-undefined
48# Delete all temporary local symbols
49LDFLAGS_vmlinux += -X
50# Next argument is a linker script
51LDFLAGS_vmlinux += -T
52
53# For uidivmod
54$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head.o $(obj)/piggy.o \
55		$(obj)/misc.o FORCE
56	$(call if_changed,ld)
57	@:
58
59# We now have a PIC decompressor implementation.  Decompressors running
60# from RAM should not define ZTEXTADDR.  Decompressors running directly
61# from ROM or Flash must define ZTEXTADDR (preferably via the config)
62ZTEXTADDR	:= 0x03000000
63ZBSSADDR	:= ALIGN(4)
64
65SEDFLAGS_lds	= s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
66$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/unicore32/boot/Makefile $(KCONFIG_CONFIG)
67	@sed "$(SEDFLAGS_lds)" < $< > $@
68
69