Subversion Repositories freemyipod

Rev

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

Rev 462 Rev 551
Line 1... Line 1...
1
NAME := installer-nano2g
1
NAME := installer-ipodnano2g
-
 
2
STACKSIZE := 4096
-
 
3
COMPRESS := false
2
BASENAME ?= $(NAME)
4
BASENAME ?= $(NAME)
3
FATNAME ?= INSTAL~1BOO
5
FATNAME ?= INSTAL~1BOO
4
 
6
 
5
EMBIOSDIR ?= ../../embios/trunk/
7
EMCOREDIR ?= ../../emcore/trunk/
-
 
8
BOOTMENUDIR ?= ../bootmenu-ipodnano2g/
6
ILOADERDIR ?= ../iloader/
9
LIBBOOTDIR ?= ../../libs/boot/
7
UNINSTDIR ?= ../uninstaller-nano2g/
10
LIBPNGDIR ?= ../../libs/png/
-
 
11
LIBUIDIR ?= ../../libs/ui/
8
UMSBOOTDIR ?= ../../umsboot/
12
UMSBOOTDIR ?= ../../umsboot/
9
NOTEBOOTDIR ?= ../../noteboot/
13
NOTEBOOTDIR ?= ../../noteboot/
10
TOOLSDIR ?= ../../tools/
14
TOOLSDIR ?= ../../tools/
11
 
15
 
12
BITMAPS = build/backdrop.ucl build/welcome.ucl build/repartition.ucl build/installing.ucl build/badpartition.ucl \
-
 
13
          build/cancelled.ucl build/repartitioning.ucl build/preparing.ucl build/installfiles.ucl build/flashing.ucl
16
FLASHFILES = flashfiles/boot.emcorelib flashfiles/png.emcorelib flashfiles/ui.emcorelib flashfiles/crapple.png \
14
 
-
 
15
FLASHFILES = flashfiles/uninstaller-nano2g.embiosapp.ucl flashfiles/iloader.cfg.ucl flashfiles/iloader.embiosapp.ucl \
17
             flashfiles/bootmenu-ipodnano2g.emcoreapp flashfiles/background.png flashfiles/icons.png flashfiles/rockbox.png \
16
             flashfiles/embiosldr-ipodnano2g.dfu flashfiles/embios-ipodnano2g.ucl flashfiles/umsboot-ipodnano2g.ucl
18
             flashfiles/emcoreldr-ipodnano2g.dfu flashfiles/emcore-ipodnano2g.ucl flashfiles/umsboot-ipodnano2g.ucl
17
 
19
 
18
ifeq ($(shell uname),WindowsNT)
20
ifeq ($(shell uname),WindowsNT)
19
CCACHE :=
21
CCACHE :=
20
else
22
else
21
CCACHE := $(shell which ccache)
23
CCACHE := $(shell which ccache)
Line 24... Line 26...
24
CROSS   ?= arm-elf-eabi-
26
CROSS   ?= arm-elf-eabi-
25
CC      := $(CCACHE) $(CROSS)gcc
27
CC      := $(CCACHE) $(CROSS)gcc
26
AS      := $(CROSS)as
28
AS      := $(CROSS)as
27
LD      := $(CROSS)ld
29
LD      := $(CROSS)ld
28
OBJCOPY := $(CROSS)objcopy
30
OBJCOPY := $(CROSS)objcopy
-
 
31
ELF2ECA := $(CROSS)elf2emcoreapp
29
UCLPACK := ucl2e10singleblk
32
UCLPACK := ucl2e10singleblk
30
GENINSTALLER := python tools/geninstaller.py
-
 
31
STUBEMBED := python tools/stubembed.py
33
STUBEMBED := python tools/stubembed.py
32
COMPILECONFIG := python $(ILOADERDIR)/tools/compileconfig.py
-
 
33
EMBIOSBOOTCFG := python $(EMBIOSDIR)/tools/embiosbootcfg.py
34
EMCOREBOOTCFG := python $(EMCOREDIR)/tools/emcorebootcfg.py
34
EMBIOSEMBEDAPP := python $(EMBIOSDIR)/tools/embiosembedapp.py
35
EMCOREEMBEDAPP := python $(EMCOREDIR)/tools/emcoreembedapp.py
35
CRYPTFW := python $(EMBIOSDIR)/tools/ipodcrypt.py s5l8701-cryptfirmware
36
CRYPTFW := python $(EMCOREDIR)/tools/ipodcrypt.py s5l8701-cryptfirmware
36
GENNOTE := python $(NOTEBOOTDIR)/gennote.py
37
GENNOTE := python $(NOTEBOOTDIR)/gennote.py
37
SCRAMBLE := python $(TOOLSDIR)/scramble.py
38
SCRAMBLE := python $(TOOLSDIR)/scramble.py
38
 
