Subversion Repositories freemyipod

Rev

Rev 462 | Rev 546 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 462 Rev 530
Line 1... Line 1...
1
NAME := installer-classic
1
NAME := installer-ipodclassic
-
 
2
STACKSIZE := 4096
-
 
3
COMPRESS := false
2
 
4
 
3
EMBIOSDIR ?= ../../embios/trunk/
5
EMCOREDIR ?= ../../emcore/trunk/
-
 
6
BOOTMENUDIR ?= ../bootmenu-ipodclassic/
-
 
7
LIBBOOTDIR ?= ../../libs/boot/
4
ILOADERDIR ?= ../iloader/
8
LIBPNGDIR ?= ../../libs/png/
5
UNINSTDIR ?= ../uninstaller-classic/
9
LIBUIDIR ?= ../../libs/ui/
6
UMSBOOTDIR ?= ../../umsboot/
10
UMSBOOTDIR ?= ../../umsboot/
7
TOOLSDIR ?= ../../tools/
11
TOOLSDIR ?= ../../tools/
8
 
12
 
9
BITMAPS = build/sidepane.ucl build/warning.ucl build/installing.ucl build/formatting.ucl build/copying.ucl build/flashing.ucl
13
FLASHFILES = flashfiles/boot.emcorelib flashfiles/png.emcorelib flashfiles/ui.emcorelib \
10
 
-
 
11
FLASHFILES = flashfiles/uninstaller-classic.embiosapp.ucl flashfiles/iloader.cfg.ucl flashfiles/iloader.embiosapp.ucl \
14
             flashfiles/bootmenu-ipodclassic.emcoreapp flashfiles/background.png flashfiles/icons.png flashfiles/rockbox.png \
12
             flashfiles/embiosldr-ipodclassic.bin flashfiles/embios-ipodclassic.ucl flashfiles/umsboot-ipodclassic.ucl
15
             flashfiles/emcoreldr-ipodclassic.bin flashfiles/emcore-ipodclassic.ucl flashfiles/umsboot-ipodclassic.ucl
13
 
16
 
14
ifeq ($(shell uname),WindowsNT)
17
ifeq ($(shell uname),WindowsNT)
15
CCACHE :=
18
CCACHE :=
16
else
19
else
17
CCACHE := $(shell which ccache)
20
CCACHE := $(shell which ccache)
Line 20... Line 23...
20
CROSS   ?= arm-elf-eabi-
23
CROSS   ?= arm-elf-eabi-
21
CC      := $(CCACHE) $(CROSS)gcc
24
CC      := $(CCACHE) $(CROSS)gcc
22
AS      := $(CROSS)as
25
AS      := $(CROSS)as
23
LD      := $(CROSS)ld
26
LD      := $(CROSS)ld
24
OBJCOPY := $(CROSS)objcopy
27
OBJCOPY := $(CROSS)objcopy
-
 
28
ELF2ECA := $(CROSS)elf2emcoreapp
25
UCLPACK := ucl2e10singleblk
29
UCLPACK := ucl2e10singleblk
26
GENINSTALLER := python tools/geninstaller.py
-
 
27
STUBEMBED := python tools/stubembed.py
30
STUBEMBED := python tools/stubembed.py
28
COMPILECONFIG := python $(ILOADERDIR)/tools/compileconfig.py
-
 
29
EMBIOSBOOTCFG := python $(EMBIOSDIR)/tools/embiosbootcfg.py
31
EMCOREBOOTCFG := python $(EMCOREDIR)/tools/emcorebootcfg.py
30
EMBIOSEMBEDAPP := python $(EMBIOSDIR)/tools/embiosembedapp.py
32
EMCOREEMBEDAPP := python $(EMCOREDIR)/tools/emcoreembedapp.py
31
GENPWN := python $(EMBIOSDIR)/tools/ipodcrypt.py s5l8702-genpwnage
33
GENPWN := python $(EMCOREDIR)/tools/ipodcrypt.py s5l8702-genpwnage
-
 
34
 
-
 
35
LIBINCLUDES := -I$(LIBBOOTDIR)/export -I$(LIBPNGDIR)/export -I$(LIBUIDIR)/export
32
 
36
 
33
CFLAGS  += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
37
CFLAGS  += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4
34
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
38
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
35
 
39
 
36
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
40
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
37
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
41
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
38
 
42
 
39
REVISION := $(shell svnversion .)
43
REVISION := $(shell svnversion .)
40
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
44
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
41
 
45
 
42
HELPERS := build/__embios_armhelpers.o
46
HELPERS := build/__emcore_armhelpers.o
43
 
47
 
44
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
48
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
45
OBJ := $(SRC:%.c=build/%.o)
49
OBJ := $(SRC:%.c=build/%.o)
46
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
50
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
47
 
51
 
Line 57... Line 61...
57
 
61
 
58
build/bootstrap.bin: build/bootstub.bin $(UMSBOOTDIR)/build/ipodclassic/umsboot.bin
62
build/bootstrap.bin: build/bootstub.bin $(UMSBOOTDIR)/build/ipodclassic/umsboot.bin
59
	@echo [STUBEM] $@
63
	@echo [STUBEM] $@
60
	@$(STUBEMBED) $^ $@
64
	@$(STUBEMBED) $^ $@
61
 
65
 
62
build/$(NAME).ubi: $(EMBIOSDIR)/build/ipodclassic/embios.bin build/$(NAME).embiosapp.ucl
66
build/$(NAME).ubi: $(EMCOREDIR)/build/ipodclassic/emcore.bin build/$(NAME).emcoreapp
63
	@echo [EMBAPP] $@
67
	@echo [EMBAPP] $@
64
	@$(EMBIOSEMBEDAPP) $^ $@ --run-from=0x08f00000 --compressed
-
 
65
 
-
 
66
build/$(NAME).embiosapp.ucl: build/$(NAME).embiosapp
-
 
67
	@echo [UCL]    $<
-
 
68
	@$(UCLPACK) $< $@
68
	@$(EMCOREEMBEDAPP) $^ $@
69
 
-
 
70
build/$(NAME).embiosapp: build/$(NAME).plain.embiosapp $(BITMAPS) flashfiles.built
-
 
71
	@echo [GENINS] $<
-
 
72
	@$(GENINSTALLER) $< $@ /notes/$(BASENAME).bootnote fsfiles
-
 
73
 
69
 
74
build/bootstub.bin: build/bootstub.elf
70
build/bootstub.bin: build/bootstub.elf
75
	@echo [OC]     $<
71
	@echo [OC]     $<
76
	@$(OBJCOPY) -O binary $^ $@
72
	@$(OBJCOPY) -O binary $^ $@
77
 
73
 
78
build/bootstub.elf: bootstub/ls.x build/bootstub/bootstub.o
74
build/bootstub.elf: bootstub/ls.x build/bootstub/bootstub.o
79
	@echo [LD]     $@
75
	@echo [LD]     $@
80
	@$(LD) $(LDFLAGS) -o $@ -T bootstub/ls.x build/bootstub/bootstub.o
76
	@$(LD) $(LDFLAGS) -o $@ -T bootstub/ls.x build/bootstub/bootstub.o
81
 
77
 
82
build/%.ucl: oobe/%.bmp
78
build/$(NAME).emcoreapp: build/$(NAME).elf
83
	@echo [UCL]    $<
79
	@echo [EMCAPP] $<
84
ifeq ($(shell uname),WindowsNT)
80
ifeq ($(COMPRESS),true)
85
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
81
	@$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
86
else
82
else
87
	@-mkdir -p $(dir $@)
83
	@$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
88
endif
84
endif
89
	@$(UCLPACK) $< $@
-
 
90
 
85
 
91
build/$(NAME).plain.embiosapp: build/$(NAME).elf
86
build/resources.o: flashfiles.built
92
	@echo [OC]     $<
-
 
93
	@$(OBJCOPY) -O binary $^ $@
-
 
94
 
87
 
95
build/$(NAME).elf: ls.x $(OBJ)
88
build/$(NAME).elf: ls.x $(OBJ)
96
	@echo [LD]     $@
89
	@echo [LD]     $@
97
	@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
90
	@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
98
 
91
 
Line 128... Line 121...
128
else
121
else
129
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
122
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
130
endif
123
endif
131
	@rm -f $@.dep.tmp
124
	@rm -f $@.dep.tmp
132
 
125
 
-
 
126
build/__emcore_%.o: $(EMCOREDIR)/export/%.c
-
 
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
 
