| 551 |
theseven |
1 |
NAME := installer-ipodnano2g
|
|
|
2 |
STACKSIZE := 4096
|
|
|
3 |
COMPRESS := false
|
| 705 |
theseven |
4 |
AUTOBUILD_FLASHFILES ?= true
|
| 843 |
theseven |
5 |
AUTOBUILD_FSFILES ?= true
|
| 253 |
theseven |
6 |
BASENAME ?= $(NAME)
|
|
|
7 |
FATNAME ?= INSTAL~1BOO
|
| 160 |
theseven |
8 |
|
| 551 |
theseven |
9 |
EMCOREDIR ?= ../../emcore/trunk/
|
| 672 |
theseven |
10 |
UNINSTDIR ?= ../uninstaller-ipodnano2g/
|
| 551 |
theseven |
11 |
BOOTMENUDIR ?= ../bootmenu-ipodnano2g/
|
| 843 |
theseven |
12 |
BOOTMENUTHEMEDIR ?= ../bootmenu-ipodnano2g-wintertheme/
|
| 551 |
theseven |
13 |
LIBBOOTDIR ?= ../../libs/boot/
|
|
|
14 |
LIBPNGDIR ?= ../../libs/png/
|
|
|
15 |
LIBUIDIR ?= ../../libs/ui/
|
| 672 |
theseven |
16 |
LIBMKFAT32DIR ?= ../../libs/mkfat32/
|
| 243 |
theseven |
17 |
UMSBOOTDIR ?= ../../umsboot/
|
| 253 |
theseven |
18 |
NOTEBOOTDIR ?= ../../noteboot/
|
| 160 |
theseven |
19 |
TOOLSDIR ?= ../../tools/
|
|
|
20 |
|
| 672 |
theseven |
21 |
FLASHFILES = flashfiles/boot.emcorelib flashfiles/png.emcorelib flashfiles/ui.emcorelib flashfiles/mkfat32.emcorelib \
|
| 843 |
theseven |
22 |
flashfiles/uninstaller-ipodnano2g.emcoreapp flashfiles/bootmenu-ipodnano2g.emcoreapp flashfiles/rockbox.ipod.ucl \
|
|
|
23 |
flashfiles/emcoreldr-ipodnano2g.dfu flashfiles/emcore-ipodnano2g.ucl flashfiles/umsboot-ipodnano2g.ucl
|
| 160 |
theseven |
24 |
|
| 843 |
theseven |
25 |
FSFILES = fsfiles/.apps/bootmenu/theme.emcoreapp
|
|
|
26 |
|
| 462 |
theseven |
27 |
ifeq ($(shell uname),WindowsNT)
|
|
|
28 |
CCACHE :=
|
|
|
29 |
else
|
|
|
30 |
CCACHE := $(shell which ccache)
|
|
|
31 |
endif
|
|
|
32 |
|
| 457 |
theseven |
33 |
CROSS ?= arm-elf-eabi-
|
| 462 |
theseven |
34 |
CC := $(CCACHE) $(CROSS)gcc
|
| 160 |
theseven |
35 |
AS := $(CROSS)as
|
|
|
36 |
LD := $(CROSS)ld
|
|
|
37 |
OBJCOPY := $(CROSS)objcopy
|
| 551 |
theseven |
38 |
ELF2ECA := $(CROSS)elf2emcoreapp
|
| 160 |
theseven |
39 |
UCLPACK := ucl2e10singleblk
|
|
|
40 |
STUBEMBED := python tools/stubembed.py
|
| 551 |
theseven |
41 |
EMCOREBOOTCFG := python $(EMCOREDIR)/tools/emcorebootcfg.py
|
|
|
42 |
EMCOREEMBEDAPP := python $(EMCOREDIR)/tools/emcoreembedapp.py
|
|
|
43 |
CRYPTFW := python $(EMCOREDIR)/tools/ipodcrypt.py s5l8701-cryptfirmware
|
| 253 |
theseven |
44 |
GENNOTE := python $(NOTEBOOTDIR)/gennote.py
|
| 160 |
theseven |
45 |
SCRAMBLE := python $(TOOLSDIR)/scramble.py
|
|
|
46 |
|
| 843 |
theseven |
47 |
LIBINCLUDES := -I$(LIBPNGDIR)/export -I$(LIBUIDIR)/export
|
| 160 |
theseven |
48 |
|
| 551 |
theseven |
49 |
CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4 -DBASENAME=$(BASENAME)
|
|
|
50 |
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
|
|
|
51 |
|
| 160 |
theseven |
52 |
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
| 672 |
theseven |
53 |
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:" | sed -e "s:^\\./::")
|
| 160 |
theseven |
54 |
|
|
|
55 |
REVISION := $(shell svnversion .)
|
|
|
56 |
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
|
|
57 |
|
| 551 |
theseven |
58 |
HELPERS := build/__emcore_armhelpers.o
|
| 160 |
theseven |
59 |
LIBS := build/libucl.a
|
|
|
60 |
|
|
|
61 |
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
|
|
|
62 |
OBJ := $(SRC:%.c=build/%.o)
|
|
|
63 |
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
|
|
|
64 |
|
|
|
65 |
all: $(NAME)
|
|
|
66 |
|
|
|
67 |
-include $(OBJ:%=%.dep)
|
|
|
68 |
|
| 253 |
theseven |
69 |
$(NAME): build/$(BASENAME).bootnote build/$(BASENAME).ipodx
|
| 160 |
theseven |
70 |
|
| 253 |
theseven |
71 |
build/$(BASENAME).ipodx: build/$(NAME).fw
|
| 160 |
theseven |
72 |
@echo [SCRAMB] $<
|
|
|
73 |
@$(SCRAMBLE) $< $@ --signature=nn2x --targetid=62
|
|
|
74 |
|
|
|
75 |
build/$(NAME).fw: build/$(NAME).bin
|
|
|
76 |
@echo [CFW] $<
|
|
|
77 |
@$(CRYPTFW) $< $@
|
|
|
78 |
|
| 253 |
theseven |
79 |
build/$(BASENAME).bootnote: build/$(NAME).bin
|
|
|
80 |
@echo [GENNOT] $<
|
|
|
81 |
@$(GENNOTE) $< "$(FATNAME)" $@
|
|
|
82 |
|
| 551 |
theseven |
83 |
build/$(NAME).bin: build/bootstub.bin build/$(NAME).ubi
|
| 160 |
theseven |
84 |
@echo [STUBEM] $@
|
|
|
85 |
@$(STUBEMBED) $^ $@
|
|
|
86 |
|
| 551 |
theseven |
87 |
build/$(NAME).ubi: $(EMCOREDIR)/build/ipodnano2g/emcore.bin build/$(NAME).emcoreapp
|
| 160 |
theseven |
88 |
@echo [EMBAPP] $@
|
| 551 |
theseven |
89 |
@$(EMCOREEMBEDAPP) $^ $@
|
| 160 |
theseven |
90 |
|
|
|
91 |
build/bootstub.bin: build/bootstub.elf
|
|
|
92 |
@echo [OC] $<
|
|
|
93 |
@$(OBJCOPY) -O binary $^ $@
|
|
|
94 |
|
|
|
95 |
build/bootstub.elf: bootstub/ls.x build/bootstub/bootstub.o
|
|
|
96 |
@echo [LD] $@
|
|
|
97 |
@$(LD) $(LDFLAGS) -o $@ -T bootstub/ls.x build/bootstub/bootstub.o
|
|
|
98 |
|
| 551 |
theseven |
99 |
build/$(NAME).emcoreapp: build/$(NAME).elf
|
|
|
100 |
@echo [EMCAPP] $<
|
|
|
101 |
ifeq ($(COMPRESS),true)
|
|
|
102 |
@$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
|
| 160 |
theseven |
103 |
else
|
| 551 |
theseven |
104 |
@$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
|
| 160 |
theseven |
105 |
endif
|
|
|
106 |
|
| 705 |
theseven |
107 |
ifeq ($(AUTOBUILD_FLASHFILES),true)
|
|
|
108 |
build/resources.o: $(FLASHFILES)
|
|
|
109 |
else
|
| 551 |
theseven |
110 |
build/resources.o: flashfiles.built
|
| 698 |
theseven |
111 |
endif
|
|
|
112 |
|
| 843 |
theseven |
113 |
ifeq ($(AUTOBUILD_FSFILES),true)
|
|
|
114 |
build/resources.o: $(FSFILES)
|
|
|
115 |
else
|
|
|
116 |
build/resources.o: fsfiles.built
|
|
|
117 |
endif
|
|
|
118 |
|
|
|
119 |
build/$(NAME).elf: ls.x $(OBJ)
|
|
|
120 |
@echo [LD] $@
|
|
|
121 |
@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
|
|
|
122 |
|
| 160 |
theseven |
123 |
build/$(NAME).elf: ls.x $(OBJ) $(LIBS)
|
|
|
124 |
@echo [LD] $@
|
|
|
125 |
@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ) $(LIBS)
|
|
|
126 |
|
|
|
127 |
build/%.o: %.c build/version.h
|
|
|
128 |
@echo [CC] $<
|
|
|
129 |
ifeq ($(shell uname),WindowsNT)
|
|
|
130 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
131 |
else
|
|
|
132 |
@-mkdir -p $(dir $@)
|
|
|
133 |
endif
|
|
|
134 |
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
135 |
@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
|
|
136 |
@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
|
|
137 |
ifeq ($(shell uname),WindowsNT)
|
|
|
138 |
@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
|
|
139 |
else
|
|
|
140 |
@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
|
|
141 |
endif
|
|
|
142 |
@rm -f $@.dep.tmp
|
|
|
143 |
|
|
|
144 |
build/%.o: %.S build/version.h
|
|
|
145 |
@echo [CC] $<
|
|
|
146 |
ifeq ($(shell uname),WindowsNT)
|
|
|
147 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
148 |
else
|
|
|
149 |
@-mkdir -p $(dir $@)
|
|
|
150 |
endif
|
|
|
151 |
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
152 |
@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
|
|
153 |
@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
|
|
154 |
ifeq ($(shell uname),WindowsNT)
|
|
|
155 |
@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
|
|
156 |
else
|
|
|
157 |
@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
|
|
158 |
endif
|
|
|
159 |
@rm -f $@.dep.tmp
|
|
|
160 |
|
| 551 |
theseven |
161 |
build/__emcore_%.o: $(EMCOREDIR)/export/%.c
|
| 160 |
theseven |
162 |
@echo [CC] $<
|
|
|
163 |
ifeq ($(shell uname),WindowsNT)
|
|
|
164 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
165 |
else
|
|
|
166 |
@-mkdir -p $(dir $@)
|
|
|
167 |
endif
|
|
|
168 |
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
169 |
|
| 551 |
theseven |
170 |
build/__emcore_%.o: $(EMCOREDIR)/export/%.S
|
|
|
171 |
@echo [CC] $<
|
|
|
172 |
ifeq ($(shell uname),WindowsNT)
|
|
|
173 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
174 |
else
|
|
|
175 |
@-mkdir -p $(dir $@)
|
|
|
176 |
endif
|
|
|
177 |
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
178 |
|
| 160 |
theseven |
179 |
build/libucl.a: libucl
|
| 697 |
theseven |
180 |
@$(MAKE) -C libucl CFLAGS="$(CFLAGS) -I../$(EMCOREDIR)/export"
|
| 160 |
theseven |
181 |
|
|
|
182 |
build/version.h: version.h .svn/entries
|
|
|
183 |
@echo [PP] $<
|
|
|
184 |
ifeq ($(shell uname),WindowsNT)
|
|
|
185 |
@-if not exist build md build
|
|
|
186 |
@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
|
|
187 |
else
|
|
|
188 |
@-mkdir -p build
|
|
|
189 |
@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
|
|
190 |
endif
|
|
|
191 |
|
|
|
192 |
flashfiles: $(FLASHFILES)
|
| 165 |
theseven |
193 |
@touch flashfiles.built
|
| 160 |
theseven |
194 |
|
| 551 |
theseven |
195 |
$(LIBBOOTDIR)/build/boot.emcorelib: libboot
|
| 705 |
theseven |
196 |
@$(MAKE) -C $(LIBBOOTDIR)
|
| 181 |
theseven |
197 |
|
| 705 |
theseven |
198 |
flashfiles/boot.emcorelib: $(LIBBOOTDIR)/build/boot.emcorelib
|
| 160 |
theseven |
199 |
@echo [CP] $@
|
|
|
200 |
@cp $< $@
|
|
|
201 |
|
| 551 |
theseven |
202 |
$(LIBPNGDIR)/build/png.emcorelib: libpng
|
| 705 |
theseven |
203 |
@$(MAKE) -C $(LIBPNGDIR)
|
| 551 |
theseven |
204 |
|
| 705 |
theseven |
205 |
flashfiles/png.emcorelib: $(LIBPNGDIR)/build/png.emcorelib
|
| 551 |
theseven |
206 |
@echo [CP] $@
|
|
|
207 |
@cp $< $@
|
|
|
208 |
|
|
|
209 |
$(LIBUIDIR)/build/ui.emcorelib: libui
|
| 705 |
theseven |
210 |
@$(MAKE) -C $(LIBUIDIR)
|
| 551 |
theseven |
211 |
|
| 705 |
theseven |
212 |
flashfiles/ui.emcorelib: $(LIBUIDIR)/build/ui.emcorelib
|
| 551 |
theseven |
213 |
@echo [CP] $@
|
|
|
214 |
@cp $< $@
|
|
|
215 |
|
| 672 |
theseven |
216 |
$(LIBMKFAT32DIR)/build/mkfat32.emcorelib: libmkfat32
|
| 705 |
theseven |
217 |
@$(MAKE) -C $(LIBMKFAT32DIR)
|
| 672 |
theseven |
218 |
|
| 705 |
theseven |
219 |
flashfiles/mkfat32.emcorelib: $(LIBMKFAT32DIR)/build/mkfat32.emcorelib
|
| 672 |
theseven |
220 |
@echo [CP] $@
|
|
|
221 |
@cp $< $@
|
|
|
222 |
|
| 706 |
theseven |
223 |
$(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl $(UMSBOOTDIR)/build/ipodnano2g/umsboot.bin: umsboot
|
| 705 |
theseven |
224 |
@$(MAKE) -C $(UMSBOOTDIR) ipodnano2g
|
| 243 |
theseven |
225 |
|
| 705 |
theseven |
226 |
flashfiles/umsboot-ipodnano2g.ucl: $(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl
|
| 243 |
theseven |
227 |
@echo [CP] $@
|
|
|
228 |
@cp $< $@
|
|
|
229 |
|
| 672 |
theseven |
230 |
$(UNINSTDIR)/build/uninstaller-ipodnano2g.emcoreapp: uninstaller-ipodnano2g
|
| 705 |
theseven |
231 |
@$(MAKE) -C $(UNINSTDIR)
|
| 672 |
theseven |
232 |
|
| 705 |
theseven |
233 |
flashfiles/uninstaller-ipodnano2g.emcoreapp: $(UNINSTDIR)/build/uninstaller-ipodnano2g.emcoreapp
|
| 672 |
theseven |
234 |
@echo [CP] $@
|
|
|
235 |
@cp $< $@
|
|
|
236 |
|
| 551 |
theseven |
237 |
$(BOOTMENUDIR)/build/bootmenu-ipodnano2g.emcoreapp: bootmenu-ipodnano2g
|
| 705 |
theseven |
238 |
@$(MAKE) -C $(BOOTMENUDIR)
|
| 160 |
theseven |
239 |
|
| 705 |
theseven |
240 |
flashfiles/bootmenu-ipodnano2g.emcoreapp: $(BOOTMENUDIR)/build/bootmenu-ipodnano2g.emcoreapp
|
| 551 |
theseven |
241 |
@echo [CP] $@
|
|
|
242 |
@cp $< $@
|
| 160 |
theseven |
243 |
|
| 843 |
theseven |
244 |
$(BOOTMENUTHEMEDIR)/build/bootmenu-ipodnano2g.emcoreapp: bootmenu-ipodnano2g-theme
|
|
|
245 |
@$(MAKE) -C $(BOOTMENUTHEMEDIR)
|
|
|
246 |
|
|
|
247 |
fsfiles/.apps/bootmenu/theme.emcoreapp: $(BOOTMENUTHEMEDIR)/build/bootmenu-ipodnano2g.emcoreapp
|
|
|
248 |
@echo [CP] $@
|
|
|
249 |
ifeq ($(shell uname),WindowsNT)
|
|
|
250 |
@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
|
|
251 |
else
|
|
|
252 |
@-mkdir -p $(dir $@)
|
|
|
253 |
endif
|
|
|
254 |
@cp $< $@
|
|
|
255 |
|
| 551 |
theseven |
256 |
$(EMCOREDIR)/loader/ipodnano2g/build/emcoreldr-ipodnano2g.dfu: emcoreldr-ipodnano2g
|
| 705 |
theseven |
257 |
@$(MAKE) -C $(EMCOREDIR)/loader/ipodnano2g
|
| 551 |
theseven |
258 |
|
| 705 |
theseven |
259 |
flashfiles/emcoreldr-ipodnano2g.dfu: $(EMCOREDIR)/loader/ipodnano2g/build/emcoreldr-ipodnano2g.dfu
|
| 551 |
theseven |
260 |
@echo [CP] $@
|
|
|
261 |
@cp $< $@
|
|
|
262 |
|
|
|
263 |
flashfiles/emcore-ipodnano2g.ucl: flashfiles/emcore-ipodnano2g.bin
|
| 160 |
theseven |
264 |
@echo [UCL] $<
|
|
|
265 |
@$(UCLPACK) $< $@
|
|
|
266 |
|
| 551 |
theseven |
267 |
$(EMCOREDIR)/build/ipodnano2g/emcore.bin: emcore
|
| 705 |
theseven |
268 |
@$(MAKE) -C $(EMCOREDIR) ipodnano2g
|
| 181 |
theseven |
269 |
|
| 705 |
theseven |
270 |
flashfiles/emcore-ipodnano2g.bin: $(EMCOREDIR)/build/ipodnano2g/emcore.bin
|
| 160 |
theseven |
271 |
@echo [EMBCFG] $@
|
| 551 |
theseven |
272 |
@$(EMCOREBOOTCFG) $< $@ "(3, '/.boot/init.emcoreapp', None, (2, 'bootmenu', None, None))"
|
| 160 |
theseven |
273 |
|
|
|
274 |
clean:
|
|
|
275 |
@rm -rf build
|
|
|
276 |
|
| 843 |
theseven |
277 |
.PHONY: all clean emcore emcoreldr-ipodnano2g bootmenu-ipodnano2g bootmenu-ipodnano2g-theme uninstaller-ipodnano2g libboot libpng libui libmkfat32 umsboot libucl flashfiles $(NAME)
|