From 346423c040fe4ac31dae7c1afcb1d853cc80635c Mon Sep 17 00:00:00 2001 From: Cástor Muñoz Date: Thu, 4 Feb 2016 23:05:17 +0100 Subject: mks5lboot v1.0 - dualboot installer for s5l8702 targets 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 --- rbutil/mks5lboot/dualboot/Makefile | 97 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 rbutil/mks5lboot/dualboot/Makefile (limited to 'rbutil/mks5lboot/dualboot/Makefile') 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) -- cgit v1.2.3