summaryrefslogtreecommitdiffstats
path: root/rbutil/mks5lboot/dualboot/Makefile
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2016-02-04 23:05:17 +0100
committerCástor Muñoz <cmvidal@gmail.com>2017-04-14 00:03:42 +0200
commit346423c040fe4ac31dae7c1afcb1d853cc80635c (patch)
treebd8dd4c55f083a1162f7019188977213a20dc41c /rbutil/mks5lboot/dualboot/Makefile
parenteefc7c73e2495decdc6f242515696fe0e3f85609 (diff)
downloadrockbox-346423c040fe4ac31dae7c1afcb1d853cc80635c.tar.gz
rockbox-346423c040fe4ac31dae7c1afcb1d853cc80635c.zip
mks5lboot v1.0 - dualboot installer for s5l8702 targetsmks5lboot_1.0
A tool to install/uninstall a bootloader into a s5l8702 based device: - iPod Classic 6G - iPod Nano 3G (TODO) See mks5lboot/README for detailed info. Change-Id: I451d2aaff34509ebd356e4660647e5222c5d3409
Diffstat (limited to 'rbutil/mks5lboot/dualboot/Makefile')
-rw-r--r--rbutil/mks5lboot/dualboot/Makefile97
1 files changed, 97 insertions, 0 deletions
diff --git a/rbutil/mks5lboot/dualboot/Makefile b/rbutil/mks5lboot/dualboot/Makefile
new file mode 100644
index 0000000000..51ce816ca0
--- /dev/null
+++ b/rbutil/mks5lboot/dualboot/Makefile
@@ -0,0 +1,97 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id$
+#
+ifndef V
+SILENT = @
+endif
+
+CC = gcc
+LD = ld
+OC = objcopy
+CROSS ?= arm-elf-eabi-
+
+ROOTDIR = ../../..
+FIRMDIR = $(ROOTDIR)/firmware
+FWARM = $(FIRMDIR)/target/arm
+FW8702 = $(FWARM)/s5l8702
+BUILDDIR = build/
+LINKFILE = dualboot.lds
+
+# Edit the following variables when adding a new target.
+# mks5lboot.c also needs to be edited to refer to these
+# To add a new target x you need to:
+# 1) add x to the list in TARGETS
+# 2) create a variable named OPT_x of the form:
+# OPT_x=target specific defines
+TARGETS = ipod6g
+OPT_ipod6g = -DIPOD_6G -DMEMORYSIZE=64
+
+LOADERS = install uninstall
+OPT_install =
+OPT_uninstall = -DDUALBOOT_UNINSTALL
+
+# target/loader specific options
+$(foreach l, $(LOADERS),$(foreach t, $(TARGETS),\
+ $(eval OPT_$(l)_$(t) = $(OPT_$(l)) $(OPT_$(t)))))
+
+DEFINES = -DBOOTLOADER
+
+SOURCES = init.S dualboot.c
+SOURCES += $(ROOTDIR)/lib/arm_support/support-arm.S
+SOURCES += $(wildcard $(FIRMDIR)/asm/mem*.c $(FIRMDIR)/libc/mem*.c)
+SOURCES += $(addprefix $(FWARM)/, mmu-arm.S)
+SOURCES += $(addprefix $(FW8702)/, clocking-s5l8702.c spi-s5l8702.c nor-s5l8702.c crypto-s5l8702.c)
+# target/loader specific sources
+SRCTARGET = piezo-.c
+$(foreach l, $(LOADERS), $(foreach t, $(TARGETS),\
+ $(eval SRC_$(l)_$(t) = $(addprefix $(FW8702)/$(t)/, $(subst -.,-$(subst ipod,,$(t)).,$(SRCTARGET))))))
+
+INCLUDES += -I. -I.. -I$(FIRMDIR) -I$(FWARM) -I$(FW8702)
+INCLUDES += $(addprefix -I$(FIRMDIR)/, export include libc/include kernel/include)
+# target/loader specific includes
+$(foreach l,$(LOADERS),$(foreach t,$(TARGETS),$(eval INC_$(l)_$(t) = -I$(FW8702)/$(t))))
+
+CFLAGS = $(INCLUDES) -mcpu=arm926ej-s -std=gnu99 -nostdlib -ffreestanding -Os -W -Wall\
+ -Wundef -Wstrict-prototypes -ffunction-sections -fdata-sections -Wl,--gc-sections $(DEFINES)
+
+# Build filenames prefix
+PFX = dualboot_
+
+BOOTBINS = $(foreach l, $(LOADERS),$(foreach t, $(TARGETS),$(PFX)$(l)_$(t).arm-bin))
+
+OUTPUTDUALBOOT = ../dualboot.h ../dualboot.c
+OUTPUTDEBUG = $(BOOTBINS:%.arm-bin=$(BUILDDIR)%.arm-elf) $(BOOTBINS:%.arm-bin=$(BUILDDIR)%.lds)
+
+
+all: $(BUILDDIR) $(OUTPUTDUALBOOT)
+
+$(BUILDDIR)$(PFX)%.lds: $(LINKFILE)
+ @echo Creating $@
+ $(SILENT)$(CROSS)$(CC) $(INC_$*) $(CFLAGS) $(OPT_$*) -E -x c - < $< | sed '/#/d' > $@
+
+$(BUILDDIR)$(PFX)%.arm-elf: $(BUILDDIR)$(PFX)%.lds $(SOURCES)
+ @echo CC -T $(notdir $^ $(SRC_$*))
+ $(SILENT)$(CROSS)$(CC) $(INC_$*) $(CFLAGS) $(OPT_$*) -o $@ -T$^ $(SRC_$*)
+
+$(PFX)%.arm-bin: $(BUILDDIR)$(PFX)%.arm-elf
+ @echo OC $<
+ $(SILENT)$(CROSS)$(OC) -O binary $< $@
+
+bin2c: bin2c.c
+ $(CC) -o $@ $<
+
+$(OUTPUTDUALBOOT): bin2c $(BOOTBINS)
+ ./bin2c ../dualboot $(BOOTBINS)
+
+$(BUILDDIR):
+ mkdir -p $@
+
+clean:
+ rm -rf bin2c $(BOOTBINS) $(BUILDDIR)
+
+.PRECIOUS: $(OUTPUTDEBUG)