forked from wkpark/x-loader-cosmo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
372 lines (321 loc) · 12.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#
# (C) Copyright 2004-2006, Texas Instruments, <www.ti.com>
# Jian Zhang <jzhang@ti.com>
#
# (C) Copyright 2000-2004
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
HOSTARCH := $(shell uname -m | \
sed -e s/i.86/i386/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/powerpc/ppc/ \
-e s/macppc/ppc/)
HOSTOS := $(shell uname -s | tr A-Z a-z | \
sed -e 's/\(cygwin\).*/cygwin/')
export HOSTARCH
# Deal with colliding definitions from tcsh etc.
VENDOR=
#########################################################################
TOPDIR_ := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
TOPDIR := $(shell echo "$(TOPDIR_)"| sed -e "s/\:/\\\:/g")
export TOPDIR
ifeq (include/config.mk,$(wildcard include/config.mk))
# load ARCH, BOARD, and CPU configuration
include include/config.mk
export ARCH CPU BOARD VENDOR
# load other configuration
include $(TOPDIR)/config.mk
ifndef CROSS_COMPILE
CROSS_COMPILE = arm-none-linux-gnueabi-
#CROSS_COMPILE = arm-linux-
export CROSS_COMPILE
endif
#########################################################################
# X-LOAD objects....order is important (i.e. start must be first)
OBJS = cpu/$(CPU)/start.o
LIBS += board/$(BOARDDIR)/lib$(BOARD).a
LIBS += cpu/$(CPU)/lib$(CPU).a
LIBS += lib/lib$(ARCH).a
LIBS += fs/fat/libfat.a
LIBS += disk/libdisk.a
LIBS += drivers/libdrivers.a
LIBS += common/libcommon.a
.PHONY : $(LIBS)
# Add GCC lib
PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
SUBDIRS =
#########################################################################
#########################################################################
ALL = x-load.bin System.map
all: $(ALL)
ift: $(ALL) x-load.bin.ift
x-load.bin.ift: signGP System.map x-load.bin
TEXT_BASE=`grep -w _start System.map|cut -d ' ' -f1`
./signGP x-load.bin $(TEXT_BASE)
ifeq ($(CHIP_VER), GP)
cp x-load.bin.ift MLO
@echo OMAP4 GP version ...
else
./generate_MLO $(CHIP_VER) x-load.bin
@echo OMAP4 $(CHIP_VER) version ...
endif
x-load.bin: x-load
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
x-load: $(OBJS) $(LIBS) $(LDSCRIPT)
UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
$(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
--start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
-Map x-load.map -o x-load
$(LIBS):
$(MAKE) -C `dirname $@`
System.map: x-load
@$(NM) $< | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > System.map
oneboot: x-load.bin
scripts/mkoneboot.sh
signGP: scripts/signGP.c
gcc -O3 -o signGP $<
#########################################################################
else
all install x-load x-load.srec oneboot depend dep:
@echo "System not configured - see README" >&2
@ exit 1
endif
#########################################################################
unconfig:
rm -f include/config.h include/config.mk
#========================================================================
# ARM
#========================================================================
#########################################################################
## OMAP4 (ARM-CortexA9) Systems
#########################################################################
cosmo_rev_b_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_B 1" >> ./include/config.h
@[ -n "$(findstring _rev_b,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
@[ -z "$(findstring _rev_b,$@)" ] || \
{ echo "#define CONFIG_MPU_600 1" >>./include/config.h ; \
echo "MPU at 600MHz revision.." ; \
}
cosmo_rev_c_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_C 1" >> ./include/config.h
@[ -n "$(findstring _rev_c,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
@[ -z "$(findstring _rev_c,$@)" ] || \
{ echo "#define CONFIG_MPU_600 1" >>./include/config.h ; \
echo "MPU at 600MHz revision.." ; \
}
cosmo_rev_d_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_D 1" >> ./include/config.h
@[ -z "$(findstring _rev_d,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cosmo_rev_e_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_E 1" >> ./include/config.h
@[ -z "$(findstring _rev_e,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cosmo_rev_1.0_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_10 1" >> ./include/config.h
@[ -z "$(findstring _rev_1.0,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cosmo_rev_1.1_config \
cosmo_rev_1.11_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_11 1" >> ./include/config.h
@[ -z "$(findstring _rev_1.1,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
#LGE_CHANGE_DOMASTIC - start
cosmo_su760_rev_a_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_C 1" >> ./include/config.h
echo "#define CONFIG_COSMO_SU760 1" >> ./include/config.h
@[ -z "$(findstring su760,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cosmo_su760_rev_b_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_D 1" >> ./include/config.h
echo "#define CONFIG_COSMO_SU760 1" >> ./include/config.h
@[ -z "$(findstring su760,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cosmo_su760_rev_d_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cosmopolitan
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cosmopolitan.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_11 1" >> ./include/config.h
echo "#define CONFIG_COSMO_SU760 1" >> ./include/config.h
@[ -z "$(findstring su760,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
#LGE_CHANGE_DOMASTIC - end
cx2_evb_config \
cx2_evb_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_EVB 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_rev_a_config \
cx2_rev_a_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_A 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_rev_b_config \
cx2_rev_b_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_B 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_rev_c_config \
cx2_rev_c_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_C 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_rev_d_config \
cx2_rev_d_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_D 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_rev_1.0_config \
cx2_rev_1.0_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_10 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_rev_1.1_config \
cx2_rev_1.11_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_11 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_su870_rev_a_config \
cx2_su870_rev_a_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_A 1" >> ./include/config.h
echo "#define CONFIG_COSMO_SU870 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
cx2_su870_rev_b_config \
cx2_su870_rev_b_mipi_config : unconfig
@./mkconfig $(@:_config=) arm omap4 cx2
echo "/* Generarated file. Do not edit */" >./include/config.h
echo "#include <configs/cx2.h>" >>./include/config.h
echo "#define CONFIG_COSMO_REV_B 1" >> ./include/config.h;
echo "#define CONFIG_COSMO_SU870 1" >> ./include/config.h
@[ -z "$(findstring cx2,$@)" ] || \
{ echo "#define CONFIG_MPU_1000 1" >>./include/config.h ; \
echo "MPU at 1GHz revision.." ; \
}
#########################################################################
clean:
find . -type f \
\( -name 'core' -o -name '*.bak' -o -name '*~' \
-o -name '*.o' -o -name '*.a' \) -print \
| xargs rm -f
clobber: clean
find . -type f \
\( -name .depend -o -name '*.srec' -o -name '*.bin' \) \
-print \
| xargs rm -f
rm -f $(OBJS) *.bak tags TAGS
rm -fr *.*~
rm -f x-load x-load.map $(ALL) x-load.bin.ift signGP MLO MLO.ch MLOb.ch MLOb MLOb_T32
rm -f include/asm/proc include/asm/arch
mrproper \
distclean: clobber unconfig
backup:
F=`basename $(TOPDIR)` ; cd .. ; \
gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
#########################################################################