summaryrefslogtreecommitdiff
path: root/utils/mkzenboot/dualboot/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'utils/mkzenboot/dualboot/Makefile')
-rw-r--r--utils/mkzenboot/dualboot/Makefile51
1 files changed, 51 insertions, 0 deletions
diff --git a/utils/mkzenboot/dualboot/Makefile b/utils/mkzenboot/dualboot/Makefile
new file mode 100644
index 0000000000..752cc3ca28
--- /dev/null
+++ b/utils/mkzenboot/dualboot/Makefile
@@ -0,0 +1,51 @@
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 zenv
15OPT_zenmozaic=-DCREATIVE_ZENMOZAIC -DIMX233_SUBTARGET=3700
16OPT_zenxfi=-DCREATIVE_ZENXFI -DIMX233_SUBTARGET=3700
17OPT_zen=-DCREATIVE_ZEN -DIMX233_SUBTARGET=3700
18OPT_zenv=-DCREATIVE_ZENV -DIMX233_SUBTARGET=3600
19
20BOOTLDS=$(patsubst %, dualboot_%.lds, $(TARGETS))
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 $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.o=%)) -c -o $@ $^
31
32dualboot_%.lds: dualboot.lds
33 $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.lds=%)) -E -x c - < $< | sed '/#/d' > $@
34
35dualboot_%.arm-elf: dualboot_%.o dualboot_%.lds
36 $(CROSS_PREFIX)$(LD) $(LDFLAGS) -T$(@:dualboot_%.arm-elf=dualboot_%.lds) -o $@ $<
37
38# Rules for the ARM code embedded in mkamsboot - assemble, link, then extract
39# the binary code and finally convert to .h for building in mkamsboot
40
41%.arm-bin: %.arm-elf
42 $(CROSS_PREFIX)$(OC) -O binary $< $@
43
44../dualboot.c ../dualboot.h: $(BOOTBINS) bin2c
45 ./bin2c ../dualboot $(BOOTBINS)
46
47bin2c: bin2c.c
48 $(CC) -o bin2c bin2c.c
49
50clean:
51 rm -f *~ bin2c $(BOOTBINS) $(BOOTOBJS) $(BOOTELFS) $(BOOTLDS)