blob: 245011f52e3786d1139ac94a741bd891b1bed7ad [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#
2# (C) Copyright 2000-2011
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# See file CREDITS for list of people who contributed to this
6# project.
7#
8# This program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundatio; either version 2 of
11# the License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21# MA 02111-1307 USA
22#
23
24VERSION = 2011
25PATCHLEVEL = 09
26SUBLEVEL =
27EXTRAVERSION =
28ifneq "$(SUBLEVEL)" ""
29U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
30else
31U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
32endif
33TIMESTAMP_FILE = $(obj)include/timestamp_autogenerated.h
34VERSION_FILE = $(obj)include/version_autogenerated.h
35
36HOSTARCH := $(shell uname -m | \
37 sed -e s/arm.*/arm/ \
38 -e s/sh.*/sh/)
39
40HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
41 sed -e 's/\(cygwin\).*/cygwin/')
42
43# Set shell to bash if possible, otherwise fall back to sh
44SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
45 else if [ -x /bin/bash ]; then echo /bin/bash; \
46 else echo sh; fi; fi)
47
48export HOSTARCH HOSTOS SHELL
49
50# Deal with colliding definitions from tcsh etc.
51VENDOR=
52
53#########################################################################
54# Allow for silent builds
55ifeq (,$(findstring s,$(MAKEFLAGS)))
56XECHO = echo
57else
58XECHO = :
59endif
60
61#########################################################################
62#
63# U-boot build supports producing a object files to the separate external
64# directory. Two use cases are supported:
65#
66# 1) Add O= to the make command line
67# 'make O=/tmp/build all'
68#
69# 2) Set environement variable BUILD_DIR to point to the desired location
70# 'export BUILD_DIR=/tmp/build'
71# 'make'
72#
73# The second approach can also be used with a MAKEALL script
74# 'export BUILD_DIR=/tmp/build'
75# './MAKEALL'
76#
77# Command line 'O=' setting overrides BUILD_DIR environent variable.
78#
79# When none of the above methods is used the local build is performed and
80# the object files are placed in the source directory.
81#
82
83ifdef O
84ifeq ("$(origin O)", "command line")
85BUILD_DIR := $(O)
86endif
87endif
88
89ifneq ($(BUILD_DIR),)
90saved-output := $(BUILD_DIR)
91
92# Attempt to create a output directory.
93$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
94
95# Verify if it was successful.
96BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
97$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
98endif # ifneq ($(BUILD_DIR),)
99
100OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
101SPLTREE := $(OBJTREE)/spl
102SRCTREE := $(CURDIR)
103TOPDIR := $(SRCTREE)
104LNDIR := $(OBJTREE)
105export TOPDIR SRCTREE OBJTREE SPLTREE
106MKCONFIG := $(SRCTREE)/mkconfig
107export MKCONFIG
108
109ifneq ($(OBJTREE),$(SRCTREE))
110REMOTE_BUILD := 1
111export REMOTE_BUILD
112endif
113# $(obj) and (src) are defined in config.mk but here in main Makefile
114# we also need them before config.mk is included which is the case for
115# some targets like unconfig, clean, clobber, distclean, etc.
116ifneq ($(OBJTREE),$(SRCTREE))
117obj := $(OBJTREE)/
118src := $(SRCTREE)/
119else
120obj :=
121src :=
122endif
123export obj src
124
125# Make sure CDPATH settings don't interfere
126unexport CDPATH
127
128#########################################################################
129
130# The "tools" are needed early, so put this first
131# Don't include stuff already done in $(LIBS)
132#SUBDIRS = tools \
133# examples/standalone \
134# examples/api
135
136#.PHONY : $(SUBDIRS) $(VERSION_FILE)
137
138ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
139
140# Include autoconf.mk before config.mk so that the config options are available
141# to all top level build files. We need the dummy all: target to prevent the
142# dependency target in autoconf.mk.dep from being the default.
143all:
144sinclude $(obj)include/autoconf.mk.dep
145sinclude $(obj)include/autoconf.mk
146
147# load ARCH, BOARD, and CPU configuration
148include $(obj)include/config.mk
149export ARCH CPU BOARD VENDOR SOC
150
151# set default to nothing for native builds
152#ifeq ($(HOSTARCH),$(ARCH))
153CROSS_COMPILE = $(TOPDIR)/../../../../build/compiler/gcc-4.9.4_thumb_linux/usr/bin/arm-buildroot-linux-uclibcgnueabi-
154#endif
155
156# load other configuration
157include $(TOPDIR)/config.mk
158
159# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
160# that (or fail if absent). Otherwise, search for a linker script in a
161# standard location.
162
163ifndef LDSCRIPT
164 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
165 ifdef CONFIG_SYS_LDSCRIPT
166 # need to strip off double quotes
167 LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
168 endif
169endif
170
171ifndef LDSCRIPT
172 ifeq ($(CONFIG_NAND_U_BOOT),y)
173 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
174 ifeq ($(wildcard $(LDSCRIPT)),)
175 LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
176 endif
177 endif
178 ifeq ($(wildcard $(LDSCRIPT)),)
179 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
180 endif
181 ifeq ($(wildcard $(LDSCRIPT)),)
182 LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
183 endif
184 ifeq ($(wildcard $(LDSCRIPT)),)
185$(error could not find linker script)
186 endif
187endif
188
189#########################################################################
190# U-Boot objects....order is important (i.e. start must be first)
191
192OBJS = $(CPUDIR)/start.o
193OBJS := $(addprefix $(obj),$(OBJS))
194
195LIBS = lib/libgeneric.o
196LIBS += lib/zlib/libz.o
197LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
198 "board/$(VENDOR)/common/lib$(VENDOR).o"; fi)
199LIBS += $(CPUDIR)/lib$(CPU).o
200ifdef SOC
201LIBS += $(CPUDIR)/$(SOC)/lib$(SOC).o
202endif
203
204LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
205LIBS += net/libnet.o
206LIBS += drivers/gmac/libgmac.o
207LIBS += drivers/gpio/libgpio.o
208LIBS += drivers/i2c/libi2c.o
209#LIBS += drivers/lcd/liblcd.o
210LIBS += drivers/misc/libmisc.o
211#LIBS += drivers/mmc/libmmc.o
212LIBS += drivers/mtd/libmtd.o
213LIBS += drivers/mtd/nand/libnand.o
214LIBS += drivers/mtd/spi-nor/libspi-nor.o
215LIBS += drivers/mtd/partition/libpartition.o #add by zhouqi
216LIBS += drivers/power/libpower.o
217LIBS += drivers/serial/libserial.o
218LIBS += drivers/spi/libspi.o
219LIBS += drivers/usb_drv/libusb_dwc.o
220#LIBS += fs/libfs.o
221LIBS += fs/jffs2/libjffs2.o
222LIBS += common/libcommon.o
223LIBS += lib/libfdt/libfdt.o
224LIBS += downloader/libdownloader.o
225LIBS += test/libtest.o
226#LIBS += drivers/sdio/libsdio.o
227LIBS += drivers/led/libled.o
228LIBS += drivers/lcd/liblcd.o
229
230LIBS += drivers/peripheral/libperipheral.o
231LIBS += drivers/charger/libcharger.o
232LIBS += drivers/hash/libdrv_hash.o
233LIBS += drivers/rsa/libdrv_rsa.o
234LIBS += drivers/dma/libdma.o
235
236LIBS += drivers/efuse/libefuse.o
237LIBS += drivers/wdt/libwdt.o
238
239LIBS := $(addprefix $(obj),$(sort $(LIBS)))
240.PHONY : $(LIBS) $(TIMESTAMP_FILE)
241
242
243LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o
244LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
245
246# Add GCC lib
247ifdef USE_PRIVATE_LIBGCC
248ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
249PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
250else
251PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
252endif
253else
254PLATFORM_LIBGCC = -L $(shell dirname `$(CC) -print-libgcc-file-name`) -lgcc --gc-sections
255endif
256PLATFORM_LIBS += $(PLATFORM_LIBGCC)
257export PLATFORM_LIBS
258
259# Special flags for CPP when processing the linker script.
260# Pass the version down so we can handle backwards compatibility
261# on the fly.
262LDPPFLAGS += \
263 -include $(TOPDIR)/include/u-boot/u-boot.lds.h \
264 $(shell $(LD) --version | \
265 sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
266
267__OBJS := $(subst $(obj),,$(OBJS))
268__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
269
270
271#########################################################################
272#########################################################################
273
274ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
275BOARD_SIZE_CHECK = \
276 @actual=`wc -c $@ | awk '{print $$1}'`; \
277 limit=$(CONFIG_BOARD_SIZE_LIMIT); \
278 if test $$actual -gt $$limit; then \
279 echo "$@ exceeds file size limit:"; \
280 echo " limit: $$limit bytes"; \
281 echo " actual: $$actual bytes"; \
282 echo " excess: $$((actual - limit)) bytes"; \
283 exit 1; \
284 fi
285else
286BOARD_SIZE_CHECK =
287endif
288
289# Compress settings
290#ifeq ($(USE_COMPRESSED), yes)
291GZIP = $(TOPDIR)/../../../../build/compiler/gcc-4.9.4_thumb_linux/utils/minigzip -c
292ifeq ($(V3T_RAM_TEXT_64M_UBOOT),y)
293export IMAGE_START = 0x23DF0000
xf.libdd93d52023-05-12 07:10:14 -0700294else ifeq ($(V3T_RAM_TEXT_128M_UBOOT),y)
295export IMAGE_START = 0x27DF0000
lh9ed821d2023-04-07 01:36:19 -0700296else
297export IMAGE_START = 0x21DF0000
298endif
299export COMPRESSED_BIN_PATH = compressed_bin
300COMPRESSED_OBJS = $(TOPDIR)/compress/head.o $(TOPDIR)/compress/compressed.o $(TOPDIR)/compress/libgzip.a
301COMPRESSED_LDFLAG = -Wl,--no-check-sections -nostartfiles -T$(TOPDIR)/compress/compressed.ld -nostdlib -Wl,-static -Wl,-Map,$(COMPRESSED_BIN_PATH)/compressed.map
302#endif
303
304# Always append ALL so that arch config.mk's can add custom ones
305ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
306
307ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
308ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
309ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
310ALL-$(CONFIG_MMC_U_BOOT) += $(obj)mmc_spl/u-boot-mmc-spl.bin
311ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
312
313all: $(ALL-y)
314
315$(obj)u-boot.hex: $(obj)u-boot
316 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
317
318$(obj)u-boot.srec: $(obj)u-boot
319 $(OBJCOPY) -O srec $< $@
320
321$(obj)u-boot.bin: $(obj)u-boot
322 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
323#ifeq ($(USE_COMPRESSED), yes)
324 @echo "--- Start Compress"
325 @mkdir $(COMPRESSED_BIN_PATH)
326 @$(GZIP) -n $@ > $(COMPRESSED_BIN_PATH)/compressed.gz
327 @echo "--- Compressed!"
328 $(MAKE) -C $(TOPDIR)/compress
329 $(CC) -o $(COMPRESSED_BIN_PATH)/compressed.elf $(COMPRESSED_OBJS) $(COMPRESSED_LDFLAG)
330 $(OBJCOPY) ${OBJCFLAGS} -O binary $(COMPRESSED_BIN_PATH)/compressed.elf $(COMPRESSED_BIN_PATH)/compressed.bin
331 @echo compressed end!
332#endif
333 $(BOARD_SIZE_CHECK)
334
335$(obj)u-boot.img: $(obj)u-boot.bin
336 $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
337 -O u-boot -a $(CONFIG_SYS_TEXT_BASE) -e 0 \
338 -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
339 sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
340 -d $< $@
341
342GEN_UBOOT = \
343 UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
344 sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
345 cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM $(__OBJS) \
346 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
347 -Map u-boot.map -o u-boot
348
349$(obj)u-boot: $(LDSCRIPT) $(obj)u-boot.lds
350 $(GEN_UBOOT)
351
352ifeq ($(CONFIG_KALLSYMS),y)
353 smap=`$(call SYSTEM_MAP,u-boot) | \
354 awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
355 $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
356 -c common/system_map.c -o $(obj)common/system_map.o
357 $(GEN_UBOOT) $(obj)common/system_map.o
358endif
359
360platform: depend \
361 $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
362 @echo "--Finished build [ Platform_Design ] ..."
363 @echo "...............................................OK...."
364 @echo ""
365
366together: $(obj)u-boot.bin
367
368$(OBJS): depend
369 $(MAKE) -C $(CPUDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@))
370
371$(LIBS): depend $(SUBDIRS)
372 $(MAKE) -C $(dir $(subst $(obj),,$@))
373
374
375
376
377$(LIBBOARD): depend $(LIBS)
378 $(MAKE) -C $(dir $(subst $(obj),,$@))
379
380$(SUBDIRS): depend
381 $(MAKE) -C $@ all
382
383$(LDSCRIPT): depend
384 $(MAKE) -C $(dir $@) $(notdir $@)
385
386$(obj)u-boot.lds: $(LDSCRIPT)
387 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
388
389nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend
390 $(MAKE) -C nand_spl/board/$(BOARDDIR) all
391
392$(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin
393 cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
394
395onenand_ipl: $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
396 $(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
397
398$(obj)u-boot-onenand.bin: onenand_ipl $(obj)u-boot.bin
399 cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
400
401mmc_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend
402 $(MAKE) -C mmc_spl/board/$(BOARDDIR) all
403
404$(obj)mmc_spl/u-boot-mmc-spl.bin: mmc_spl
405
406$(obj)spl/u-boot-spl.bin: depend
407 $(MAKE) -C spl all
408
409$(TIMESTAMP_FILE):
410 @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
411 @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@
412
413updater:
414 $(MAKE) -C tools/updater all
415
416# Explicitly make _depend in subdirs containing multiple targets to prevent
417# parallel sub-makes creating .depend files simultaneously.
418depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \
419 $(obj)include/autoconf.mk \
420 $(obj)include/generated/generic-asm-offsets.h \
421 $(obj)include/generated/asm-offsets.h
422 for dir in $(SUBDIRS) $(CPUDIR) $(dir $(LDSCRIPT)) ; do \
423 $(MAKE) -C $$dir _depend ; done
424
425TAG_SUBDIRS = $(SUBDIRS)
426TAG_SUBDIRS += $(dir $(__LIBS))
427TAG_SUBDIRS += include
428
429FIND := find
430FINDFLAGS := -L
431
432tags ctags:
433 ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
434 -name '*.[chS]' -print`
435
436etags:
437 etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
438 -name '*.[chS]' -print`
439cscope:
440 $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
441 cscope.files
442 cscope -b -q -k
443
444SYSTEM_MAP = \
445 $(NM) $1 | \
446 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
447 LC_ALL=C sort
448$(obj)System.map: $(obj)u-boot
449 @$(call SYSTEM_MAP,$<) > $(obj)System.map
450
451#
452# Auto-generate the autoconf.mk file (which is included by all makefiles)
453#
454# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
455# the dep file is only include in this top level makefile to determine when
456# to regenerate the autoconf.mk file.
457$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
458 @$(XECHO) Generating $@ ; \
459 set -e ; \
460 : Generate the dependancies ; \
461 $(CC) -x c -DDO_DEPS_ONLY -M $(HOSTCFLAGS) $(CPPFLAGS) \
462 -MQ $(obj)include/autoconf.mk include/common.h > $@
463
464$(obj)include/autoconf.mk: $(obj)include/config.h
465 @$(XECHO) Generating $@ ; \
466 set -e ; \
467 : Extract the config macros ; \
468 $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
469 sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
470 mv $@.tmp $@
471
472$(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \
473 $(obj)lib/asm-offsets.s
474 @$(XECHO) Generating $@
475 tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
476
477$(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \
478 $(src)lib/asm-offsets.c
479 @mkdir -p $(obj)lib
480 $(CC) -DDO_DEPS_ONLY \
481 $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
482 -o $@ $(src)lib/asm-offsets.c -c -S
483
484$(obj)include/generated/asm-offsets.h: $(obj)include/autoconf.mk.dep \
485 $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
486 @echo Generating $@
487 tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
488
489$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/autoconf.mk.dep
490 @mkdir -p $(obj)$(CPUDIR)/$(SOC)
491 if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
492 $(CC) -DDO_DEPS_ONLY \
493 $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
494 -o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
495 else \
496 touch $@; \
497 fi
498
499#########################################################################
500else # !config.mk
501all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
502$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
503$(filter-out tools,$(SUBDIRS)) $(TIMESTAMP_FILE) \
504updater depend dep tags ctags etags cscope $(obj)System.map:
505 @echo "System not configured - see README" >&2
506 @ exit 1
507
508tools: $(VERSION_FILE)
509 $(MAKE) -C $@ all
510endif # config.mk
511
512$(VERSION_FILE):
513 @mkdir -p $(dir $(VERSION_FILE))
514 @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
515 printf '#define PLAIN_VERSION "%s%s"\n' \
516 "$(U_BOOT_VERSION)" "$${localvers}" ; \
517 printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
518 "$(U_BOOT_VERSION)" "$${localvers}" ; \
519 ) > $@.tmp
520 @( printf '#define CC_VERSION_STRING "%s"\n' \
521 '$(shell $(CC) --version | head -n 1)' )>> $@.tmp
522 @( printf '#define LD_VERSION_STRING "%s"\n' \
523 '$(shell $(LD) -v | head -n 1)' )>> $@.tmp
524 @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
525
526easylogo env gdb:
527 $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION}
528gdbtools: gdb
529
530tools-all: easylogo env gdb $(VERSION_FILE)
531 $(MAKE) -C tools HOST_TOOLS_ALL=y
532
533.PHONY : CHANGELOG
534CHANGELOG:
535 git log --no-merges U-Boot-1_1_5.. | \
536 unexpand -a | sed -e 's/\s\s*$$//' > $@
537
538include/license.h: tools/bin2header COPYING
539 cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
540#########################################################################
541
542unconfig:
543 @rm -fr $(obj)include/config.h $(obj)include/config.mk \
544 $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
545 $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
546
547%_config:: unconfig
548 @$(MKCONFIG) -A $(@:_config=)
549
550sinclude $(obj).boards.depend
551$(obj).boards.depend: boards.cfg
552 awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@
553
554#
555# Functions to generate common board directory names
556#
557lcname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/')
558ucname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
559
560#########################################################################
561## zx297520v3 Cortex-A53 Systems
562#########################################################################
563
564#################
565### 7520v3 ###
566#################
567zx297520v3_boot_config : unconfig
568 @mkdir -p $(obj)include $(obj)board/zte/zx297520v3
569 echo "/* Automatically generated - do not edit */" >./include/board.h;
570 echo "#define CPU_SHIFT 0" >./include/board.h;
571ifeq ($(V3T_RAM_TEXT_64M_UBOOT),y)
572 echo "RAM_TEXT = 0x23DF0000" >> $(obj)board/zte/zx297520v3/config.tmp
xf.libdd93d52023-05-12 07:10:14 -0700573else ifeq ($(V3T_RAM_TEXT_128M_UBOOT),y)
574 echo "RAM_TEXT = 0x27DF0000" >> $(obj)board/zte/zx297520v3/config.tmp
lh9ed821d2023-04-07 01:36:19 -0700575else
576 echo "RAM_TEXT = 0x21DF0000" >> $(obj)board/zte/zx297520v3/config.tmp
577endif
578 @$(MKCONFIG) zx297520v3 arm armv7 zx297520v3 zte zx297520v3
579
580
581#########################################################################
582#########################################################################
583
584clean:
585 @rm -f $(obj)examples/standalone/82559_eeprom \
586 $(obj)examples/standalone/atmel_df_pow2 \
587 $(obj)examples/standalone/eepro100_eeprom \
588 $(obj)examples/standalone/hello_world \
589 $(obj)examples/standalone/interrupt \
590 $(obj)examples/standalone/mem_to_mem_idma2intr \
591 $(obj)examples/standalone/sched \
592 $(obj)examples/standalone/smc911{11,x}_eeprom \
593 $(obj)examples/standalone/test_burst \
594 $(obj)examples/standalone/timer
595 @rm -f $(obj)examples/api/demo{,.bin}
596 @rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo \
597 $(obj)tools/env/{fw_printenv,fw_setenv} \
598 $(obj)tools/envcrc \
599 $(obj)tools/gdb/{astest,gdbcont,gdbsend} \
600 $(obj)tools/gen_eth_addr $(obj)tools/img2srec \
601 $(obj)tools/mkimage $(obj)tools/mpc86x_clk \
602 $(obj)tools/ncb $(obj)tools/ubsha1
603 @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image} \
604 $(obj)board/matrix_vision/*/bootscript.img \
605 $(obj)board/voiceblue/eeprom \
606 $(obj)u-boot.lds \
607 $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \
608 $(obj)arch/blackfin/cpu/init.{lds,elf}
609 @rm -f $(obj)include/bmp_logo.h
610 @rm -f $(obj)lib/asm-offsets.s
611 @rm -f $(obj)include/generated/asm-offsets.h
612 @rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
613 @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
614 @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
615 @rm -f $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin}
616 @rm -f $(ONENAND_BIN)
617 @rm -f $(obj)onenand_ipl/u-boot.lds
618 @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.lds,u-boot-spl.map}
619 @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
620 @find $(OBJTREE) -type f \
621 \( -name 'core' -o -name '*.bak' -o -name '*~' \
622 -o -name '*.o' -o -name '*.a' -o -name '*.exe' \) -print \
623 | xargs rm -f
624
625clobber: clean
626 @find $(OBJTREE) -type f \( -name '*.depend' \
627 -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
628 -print0 \
629 | xargs -0 rm -f
630 @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
631 $(obj)cscope.* $(obj)*.*~
632 @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
633 @rm -f $(obj)u-boot.kwb
634 @rm -f $(obj)u-boot.imx
635 @rm -f $(obj)u-boot.ubl
636 @rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes}
637 @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
638 @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
639 @rm -fr $(obj)include/generated
640 @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
641 @[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f
642 @[ ! -d $(obj)mmc_spl ] || find $(obj)mmc_spl -name "*" -type l -print | xargs rm -f
643
644mrproper \
645distclean: clobber unconfig
646ifneq ($(OBJTREE),$(SRCTREE))
647 rm -rf $(obj)*
648endif
649
650backup:
651 F=`basename $(TOPDIR)` ; cd .. ; \
652 gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
653
654#########################################################################