39
 
-
 
40
LIBINCLUDES := -I$(LIBBOOTDIR)/export -I$(LIBPNGDIR)/export -I$(LIBUIDIR)/export
-
 
41
 
39
CFLAGS  += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
42
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)
40
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
43
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
41
 
44
 
42
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
45
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
43
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
46
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
44
 
47
 
45
REVISION := $(shell svnversion .)
48
REVISION := $(shell svnversion .)
46
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
49
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
47
 
50
 
48
HELPERS := build/__embios_armhelpers.o
51
HELPERS := build/__emcore_armhelpers.o
49
LIBS := build/libucl.a
52
LIBS := build/libucl.a
50
 
53
 
51
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
54
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
52
OBJ := $(SRC:%.c=build/%.o)
55
OBJ := $(SRC:%.c=build/%.o)
53
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
56
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
Line 68... Line 71...
68
 
71
 
69
build/$(BASENAME).bootnote: build/$(NAME).bin
72
build/$(BASENAME).bootnote: build/$(NAME).bin
70
	@echo [GENNOT] $<
73
	@echo [GENNOT] $<
71
	@$(GENNOTE) $< "$(FATNAME)" $@
74
	@$(GENNOTE) $< "$(FATNAME)" $@
72
 
75
 
73
build/$(NAME).bin: build/bootstub.bin build/$(NAME).integrated.bin
76
build/$(NAME).bin: build/bootstub.bin build/$(NAME).ubi
74
	@echo [STUBEM] $@
77
	@echo [STUBEM] $@
75
	@$(STUBEMBED) $^ $@
78
	@$(STUBEMBED) $^ $@
76
 
79
 
77
build/$(NAME).integrated.bin: $(EMBIOSDIR)/build/ipodnano2g/embios.bin build/$(NAME).embiosapp.ucl
80
build/$(NAME).ubi: $(EMCOREDIR)/build/ipodnano2g/emcore.bin build/$(NAME).emcoreapp
78
	@echo [EMBAPP] $@
81
	@echo [EMBAPP] $@
79
	@$(EMBIOSEMBEDAPP) $^ $@ --run-from=0x08f00000 --compressed
-
 
80
 
-
 
81
build/$(NAME).embiosapp.ucl: build/$(NAME).embiosapp
-
 
82
	@echo [UCL]    $<
-
 
83
	@$(UCLPACK) $< $@
82
	@$(EMCOREEMBEDAPP) $^ $@
84
 
-
 
85
build/$(NAME).embiosapp: build/$(NAME).plain.embiosapp $(BITMAPS) flashfiles.built
-
 
86
	@echo [GENINS] $<
-
 
87
	@$(GENINSTALLER) $< $@ /notes/$(BASENAME).bootnote fsfiles
-
 
88
 
83
 
89
build/bootstub.bin: build/bootstub.elf
84
build/bootstub.bin: build/bootstub.elf
90
	@echo [OC]     $<
85
	@echo [OC]     $<
91
	@$(OBJCOPY) -O binary $^ $@
86
	@$(OBJCOPY) -O binary $^ $@
92
 
87
 
93
build/bootstub.elf: bootstub/ls.x build/bootstub/bootstub.o
88
build/bootstub.elf: bootstub/ls.x build/bootstub/bootstub.o
94
	@echo [LD]     $@
89
	@echo [LD]     $@
95
	@$(LD) $(LDFLAGS) -o $@ -T bootstub/ls.x build/bootstub/bootstub.o
90
	@$(LD) $(LDFLAGS) -o $@ -T bootstub/ls.x build/bootstub/bootstub.o
96
 
91
 
97
build/%.ucl: oobe/%.bmp
92
build/$(NAME).emcoreapp: build/$(NAME).elf
98
	@echo [UCL]    $<
93
	@echo [EMCAPP] $<
99
ifeq ($(shell uname),WindowsNT)
94
ifeq ($(COMPRESS),true)
100
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
95
	@$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
101
else
96
else
102
	@-mkdir -p $(dir $@)
97
	@$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
103
endif
98
endif
104
	@$(UCLPACK) $< $@
-
 
105
 
99
 
106
build/$(NAME).plain.embiosapp: build/$(NAME).elf
100
build/resources.o: flashfiles.built
107
	@echo [OC]     $<
-
 
108
	@$(OBJCOPY) -O binary $^ $@
-
 
109
 
101
 
110
build/$(NAME).elf: ls.x $(OBJ) $(LIBS)
102
build/$(NAME).elf: ls.x $(OBJ) $(LIBS)
111
	@echo [LD]     $@
103
	@echo [LD]     $@
112
	@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ) $(LIBS)
104
	@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ) $(LIBS)
113
 
105
 
Line 143... Line 135...
143
else
135
else
144
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
136
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
145
endif
137
endif
146
	@rm -f $@.dep.tmp
