GNUmakefile
1.55 KB
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
65
BBDEPTH = ../..
include $(BBDEPTH)/BBdefs
LASINCS = -I$(ROOT)/usr/include/PR -I..
LCINCS = -I$(ROOT)/usr/include/PR -I..
OPTIMIZER = -O2 -g
LCFLAGS += -Wall -mips2
ASFLAGS += -mips2
VPATH=..
LDFLAGS = -Ttext 0x9fc00000 -N
TARGETS= boot.dat mon.dat
LDIRT += $(TARGETS:.dat=.bin) $(TARGETS:.dat=.elf) sk.bin virage2.in v2.bin
.SUFFIXES: .bin .dat .elf
include $(BBDEPTH)/BBrules
default: $(TARGETS)
.s.elf:
$(ASF) -o $*.o $<
$(LD) $(LDFLAGS) crt0.o $*.o -o $*.elf
.elf.bin:
mips-linux-objcopy -O binary -R .mdebug -R .reginfo $*.elf $*.bin
.bin.dat:
od -v -w4 -An -tx1 $*.bin | tr -d " " > $*.dat
.c.elf:
$(CCF) -c -o $*.o $<
$(LD) $(LDFLAGS) crt0.o $*.o -o $*.elf
boot.elf: boot.o
$(LD) $(LDFLAGS) crt0.o $^ -o $*.elf
sk.bin mon.bin : boot.bin
# glue boot block onto mon program
dd if=boot.bin ibs=2048 conv=sync of=mon.bin
dd if=../../bbapps/mon/rom bs=4096 skip=1 >> mon.bin
@if [ `ls -l mon.bin | awk '{print $$5}'` -gt 65536 ]; then \
echo "MON TOO LARGE"; ls -l mon.bin; rm -f mon.bin; exit 1; \
fi
# pad to 64KB
dd if=mon.bin ibs=65536 conv=sync of=sk.bin
# generate virage2 image
$(ROOT)/usr/sbin/v2Const -k b81902767e25db270f3449c5d94b162f sk.bin \
virage2.in
$(ROOT)/usr/sbin/v2Create virage2.in virage2.out
$(ROOT)/usr/sbin/aes_encode -p -i a438b3410298747b0c089d8f6d2991a8 \
-k a81902767e25db170f3449c5d94b162f sk.bin sk_encrypt.bin
$(ROOT)/usr/sbin/mkflash sk_encrypt.bin > sk_encrypt.flash
od -v -w16 -An -tx1 sk_encrypt.flash > sk_encrypt.dat
boot.o: crt0.o
$(TARGETS) : crt0.o ../cpusim.h
install exports: