From: Piotr Dymacz Date: Fri, 26 Aug 2016 10:23:40 +0000 (+0200) Subject: Rework main Makefiles X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b1dfe3b942823bad29ae8eff755f9f2fefc8a860;p=oweals%2Fu-boot_mod.git Rework main Makefiles This includes: 1. Finally, move SOC definitions to an external header file and just include it in config.h 2. Unify target naming scheme and use same names in both Makefiles, fix names for some targets, include device vendor name 3. Use custom functions to reduce code size and duplicates 4. IMPORTANT: Use LZMA-compressed image version by default, as the difference in boot time is negligible, but size of the code is reduced by more than 50% 5. Show some information about image configuration during building, example: Removing configuration... Preparing configuration for target: tp-link_tl-wdr3600_tl-43x0 Device vendor/model: TP-Link TL-WDR3600/43x0 Custom recovery web: no Image size limit: 123 KB Default FLASH size: 8 MB GPIO reset button: 16 Button active low: yes LZMA compression: yes RAM-loadable only: no [...] Copying compiled image... Checking size of the image... Preparing 123 KB image padded with 0xFF... Preparing final image... Calculating MD5 sum for the final image... DONE! Image 'bin/u-boot_mod__20160826__tp-link_tl-wdr3600_tl-43x0.bin' is ready! 6. Change final image name, include build date, proper name of the project (u-boot_mod) and selected target name --- diff --git a/Makefile b/Makefile index 0395cf5..e9bd3ce 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,18 @@ +# +# Copyright (C) 2016 Piotr Dymacz +# +# SPDX-License-Identifier: GPL-2.0 +# + SHELL = bash -HOSTARCH := $(shell uname -m | \ - sed -e s/i.86/x86_32/ \ - -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ \ - -e s/sa110/arm/ \ - -e s/powerpc/ppc/ \ - -e s/macppc/ppc/) +HOSTARCH := $(shell uname -m | \ + sed -e s/i.86/x86_32/ \ + -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 '[:upper:]' '[:lower:]' | \ sed -e 's/\(cygwin\).*/cygwin/') @@ -19,326 +25,225 @@ endif export HOSTOS export HOSTARCH -export BUILD_TOPDIR=$(PWD) -export STAGING_DIR=$(BUILD_TOPDIR)/tmp - -# -------------------------------------------------------------------------- -# Define absolute path to your toolchain directory here, for example: -# -# export TOOLCHAIN_DIR:=/home/user/toolchain-mips_34kc_gcc-5.4.0_musl-1.1.15 +export BUILD_TOPDIR = $(PWD) +export STAGING_DIR = $(BUILD_TOPDIR)/tmp +export SOURCE_DIR = $(BUILD_TOPDIR)/u-boot +export BIN_DIR = $(BUILD_TOPDIR)/bin +export SUB_MAKE_CMD = $(MAKE) --silent --no-print-directory \ + ARCH=mips V=1 SHELL=$(SHELL) + +# ========================================================================== +# You can override some default configuration options below or pass them on +# command line, for example: +# make ... IMG_SIZE=256 IMG_LZMA=0 CROSS_COMPILE=... + +# Set to 1 if you want to build RAM-loadable image, without low level +# initialization of the hardware (PLL/clocks, DRAM): +# IMG_RAM = + +# You can change limit of the image size in KB with below option (image will +# be filled up to the selected size with 0xFF): +# IMG_SIZE = + +# If you don't want LZMA compressed image, set below option to 1 (by default +# images for all targets are LZMA compressed): +# IMG_LZMA = + +# Define _absolute_ path to your toolchain directory, for example: +# export TOOLCHAIN_DIR:=/home/user/toolchain-mips_24kc_gcc-5.4.0_musl-1.1.15 # export PATH:=$(TOOLCHAIN_DIR)/bin:$(PATH) -# -------------------------------------------------------------------------- ifndef CROSS_COMPILE -CROSS_COMPILE = mips-openwrt-linux-musl- + CROSS_COMPILE = mips-openwrt-linux-musl- endif export CROSS_COMPILE -export MAKECMD=make --silent --no-print-directory ARCH=mips +# ========================================================================== + +# ======================= +# CUSTOM HELPER FUNCTIONS +# ======================= + +define echo_green + echo -e "\e[92m$(1)\e[0m" +endef + +define echo_red + echo -e "\e[91m$(1)\e[0m" +endef + +define echo_blue + echo -e "\e[96m$(1)\e[0m" +endef + +# $(1): size +define img_size +$(if $(IMG_SIZE),$(strip $(IMG_SIZE)),$(strip $(1))) +endef + +# $(1): value +define is_one +$(if $(filter $(strip $(1)),1),1,0) +endef + +# $(1): file extension +define img_name +u-boot_mod__$(shell date +"%Y%m%d")__$@$(if \ +$(filter $(IMG_RAM),1),__RAM-LOAD-ONLY)$(if $(1),.$(1)) +endef + +define md5_sum + $(call echo_green,Calculating MD5 sum for the final image...) + + md5sum $(BIN_DIR)/$(call img_name,bin) | \ + awk '{print $$1}' | \ + tr -d '\n' > $(BIN_DIR)/$(call img_name).md5 + + echo ' *'$(call img_name,bin) >> $(BIN_DIR)/$(call img_name,md5) +endef + +# $(1): size +define padded_img + $(call echo_green,Preparing $(1) KB image padded with 0xFF...) + tr "\000" "\377" < /dev/zero | dd ibs=1k count=$(1) \ + of=$(BIN_DIR)/$(call img_name,bin) 2> /dev/null +endef + +define final_img + $(call echo_green,Preparing final image...) + dd if=$(BIN_DIR)/temp.bin of=$(BIN_DIR)/$(call img_name,bin) \ + conv=notrunc 2> /dev/null + + rm -f $(BIN_DIR)/temp.bin +endef + +# $(1): path to image +# $(2): size limit in KB +define size_chk + $(call echo_green,Checking size of the image...) + + if [ `wc -c < $(1)` -gt `echo $(2)*1024 | bc` ]; then \ + echo; \ + $(call echo_red, ======================); \ + $(call echo_red, IMAGE SIZE IS TOO BIG!); \ + $(call echo_red, ======================); \ + echo; \ + rm -f $(1); \ + exit 1; \ + fi; +endef + +# $(1): filename of image to copy +# $(2): image size limit (check if set) +define copy_img + echo; + $(call echo_green,Copying compiled image...) + + cp $(SOURCE_DIR)/$(strip $(1)).bin $(BIN_DIR)/temp.bin + $(if $(2),$(call size_chk,$(BIN_DIR)/temp.bin,$(2))) +endef + +# $(1): size limit in KB +# $(2): if set to 1, use LZMA +# $(3): other parameters passed to subdir make +define build + args="IMG_SIZE=$(call img_size,$(1)) \ + IMG_LZMA=$(call is_one,$(2)) \ + $(strip $(3))"; \ + cd $(SOURCE_DIR) && \ + $(SUB_MAKE_CMD) $@ $$args && \ + $(SUB_MAKE_CMD) all $$args + + $(if $(filter $(IMG_RAM),1),\ + $(call copy_img,u-boot), \ + $(if $(filter $(call is_one,$(2)),1), \ + $(call copy_img,tuboot,$(call img_size,$(1))), \ + $(call copy_img,u-boot,$(call img_size,$(1))) \ + ) \ + ) + + $(if $(filter $(IMG_RAM),1),,$(call padded_img,$(1))) + $(call final_img) + $(call md5_sum) + echo; + $(call echo_green,DONE!) + $(call echo_green,Image 'bin/$(call img_name,bin)' is ready!) + + if [ "x$$IMG_RAM" = "x1" ]; then \ + echo; \ + $(call echo_blue, ================================); \ + $(call echo_blue, THIS IMAGE IS ONLY FOR RAM LOAD!); \ + $(call echo_blue, DO NOT WRITE IT INTO FLASH CHIP!); \ + $(call echo_blue, ================================); \ + echo; \ + fi; +endef + +# =========================================== +# TARGETS IN ALPHABETICAL ORDER, SHARED FIRST +# =========================================== + +COMMON_AR933X_TARGETS = \ + gainstrong_oolite_v1_dev \ + gl-innovations_gl-inet-6416 \ + tp-link_tl-mr10u \ + tp-link_tl-mr13u \ + tp-link_tl-mr3020 \ + tp-link_tl-mr3040 \ + tp-link_tl-mr3220_v2 \ + tp-link_tl-wr703n \ + tp-link_tl-wr710n \ + tp-link_tl-wr720n_v3_CN \ + tp-link_tl-wr740n_v4 + +$(COMMON_AR933X_TARGETS): + @$(call build,123,1) + +COMMON_ETHS27_TARGETS = \ + tp-link_tl-mr3420_v2 \ + tp-link_tl-wa830re_v2_tl-wa801nd_v2 \ + tp-link_tl-wdr3500 \ + tp-link_tl-wr802n \ + tp-link_tl-wr820n_CN \ + tp-link_tl-wr841n_v8 \ + tp-link_tl-wr841n_v9 + +$(COMMON_ETHS27_TARGETS): + @$(call build,123,1,ETH_CONFIG=_s27) -# boot delay (time to autostart boot command) -export CONFIG_BOOTDELAY=1 +8devices_carambola2: + @$(call build,256) -# uncomment following line, to build RAM version images (without low level initialization) -#export CONFIG_SKIP_LOWLEVEL_INIT=1 +d-link_dir-505: + @$(call build,64,1) -tplink_mr3020: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-mr3020 -tplink_mr3020: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_mr3020: export COMPRESSED_UBOOT=1 -endif -tplink_mr3020: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) mr3020_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr703n: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr703n -tplink_wr703n: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr703n: export COMPRESSED_UBOOT=1 -endif -tplink_wr703n: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr703n_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr720n_v3_CN: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr720n_v3_CN -tplink_wr720n_v3_CN: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr720n_v3_CN: export COMPRESSED_UBOOT=1 -endif -tplink_wr720n_v3_CN: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr720n_v3_CN_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr710n: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr710n -tplink_wr710n: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr710n: export COMPRESSED_UBOOT=1 -endif -tplink_wr710n: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr710n_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_mr3040: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-mr3040 -tplink_mr3040: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_mr3040: export COMPRESSED_UBOOT=1 -endif -tplink_mr3040: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) mr3040_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_mr10u: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-mr10u -tplink_mr10u: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_mr10u: export COMPRESSED_UBOOT=1 -endif -tplink_mr10u: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) mr10u_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_mr13u: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-mr13u -tplink_mr13u: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_mr13u: export COMPRESSED_UBOOT=1 -endif -tplink_mr13u: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) mr13u_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr740n_v4: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr740n_v4 -tplink_wr740n_v4: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr740n_v4: export COMPRESSED_UBOOT=1 -endif -tplink_wr740n_v4: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr740n_v4_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_mr3220_v2: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-mr3220_v2 -tplink_mr3220_v2: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_mr3220_v2: export COMPRESSED_UBOOT=1 -endif -tplink_mr3220_v2: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) mr3220_v2_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wdr3600_43x0: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wdr3600-43x0 -tplink_wdr3600_43x0: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wdr3600_43x0: export COMPRESSED_UBOOT=1 -endif -tplink_wdr3600_43x0: export ETH_CONFIG=_s17 -tplink_wdr3600_43x0: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wdr3600_43x0_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wdr3500: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wdr3500 -tplink_wdr3500: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wdr3500: export COMPRESSED_UBOOT=1 -endif -tplink_wdr3500: export ETH_CONFIG=_s27 -tplink_wdr3500: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wdr3500_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_mr3420_v2: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-mr3420_v2 -tplink_mr3420_v2: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_mr3420_v2: export COMPRESSED_UBOOT=1 -endif -tplink_mr3420_v2: export ETH_CONFIG=_s27 -tplink_mr3420_v2: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) mr3420_v2_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr841n_v8: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr841n_v8 -tplink_wr841n_v8: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr841n_v8: export COMPRESSED_UBOOT=1 -endif -tplink_wr841n_v8: export ETH_CONFIG=_s27 -tplink_wr841n_v8: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr841n_v8_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr841n_v9: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr841n_v9 -tplink_wr841n_v9: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr841n_v9: export COMPRESSED_UBOOT=1 -endif -tplink_wr841n_v9: export ETH_CONFIG=_s27 -tplink_wr841n_v9: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr841n_v9_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wa830re_v2_wa801nd_v2: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wa830re_v2_tl-wa801nd_v2 -tplink_wa830re_v2_wa801nd_v2: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wa830re_v2_wa801nd_v2: export COMPRESSED_UBOOT=1 -endif -tplink_wa830re_v2_wa801nd_v2: export ETH_CONFIG=_s27 -tplink_wa830re_v2_wa801nd_v2: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wa830re_v2_wa801nd_v2_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr820n_CN: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr820n_CN -tplink_wr820n_CN: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr820n_CN: export COMPRESSED_UBOOT=1 -endif -tplink_wr820n_CN: export ETH_CONFIG=_s27 -tplink_wr820n_CN: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr820n_CN_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -tplink_wr802n: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr802n -tplink_wr802n: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -tplink_wr802n: export COMPRESSED_UBOOT=1 -endif -tplink_wr802n: export ETH_CONFIG=_s27 -tplink_wr802n: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr802n_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -dlink_dir505: export UBOOT_FILE_NAME=uboot_for_d-link_dir-505 -dlink_dir505: export CONFIG_MAX_UBOOT_SIZE_KB=64 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -dlink_dir505: export COMPRESSED_UBOOT=1 -endif -dlink_dir505: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) dir505_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -gs-oolite_v1_dev: export UBOOT_FILE_NAME=uboot_for_gs-oolite_v1_dev -gs-oolite_v1_dev: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -gs-oolite_v1_dev: export COMPRESSED_UBOOT=1 -endif -gs-oolite_v1_dev: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) gs_oolite_v1_dev_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size +dragino_v2_ms14: + @$(call build,192,1,DEVICE_VENDOR=dragino) -8devices_carambola2: export UBOOT_FILE_NAME=uboot_for_8devices_carambola2 -8devices_carambola2: export CONFIG_MAX_UBOOT_SIZE_KB=256 -8devices_carambola2: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) carambola2_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size +tp-link_tl-wdr3600_tl-43x0: + @$(call build,123,1,ETH_CONFIG=_s17) + +unwireddevices_unwired-one: + @$(call build,128,1,DEVICE_VENDOR=SE) + +village-telco_mesh-potato_v2: + @$(call build,192,1,DEVICE_VENDOR=villagetelco) -dragino_v2_ms14: export UBOOT_FILE_NAME=uboot_for_dragino_v2_ms14 -dragino_v2_ms14: export CONFIG_MAX_UBOOT_SIZE_KB=192 -dragino_v2_ms14: export DEVICE_VENDOR=dragino -dragino_v2_ms14: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) dragino_v2_ms14_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -black_swift_board: export UBOOT_FILE_NAME=uboot_for_black_swift_board -black_swift_board: export CONFIG_MAX_UBOOT_SIZE_KB=128 -black_swift_board: export COMPRESSED_UBOOT=1 -black_swift_board: export DEVICE_VENDOR=SE -black_swift_board: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) black_swift_board_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -villagetelco_mp2: export UBOOT_FILE_NAME=uboot_for_villagetelco_mp2 -villagetelco_mp2: export CONFIG_MAX_UBOOT_SIZE_KB=192 -villagetelco_mp2: export DEVICE_VENDOR=villagetelco -villagetelco_mp2: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) villagetelco_mp2_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -gl-inet: export UBOOT_FILE_NAME=uboot_for_gl-inet -gl-inet: export CONFIG_MAX_UBOOT_SIZE_KB=123 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -gl-inet: export COMPRESSED_UBOOT=1 -endif -gl-inet: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) gl-inet_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -wallys_dr531: export UBOOT_FILE_NAME=uboot_for_wallys_dr531 -wallys_dr531: export CONFIG_MAX_UBOOT_SIZE_KB=192 -ifndef CONFIG_SKIP_LOWLEVEL_INIT -wallys_dr531: export COMPRESSED_UBOOT=1 -endif -wallys_dr531: export ETH_CONFIG=_s27 wallys_dr531: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) dr531_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -zbtlink_zbt_we1526: export UBOOT_FILE_NAME=uboot_for_zbtlink_zbt-we1526 -zbtlink_zbt_we1526: export CONFIG_MAX_UBOOT_SIZE_KB=256 -zbtlink_zbt_we1526: export ETH_CONFIG=_s27 -zbtlink_zbt_we1526: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) zbt-we1526_config - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all - @make --no-print-directory show_size - -ifdef CONFIG_SKIP_LOWLEVEL_INIT -show_size: export UBOOT_FILE_NAME_SUFFIX=__RAM -endif -show_size: -ifdef COMPRESSED_UBOOT - @cp $(BUILD_TOPDIR)/u-boot/tuboot.bin $(BUILD_TOPDIR)/bin/temp.bin -else - @cp $(BUILD_TOPDIR)/u-boot/u-boot.bin $(BUILD_TOPDIR)/bin/temp.bin -endif - @echo -ne "\e[32m" -ifndef CONFIG_SKIP_LOWLEVEL_INIT - @echo "> Preparing $(CONFIG_MAX_UBOOT_SIZE_KB)KB file filled with 0xFF..." - @`tr "\000" "\377" < /dev/zero | dd ibs=1k count=$(CONFIG_MAX_UBOOT_SIZE_KB) of=$(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).bin 2> /dev/null` - @echo "> Copying U-Boot image..." - @`dd if=$(BUILD_TOPDIR)/bin/temp.bin of=$(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).bin conv=notrunc 2> /dev/null` - @`rm $(BUILD_TOPDIR)/bin/temp.bin` -else - @echo "> Copying U-Boot image..." - @`mv $(BUILD_TOPDIR)/bin/temp.bin $(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).bin` -endif - @echo "> U-Boot image ready, size:" `wc -c < $(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).bin`" bytes" - @`md5sum $(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).bin | awk '{print $$1}' | tr -d '\n' > $(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).md5` - @`echo ' *'$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).bin >> $(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).md5` -# Do not check image size for RAM version -ifndef CONFIG_SKIP_LOWLEVEL_INIT - @if [ "`wc -c < $(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME)$(UBOOT_FILE_NAME_SUFFIX).bin`" -gt "`echo '$(CONFIG_MAX_UBOOT_SIZE_KB)*1024' | bc`" ]; then \ - echo -e "\e[31m\n**************************************************"; \ - echo "* WARNING: U-BOOT IMAGE SIZE IS TOO BIG! *"; \ - echo -e "**************************************************"; \ - fi; -endif - @echo -ne "\e[0m" + @$(call build,192,1,ETH_CONFIG=_s27) + +zbtlink_zbt-we1526: + @$(call build,256,1,ETH_CONFIG=_s27) + +# ============= +# CLEAN TARGETS +# ============= clean: - @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) --no-print-directory distclean - @rm -f $(BUILD_TOPDIR)/u-boot/httpd/fsdata.c + @cd $(SOURCE_DIR) && $(SUB_MAKE_CMD) distclean + @rm -f $(SOURCE_DIR)/httpd/fsdata.c -clean_all: clean - @echo -e "\e[32m> Removing all binary images...\e[0m" - @rm -f $(BUILD_TOPDIR)/bin/*.bin - @rm -f $(BUILD_TOPDIR)/bin/*.md5 +clean_all: clean + @$(call echo_green,Removing all binary images...) + @rm -f $(BIN_DIR)/*.bin + @rm -f $(BIN_DIR)/*.md5 diff --git a/u-boot/Makefile b/u-boot/Makefile index 07ecda5..67844c0 100644 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -1,113 +1,210 @@ # -# (C) Copyright 2000-2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# Copyright (C) 2016 Piotr Dymacz # -# See file CREDITS for list of people who contributed to this -# project. +# (C) Copyright 2000-2006 Wolfgang Denk, +# DENX Software Engineering, wd@denx.de. # -# 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 +# SPDX-License-Identifier: GPL-2.0 # -SHELL = bash -VERSION = 1 -PATCHLEVEL = 1 -SUBLEVEL = 4 -EXTRAVERSION = -$(shell git rev-parse --short=8 HEAD) -ISREPODIRTY = $(shell if git diff-files | read dummy; then echo 1; else echo 0; fi) -VERSION_FILE = include/version_autogenerated.h +VERSION = 1 +PATCHLEVEL = 1 +SUBLEVEL = 4 +EXTRAVERSION = -$(shell git rev-parse --short=8 HEAD) +ISREPODIRTY = $(shell if git diff-files | read dummy; then echo 1; else echo 0; fi) +VERSION_FILE = include/version_autogenerated.h + +MKCONFIG = $(BUILD_TOPDIR)/u-boot/mkconfig +MKIMAGE = $(BUILD_TOPDIR)/u-boot/tools/mkimage +LZMA = $(BUILD_TOPDIR)/host_util/$(HOSTOS)-$(HOSTARCH)/lzma # Show in version string if we are not building from clean repository -ifeq ($(ISREPODIRTY), 1) -U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-dirty" +ifeq ($(ISREPODIRTY),1) + U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-dirty" else -U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-clean" + U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-clean" endif -# Deal with colliding definitions from tcsh etc. -VENDOR= - -######################################################################### +# =============================================================== -TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) -export TOPDIR +TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) +export TOPDIR -ifdef COMPRESSED_UBOOT - ifndef CONFIG_SKIP_LOWLEVEL_INIT -COMPRESSED_UBOOT = 1 -export export COMPRESSED_UBOOT - endif +# Some variables passed as arguments in cmd +ifneq ($(IMG_SIZE),) + CONFIG_MAX_UBOOT_SIZE_KB = $(IMG_SIZE) + export CONFIG_MAX_UBOOT_SIZE_KB endif -ifeq (include/config.mk,$(wildcard include/config.mk)) -# load ARCH, BOARD, and CPU configuration -include include/config.mk -export ARCH CPU BOARD VENDOR SOC -ifndef CROSS_COMPILE -ifeq ($(HOSTARCH),ppc) -CROSS_COMPILE = -else -ifeq ($(ARCH),ppc) -CROSS_COMPILE = powerpc-linux- -endif -ifeq ($(ARCH),arm) -CROSS_COMPILE = arm-linux- -endif -ifeq ($(ARCH),i386) -ifeq ($(HOSTARCH),i386) -CROSS_COMPILE = -else -CROSS_COMPILE = i386-linux- -endif -endif -ifeq ($(ARCH),mips) -CROSS_COMPILE = mips-linux- -endif -ifeq ($(ARCH),nios) -CROSS_COMPILE = nios-elf- -endif -ifeq ($(ARCH),nios2) -CROSS_COMPILE = nios2-elf- +ifeq ($(IMG_LZMA),1) + COMPRESSED_UBOOT = 1 + export COMPRESSED_UBOOT endif -ifeq ($(ARCH),m68k) -CROSS_COMPILE = m68k-elf- + +ifeq ($(IMG_RAM),1) + CONFIG_SKIP_LOWLEVEL_INIT = 1 + export CONFIG_SKIP_LOWLEVEL_INIT endif -ifeq ($(ARCH),microblaze) -CROSS_COMPILE = mb- + +ifneq ($(DEVICE_VENDOR),) + DEVICE_VENDOR = $(DEVICE_VENDOR) + export DEVICE_VENDOR endif -ifeq ($(ARCH),blackfin) -CROSS_COMPILE = bfin-elf- + +# Never use LZMA compression +# for a RAM version of image +ifdef CONFIG_SKIP_LOWLEVEL_INIT + unexport COMPRESSED_UBOOT + COMPRESSED_UBOOT = endif + +ifndef CROSS_COMPILE + $(error "CROSS_COMPILE is not defined!") endif +export CROSS_COMPILE + +ifndef STAGING_DIR + $(error "STAGING_DIR is not defined!") endif +export STAGING_DIR -export CROSS_COMPILE +# Endianness +ifndef ENDIANNESS + ENDIANNESS=-EB +endif +export ENDIANNESS + +# ======================= +# CUSTOM HELPER FUNCTIONS +# ======================= + +define echo_green + echo -e "\e[92m$(1)\e[0m" +endef + +define echo_red + echo -e "\e[91m$(1)\e[0m" +endef + +define echo_yellow + echo -e "\e[93m$(1)\e[0m" +endef + +define ih_name +u-boot_mod $(if $(filter $(IMG_RAM),1),RAM,$(if $(filter $(IMG_LZMA),1),LZMA FLASH,FLASH)) image +endef + +# $(1): define name +# $(2): define value +define define_add + len=$$((5 - ($$(expr length $(1))/8))); \ + tab=`printf '%*s' "$$len" | tr ' ' "\t"`; \ + echo -ne "#define $(strip $(1))$${tab}" >> include/config.h; \ + echo -e '$(strip $(2))' >> include/config.h +endef + +# $(1): define name +define undef_add + echo -e '#undef $(strip $(1))' >> include/config.h +endef + +# $(1): path +define include_add + echo -e '#include <$(strip $(1))>' >> include/config.h +endef + +# $(1): name +define board_name +$(if $(1),$(strip $(1)),OEM/Unknown) +endef + +# $(1): size +define flash_size +$(if $(1),$(strip $(1)),4) +endef + +# $(1): vendor, board name/model +# $(2): default FLASH size in MB +# $(3): reset button GPIO number +# $(4): 1 if reset button is active low +# $(5): SOC_TYPE +define config_init + $(call echo_green,Preparing configuration for target: $@) + echo + + $(call echo_yellow, Device vendor/model:\t$(call board_name,$(1))) + $(if $(DEVICE_VENDOR), \ + $(call echo_yellow, Custom recovery web:\tyes ($(DEVICE_VENDOR))), \ + $(call echo_yellow, Custom recovery web:\tno) \ + ) + + $(if $(CONFIG_MAX_UBOOT_SIZE_KB), \ + $(call echo_yellow, Image size limit:\t$(CONFIG_MAX_UBOOT_SIZE_KB) KB), + $(call echo_yellow, Image size limit:\tnot specified) + ) + + $(call echo_yellow, Default FLASH size:\t$(call flash_size,$(2)) MB) + + $(if $(3), + $(call echo_yellow, GPIO reset button:\t$(strip $(3))), \ + $(call echo_yellow, GPIO reset button:\tnot specified) \ + ) + + $(if $(filter $(4),1), + $(call echo_yellow, Button active low:\tyes), \ + $(call echo_yellow, Button active low:\tno) \ + ) + + $(if $(filter $(COMPRESSED_UBOOT),1), \ + $(call echo_yellow, LZMA compression:\tyes), \ + $(call echo_yellow, LZMA compression:\tno) \ + ) + + $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \ + $(call echo_yellow, RAM-loadable only:\tyes), \ + $(call echo_yellow, RAM-loadable only:\tno) \ + ) + + $(if $(3),$(call define_add,CONFIG_GPIO_RESET_BTN,$(strip $(3)))) + $(if $(filter $(4),1),$(call define_add,CONFIG_GPIO_RESET_BTN_ACTIVE_LOW,1)) + $(if $(CONFIG_MAX_UBOOT_SIZE_KB), \ + $(call define_add,CONFIG_MAX_UBOOT_SIZE_KB,$(CONFIG_MAX_UBOOT_SIZE_KB)) + ) + + $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \ + $(call define_add,CONFIG_SKIP_LOWLEVEL_INIT,1) \ + ) + $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \ + $(call undef_add,COMPRESSED_UBOOT) \ + ) + + $(if $(5), \ + $(call define_add,SOC_TYPE,$(5)) \ + ) + + $(call define_add,CONFIG_BOARD_CUSTOM_STRING,"$(call board_name,$(1))") + $(call define_add,CONFIG_DEFAULT_FLASH_SIZE_IN_MB,$(call flash_size,$(2))) + + echo +endef + +# =============================================================== + +# First, check if configuration was done +ifneq (include/config.mk, $(wildcard include/config.mk)) +all install u-boot u-boot.srec depend dep: + $(error "System was not configured!") +else +# Load ARCH, BOARD, and CPU configuration +include include/config.mk +export ARCH CPU BOARD VENDOR SOC -# load other configuration +# Load other configuration include $(TOPDIR)/config.mk - -######################################################################### +# =============================================================== # U-Boot objects....order is important (i.e. start must be first) -OBJS = cpu/$(CPU)/start.o - -ifdef COMPRESSED_UBOOT - ifndef CONFIG_SKIP_LOWLEVEL_INIT -OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o - endif -endif +OBJS = cpu/$(CPU)/start.o LIBS = lib_generic/libgeneric.a LIBS += common/libcommon.a @@ -121,75 +218,64 @@ LIBS += $(BOARDLIBS) LIBS_SHARED = board/$(BOARDDIR)/lib$(BOARD).a ifdef SOC -LIBS_SHARED += cpu/$(CPU)/$(SOC)/lib$(SOC).a + LIBS_SHARED += cpu/$(CPU)/$(SOC)/lib$(SOC).a endif LIBS_SHARED += cpu/$(CPU)/lib$(CPU).a ifdef COMPRESSED_UBOOT - ifndef CONFIG_SKIP_LOWLEVEL_INIT -LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a - endif -endif - -PHONY_LIBS = $(LIBS) $(LIBS_SHARED) - -ifdef COMPRESSED_UBOOT -ifndef CONFIG_SKIP_LOWLEVEL_INIT -PHONY_LIBS = $(LIBS_BOOTSTRAP) $(LIBS_SHARED) -endif + OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o + LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a + PHONY_LIBS = $(LIBS_BOOTSTRAP) $(LIBS_SHARED) +else + PHONY_LIBS = $(LIBS) $(LIBS_SHARED) endif - -.PHONY : $(PHONY_LIBS) +.PHONY: $(PHONY_LIBS) # Add GCC lib PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc # The "tools" are needed early, so put this first # Don't include stuff already done in $(LIBS) -SUBDIRS = tools +SUBDIRS = tools -.PHONY : $(SUBDIRS) +.PHONY: $(SUBDIRS) -######################################################################### -######################################################################### +# =============================================================== ALL = u-boot.srec u-boot.bin System.map ifdef COMPRESSED_UBOOT -ifndef CONFIG_SKIP_LOWLEVEL_INIT -all: $(ALL) tuboot.bin -else -all: $(ALL) u-boot.img -endif +all: $(ALL) tuboot.bin else -all: $(ALL) u-boot.img +all: $(ALL) u-boot.img endif -u-boot.hex: u-boot +u-boot.hex: u-boot $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -u-boot.srec: u-boot +u-boot.srec: u-boot $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -u-boot.bin: u-boot +u-boot.bin: u-boot $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ -u-boot.img: u-boot.bin - @echo -e "\e[32m> Preparing U-Boot image \"u-boot.img\"...\e[0m" - ./tools/mkimage -A $(ARCH) -T firmware -C none \ - -a $(TEXT_BASE) -e 0 \ - -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ - sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ - -d $< $@ +u-boot.img: u-boot.bin + @echo + $(call echo_green,Preparing regular U-Boot image $@...) + $(MKIMAGE) -A $(ARCH) -T firmware -C none -a $(TEXT_BASE) \ + -e 0 -n '$(call ih_name)' -d $< $@ -u-boot.dis: u-boot +u-boot.dis: u-boot $(OBJDUMP) -d $< > $@ -u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LIBS_SHARED) $(LDSCRIPT) - UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) $(LIBS_SHARED) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\ - $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \ - --start-group $(LIBS) $(LIBS_SHARED) --end-group $(PLATFORM_LIBS) \ - -Map u-boot.map -o u-boot +u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LIBS_SHARED) $(LDSCRIPT) + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) $(LIBS_SHARED) | \ + sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p' | \ + sort | uniq`; \ + $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \ + --start-group $(LIBS) $(LIBS_SHARED) \ + --end-group $(PLATFORM_LIBS) \ + -Map u-boot.map -o u-boot $(LIBS_SHARED): $(MAKE) -C `dirname $@` @@ -200,440 +286,251 @@ $(LIBS): $(SUBDIRS): $(MAKE) -C $@ all +# For LZMA compressed image ifdef COMPRESSED_UBOOT -ifndef CONFIG_SKIP_LOWLEVEL_INIT -LZMA = $(BUILD_TOPDIR)/host_util/$(HOSTOS)-$(HOSTARCH)/lzma - -tuboot.bin: System.map bootstrap.bin u-boot.lzimg +tuboot.bin: System.map bootstrap.bin u-boot.lzimg @cat bootstrap.bin > $@ @cat u-boot.lzimg >> $@ u-boot.lzimg: $(obj)u-boot.bin System.map + @echo @rm -rf u-boot.bin.lzma - $(LZMA) --best --keep $(obj)u-boot.bin - @echo -e "\e[32m> Preparing compressed U-Boot image \"u-boot.lzimg\"...\e[0m" - ./tools/mkimage -A mips -T firmware -C lzma \ - -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ - -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ - -n 'u-boot image' -d $(obj)u-boot.bin.lzma $@ - -bootstrap.bin: bootstrap + @$(call echo_green,Compressing U-Boot image $<...) + @$(LZMA) --best --keep $(obj)u-boot.bin + $(call echo_green,Preparing LZMA compressed U-Boot image $@...) + $(MKIMAGE) -A $(ARCH) -T firmware -C lzma \ + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | \ + awk '{ printf "%s", $$1 }') \ + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | \ + awk '{ printf "%s", $$1 }') \ + -n '$(call ih_name)' -d $(obj)u-boot.bin.lzma $@ + +bootstrap.bin: bootstrap $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ -bootstrap: depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LIBS_SHARED) $(LDSCRIPT_BOOTSTRAP) - UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\ - $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \ - --start-group $(LIBS_BOOTSTRAP) $(LIBS_SHARED) --end-group $(PLATFORM_LIBS) \ - -Map bootstrap.map -o bootstrap +bootstrap: depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LIBS_SHARED) $(LDSCRIPT_BOOTSTRAP) + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) | \ + sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p' | \ + sort | uniq`; \ + $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \ + --start-group $(LIBS_BOOTSTRAP) $(LIBS_SHARED) \ + --end-group $(PLATFORM_LIBS) \ + -Map bootstrap.map -o bootstrap $(LIBS_BOOTSTRAP): $(MAKE) -C `dirname $@` -endif -endif +endif # ifdef COMPRESSED_UBOOT version: - @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \ - echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \ - echo "\"" >> $(VERSION_FILE) - -gdbtools: - $(MAKE) -C tools/gdb || exit 1 + @echo -n "#define U_BOOT_VERSION \"U-Boot $(U_BOOT_VERSION)\"" > $(VERSION_FILE) depend dep: - @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done - -tags: - ctags -w `find $(SUBDIRS) include \ - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \ - fs/cramfs fs/fat fs/fdos fs/jffs2 \ - net disk rtc dtt drivers drivers/sk98lin common \ - \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` - -etags: - etags -a `find $(SUBDIRS) include \ - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \ - fs/cramfs fs/fat fs/fdos fs/jffs2 \ - net disk rtc dtt drivers drivers/sk98lin common \ - \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` - -System.map: u-boot - @$(NM) $< | \ - grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ - sort > System.map + @for dir in $(SUBDIRS); do $(MAKE) -C $$dir .depend; done -######################################################################### -else -all install u-boot u-boot.srec depend dep: - @echo "System not configured - see README" >&2 - @ exit 1 -endif +System.map: u-boot + @$(NM) $< | \ + grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ + sort > System.map +endif # include/config.mk -######################################################################### +# ===================== +# COMMON/SHARED TARGETS +# ===================== unconfig: + @$(call echo_green,Removing configuration...) @rm -f include/config.h include/config.mk board/*/config.tmp -#======================================================================== -# MIPS -#======================================================================== -######################################################################### -## MIPS32 AR7100 (24K) -######################################################################### -common_config : +config_common: @ >include/config.h - @echo "/* Temporary solution */" >> include/config.h - @echo "/* AR933x */" >> include/config.h - @echo "#define QCA_AR9330_SOC 0x00001" >> include/config.h - @echo "#define QCA_AR9331_SOC 0x00002" >> include/config.h - @echo "#define QCA_AR933X_SOC (QCA_AR9330_SOC | QCA_AR9331_SOC)" >> include/config.h - @echo "/* AR934x */" >> include/config.h - @echo "#define QCA_AR9341_SOC 0x00010" >> include/config.h - @echo "#define QCA_AR9342_SOC 0x00020" >> include/config.h - @echo "#define QCA_AR9344_SOC 0x00040" >> include/config.h - @echo "#define QCA_AR934X_SOC (QCA_AR9341_SOC | QCA_AR9342_SOC | QCA_AR9344_SOC)" >> include/config.h - @echo "/* QCA953x */" >> include/config.h - @echo "#define QCA_QCA9531_SOC 0x00100" >> include/config.h - @echo "#define QCA_QCA9533_SOC 0x00200" >> include/config.h - @echo "#define QCA_QCA953X_SOC (QCA_QCA9531_SOC | QCA_QCA9533_SOC)" >> include/config.h - @echo "/* QCA956x */" >> include/config.h - @echo "#define QCA_QCA9561_SOC 0x01000" >> include/config.h - @echo "#define QCA_QCA9563_SOC 0x02000" >> include/config.h - @echo "#define QCA_QCA956X_SOC (QCA_QCA9561_SOC | QCA_QCA9563_SOC)" >> include/config.h - @echo "/* QCA955x */" >> include/config.h - @echo "#define QCA_QCA9557_SOC 0x10000" >> include/config.h - @echo "#define QCA_QCA9558_SOC 0x20000" >> include/config.h - @echo "#define QCA_QCA955X_SOC (QCA_QCA9557_SOC | QCA_QCA9558_SOC)" >> include/config.h - @echo "" >> include/config.h - -ifdef CONFIG_BOOTDELAY - @echo "#define CONFIG_BOOTDELAY "$(CONFIG_BOOTDELAY) >> include/config.h -endif - -ifdef CONFIG_MAX_UBOOT_SIZE_KB - @echo "#define CONFIG_MAX_UBOOT_SIZE_KB "$(CONFIG_MAX_UBOOT_SIZE_KB) >> include/config.h -endif - -ifdef CONFIG_SKIP_LOWLEVEL_INIT - @echo "#define CONFIG_SKIP_LOWLEVEL_INIT 1" >> include/config.h - @echo "#undef COMPRESSED_UBOOT" >> include/config.h -endif - - @echo "#define CONFIG_SILENT_CONSOLE 1" >> include/config.h - @echo "#define CONFIG_DELAY_TO_AUTORUN_HTTPD 3" >> include/config.h - @echo "#define CONFIG_DELAY_TO_AUTORUN_CONSOLE 5" >> include/config.h - @echo "#define CONFIG_DELAY_TO_AUTORUN_NETCONSOLE 7" >> include/config.h - - # max delay time for button pressing - @echo "#define CONFIG_MAX_BUTTON_PRESSING 10" >> include/config.h - - # don't show info about console (in, out, err...) - @echo "#define CFG_CONSOLE_INFO_QUIET" >> include/config.h - -hornet_common_config : common_config - @echo "#define SOC_TYPE QCA_AR933X_SOC" >> include/config.h - @echo "#define CONFIG_MACH_HORNET 1" >> include/config.h - -wr703n_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR703N at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_WR703N_V1 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR703N\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -wr720n_v3_CN_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR720N v3 CN at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_WR720N_V3 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR720N v3 CN\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -wr710n_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR710N at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_WR710N_V1 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR710N\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -mr3020_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-MR3020 at:' `date`.'\e[0m' - @echo "#define CONFIG_FOR_TPLINK_MR3020_V1 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-MR3020\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -mr3040_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-MR3040 at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_MR3040_V1V2 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-MR3040\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -mr10u_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-MR10U at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_MR10U_V1 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-MR10U\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -mr13u_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-MR13U at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_MR13U_V1 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-MR13U\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -wr740n_v4_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR740N v4 at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_WR740N_V4 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR74xN/D v4\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -mr3220_v2_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-MR3220 v2 at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_TPLINK_MR3220_V2 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-MR3220 v2\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -dir505_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for D-Link DIR-505 at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_DLINK_DIR505_A1 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"D-Link DIR-505\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -gs_oolite_v1_dev_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for GS-Oolite v1 with dev board at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"Gainstrong GS-Oolite v1\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -black_swift_board_config : unconfig hornet_common_config - @echo '======= Configuring for Black Swift board (128K compressed) at:' `date` '=======' - @echo "#define CONFIG_FOR_BLACK_SWIFT_BOARD 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"Black Swift board\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -carambola2_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for 8devices Carambola 2 at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_8DEVICES_CARAMBOLA2 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"8devices Carambola2 v1\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -dragino_v2_ms14_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for Dragino Dragino v2 (MS14) at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_DRAGINO_V2 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h - @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE 1" >> include/config.h - @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE 1" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"Dragino v2 MS14\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -villagetelco_mp2_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for Village Telco Mesh Potato 2 at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_MESH_POTATO_V2 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h - @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE 1" >> include/config.h - @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE 1" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"Village Telco Mesh Potato 2\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -gl-inet_config : unconfig hornet_common_config - @echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m' - @echo "#define CONFIG_FOR_GL_INET 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 11" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"GL.iNet\"" >> include/config.h - - @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 - -wasp_common_config : common_config - @echo "#define CONFIG_WASP 1" >> include/config.h - @echo "#define CONFIG_WASP_SUPPORT 1" >> include/config.h - -wdr3600_43x0_config : unconfig wasp_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WDR3600/43x0 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_AR9344_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1 1" >> include/config.h - @echo "#define CFG_ATHRS17_PHY 1" >> include/config.h - @echo "#define CFG_AG7240_NMACS 1" >> include/config.h - @echo "#define CONFIG_PCI 1" >> include/config.h - @echo "#define CFG_DUAL_PHY_SUPPORT 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 16" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WDR3600/43x0\"" >> include/config.h - - @./mkconfig -a db12x mips mips db12x ar7240 ar7240 - -wdr3500_config : unconfig wasp_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WDR3500 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_AR9344_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_WDR3500_V1 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_AG7240_NMACS 2" >> include/config.h - @echo "#define CONFIG_PCI 1" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 16" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WDR3500\"" >> include/config.h - - @./mkconfig -a db12x mips mips db12x ar7240 ar7240 - -mr3420_v2_config : unconfig wasp_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-MR3420 v2 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_AR9341_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_MR3420_V2 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_AG7240_NMACS 2" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 17" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-MR3420 v2\"" >> include/config.h - - @./mkconfig -a db12x mips mips db12x ar7240 ar7240 - -wr841n_v8_config : unconfig wasp_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v8 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_AR9341_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_WR841N_V8 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_AG7240_NMACS 2" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 17" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR841N/D v8\"" >> include/config.h - - @./mkconfig -a db12x mips mips db12x ar7240 ar7240 - -wa830re_v2_wa801nd_v2_config : unconfig wasp_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WA830RE/TL-WA801ND v2 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_AR9341_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_AG7240_NMACS 2" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 17" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WA830RE/TL-WA801ND v2\"" >> include/config.h - - @./mkconfig -a db12x mips mips db12x ar7240 ar7240 - -ap143_common_config : common_config - @echo "#define CONFIG_ATHEROS 1" >> include/config.h - @echo "#define CONFIG_MACH_QCA953x 1" >> include/config.h - -dr531_config : unconfig ap143_common_config - @echo -e '\e[32m> Configuring for Wallys DR531 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h - @echo "#define CONFIG_FOR_WALLYS_DR531 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_ATH_GMAC_NMACS 2" >> include/config.h - @echo "#define CONFIG_PCI 1" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 17" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"Wallys DR531\"" >> include/config.h - - @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 - -wr820n_CN_config : unconfig ap143_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR820N CN at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_WR820N_CN 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_ATH_GMAC_NMACS 2" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 12" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR820N CN\"" >> include/config.h - - @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 - -wr802n_config : unconfig ap143_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR802N at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_WR802N 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_ATH_GMAC_NMACS 2" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 12" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR802N\"" >> include/config.h - - @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 - -wr841n_v9_config : unconfig ap143_common_config - @echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v9 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h - @echo "#define CONFIG_FOR_TPLINK_WR841N_V9 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_ATH_GMAC_NMACS 2" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 12" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR841N/D v9\"" >> include/config.h - - @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 - -zbt-we1526_config : unconfig ap143_common_config - @echo -e '\e[32m> Configuring for Zbtlink ZBT-WE1526 at:' `date` '\e[0m' - @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h - @echo "#define CONFIG_FOR_ZBTLINK_ZBT_WE1526 1" >> include/config.h - @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h - @echo "#define CFG_ATH_GMAC_NMACS 2" >> include/config.h - @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN 17" >> include/config.h - @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h - @echo "#define CONFIG_BOARD_CUSTOM_STRING \"Zbtlink ZBT-WE1526\"" >> include/config.h - - @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 - -######################################################################### -######################################################################### -######################################################################### + @$(call include_add,soc/soc_list.h) + @$(call define_add,CONFIG_BOOTDELAY,1) + @$(call define_add,CONFIG_SILENT_CONSOLE,1) + @$(call define_add,CFG_CONSOLE_INFO_QUIET,1) + @$(call define_add,CONFIG_MAX_BUTTON_PRESSING,10) + @$(call define_add,CONFIG_DELAY_TO_AUTORUN_HTTPD,3) + @$(call define_add,CONFIG_DELAY_TO_AUTORUN_CONSOLE,5) + @$(call define_add,CONFIG_DELAY_TO_AUTORUN_NETCONSOLE,7) + +ar933x_common: unconfig config_common + @$(call define_add,CONFIG_MACH_HORNET,1) + +ar934x_common: unconfig config_common + @$(call define_add,CONFIG_WASP,1) + @$(call define_add,CONFIG_WASP_SUPPORT,1) + +qca953x_common: unconfig config_common + @$(call define_add,CONFIG_ATHEROS,1) + @$(call define_add,CONFIG_MACH_QCA953x,1) + +# ============================= +# TARGETS IN ALPHABETICAL ORDER +# ============================= + +8devices_carambola2: ar933x_common + @$(call config_init,8devices Carambola 2,16,11,1,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_8DEVICES_CARAMBOLA2,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +d-link_dir-505: ar933x_common + @$(call config_init,D-Link DIR-505,8,11,1,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_DLINK_DIR505_A1,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +dragino_v2_ms14: ar933x_common + @$(call config_init,Dragino v2 (MS14),16,11,1,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_DRAGINO_V2,1) + @$(call define_add,WEBFAILSAFE_DISABLE_ART_UPGRADE,1) + @$(call define_add,WEBFAILSAFE_DISABLE_UBOOT_UPGRADE,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +gainstrong_oolite_v1_dev: ar933x_common + @$(call config_init,Gainstrong Oolite v1 (dev board),16,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_GS_OOLITE_V1_DEV,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +gl-innovations_gl-inet-6416: ar933x_common + @$(call config_init,GL-Innovations GL.iNet 6416,8,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_GL_INET,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-mr10u: ar933x_common + @$(call config_init,TP-Link TL-MR10U,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_MR10U_V1,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-mr13u: ar933x_common + @$(call config_init,TP-Link TL-MR13U,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_MR13U_V1,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-mr3020: ar933x_common + @$(call config_init,TP-Link TL-MR3020,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_MR3020_V1,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-mr3040: ar933x_common + @$(call config_init,TP-Link TL-MR3040,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_MR3040_V1V2,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-mr3220_v2: ar933x_common + @$(call config_init,TP-Link TL-MR3220 v2,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_MR3220_V2,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-mr3420_v2: ar934x_common + @$(call config_init,TP-Link TL-MR3420 v2,4,17,1,QCA_AR9341_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_MR3420_V2,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_AG7240_NMACS,2) + @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240 + +tp-link_tl-wa830re_v2_tl-wa801nd_v2: ar934x_common + @$(call config_init,TP-Link TL-WA830RE/TL-WA801ND v2,4,17,1,QCA_AR9341_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_AG7240_NMACS,2) + @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240 + +tp-link_tl-wdr3500: ar934x_common + @$(call config_init,TP-Link TL-WDR3500,8,16,1,QCA_AR9344_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WDR3500_V1,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_AG7240_NMACS,2) + @$(call define_add,CONFIG_PCI,1) + @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240 + +tp-link_tl-wdr3600_tl-43x0: ar934x_common + @$(call config_init,TP-Link TL-WDR3600/43x0,8,16,1,QCA_AR9344_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1,1) + @$(call define_add,CFG_ATHRS17_PHY,1) + @$(call define_add,CFG_AG7240_NMACS,1) + @$(call define_add,CONFIG_PCI,1) + @$(call define_add,CFG_DUAL_PHY_SUPPORT,1) + @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240 + +tp-link_tl-wr703n: ar933x_common + @$(call config_init,TP-Link TL-WR703N,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR703N_V1,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-wr710n: ar933x_common + @$(call config_init,TP-Link TL-WR710N,8,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR710N_V1,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-wr720n_v3_CN: ar933x_common + @$(call config_init,TP-Link TL-WR720N v3 CN,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR720N_V3,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-wr740n_v4: ar933x_common + @$(call config_init,TP-Link TL-WR74xN/D v4,4,11,,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR740N_V4,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +tp-link_tl-wr802n: qca953x_common + @$(call config_init,TP-Link TL-WR802N,4,12,1,QCA_QCA953X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR802N,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_ATH_GMAC_NMACS,2) + @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240 + +tp-link_tl-wr820n_CN: qca953x_common + @$(call config_init,TP-Link TL-WR820N CN,4,12,1,QCA_QCA953X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR820N_CN,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_ATH_GMAC_NMACS,2) + @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240 + +tp-link_tl-wr841n_v8: ar934x_common + @$(call config_init,TP-Link TL-WR841N/D v8,4,17,1,QCA_AR9341_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR841N_V8,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_AG7240_NMACS,2) + @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240 + +tp-link_tl-wr841n_v9: qca953x_common + @$(call config_init,TP-Link TL-WR841N/D v9,4,12,1,QCA_QCA953X_SOC) + @$(call define_add,CONFIG_FOR_TPLINK_WR841N_V9,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_ATH_GMAC_NMACS,2) + @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240 + +unwireddevices_unwired-one: ar933x_common + @$(call config_init,Black Swift aka Unwired One,16,11,1,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_BLACK_SWIFT_BOARD,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +village-telco_mesh-potato_v2: ar933x_common + @$(call config_init,Village Telco Mesh Potato 2,16,11,1,QCA_AR933X_SOC) + @$(call define_add,CONFIG_FOR_MESH_POTATO_V2,1) + @$(call define_add,WEBFAILSAFE_DISABLE_ART_UPGRADE,1) + @$(call define_add,WEBFAILSAFE_DISABLE_UBOOT_UPGRADE,1) + @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240 + +wallys_dr531: qca953x_common + @$(call config_init,Wallys DR531,8,17,1,QCA_QCA953X_SOC) + @$(call define_add,CONFIG_FOR_WALLYS_DR531,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_ATH_GMAC_NMACS,2) + @$(call define_add,CONFIG_PCI,1) + @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240 + +zbtlink_zbt-we1526: qca953x_common + @$(call config_init,Zbtlink ZBT-WE1526,16,17,1,QCA_QCA953X_SOC) + @$(call define_add,CONFIG_FOR_ZBTLINK_ZBT_WE1526,1) + @$(call define_add,CFG_ATHRS27_PHY,1) + @$(call define_add,CFG_ATH_GMAC_NMACS,2) + @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240 + +# ============= +# CLEAN TARGETS +# ============= clean: - @echo -e "\e[32m> Making $@...\e[0m" + @$(call echo_green,Making $@...) @find . -type f \ \( -name 'core' -o -name '*.bak' -o -name '*~' \ -o -name '*.o' -o -name '*.a' -o -name .depend \) -print \ @@ -643,24 +540,16 @@ clean: @rm -f lib_bootstrap/*.a @rm -f bootstrap bootstrap.bin tuboot.bin u-boot.lzimg u-boot.bin.lzma bootstrap.map -clobber: clean - @echo -e "\e[32m> Making $@...\e[0m" +clobber: clean + @$(call echo_green,Making $@...) @find . -type f \( -name .depend \ -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \ -print0 \ | xargs -0 rm -f - @rm -f $(OBJS) *.bak tags TAGS include/version_autogenerated.h + @rm -f $(OBJS) *.bak include/version_autogenerated.h @rm -fr *.*~ @rm -f u-boot u-boot.map u-boot.hex $(ALL) @rm -f tools/crc32.c tools/environment.c - @rm -f cpu/mpc824x/bedbug_603e.c @rm -f include/asm/proc include/asm/arch include/asm -mrproper \ -distclean: clobber unconfig - -backup: - F=`basename $(TOPDIR)` ; cd .. ; \ - gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F - -######################################################################### +distclean: clobber unconfig diff --git a/u-boot/include/soc/soc_list.h b/u-boot/include/soc/soc_list.h new file mode 100644 index 0000000..e188943 --- /dev/null +++ b/u-boot/include/soc/soc_list.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2016 Piotr Dymacz + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#ifndef _SOC_LIST_H_ +#define _SOC_LIST_H_ + +/* AR933x */ +#define QCA_AR9330_SOC 0x00000001 +#define QCA_AR9331_SOC 0x00000002 +#define QCA_AR933X_SOC (QCA_AR9330_SOC |\ + QCA_AR9331_SOC) + +/* AR934x */ +#define QCA_AR9341_SOC 0x00000010 +#define QCA_AR9342_SOC 0x00000020 +#define QCA_AR9344_SOC 0x00000040 +#define QCA_AR934X_SOC (QCA_AR9341_SOC |\ + QCA_AR9342_SOC |\ + QCA_AR9344_SOC) + +/* QCA953x */ +#define QCA_QCA9531_SOC 0x00000100 +#define QCA_QCA9533_SOC 0x00000200 +#define QCA_QCA953X_SOC (QCA_QCA9531_SOC |\ + QCA_QCA9533_SOC) + +/* QCA956x */ +#define QCA_QCA9561_SOC 0x00001000 +#define QCA_QCA9563_SOC 0x00002000 +#define QCA_QCA956X_SOC (QCA_QCA9561_SOC |\ + QCA_QCA9563_SOC) + +/* QCA955x */ +#define QCA_QCA9557_SOC 0x00010000 +#define QCA_QCA9558_SOC 0x00020000 +#define QCA_QCA955X_SOC (QCA_QCA9557_SOC |\ + QCA_QCA9558_SOC) + +#endif /* _SOC_LIST_H_ */