lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | # |
| 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 | |
| 24 | VERSION = 2011 |
| 25 | PATCHLEVEL = 09 |
| 26 | SUBLEVEL = |
| 27 | EXTRAVERSION = |
| 28 | ifneq "$(SUBLEVEL)" "" |
| 29 | U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
| 30 | else |
| 31 | U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION) |
| 32 | endif |
| 33 | TIMESTAMP_FILE = $(obj)include/timestamp_autogenerated.h |
| 34 | VERSION_FILE = $(obj)include/version_autogenerated.h |
| 35 | |
| 36 | HOSTARCH := $(shell uname -m | \ |
| 37 | sed -e s/arm.*/arm/ \ |
| 38 | -e s/sh.*/sh/) |
| 39 | |
| 40 | HOSTOS := $(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 |
| 44 | SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ |
| 45 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
| 46 | else echo sh; fi; fi) |
| 47 | |
| 48 | export HOSTARCH HOSTOS SHELL |
| 49 | |
| 50 | # Deal with colliding definitions from tcsh etc. |
| 51 | VENDOR= |
| 52 | |
| 53 | ######################################################################### |
| 54 | # Allow for silent builds |
| 55 | ifeq (,$(findstring s,$(MAKEFLAGS))) |
| 56 | XECHO = echo |
| 57 | else |
| 58 | XECHO = : |
| 59 | endif |
| 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 | |
| 83 | ifdef O |
| 84 | ifeq ("$(origin O)", "command line") |
| 85 | BUILD_DIR := $(O) |
| 86 | endif |
| 87 | endif |
| 88 | |
| 89 | ifneq ($(BUILD_DIR),) |
| 90 | saved-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. |
| 96 | BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd) |
| 97 | $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist)) |
| 98 | endif # ifneq ($(BUILD_DIR),) |
| 99 | |
| 100 | OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR)) |
| 101 | SPLTREE := $(OBJTREE)/spl |
| 102 | SRCTREE := $(CURDIR) |
| 103 | TOPDIR := $(SRCTREE) |
| 104 | LNDIR := $(OBJTREE) |
| 105 | export TOPDIR SRCTREE OBJTREE SPLTREE |
| 106 | MKCONFIG := $(SRCTREE)/mkconfig |
| 107 | export MKCONFIG |
| 108 | |
| 109 | ifneq ($(OBJTREE),$(SRCTREE)) |
| 110 | REMOTE_BUILD := 1 |
| 111 | export REMOTE_BUILD |
| 112 | endif |
| 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. |
| 116 | ifneq ($(OBJTREE),$(SRCTREE)) |
| 117 | obj := $(OBJTREE)/ |
| 118 | src := $(SRCTREE)/ |
| 119 | else |
| 120 | obj := |
| 121 | src := |
| 122 | endif |
| 123 | export obj src |
| 124 | |
| 125 | # Make sure CDPATH settings don't interfere |
| 126 | unexport 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 | |
| 138 | ifeq ($(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. |
| 143 | all: |
| 144 | sinclude $(obj)include/autoconf.mk.dep |
| 145 | sinclude $(obj)include/autoconf.mk |
| 146 | |
| 147 | # load ARCH, BOARD, and CPU configuration |
| 148 | include $(obj)include/config.mk |
| 149 | export ARCH CPU BOARD VENDOR SOC |
| 150 | |
| 151 | # set default to nothing for native builds |
| 152 | #ifeq ($(HOSTARCH),$(ARCH)) |
| 153 | CROSS_COMPILE = $(TOPDIR)/../../../../build/compiler/gcc-4.9.4_thumb_linux/usr/bin/arm-buildroot-linux-uclibcgnueabi- |
| 154 | #endif |
| 155 | |
| 156 | # load other configuration |
| 157 | include $(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 | |
| 163 | ifndef 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 |
| 169 | endif |
| 170 | |
| 171 | ifndef 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 |
| 187 | endif |
| 188 | |
| 189 | ######################################################################### |
| 190 | # U-Boot objects....order is important (i.e. start must be first) |
| 191 | |
| 192 | OBJS = $(CPUDIR)/start.o |
| 193 | OBJS := $(addprefix $(obj),$(OBJS)) |
| 194 | |
| 195 | LIBS = lib/libgeneric.o |
| 196 | LIBS += lib/zlib/libz.o |
| 197 | LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \ |
| 198 | "board/$(VENDOR)/common/lib$(VENDOR).o"; fi) |
| 199 | LIBS += $(CPUDIR)/lib$(CPU).o |
| 200 | ifdef SOC |
| 201 | LIBS += $(CPUDIR)/$(SOC)/lib$(SOC).o |
| 202 | endif |
| 203 | |
| 204 | LIBS += arch/$(ARCH)/lib/lib$(ARCH).o |
| 205 | LIBS += net/libnet.o |
| 206 | LIBS += drivers/gmac/libgmac.o |
| 207 | LIBS += drivers/gpio/libgpio.o |
| 208 | LIBS += drivers/i2c/libi2c.o |
| 209 | #LIBS += drivers/lcd/liblcd.o |
| 210 | LIBS += drivers/misc/libmisc.o |
| 211 | #LIBS += drivers/mmc/libmmc.o |
| 212 | LIBS += drivers/mtd/libmtd.o |
| 213 | LIBS += drivers/mtd/nand/libnand.o |
| 214 | LIBS += drivers/mtd/spi-nor/libspi-nor.o |
| 215 | LIBS += drivers/mtd/partition/libpartition.o #add by zhouqi |
| 216 | LIBS += drivers/power/libpower.o |
| 217 | LIBS += drivers/serial/libserial.o |
| 218 | LIBS += drivers/spi/libspi.o |
| 219 | LIBS += drivers/usb_drv/libusb_dwc.o |
| 220 | #LIBS += fs/libfs.o |
| 221 | LIBS += fs/jffs2/libjffs2.o |
| 222 | LIBS += common/libcommon.o |
| 223 | LIBS += lib/libfdt/libfdt.o |
| 224 | LIBS += downloader/libdownloader.o |
| 225 | LIBS += test/libtest.o |
| 226 | #LIBS += drivers/sdio/libsdio.o |
| 227 | LIBS += drivers/led/libled.o |
| 228 | LIBS += drivers/lcd/liblcd.o |
| 229 | |
| 230 | LIBS += drivers/peripheral/libperipheral.o |
| 231 | LIBS += drivers/charger/libcharger.o |
| 232 | LIBS += drivers/hash/libdrv_hash.o |
| 233 | LIBS += drivers/rsa/libdrv_rsa.o |
| 234 | LIBS += drivers/dma/libdma.o |
| 235 | |
| 236 | LIBS += drivers/efuse/libefuse.o |
| 237 | LIBS += drivers/wdt/libwdt.o |
| 238 | |
| 239 | LIBS := $(addprefix $(obj),$(sort $(LIBS))) |
| 240 | .PHONY : $(LIBS) $(TIMESTAMP_FILE) |
| 241 | |
| 242 | |
| 243 | LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o |
| 244 | LIBBOARD := $(addprefix $(obj),$(LIBBOARD)) |
| 245 | |
| 246 | # Add GCC lib |
| 247 | ifdef USE_PRIVATE_LIBGCC |
| 248 | ifeq ("$(USE_PRIVATE_LIBGCC)", "yes") |
| 249 | PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o |
| 250 | else |
| 251 | PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc |
| 252 | endif |
| 253 | else |
| 254 | PLATFORM_LIBGCC = -L $(shell dirname `$(CC) -print-libgcc-file-name`) -lgcc --gc-sections |
| 255 | endif |
| 256 | PLATFORM_LIBS += $(PLATFORM_LIBGCC) |
| 257 | export 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. |
| 262 | LDPPFLAGS += \ |
| 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 | |
| 274 | ifneq ($(CONFIG_BOARD_SIZE_LIMIT),) |
| 275 | BOARD_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 |
| 285 | else |
| 286 | BOARD_SIZE_CHECK = |
| 287 | endif |
| 288 | |
| 289 | # Compress settings |
| 290 | #ifeq ($(USE_COMPRESSED), yes) |
| 291 | GZIP = $(TOPDIR)/../../../../build/compiler/gcc-4.9.4_thumb_linux/utils/minigzip -c |
| 292 | ifeq ($(V3T_RAM_TEXT_64M_UBOOT),y) |
| 293 | export IMAGE_START = 0x23DF0000 |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame^] | 294 | else ifeq ($(V3T_RAM_TEXT_128M_UBOOT),y) |
| 295 | export IMAGE_START = 0x27DF0000 |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 296 | else |
| 297 | export IMAGE_START = 0x21DF0000 |
| 298 | endif |
| 299 | export COMPRESSED_BIN_PATH = compressed_bin |
| 300 | COMPRESSED_OBJS = $(TOPDIR)/compress/head.o $(TOPDIR)/compress/compressed.o $(TOPDIR)/compress/libgzip.a |
| 301 | COMPRESSED_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 |
| 305 | ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map |
| 306 | |
| 307 | ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin |
| 308 | ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin |
| 309 | ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin |
| 310 | ALL-$(CONFIG_MMC_U_BOOT) += $(obj)mmc_spl/u-boot-mmc-spl.bin |
| 311 | ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin |
| 312 | |
| 313 | all: $(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 | |
| 342 | GEN_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 | |
| 352 | ifeq ($(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 |
| 358 | endif |
| 359 | |
| 360 | platform: depend \ |
| 361 | $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds |
| 362 | @echo "--Finished build [ Platform_Design ] ..." |
| 363 | @echo "...............................................OK...." |
| 364 | @echo "" |
| 365 | |
| 366 | together: $(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 | |
| 389 | nand_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 | |
| 395 | onenand_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 | |
| 401 | mmc_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 | |
| 413 | updater: |
| 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. |
| 418 | depend 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 | |
| 425 | TAG_SUBDIRS = $(SUBDIRS) |
| 426 | TAG_SUBDIRS += $(dir $(__LIBS)) |
| 427 | TAG_SUBDIRS += include |
| 428 | |
| 429 | FIND := find |
| 430 | FINDFLAGS := -L |
| 431 | |
| 432 | tags ctags: |
| 433 | ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ |
| 434 | -name '*.[chS]' -print` |
| 435 | |
| 436 | etags: |
| 437 | etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ |
| 438 | -name '*.[chS]' -print` |
| 439 | cscope: |
| 440 | $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ |
| 441 | cscope.files |
| 442 | cscope -b -q -k |
| 443 | |
| 444 | SYSTEM_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 | ######################################################################### |
| 500 | else # !config.mk |
| 501 | all $(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) \ |
| 504 | updater depend dep tags ctags etags cscope $(obj)System.map: |
| 505 | @echo "System not configured - see README" >&2 |
| 506 | @ exit 1 |
| 507 | |
| 508 | tools: $(VERSION_FILE) |
| 509 | $(MAKE) -C $@ all |
| 510 | endif # 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 | |
| 526 | easylogo env gdb: |
| 527 | $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION} |
| 528 | gdbtools: gdb |
| 529 | |
| 530 | tools-all: easylogo env gdb $(VERSION_FILE) |
| 531 | $(MAKE) -C tools HOST_TOOLS_ALL=y |
| 532 | |
| 533 | .PHONY : CHANGELOG |
| 534 | CHANGELOG: |
| 535 | git log --no-merges U-Boot-1_1_5.. | \ |
| 536 | unexpand -a | sed -e 's/\s\s*$$//' > $@ |
| 537 | |
| 538 | include/license.h: tools/bin2header COPYING |
| 539 | cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h |
| 540 | ######################################################################### |
| 541 | |
| 542 | unconfig: |
| 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 | |
| 550 | sinclude $(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 | # |
| 557 | lcname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/') |
| 558 | ucname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/') |
| 559 | |
| 560 | ######################################################################### |
| 561 | ## zx297520v3 Cortex-A53 Systems |
| 562 | ######################################################################### |
| 563 | |
| 564 | ################# |
| 565 | ### 7520v3 ### |
| 566 | ################# |
| 567 | zx297520v3_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; |
| 571 | ifeq ($(V3T_RAM_TEXT_64M_UBOOT),y) |
| 572 | echo "RAM_TEXT = 0x23DF0000" >> $(obj)board/zte/zx297520v3/config.tmp |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame^] | 573 | else ifeq ($(V3T_RAM_TEXT_128M_UBOOT),y) |
| 574 | echo "RAM_TEXT = 0x27DF0000" >> $(obj)board/zte/zx297520v3/config.tmp |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 575 | else |
| 576 | echo "RAM_TEXT = 0x21DF0000" >> $(obj)board/zte/zx297520v3/config.tmp |
| 577 | endif |
| 578 | @$(MKCONFIG) zx297520v3 arm armv7 zx297520v3 zte zx297520v3 |
| 579 | |
| 580 | |
| 581 | ######################################################################### |
| 582 | ######################################################################### |
| 583 | |
| 584 | clean: |
| 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 | |
| 625 | clobber: 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 | |
| 644 | mrproper \ |
| 645 | distclean: clobber unconfig |
| 646 | ifneq ($(OBJTREE),$(SRCTREE)) |
| 647 | rm -rf $(obj)* |
| 648 | endif |
| 649 | |
| 650 | backup: |
| 651 | F=`basename $(TOPDIR)` ; cd .. ; \ |
| 652 | gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F |
| 653 | |
| 654 | ######################################################################### |