133
build/__embios_%.o: $(EMBIOSDIR)/export/%.S
135
build/__emcore_%.o: $(EMCOREDIR)/export/%.S
134
	@echo [CC]     $<
136
	@echo [CC]     $<
135
ifeq ($(shell uname),WindowsNT)
137
ifeq ($(shell uname),WindowsNT)
136
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
138
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
137
else
139
else
138
	@-mkdir -p $(dir $@)
140
	@-mkdir -p $(dir $@)
Line 150... Line 152...
150
endif
152
endif
151
 
153
 
152
flashfiles: $(FLASHFILES)
154
flashfiles: $(FLASHFILES)
153
	@touch flashfiles.built
155
	@touch flashfiles.built
154
 
156
 
155
$(UNINSTDIR)/build/uninstaller-classic.embiosapp.ucl: uninstaller-classic
157
$(LIBBOOTDIR)/build/boot.emcorelib: libboot
156
 
158
 
-
 
159
flashfiles/boot.emcorelib: $(LIBBOOTDIR)/build/boot.emcorelib libboot
-
 
160
	@echo [CP]     $@
-
 
161
	@cp $< $@
-
 
162
 
-
 
163
$(LIBPNGDIR)/build/png.emcorelib: libpng
-
 
164
 
-
 
165
flashfiles/png.emcorelib: $(LIBPNGDIR)/build/png.emcorelib libpng
-
 
166
	@echo [CP]     $@
-
 
167
	@cp $< $@
-
 
168
 
-
 
169
$(LIBUIDIR)/build/ui.emcorelib: libui
-
 
170
 
157
flashfiles/uninstaller-classic.embiosapp.ucl: $(UNINSTDIR)/build/uninstaller-classic.embiosapp.ucl uninstaller-classic
171
flashfiles/ui.emcorelib: $(LIBUIDIR)/build/ui.emcorelib libui
158
	@echo [CP]     $@
172
	@echo [CP]     $@
159
	@cp $< $@
173
	@cp $< $@
160
 
174
 
161
$(UMSBOOTDIR)/build/ipodclassic/umsboot-ipodclassic.ucl: umsboot
175
$(UMSBOOTDIR)/build/ipodclassic/umsboot-ipodclassic.ucl: umsboot
162
 
176
 
163
flashfiles/umsboot-ipodclassic.ucl: $(UMSBOOTDIR)/build/ipodclassic/umsboot-ipodclassic.ucl umsboot
177
flashfiles/umsboot-ipodclassic.ucl: $(UMSBOOTDIR)/build/ipodclassic/umsboot-ipodclassic.ucl umsboot
164
	@echo [CP]     $@
178
	@echo [CP]     $@
165
	@cp $< $@
179
	@cp $< $@
166
 
180
 
167
flashfiles/iloader.cfg: flashfiles/iloader.conf
181
$(BOOTMENUDIR)/build/bootmenu-ipodclassic.emcoreapp: bootmenu-ipodclassic
168
	@echo [COMCFG] $@
-
 
169
	@$(COMPILECONFIG) $< $@
-
 
170
 
182
 
171
flashfiles/iloader.cfg.ucl: flashfiles/iloader.cfg
183
flashfiles/bootmenu-ipodclassic.emcoreapp: $(BOOTMENUDIR)/build/bootmenu-ipodclassic.emcoreapp bootmenu-ipodclassic
172
	@echo [UCL]    $<
184
	@echo [CP]     $@
173
	@$(UCLPACK) $< $@
185
	@cp $< $@
174
 
186
 
-
 
187
flashfiles/background.png: $(BOOTMENUDIR)/images/background.png
-
 
188
	@echo [CP]     $@
-
 
189
	@cp $< $@
-
 
190
 
175
$(ILOADERDIR)/build/iloader.embiosapp.ucl: iloader
191
flashfiles/icons.png: $(BOOTMENUDIR)/images/icons.png
-
 
192
	@echo [CP]     $@
-
 
193
	@cp $< $@
176
 
194
 
177
flashfiles/iloader.embiosapp.ucl: $(ILOADERDIR)/build/iloader.embiosapp.ucl iloader
195
flashfiles/rockbox.png: $(BOOTMENUDIR)/images/rockbox.png
178
	@echo [CP]     $@
196
	@echo [CP]     $@