138
	@rm -f $@.dep.tmp
147
 
139
 
-
 
140
build/__emcore_%.o: $(EMCOREDIR)/export/%.c
-
 
141
	@echo [CC]     $<
-
 
142
ifeq ($(shell uname),WindowsNT)
-
 
143
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
-
 
144
else
-
 
145
	@-mkdir -p $(dir $@)
-
 
146
endif
-
 
147
	@$(CC) -c $(CFLAGS) -o $@ $<
-
 
148
 
148
build/__embios_%.o: $(EMBIOSDIR)/export/%.S
149
build/__emcore_%.o: $(EMCOREDIR)/export/%.S
149
	@echo [CC]     $<
150
	@echo [CC]     $<
150
ifeq ($(shell uname),WindowsNT)
151
ifeq ($(shell uname),WindowsNT)
151
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
152
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
152
else
153
else
153
	@-mkdir -p $(dir $@)
154
	@-mkdir -p $(dir $@)
Line 155... Line 156...
155
	@$(CC) -c $(CFLAGS) -o $@ $<
156
	@$(CC) -c $(CFLAGS) -o $@ $<
156
 
157
 
157
build/libucl.a: libucl
158
build/libucl.a: libucl
158
 
159
 
159
libucl:
160
libucl:
160
	@make -C libucl CFLAGS="$(CFLAGS) -I../$(EMBIOSDIR)/export"
161
	@make -C libucl CFLAGS="$(CFLAGS) -I../$(EMCOREDIR)/export"
161
 
162
 
162
build/version.h: version.h .svn/entries
163
build/version.h: version.h .svn/entries
163
	@echo [PP]     $<
164
	@echo [PP]     $<
164
ifeq ($(shell uname),WindowsNT)
165
ifeq ($(shell uname),WindowsNT)
165
	@-if not exist build md build
166
	@-if not exist build md build
Line 170... Line 171...
170
endif
171
endif
171
 
172
 
172
flashfiles: $(FLASHFILES)
173
flashfiles: $(FLASHFILES)
173
	@touch flashfiles.built
174
	@touch flashfiles.built
174
 
175
 
175
$(UNINSTDIR)/build/uninstaller-nano2g.embiosapp.ucl: uninstaller-nano2g
176
$(LIBBOOTDIR)/build/boot.emcorelib: libboot
176
 
177
 
-
 
178
flashfiles/boot.emcorelib: $(LIBBOOTDIR)/build/boot.emcorelib libboot
-
 
179
	@echo [CP]     $@
-
 
180
	@cp $< $@
-
 
181
 
-
 
182
$(LIBPNGDIR)/build/png.emcorelib: libpng
-
 
183
 
177
flashfiles/uninstaller-nano2g.embiosapp.ucl: $(UNINSTDIR)/build/uninstaller-nano2g.embiosapp.ucl uninstaller-nano2g
184
flashfiles/png.emcorelib: $(LIBPNGDIR)/build/png.emcorelib libpng
-
 
185
	@echo [CP]     $@
-
 
186
	@cp $< $@
-
 
187
 
-
 
188
$(LIBUIDIR)/build/ui.emcorelib: libui
-
 
189
 
-
 
190
flashfiles/ui.emcorelib: $(LIBUIDIR)/build/ui.emcorelib libui
178
	@echo [CP]     $@
191
	@echo [CP]     $@
179
	@cp $< $@
192
	@cp $< $@
180
 
193
 
