2008-11-14 22:16:22 +00:00
|
|
|
CC=gcc
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-10-11 11:35:59 +00:00
|
|
|
# We use the UCL code available in the Rockbox tools/ directory
|
|
|
|
CFLAGS=-I../../tools/ucl/include
|
|
|
|
LIBUCL=../../tools/ucl/src/libucl.a
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-10-11 11:35:59 +00:00
|
|
|
# Edit the following variables (plus copy/paste another set of rules) when
|
|
|
|
# adding a new target. mkamsboot.c also needs to be edited to refer to these
|
|
|
|
# new images.
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-12-24 04:23:52 +00:00
|
|
|
BOOTIMAGES = dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o
|
|
|
|
BOOTHEADERS = dualboot_clip.h dualboot_e200v2.h dualboot_c200v2.h dualboot_m200v4.h dualboot_fuze.h
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
CLIPFILES = dualboot_clip.arm-o dualboot_clip.o dualboot_clip.c dualboot_clip.h
|
2008-10-11 11:35:59 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
E200V2FILES = dualboot_e200v2.arm-o dualboot_e200v2.o dualboot_e200v2.c \
|
|
|
|
dualboot_e200v2.h
|
2008-10-11 11:35:59 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
M200V4FILES = dualboot_m200v4.arm-o dualboot_m200v4.o dualboot_m200v4.arm-bin \
|
|
|
|
dualboot_m200v4.c dualboot_m200v4.h
|
2008-10-30 00:13:29 +00:00
|
|
|
|
2008-12-24 04:23:52 +00:00
|
|
|
C200V2FILES = dualboot_c200v2.arm-o dualboot_c200v2.o dualboot_c200v2.c \
|
|
|
|
dualboot_c200v2.h
|
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
FUZEFILES = dualboot_fuze.arm-o dualboot_fuze.o dualboot_fuze.c dualboot_fuze.h
|
2008-10-30 20:00:56 +00:00
|
|
|
|
2008-10-11 11:35:59 +00:00
|
|
|
all: mkamsboot
|
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
# Dualboot bootloaders
|
2008-10-11 11:35:59 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
dualboot_clip.arm-o: dualboot.S
|
|
|
|
arm-elf-gcc -DSANSA_CLIP -c -o dualboot_clip.arm-o dualboot.S
|
2008-10-11 11:35:59 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
dualboot_fuze.arm-o: dualboot.S
|
|
|
|
arm-elf-gcc -DSANSA_FUZE -c -o dualboot_fuze.arm-o dualboot.S
|
2008-10-11 11:35:59 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
dualboot_e200v2.arm-o: dualboot.S
|
|
|
|
arm-elf-gcc -DSANSA_E200V2 -c -o dualboot_e200v2.arm-o dualboot.S
|
2008-10-30 20:00:56 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
dualboot_m200v4.arm-o: dualboot.S
|
|
|
|
arm-elf-gcc -DSANSA_M200V4 -c -o dualboot_m200v4.arm-o dualboot.S
|
2008-10-30 20:00:56 +00:00
|
|
|
|
2008-12-24 04:23:52 +00:00
|
|
|
dualboot_c200v2.arm-o: dualboot.S
|
|
|
|
arm-elf-gcc -DSANSA_C200V2 -c -o dualboot_c200v2.arm-o dualboot.S
|
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
# Rules for the ucl unpack function
|
|
|
|
nrv2e_d8.arm-o: nrv2e_d8.S
|
|
|
|
arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.arm-o nrv2e_d8.S
|
2008-10-11 11:35:59 +00:00
|
|
|
|
2008-10-04 08:46:03 +00:00
|
|
|
|
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
$(LIBUCL):
|
|
|
|
make -C ../../tools/ucl/src libucl.a
|
2008-10-28 11:24:24 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
md5.o: md5.c md5.h
|
|
|
|
$(CC) $(CFLAGS) -c -o md5.o -W -Wall md5.c
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
mkamsboot.o: mkamsboot.c $(BOOTHEADERS) nrv2e_d8.h md5.h
|
|
|
|
$(CC) $(CFLAGS) -c -o mkamsboot.o -W -Wall mkamsboot.c
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
mkamsboot: mkamsboot.o $(BOOTIMAGES) nrv2e_d8.o md5.o $(LIBUCL)
|
|
|
|
$(CC) -o mkamsboot mkamsboot.o $(BOOTIMAGES) nrv2e_d8.o md5.o $(LIBUCL)
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
# Rules for the ARM code embedded in mkamsboot - assemble, link, then extract
|
|
|
|
# the binary code and finally convert to .c/.h for linking with mkamsboot
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
%.arm-elf: %.arm-o
|
|
|
|
arm-elf-ld -e 0 -Ttext=0 -o $@ $<
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
%.arm-bin: %.arm-elf
|
|
|
|
arm-elf-objcopy -O binary $< $@
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
%.c %.h: %.arm-bin bin2c
|
|
|
|
./bin2c $< $*
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
# Generic host rule.
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
# Cancel the implicit .S -> .o rule
|
|
|
|
%.o: %.S
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2008-10-11 11:35:59 +00:00
|
|
|
bin2c: bin2c.c
|
2008-11-14 22:16:22 +00:00
|
|
|
$(CC) -o bin2c bin2c.c
|
2008-10-04 08:46:03 +00:00
|
|
|
|
|
|
|
clean:
|
2008-11-14 22:16:22 +00:00
|
|
|
rm -f mkamsboot mkamsboot.o nrv2e_d8.arm-o nrv2e_d8.arm-elf \
|
|
|
|
nrv2e_d8.arm-bin *~ bin2c nrv2e_d8.c nrv2e_d8.h nrv2e_d8.o md5.o \
|
2008-12-24 04:23:52 +00:00
|
|
|
$(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V4FILES) $(FUZEFILES) \
|
|
|
|
$(C200V2FILES)
|