summaryrefslogtreecommitdiff
path: root/rbutil/mkzenboot/dualboot/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/mkzenboot/dualboot/Makefile')
-rw-r--r--rbutil/mkzenboot/dualboot/Makefile50
1 files changed, 50 insertions, 0 deletions
diff --git a/rbutil/mkzenboot/dualboot/Makefile b/rbutil/mkzenboot/dualboot/Makefile
new file mode 100644
index 0000000000..cc8c604f6e
--- /dev/null
+++ b/rbutil/mkzenboot/dualboot/Makefile
@@ -0,0 +1,50 @@
1CC=gcc
2LD=ld
3OC=objcopy
4CROSS_PREFIX=arm-elf-eabi-
5REGS_PATH=../../../firmware/target/arm/imx233/regs
6CFLAGS=-mcpu=arm926ej-s -std=gnu99 -I. -I$(REGS_PATH) -nostdlib -ffreestanding -fomit-frame-pointer -O
7LDFLAGS=
8# Edit the following variables when adding a new target.
9# mkimxboot.c also needs to be edited to refer to these
10# To add a new target x you need to:
11# 1) add x to the list in TARGETS
12# 2) create a variable named OPT_x of the form:
13# OPT_x=target specific defines
14TARGETS=zenmozaic zenxfi zen
15OPT_zenmozaic=-DCREATIVE_ZENMOZAIC -DIMX233_SUBTARGET=3700
16OPT_zenxfi=-DCREATIVE_ZENXFI -DIMX233_SUBTARGET=3700
17OPT_zen=-DCREATIVE_ZEN -DIMX233_SUBTARGET=3700
18
19BOOTLDS=$(patsubst %, dualboot_%.lds, $(TARGETS))
20BOOTOBJS=$(patsubst %, dualboot_%.o, $(TARGETS))
21BOOTBINS=$(patsubst %, dualboot_%.arm-bin, $(TARGETS))
22BOOTELFS=$(patsubst %, dualboot_%.arm-elf, $(TARGETS))
23
24all: ../dualboot.h ../dualboot.c $(BOOTELFS)
25
26# Dualboot bootloaders
27
28dualboot_%.o: dualboot.c
29 $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.o=%)) -c -o $@ $^
30
31dualboot_%.lds: dualboot.lds
32 $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.lds=%)) -E -x c - < $< | sed '/#/d' > $@
33
34dualboot_%.arm-elf: dualboot_%.o dualboot_%.lds
35 $(CROSS_PREFIX)$(LD) $(LDFLAGS) -T$(@:dualboot_%.arm-elf=dualboot_%.lds) -o $@ $<
36
37# Rules for the ARM code embedded in mkamsboot - assemble, link, then extract
38# the binary code and finally convert to .h for building in mkamsboot
39
40%.arm-bin: %.arm-elf
41 $(CROSS_PREFIX)$(OC) -O binary $< $@
42
43../dualboot.c ../dualboot.h: $(BOOTBINS) bin2c
44 ./bin2c ../dualboot $(BOOTBINS)
45
46bin2c: bin2c.c
47 $(CC) -o bin2c bin2c.c
48
49clean:
50 rm -f *~ bin2c $(BOOTBINS) $(BOOTOBJS) $(BOOTELFS) $(BOOTLDS)