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