| 160 |
theseven |
1 |
NAME := installer-nano2g
|
|
|
2 |
|
|
|
3 |
EMBIOSDIR ?= ../../embios/trunk/
|
|
|
4 |
ILOADERDIR ?= ../iloader/
|
|
|
5 |
UNINSTDIR ?= ../uninstaller-nano2g/
|
|
|
6 |
TOOLSDIR ?= ../../tools/
|
|
|
7 |
|
|
|
8 |
BITMAPS = build/backdrop.ucl build/welcome.ucl build/repartition.ucl build/installing.ucl build/badpartition.ucl \
|
|
|
9 |
build/cancelled.ucl build/repartitioning.ucl build/preparing.ucl build/installfiles.ucl build/flashing.ucl
|
|
|
10 |
|
|
|
11 |
FLASHFILES = flashfiles/uninstaller-nano2g.embiosapp.ucl flashfiles/iloader.cfg.ucl flashfiles/iloader.embiosapp.ucl \
|
|
|
12 |
flashfiles/embiosldr-ipodnano2g.dfu flashfiles/embios-ipodnano2g.ucl
|
|
|
13 |
|
|
|
14 |
CROSS ?= arm-none-eabi-
|
|
|
15 |
CC := $(CROSS)gcc
|
|
|
16 |
AS := $(CROSS)as
|
|
|
17 |
LD := $(CROSS)ld
|
|
|
18 |
OBJCOPY := $(CROSS)objcopy
|
|
|
19 |
UCLPACK := ucl2e10singleblk
|
|
|
20 |
GENINSTALLER := python tools/geninstaller.py
|
|
|
21 |
STUBEMBED := python tools/stubembed.py
|
|
|
22 |
COMPILECONFIG := python $(ILOADERDIR)/tools/compileconfig.py
|
|
|
23 |
EMBIOSBOOTCFG := python $(EMBIOSDIR)/tools/embiosbootcfg.py
|
|
|
24 |
EMBIOSEMBEDAPP := python $(EMBIOSDIR)/tools/embiosembedapp.py
|
|
|
25 |
CRYPTFW := python $(TOOLSDIR)/ipodcrypt.py nano2g-cryptfw
|
|
|
26 |
SCRAMBLE := python $(TOOLSDIR)/scramble.py
|
|
|
27 |
|
|
|
28 |
CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
|
|
|
29 |
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
|
|
|
30 |
|
|
|
31 |
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
|
|
32 |
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
|
|
|
33 |
|
|
|
34 |
REVISION := $(shell svnversion .)
|
|
|
35 |
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
|
|
36 |
|
|
|
37 |
HELPERS := build/__embios_armhelpers.o
|
|
|
38 |
LIBS := build/libucl.a
|
|
|
39 |
|
|
|
40 |
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
|
|
|
41 |
OBJ := $(SRC:%.c=build/%.o)
|
|
|
42 |
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
|
|
|
43 |
|
|
|
44 |
all: $(NAME)
|
|
|
45 |
|
|
|
46 |
-include $(OBJ:%=%.dep)
|
|
|
47 |
|
|
|
48 |
$(NAME): build/$(NAME).ipodx
|
|
|
49 |
|
|
|
50 |
build/$(NAME).ipodx: build/$(NAME).fw
|
|
|
51 |
@echo [SCRAMB] $<
|
|
|
52 |
@$(SCRAMBLE) $< $@ --signature=nn2x --targetid=62
|
|
|
53 |
|
|
|
54 |
build/$(NAME).fw: build/$(NAME).bin
|
|
|
55 |
@echo [CFW] $<
|
|
|
56 |
@$(CRYPTFW) $< $@
|
|
|
57 |
|
|
|
58 |
build/$(NAME).bin: build/bootstub.bin build/$(NAME).integrated.bin
|
|
|
59 |
@echo [STUBEM] $@
|
|
|
60 |
@$(STUBEMBED) $^ $@
|
|
|
61 |
|
|
|
62 |
build/$(NAME).integrated.bin: $(EMBIOSDIR)/build/ipodnano2g/embios.bin build/$(NAME).embiosapp
|
|
|
63 |
@echo [EMBAPP] $@
|
|
|
64 |
@$(EMBIOSEMBEDAPP) $^ $@ --run-from=08000000
|
|
|
65 |
|
|
|
66 |
build/$(NAME).embiosapp: build/$(NAME).plain.embiosapp $(BITMAPS)
|
|
|
67 |
@echo [GENINS] $<
|
|
|
68 |
@$(GENINSTALLER) $< $@
|
|
|
69 |
|
|
|
70 |
build/bootstub.bin: build/bootstub.elf
|
|
|
71 |
@echo [OC] $<
|
|
|
72 |
@$(OBJCOPY) -O binary $^ $@
|
|
|
73 |
|
|
|
74 |
build/bootstub.elf: bootstub/ls.x build/bootstub/bootstub.o
|
|
|
75 |
@echo [LD] $@
|
|
|
76 |
@$(LD) $(LDFLAGS) -o $@ -T bootstub/ls.x build/bootstub/bootstub.o
|
|
|
77 |
|
|
|
78 |
build/%.ucl: oobe/%.bmp
|
|
|
79 |
@echo [UCL] $<
|
|
|
80 |
ifeq ($(shell uname),WindowsNT)
|
|
|
81 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
82 |
else
|
|
|
83 |
@-mkdir -p $(dir $@)
|
|
|
84 |
endif
|
|
|
85 |
@$(UCLPACK) $< $@
|
|
|
86 |
|
|
|
87 |
build/$(NAME).plain.embiosapp: build/$(NAME).elf
|
|
|
88 |
@echo [OC] $<
|
|
|
89 |
@$(OBJCOPY) -O binary $^ $@
|
|
|
90 |
|
|
|
91 |
build/$(NAME).elf: ls.x $(OBJ) $(LIBS)
|
|
|
92 |
@echo [LD] $@
|
|
|
93 |
@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ) $(LIBS)
|
|
|
94 |
|
|
|
95 |
build/%.o: %.c build/version.h
|
|
|
96 |
@echo [CC] $<
|
|
|
97 |
ifeq ($(shell uname),WindowsNT)
|
|
|
98 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
99 |
else
|
|
|
100 |
@-mkdir -p $(dir $@)
|
|
|
101 |
endif
|
|
|
102 |
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
103 |
@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
|
|
104 |
@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
|
|
105 |
ifeq ($(shell uname),WindowsNT)
|
|
|
106 |
@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
|
|
107 |
else
|
|
|
108 |
@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
|
|
109 |
endif
|
|
|
110 |
@rm -f $@.dep.tmp
|
|
|
111 |
|
|
|
112 |
build/%.o: %.S build/version.h
|
|
|
113 |
@echo [CC] $<
|
|
|
114 |
ifeq ($(shell uname),WindowsNT)
|
|
|
115 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
116 |
else
|
|
|
117 |
@-mkdir -p $(dir $@)
|
|
|
118 |
endif
|
|
|
119 |
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
120 |
@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
|
|
121 |
@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
|
|
122 |
ifeq ($(shell uname),WindowsNT)
|
|
|
123 |
@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
|
|
124 |
else
|
|
|
125 |
@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
|
|
126 |
endif
|
|
|
127 |
@rm -f $@.dep.tmp
|
|
|
128 |
|
|
|
129 |
build/__embios_%.o: $(EMBIOSDIR)/export/%.S
|
|
|
130 |
@echo [CC] $<
|
|
|
131 |
ifeq ($(shell uname),WindowsNT)
|
|
|
132 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
133 |
else
|
|
|
134 |
@-mkdir -p $(dir $@)
|
|
|
135 |
endif
|
|
|
136 |
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
137 |
|
|
|
138 |
build/libucl.a: libucl
|
|
|
139 |
|
|
|
140 |
libucl:
|
|
|
141 |
@make -C libucl CFLAGS="$(CFLAGS) -I../$(EMBIOSDIR)/export"
|
|
|
142 |
|
|
|
143 |
build/version.h: version.h .svn/entries
|
|
|
144 |
@echo [PP] $<
|
|
|
145 |
ifeq ($(shell uname),WindowsNT)
|
|
|
146 |
@-if not exist build md build
|
|
|
147 |
@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
|
|
148 |
else
|
|
|
149 |
@-mkdir -p build
|
|
|
150 |
@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
|
|
151 |
endif
|
|
|
152 |
|
|
|
153 |
flashfiles: $(FLASHFILES)
|
|
|
154 |
|
|
|
155 |
flashfiles/uninstaller-nano2g.embiosapp.ucl: $(UNINSTDIR)/build/uninstaller-nano2g.embiosapp.ucl uninstaller-nano2g
|
|
|
156 |
@echo [CP] $@
|
|
|
157 |
@cp $< $@
|
|
|
158 |
|
|
|
159 |
flashfiles/iloader.cfg: flashfiles/iloader.conf
|
|
|
160 |
@echo [COMCFG] $@
|
|
|
161 |
@$(COMPILECONFIG) $< $@
|
|
|
162 |
|
|
|
163 |
flashfiles/iloader.cfg.ucl: flashfiles/iloader.cfg
|
|
|
164 |
@echo [UCL] $<
|
|
|
165 |
@$(UCLPACK) $< $@
|
|
|
166 |
|
|
|
167 |
flashfiles/iloader.embiosapp.ucl: $(ILOADERDIR)/build/iloader.embiosapp.ucl iloader
|
|
|
168 |
@echo [CP] $@
|
|
|
169 |
@cp $< $@
|
|
|
170 |
|
|
|
171 |
flashfiles/embiosldr-ipodnano2g.dfu: $(EMBIOSDIR)/loader/ipodnano2g/build/embiosldr-ipodnano2g.dfu embiosldr-ipodnano2g
|
|
|
172 |
@echo [CP] $@
|
|
|
173 |
@cp $< $@
|
|
|
174 |
|
|
|
175 |
flashfiles/embios-ipodnano2g.ucl: flashfiles/embios-ipodnano2g.bin
|
|
|
176 |
@echo [UCL] $<
|
|
|
177 |
@$(UCLPACK) $< $@
|
|
|
178 |
|
|
|
179 |
flashfiles/embios-ipodnano2g.bin: $(EMBIOSDIR)/build/ipodnano2g/embios.bin embios
|
|
|
180 |
@echo [EMBCFG] $@
|
|
|
181 |
@$(EMBIOSBOOTCFG) $< $@ --file=/iLoader/boot.embiosapp --file-compressed --file-run-from=08000000 \
|
|
|
182 |
--flash="iloader " --flash-compressed --flash-run-from=09e00000
|
|
|
183 |
|
|
|
184 |
embios:
|
|
|
185 |
@make -C $(EMBIOSDIR)
|
|
|
186 |
|
|
|
187 |
embiosldr-ipodnano2g:
|
|
|
188 |
@make -C $(EMBIOSDIR)/loader/ipodnano2g
|
|
|
189 |
|
|
|
190 |
iloader:
|
|
|
191 |
@make -C $(ILOADERDIR)
|
|
|
192 |
|
|
|
193 |
uninstaller-nano2g:
|
|
|
194 |
@make -C $(UNINSTDIR)
|
|
|
195 |
|
|
|
196 |
clean:
|
|
|
197 |
@rm -rf build
|
|
|
198 |
|
|
|
199 |
.PHONY: all clean uninstaller-nano2g iloader embios embiosldr-ipodnano2g libucl flashfiles $(NAME)
|