2 # MAKEFILE FOR THE MIPS LINUX BOOTLOADER AND ROM DEBUGGER
6 # Author: Thomas Horsten <thh@i-data.com>
10 Version
= "$(USER)-test"
13 MKLASATIMG
= mklasatimg
14 MKLASATIMG_ARCH
= mq2
,mqpro
,sp100
,sp200
15 KERNEL_IMAGE
= $(TOPDIR
)/vmlinux
16 KERNEL_START
= $(shell $(NM
) $(KERNEL_IMAGE
) | grep
" _text" | cut
-f1
-d\
)
17 KERNEL_ENTRY
= $(shell $(NM
) $(KERNEL_IMAGE
) | grep kernel_entry | cut
-f1
-d\
)
19 LDSCRIPT
= -L
$(obj
) -Tromscript.normal
21 HEAD_DEFINES
:= -D_kernel_start
=0x
$(KERNEL_START
) \
22 -D_kernel_entry
=0x
$(KERNEL_ENTRY
) \
23 -D VERSION
="\"$(Version)\"" \
24 -D TIMESTAMP
=$(shell date
+%s
)
26 $(obj
)/head.o
: $(obj
)/head.S
$(KERNEL_IMAGE
)
27 $(CC
) -fno-pic
$(HEAD_DEFINES
) -I
$(TOPDIR
)/include -c
-o
$@
$<
29 OBJECTS
= head.o kImage.o
33 $(obj
)/rom.sw
: $(obj
)/rom.bin
34 $(MKLASATIMG
) -o
$@
-k
$^
-m
$(MKLASATIMG_ARCH
)
36 $(obj
)/rom.bin
: $(obj
)/rom
37 $(OBJCOPY
) -O binary
-S
$^
$@
39 # Rule to make the bootloader
40 $(obj
)/rom
: $(addprefix $(obj
)/,$(OBJECTS
))
41 $(LD
) $(LDFLAGS
) $(LDSCRIPT
) -o
$@
$^
43 $(obj
)/%.o
: $(obj
)/%.gz
44 $(LD
) -r
-o
$@
-b binary
$<
46 $(obj
)/%.gz
: $(obj
)/%.bin
49 $(obj
)/kImage.bin
: $(KERNEL_IMAGE
)
50 $(OBJCOPY
) -O binary
-S
$^
$@
53 rm -f rom rom.bin rom.sw kImage.bin kImage.o