summaryrefslogtreecommitdiff
path: root/utils/mkimxboot/dualboot/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'utils/mkimxboot/dualboot/Makefile')
-rw-r--r--utils/mkimxboot/dualboot/Makefile48
1 files changed, 48 insertions, 0 deletions
diff --git a/utils/mkimxboot/dualboot/Makefile b/utils/mkimxboot/dualboot/Makefile
new file mode 100644
index 0000000000..b80233226a
--- /dev/null
+++ b/utils/mkimxboot/dualboot/Makefile
@@ -0,0 +1,48 @@
1CC=gcc
2LD=ld
3OC=objcopy
4PREFIX?=arm-elf-eabi-
5IMX233_PATH=../../../firmware/target/arm/imx233
6CFLAGS=-mcpu=arm926ej-s -std=gnu99 -I. -I$(IMX233_PATH) -nostdlib -ffreestanding -fomit-frame-pointer -O
7# Edit the following variables when adding a new target.
8# mkimxboot.c also needs to be edited to refer to these
9# To add a new target x you need to:
10# 1) add x to the list in TARGETS
11# 2) create a variable named OPT_x of the form:
12# OPT_x=target specific defines
13TARGETS=fuzeplus zenxfi2 zenxfi3 nwze370 nwze360 zenxfistyle
14OPT_fuzeplus=-DSANSA_FUZEPLUS -DIMX233_SUBTARGET=3780
15OPT_zenxfi2=-DCREATIVE_ZENXFI2 -DIMX233_SUBTARGET=3780
16OPT_zenxfi3=-DCREATIVE_ZENXFI3 -DIMX233_SUBTARGET=3780
17OPT_nwze370=-DSONY_NWZE370 -DIMX233_SUBTARGET=3780
18OPT_nwze360=-DSONY_NWZE360 -DIMX233_SUBTARGET=3780
19OPT_zenxfistyle=-DCREATIVE_ZENXFISTYLE -DIMX233_SUBTARGET=3780
20
21BOOTOBJS=$(patsubst %, dualboot_%.o, $(TARGETS))
22BOOTBINS=$(patsubst %, dualboot_%.arm-bin, $(TARGETS))
23BOOTELFS=$(patsubst %, dualboot_%.arm-elf, $(TARGETS))
24
25all: ../dualboot.h ../dualboot.c $(BOOTELFS)
26
27# Dualboot bootloaders
28
29dualboot_%.o: dualboot.c
30 $(PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.o=%)) -c -o $@ $^
31
32dualboot_%.arm-elf: dualboot_%.o
33 $(PREFIX)$(LD) $(LDFLAGS) -Tdualboot.lds -o $@ $<
34
35# Rules for the ARM code embedded in mkamsboot - assemble, link, then extract
36# the binary code and finally convert to .h for building in mkamsboot
37
38%.arm-bin: %.arm-elf
39 $(PREFIX)$(OC) -O binary $< $@
40
41../dualboot.c ../dualboot.h: $(BOOTBINS) bin2c
42 ./bin2c ../dualboot $(BOOTBINS)
43
44bin2c: bin2c.c
45 $(CC) -o bin2c bin2c.c
46
47clean:
48 rm -f *~ bin2c $(BOOTBINS) $(BOOTOBJS) $(BOOTELFS)