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