179
	@cp $< $@
197
	@cp $< $@
180
 
198
 
181
$(EMBIOSDIR)/loader/ipodclassic/build/embiosldr-ipodclassic.bin: embiosldr-ipodclassic
199
$(EMCOREDIR)/loader/ipodclassic/build/emcoreldr-ipodclassic.bin: emcoreldr-ipodclassic
182
 
200
 
183
flashfiles/embiosldr-ipodclassic.bin: $(EMBIOSDIR)/loader/ipodclassic/build/embiosldr-ipodclassic.bin embiosldr-ipodclassic
201
flashfiles/emcoreldr-ipodclassic.bin: $(EMCOREDIR)/loader/ipodclassic/build/emcoreldr-ipodclassic.bin emcoreldr-ipodclassic
184
	@echo [CP]     $@
202
	@echo [CP]     $@
185
	@cp $< $@
203
	@cp $< $@
186
 
204
 
187
flashfiles/embios-ipodclassic.ucl: flashfiles/embios-ipodclassic.bin
205
flashfiles/emcore-ipodclassic.ucl: flashfiles/emcore-ipodclassic.bin
188
	@echo [UCL]    $<
206
	@echo [UCL]    $<
189
	@$(UCLPACK) $< $@
207
	@$(UCLPACK) $< $@
190
 
208
 
191
$(EMBIOSDIR)/build/ipodclassic/embios.bin: embios
209
$(EMCOREDIR)/build/ipodclassic/emcore.bin: emcore
192
 
210
 
193
flashfiles/embios-ipodclassic.bin: $(EMBIOSDIR)/build/ipodclassic/embios.bin embios
211
flashfiles/emcore-ipodclassic.bin: $(EMCOREDIR)/build/ipodclassic/emcore.bin emcore
194
	@echo [EMBCFG] $@
212
	@echo [EMBCFG] $@
195
	@$(EMBIOSBOOTCFG) $< $@ --file=/iLoader/boot.embiosapp --file-compressed --file-run-from=0x08000000 \
213
	@$(EMCOREBOOTCFG) $< $@ "(3, '/.emcore/boot.emcoreapp', None, (2, 'bootmenu', None, None))"
-
 
214
 
196
	                        --flash=iloader --flash-compressed --flash-run-from=0x09e00000
215
$(EMBIOSDIR)/build/ipodclassic/embios.bin: embios
197
 
216
 
198
embios:
217
embios:
199
	@make -C $(EMBIOSDIR) ipodclassic
218
	@make -C $(EMBIOSDIR) ipodclassic
200
 
219
 
-
 
220
emcore:
-
 
221
	@make -C $(EMCOREDIR) ipodclassic
-
 
222
 
201
embiosldr-ipodclassic:
223
emcoreldr-ipodclassic:
202
	@make -C $(EMBIOSDIR)/loader/ipodclassic
224
	@make -C $(EMCOREDIR)/loader/ipodclassic
-
 
225
 
-
 
226
bootmenu-ipodclassic:
-
 
227
	@make -C $(BOOTMENUDIR)
-
 
228
 
-
 
229
libboot:
-
 
230
	@make -C $(LIBBOOTDIR)
203
 
231
 
204
iloader:
232
libpng:
205
	@make -C $(ILOADERDIR)
233
	@make -C $(LIBPNGDIR)
206
 
234
 
207
uninstaller-classic:
235
libui:
208
	@make -C $(UNINSTDIR)
236
	@make -C $(LIBUIDIR)
209
 
237
 
210
$(UMSBOOTDIR)/build/ipodclassic/umsboot.bin: umsboot
238
$(UMSBOOTDIR)/build/ipodclassic/umsboot.bin: umsboot
211
 
239
 
212
umsboot:
240
umsboot:
213
	@make -C $(UMSBOOTDIR) ipodclassic
241
	@make -C $(UMSBOOTDIR) ipodclassic
214
 
242
 
215
clean:
243
clean:
216
	@rm -rf build
244
	@rm -rf build
217
 
245
 
218
.PHONY: all clean uninstaller-classic iloader embios embiosldr-ipodclassic umsboot libucl flashfiles $(NAME)
246
.PHONY: all clean emcore emcoreldr-ipodclassic bootmenu-ipodclassic libboot libpng libui umsboot libucl flashfiles $(NAME)