summaryrefslogtreecommitdiffstats
path: root/arch/mips/baget/Makefile
blob: a62e4802176c89a19fe9e2dadb8732485f7cd0b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
# Makefile for the Baget specific kernel interface routines
# under Linux.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...

all: baget.a 

O_TARGET := baget.a

export-objs		:= vacserial.o vacrtc.o
obj-y			:= baget.o print.o setup.o time.o irq.o bagetIRQ.o \
			   reset.o wbflush.o
obj-$(CONFIG_SERIAL)	+= vacserial.o
obj-$(CONFIG_VAC_RTC)	+= vacrtc.o

bagetIRQ.o : bagetIRQ.S
	$(CC) $(CFLAGS) -c -o $@ $<


##################### Baget Loader stuff ########################

image: ../../../vmlinux
	cp -f $< $@

image.bin: image
	$(OBJCOPY) -O binary $< $@

ramdisk.bin:
	echo "Dummy ramdisk used. Provide your own if needed !" > $@

dummy.c:
	touch $@

dummy.o: dummy.c image.bin ramdisk.bin
	$(CC) $(CFLAGS) -c -o $@ $<
	$(OBJCOPY) --add-section=.vmlinux=image.bin \
                   --add-section=.ramdisk=ramdisk.bin   $@ 

balo.h: image
	$(NM) $< | awk ' \
	BEGIN               { printf "/* DO NOT EDIT THIS FILE */\n" }    \
	/_ftext/            { printf "#define LOADADDR 0x%s\n", $$1     } \
	/kernel_entry/      { printf "#define START 0x%s\n", $$1 }        \
	/balo_ramdisk_base/ { printf "#define RAMDISK_BASE 0x%s\n", $$1 } \
	/balo_ramdisk_size/ { printf "#define RAMDISK_SIZE 0x%s\n", $$1 } \
                       ' > $@
balo.o:   balo.c balo.h
	$(CC) $(CFLAGS) -c $< 

balo_supp.o: balo_supp.S
	$(CC) $(CFLAGS) -c $<

balo:   balo.o dummy.o balo_supp.o print.o
	$(LD) $(LDFLAGS) -T ld.script.balo -o $@ $^ 

clean:
	rm -f balo balo.h dummy.c image image.bin

include $(TOPDIR)/Rules.make