Subversion Repositories freemyipod

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
366 theseven 1
NAME := installer-classic
2
 
3
EMBIOSDIR ?= ../../embios/trunk/
4
ILOADERDIR ?= ../iloader/
383 theseven 5
UNINSTDIR ?= ../uninstaller-classic/
366 theseven 6
UMSBOOTDIR ?= ../../umsboot/
7
TOOLSDIR ?= ../../tools/
8
 
9
BITMAPS = build/sidepane.ucl build/warning.ucl build/installing.ucl build/formatting.ucl build/copying.ucl build/flashing.ucl
10
 
383 theseven 11
FLASHFILES = flashfiles/uninstaller-classic.embiosapp.ucl flashfiles/iloader.cfg.ucl flashfiles/iloader.embiosapp.ucl \
366 theseven 12
             flashfiles/embiosldr-ipodclassic.bin flashfiles/embios-ipodclassic.ucl flashfiles/umsboot-ipodclassic.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
GENPWN := python $(EMBIOSDIR)/tools/ipodcrypt.py s5l8702-genpwnage
26
 
27
CFLAGS  += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
28
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
29
 
30
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
31
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
32
 
33
REVISION := $(shell svnversion .)
34
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
35
 
36
HELPERS := build/__embios_armhelpers.o
37
 
38
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
39
OBJ := $(SRC:%.c=build/%.o)
40
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
41
 
42
all: $(NAME)
43
 
44
-include $(OBJ:%=%.dep)
45
 
46
$(NAME): build/bootstrap-ipodclassic.dfu build/$(NAME).ubi
47
 
48
build/bootstrap-ipodclassic.dfu: build/bootstrap.bin
49
	@echo [GENPWN] $<
50
	@$(GENPWN) $< $@
51
 
52
build/bootstrap.bin: build/bootstub.bin $(UMSBOOTDIR)/build/ipodclassic/umsboot.bin
53
	@echo [STUBEM] $@
54
	@$(STUBEMBED) $^ $@
55
 
56
build/$(NAME).ubi: $(EMBIOSDIR)/build/ipodclassic/embios.bin build/$(NAME).embiosapp.ucl
57
	@echo [EMBAPP] $@
58
	@$(EMBIOSEMBEDAPP) $^ $@ --run-from=0x08f00000 --compressed
59
 
60
build/$(NAME).embiosapp.ucl: build/$(NAME).embiosapp
61
	@echo [UCL]    $<
62
	@$(UCLPACK) $< $@
63
 
64
build/$(NAME).embiosapp: build/$(NAME).plain.embiosapp $(BITMAPS) flashfiles.built
65
	@echo [GENINS] $<
66
	@$(GENINSTALLER) $< $@ /notes/$(BASENAME).bootnote fsfiles
67
 
68
build/bootstub.bin: build/bootstub.elf
69
	@echo [OC]     $<
70
	@$(OBJCOPY) -O binary $^ $@
71
 
72
build/bootstub.elf: bootstub/ls.x build/bootstub/bootstub.o
73
	@echo [LD]     $@
74
	@$(LD) $(LDFLAGS) -o $@ -T bootstub/ls.x build/bootstub/bootstub.o
75
 
76
build/%.ucl: oobe/%.bmp
77
	@echo [UCL]    $<
78
ifeq ($(shell uname),WindowsNT)
79
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
80
else
81
	@-mkdir -p $(dir $@)
82
endif
83
	@$(UCLPACK) $< $@
84
 
85
build/$(NAME).plain.embiosapp: build/$(NAME).elf
86
	@echo [OC]     $<
87
	@$(OBJCOPY) -O binary $^ $@
88
 
89
build/$(NAME).elf: ls.x $(OBJ)
90
	@echo [LD]     $@
91
	@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
92
 
93
build/%.o: %.c build/version.h
94
	@echo [CC]     $<
95
ifeq ($(shell uname),WindowsNT)
96
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
97
else
98
	@-mkdir -p $(dir $@)
99
endif
100
	@$(CC) -c $(CFLAGS) -o $@ $<
101
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
102
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
103
ifeq ($(shell uname),WindowsNT)
104
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
105
else
106
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
107
endif
108
	@rm -f $@.dep.tmp
109
 