181
$(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl: umsboot
194
$(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl: umsboot
182
 
195
 
183
flashfiles/umsboot-ipodnano2g.ucl: $(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl umsboot
196
flashfiles/umsboot-ipodnano2g.ucl: $(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl umsboot
184
	@echo [CP]     $@
197
	@echo [CP]     $@
185
	@cp $< $@
198
	@cp $< $@
186
 
199
 
187
flashfiles/iloader.cfg: flashfiles/iloader.conf
200
$(BOOTMENUDIR)/build/bootmenu-ipodnano2g.emcoreapp: bootmenu-ipodnano2g
188
	@echo [COMCFG] $@
-
 
189
	@$(COMPILECONFIG) $< $@
-
 
190
 
201
 
191
flashfiles/iloader.cfg.ucl: flashfiles/iloader.cfg
202
flashfiles/bootmenu-ipodnano2g.emcoreapp: $(BOOTMENUDIR)/build/bootmenu-ipodnano2g.emcoreapp bootmenu-ipodnano2g
192
	@echo [UCL]    $<
203
	@echo [CP]     $@
193
	@$(UCLPACK) $< $@
204
	@cp $< $@
194
 
205
 
-
 
206
flashfiles/background.png: $(BOOTMENUDIR)/images/background.png
-
 
207
	@echo [CP]     $@
-
 
208
	@cp $< $@
-
 
209
 
195
$(ILOADERDIR)/build/iloader.embiosapp.ucl: iloader
210
flashfiles/icons.png: $(BOOTMENUDIR)/images/icons.png
-
 
211
	@echo [CP]     $@
-
 
212
	@cp $< $@
196
 
213
 
197
flashfiles/iloader.embiosapp.ucl: $(ILOADERDIR)/build/iloader.embiosapp.ucl iloader
214
flashfiles/rockbox.png: $(BOOTMENUDIR)/images/rockbox.png
198
	@echo [CP]     $@
215
	@echo [CP]     $@
199
	@cp $< $@
216
	@cp $< $@
200
 
217
 
-
 
218
flashfiles/crapple.png: $(BOOTMENUDIR)/images/crapple.png
-
 
219
	@echo [CP]     $@
-
 
220
	@cp $< $@
-
 
221
 
201
$(EMBIOSDIR)/loader/ipodnano2g/build/embiosldr-ipodnano2g.dfu: embiosldr-ipodnano2g
222
$(EMCOREDIR)/loader/ipodnano2g/build/emcoreldr-ipodnano2g.dfu: emcoreldr-ipodnano2g
202
 
223
 
203
flashfiles/embiosldr-ipodnano2g.dfu: $(EMBIOSDIR)/loader/ipodnano2g/build/embiosldr-ipodnano2g.dfu embiosldr-ipodnano2g
224
flashfiles/emcoreldr-ipodnano2g.dfu: $(EMCOREDIR)/loader/ipodnano2g/build/emcoreldr-ipodnano2g.dfu emcoreldr-ipodnano2g
204
	@echo [CP]     $@
225
	@echo [CP]     $@
205
	@cp $< $@
226
	@cp $< $@
206
 
227
 
207
flashfiles/embios-ipodnano2g.ucl: flashfiles/embios-ipodnano2g.bin
228
flashfiles/emcore-ipodnano2g.ucl: flashfiles/emcore-ipodnano2g.bin
208
	@echo [UCL]    $<
229
	@echo [UCL]    $<
209
	@$(UCLPACK) $< $@
230
	@$(UCLPACK) $< $@
210
 
231
 
211
$(EMBIOSDIR)/build/ipodnano2g/embios.bin: embios
232
$(EMCOREDIR)/build/ipodnano2g/emcore.bin: emcore
212
 
233
 
213
flashfiles/embios-ipodnano2g.bin: $(EMBIOSDIR)/build/ipodnano2g/embios.bin embios
234
flashfiles/emcore-ipodnano2g.bin: $(EMCOREDIR)/build/ipodnano2g/emcore.bin emcore
214
	@echo [EMBCFG] $@
235
	@echo [EMBCFG] $@
215
	@$(EMBIOSBOOTCFG) $< $@ --file=/iLoader/boot.embiosapp --file-compressed --file-run-from=0x08000000 \
236
	@$(EMCOREBOOTCFG) $< $@ "(3, '/.boot/init.emcoreapp', None, (2, 'bootmenu', None, None))"
-
 
237
 
-
 
238
emcore:
-
 
239
	@make -C $(EMCOREDIR) ipodnano2g
-
 
240
 
-
 
241
emcoreldr-ipodnano2g:
216
	                        --flash=iloader --flash-compressed --flash-run-from=0x09e00000
242
	@make -C $(EMCOREDIR)/loader/ipodnano2g
217
 
243
 
218
embios:
244
bootmenu-ipodnano2g:
219
	@make -C $(EMBIOSDIR) ipodnano2g
245
	@make -C $(BOOTMENUDIR)
220
 
246
 
221
embiosldr-ipodnano2g:
247
libboot:
222
	@make -C $(EMBIOSDIR)/loader/ipodnano2g
248
	@make -C $(LIBBOOTDIR)
223
 
249
 
224
iloader:
250
libpng:
225
	@make -C $(ILOADERDIR)
251
	@make -C $(LIBPNGDIR)
226
 
252
 
227
uninstaller-nano2g:
253
libui:
228
	@make -C $(UNINSTDIR)
254
	@make -C $(LIBUIDIR)
229
 
255
 
230
umsboot:
256
umsboot:
231
	@make -C $(UMSBOOTDIR) ipodnano2g
257
	@make -C $(UMSBOOTDIR) ipodnano2g
232
 
258
 
233
clean:
259
clean:
234
	@rm -rf build
260
	@rm -rf build
235
 
261
 
236
.PHONY: all clean uninstaller-nano2g iloader embios embiosldr-ipodnano2g umsboot libucl flashfiles $(NAME)
262
.PHONY: all clean emcore emcoreldr-ipodnano2g bootmenu-ipodnano2g libboot libpng libui umsboot libucl flashfiles $(NAME)