diff options
Diffstat (limited to 'rbutil/mkzenboot/dualboot/Makefile')
-rw-r--r-- | rbutil/mkzenboot/dualboot/Makefile | 50 |
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 @@ | |||
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 | ||
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 | |||
19 | BOOTLDS=$(patsubst %, dualboot_%.lds, $(TARGETS)) | ||
20 | BOOTOBJS=$(patsubst %, dualboot_%.o, $(TARGETS)) | ||
21 | BOOTBINS=$(patsubst %, dualboot_%.arm-bin, $(TARGETS)) | ||
22 | BOOTELFS=$(patsubst %, dualboot_%.arm-elf, $(TARGETS)) | ||
23 | |||
24 | all: ../dualboot.h ../dualboot.c $(BOOTELFS) | ||
25 | |||
26 | # Dualboot bootloaders | ||
27 | |||
28 | dualboot_%.o: dualboot.c | ||
29 | $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.o=%)) -c -o $@ $^ | ||
30 | |||
31 | dualboot_%.lds: dualboot.lds | ||
32 | $(CROSS_PREFIX)$(CC) $(CFLAGS) $(OPT_$(@:dualboot_%.lds=%)) -E -x c - < $< | sed '/#/d' > $@ | ||
33 | |||
34 | dualboot_%.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 | |||
46 | bin2c: bin2c.c | ||
47 | $(CC) -o bin2c bin2c.c | ||
48 | |||
49 | clean: | ||
50 | rm -f *~ bin2c $(BOOTBINS) $(BOOTOBJS) $(BOOTELFS) $(BOOTLDS) | ||