110
build/%.o: %.S build/version.h
111
	@echo [CC]     $<
112
ifeq ($(shell uname),WindowsNT)
113
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
114
else
115
	@-mkdir -p $(dir $@)
116
endif
117
	@$(CC) -c $(CFLAGS) -o $@ $<
118
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
119
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
120
ifeq ($(shell uname),WindowsNT)
121
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
122
else
123
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
124
endif
125
	@rm -f $@.dep.tmp
126
 
127
build/__embios_%.o: $(EMBIOSDIR)/export/%.S
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
 
136
build/version.h: version.h .svn/entries
137
	@echo [PP]     $<
138
ifeq ($(shell uname),WindowsNT)
139
	@-if not exist build md build
140
	@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
141
else
142
	@-mkdir -p build
143
	@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
144
endif
145
 
146
flashfiles: $(FLASHFILES)
147
	@touch flashfiles.built
148
 
383 theseven 149
$(UNINSTDIR)/build/uninstaller-classic.embiosapp.ucl: uninstaller-classic
150
 
151
flashfiles/uninstaller-classic.embiosapp.ucl: $(UNINSTDIR)/build/uninstaller-classic.embiosapp.ucl uninstaller-classic
152
	@echo [CP]     $@
153
	@cp $< $@
154
 
366 theseven 155
$(UMSBOOTDIR)/build/ipodclassic/umsboot-ipodclassic.ucl: umsboot
156
 
157
flashfiles/umsboot-ipodclassic.ucl: $(UMSBOOTDIR)/build/ipodclassic/umsboot-ipodclassic.ucl umsboot
158
	@echo [CP]     $@
159
	@cp $< $@
160
 
161
flashfiles/iloader.cfg: flashfiles/iloader.conf
162
	@echo [COMCFG] $@
163
	@$(COMPILECONFIG) $< $@
164
 
165
flashfiles/iloader.cfg.ucl: flashfiles/iloader.cfg
166
	@echo [UCL]    $<
167
	@$(UCLPACK) $< $@
168
 
169
$(ILOADERDIR)/build/iloader.embiosapp.ucl: iloader
170
 
171
flashfiles/iloader.embiosapp.ucl: $(ILOADERDIR)/build/iloader.embiosapp.ucl iloader
172
	@echo [CP]     $@
173
	@cp $< $@
174
 
175
$(EMBIOSDIR)/loader/ipodclassic/build/embiosldr-ipodclassic.bin: embiosldr-ipodclassic
176
 
177
flashfiles/embiosldr-ipodclassic.bin: $(EMBIOSDIR)/loader/ipodclassic/build/embiosldr-ipodclassic.bin embiosldr-ipodclassic
178
	@echo [CP]     $@
179
	@cp $< $@
180
 
181
flashfiles/embios-ipodclassic.ucl: flashfiles/embios-ipodclassic.bin
182
	@echo [UCL]    $<
183
	@$(UCLPACK) $< $@
184
 
185
$(EMBIOSDIR)/build/ipodclassic/embios.bin: embios
186
 
187
flashfiles/embios-ipodclassic.bin: $(EMBIOSDIR)/build/ipodclassic/embios.bin embios
188
	@echo [EMBCFG] $@
189
	@$(EMBIOSBOOTCFG) $< $@ --file=/iLoader/boot.embiosapp --file-compressed --file-run-from=0x08000000 \
190
	                        --flash=iloader --flash-compressed --flash-run-from=0x09e00000
191
 
192
embios:
193
	@make -C $(EMBIOSDIR) ipodclassic
194
 
195
embiosldr-ipodclassic:
196
	@make -C $(EMBIOSDIR)/loader/ipodclassic
197
 
198
iloader:
199
	@make -C $(ILOADERDIR)
200
 
383 theseven 201
uninstaller-classic:
202
	@make -C $(UNINSTDIR)
203
 
366 theseven 204
$(UMSBOOTDIR)/build/ipodclassic/umsboot.bin: umsboot
205
 
206
umsboot:
207
	@make -C $(UMSBOOTDIR) ipodclassic
208
 
209
clean:
210
	@rm -rf build
211
 
383 theseven 212
.PHONY: all clean uninstaller-classic iloader embios embiosldr-ipodclassic umsboot libucl flashfiles $(NAME)