import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / mips / lasat / image / Makefile
1 #
2 # MAKEFILE FOR THE MIPS LINUX BOOTLOADER AND ROM DEBUGGER
3 #
4 # i-data Networks
5 #
6 # Author: Thomas Horsten <thh@i-data.com>
7 #
8
9 ifndef Version
10  Version = "$(USER)-test"
11 endif
12
13 MKLASATIMG = mklasatimg
14 MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
15 ifdef CONFIG_LASAT_SERVICE
16 MKLASATIMG_FLAG = -s
17 else
18 MKLASATIMG_FLAG = -k
19 endif
20
21 KERNEL_IMAGE = $(TOPDIR)/vmlinux
22 KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep _ftext | cut -f1 -d\ )
23 KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
24
25 LDSCRIPT= -Tromscript.normal
26
27 HEAD_DEFINES = -D_kernel_start=0x$(KERNEL_START) \
28                 -D_kernel_entry=0x$(KERNEL_ENTRY) \
29                 -D VERSION="\"$(Version)\"" \
30                 -D TIMESTAMP=$(shell date +%s) 
31
32 head.o: head.S $(KERNEL_IMAGE)
33         $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
34
35 OBJECTS= head.o kImage.o
36
37 rom.sw: rom.bin
38         $(MKLASATIMG) -o rom.sw $(MKLASATIMG_FLAG) rom.bin -m $(MKLASATIMG_ARCH)
39
40 rom.bin: rom
41         $(OBJCOPY) -O binary -S rom rom.bin
42
43 # Rule to make the bootloader
44 rom:    $(OBJECTS)
45         $(LD) $(LDFLAGS) $(LDSCRIPT) -o rom $(OBJECTS) 
46
47 %.o: %.gz
48         $(LD) $(LDFLAGS) -r -o $@ -b binary $<
49
50 %.gz: %.bin
51         gzip -cf -9 $< > $@
52
53 kImage.bin: $(KERNEL_IMAGE)
54         $(OBJCOPY) -O binary -S $(TOPDIR)/vmlinux kImage.bin
55
56 clean:
57         rm -f rom rom.bin rom.sw kImage.bin
58
59 USE_STANDARD_AS_RULE = 1
60 include $(TOPDIR)/Rules.make