diff options
Diffstat (limited to 'utils/mkzenboot/dualboot/Makefile')
-rw-r--r-- | utils/mkzenboot/dualboot/Makefile | 51 |
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 @@ | |||
1 | CC=gcc | ||
2 | LD=ld | ||
3 | OC=objcopy | ||
4 | CROSS_PREFIX=arm-elf-eabi- | ||
5 | REGS_PATH=../../../firmware/target/arm/imx233/regs | ||
6 | CFLAGS=-mcpu=arm926ej-s -std=gnu99 -I. -I$(REGS_PATH) -nostdlib -ffreestanding -fomit-frame-pointer -O | ||
7 | LDFLAGS= | ||
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 | ||
14 | TARGETS=zenmozaic zenxfi zen zenv | ||
15 | OPT_zenmozaic=-DCREATIVE_ZENMOZAIC -DIMX233_SUBTARGET=3700 | ||
16 | OPT_zenxfi=-DCREATIVE_ZENXFI -DIMX233_SUBTARGET=3700 | ||
17 | OPT_zen=-DCREATIVE_ZEN -DIMX233_SUBTARGET=3700 | ||
18 | OPT_zenv=-DCREATIVE_ZENV -DIMX233_SUBTARGET=3600 | ||
19 | |||
20 | BOOTLDS=$(patsubst %, dualboot_%.lds, $(TARGETS)) | ||
21 | BOOTOBJS=$(patsubst %, dualboot_%.o, $(TARGETS)) | ||
22 | BOOTBINS=$(patsubst %, dualboot_%.arm-bin, $(TARGETS)) | ||
23 | BOOTELFS=$(patsubst %, dualboot_%.arm-elf, $(TARGETS)) | ||
24 | |||
25 | all: ../dualboot.h ../dualboot.c $(BOOTELFS) | ||
26 | |||
27 | # Dualboot bootloaders | ||
28 | |||
29 | dualboot_%.o: dualboot.c | ||
30 | $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.o=%)) -c -o $@ $^ | ||
31 | |||
32 | dualboot_%.lds: dualboot.lds | ||
33 | $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.lds=%)) -E -x c - < $< | sed '/#/d' > $@ | ||
34 | |||
35 | dualboot_%.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 | |||
47 | bin2c: bin2c.c | ||
48 | $(CC) -o bin2c bin2c.c | ||
49 | |||
50 | clean: | ||
51 | rm -f *~ bin2c $(BOOTBINS) $(BOOTOBJS) $(BOOTELFS) $(BOOTLDS) | ||