Fork of the vendor (Boundary Devices) u-boot for Reform 2, with minor tweaks. The goal is to migrate to mainstream u-boot or barebox ASAP. The main impediment so far is the 4GB RAM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

293 lines
8.8 KiB

  1. #
  2. # (C) Copyright 2000-2006
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0+
  6. #
  7. # Enable all the config-independent tools
  8. ifneq ($(HOST_TOOLS_ALL),)
  9. CONFIG_LCD_LOGO = y
  10. CONFIG_CMD_LOADS = y
  11. CONFIG_CMD_NET = y
  12. CONFIG_XWAY_SWAP_BYTES = y
  13. CONFIG_NETCONSOLE = y
  14. CONFIG_SHA1_CHECK_UB_IMG = y
  15. CONFIG_ARCH_SUNXI = y
  16. endif
  17. subdir-$(HOST_TOOLS_ALL) += easylogo
  18. subdir-$(HOST_TOOLS_ALL) += gdb
  19. # Merge all the different vars for envcrc into one
  20. ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y
  21. ENVCRC-$(CONFIG_ENV_IS_IN_DATAFLASH) = y
  22. ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
  23. ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
  24. ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
  25. ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
  26. ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
  27. ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
  28. CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
  29. hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
  30. hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
  31. hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
  32. HOSTCFLAGS_bmp_logo.o := -pedantic
  33. hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
  34. envcrc-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o
  35. hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
  36. HOSTCFLAGS_gen_eth_addr.o := -pedantic
  37. hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
  38. gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
  39. HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
  40. hostprogs-$(CONFIG_CMD_LOADS) += img2srec
  41. HOSTCFLAGS_img2srec.o := -pedantic
  42. hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes
  43. HOSTCFLAGS_xway-swap-bytes.o := -pedantic
  44. hostprogs-y += mkenvimage
  45. mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
  46. hostprogs-y += dumpimage mkimage
  47. hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
  48. FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
  49. # Flattened device tree objects
  50. LIBFDT_CSRCS := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \
  51. fdt_empty_tree.c fdt_addresses.c fdt_overlay.c \
  52. fdt_region.c
  53. # Unfortunately setup.py below cannot handle srctree being ".." which it often
  54. # is. It fails with an error like:
  55. # Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o:
  56. # No such file or directory
  57. # To fix this, use an absolute path.
  58. libfdt_tree := $(shell readlink -f $(srctree)/lib/libfdt)
  59. LIBFDT_SRCS := $(addprefix $(libfdt_tree)/, $(LIBFDT_CSRCS))
  60. LIBFDT_SWIG := $(addprefix $(libfdt_tree)/, pylibfdt/libfdt.i)
  61. LIBFDT_OBJS := $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_CSRCS)))
  62. RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
  63. rsa-sign.o rsa-verify.o rsa-checksum.o \
  64. rsa-mod-exp.o)
  65. ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
  66. # common objs for dumpimage and mkimage
  67. dumpimage-mkimage-objs := aisimage.o \
  68. atmelimage.o \
  69. $(FIT_SIG_OBJS-y) \
  70. common/bootm.o \
  71. lib/crc32.o \
  72. default_image.o \
  73. lib/fdtdec_common.o \
  74. lib/fdtdec.o \
  75. fit_common.o \
  76. fit_image.o \
  77. common/image-fit.o \
  78. image-host.o \
  79. common/image.o \
  80. imagetool.o \
  81. imximage.o \
  82. kwbimage.o \
  83. lib/md5.o \
  84. lpc32xximage.o \
  85. mxsimage.o \
  86. omapimage.o \
  87. os_support.o \
  88. pblimage.o \
  89. pbl_crc32.o \
  90. vybridimage.o \
  91. $(ROCKCHIP_OBS) \
  92. socfpgaimage.o \
  93. lib/sha1.o \
  94. lib/sha256.o \
  95. common/hash.o \
  96. ublimage.o \
  97. zynqimage.o \
  98. zynqmpimage.o \
  99. $(LIBFDT_OBJS) \
  100. gpimage.o \
  101. gpimage-common.o \
  102. $(RSA_OBJS-y)
  103. dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
  104. mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
  105. fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o
  106. fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o
  107. # Unfortunately setup.py (or actually the Python distutil implementation)
  108. # puts files into the same directory as the .i file. We cannot touch the source
  109. # directory, so we copy the .i file into the tools/ build subdirectory before
  110. # calling setup. This directory is safe to write to. This ensures that we get
  111. # all three files in $(obj)/tools: _libfdt.so, libfdt.py and libfdt_wrap.c
  112. # The latter is a temporary file which we could actually remove.
  113. tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG)
  114. cp $(LIBFDT_SWIG) tools/.
  115. unset CC; \
  116. unset CROSS_COMPILE; \
  117. LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= VERSION="u-boot-$(UBOOTVERSION)" \
  118. CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \
  119. SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \
  120. SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \
  121. $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \
  122. --build-lib tools
  123. ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
  124. # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
  125. # the mxsimage support within tools/mxsimage.c .
  126. HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
  127. endif
  128. ifdef CONFIG_FIT_SIGNATURE
  129. # This affects include/image.h, but including the board config file
  130. # is tricky, so manually define this options here.
  131. HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE
  132. endif
  133. ifdef CONFIG_SYS_U_BOOT_OFFS
  134. HOSTCFLAGS_kwbimage.o += -DCONFIG_SYS_U_BOOT_OFFS=$(CONFIG_SYS_U_BOOT_OFFS)
  135. endif
  136. ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
  137. HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
  138. endif
  139. # MXSImage needs LibSSL
  140. ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
  141. HOSTLOADLIBES_mkimage += \
  142. $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
  143. # OS X deprecate openssl in favour of CommonCrypto, supress deprecation
  144. # warnings on those systems
  145. ifeq ($(HOSTOS),darwin)
  146. HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations
  147. HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations
  148. HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
  149. endif
  150. endif
  151. HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
  152. HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
  153. HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
  154. hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
  155. hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
  156. HOSTCFLAGS_mkexynosspl.o := -pedantic
  157. ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
  158. hostprogs-$(CONFIG_X86) += ifdtool
  159. hostprogs-$(CONFIG_MX23) += mxsboot
  160. hostprogs-$(CONFIG_MX28) += mxsboot
  161. HOSTCFLAGS_mxsboot.o := -pedantic
  162. hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
  163. hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
  164. sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
  165. hostprogs-$(CONFIG_NETCONSOLE) += ncb
  166. hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
  167. ubsha1-objs := os_support.o ubsha1.o lib/sha1.o
  168. HOSTCFLAGS_ubsha1.o := -pedantic
  169. hostprogs-$(CONFIG_KIRKWOOD) += kwboot
  170. hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
  171. hostprogs-y += proftool
  172. hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
  173. hostprogs-y += fdtgrep
  174. fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.o
  175. # We build some files with extra pedantic flags to try to minimize things
  176. # that won't build on some weird host compiler -- though there are lots of
  177. # exceptions for files that aren't complaint.
  178. HOSTCFLAGS_crc32.o := -pedantic
  179. HOSTCFLAGS_crc8.o := -pedantic
  180. HOSTCFLAGS_md5.o := -pedantic
  181. HOSTCFLAGS_sha1.o := -pedantic
  182. HOSTCFLAGS_sha256.o := -pedantic
  183. quiet_cmd_wrap = WRAP $@
  184. cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
  185. $(obj)/lib/%.c $(obj)/common/%.c:
  186. $(call cmd,wrap)
  187. clean-dirs := lib common
  188. always := $(hostprogs-y)
  189. # Build a libfdt Python module if swig is available
  190. # Use 'sudo apt-get install swig libpython-dev' to enable this
  191. always += $(if $(shell which swig 2> /dev/null),_libfdt.so)
  192. # Generated LCD/video logo
  193. LOGO_H = $(objtree)/include/bmp_logo.h
  194. LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
  195. LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
  196. LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
  197. LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
  198. LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
  199. # Generic logo
  200. ifeq ($(LOGO_BMP),)
  201. LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp
  202. # Use board logo and fallback to vendor
  203. ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),)
  204. LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp
  205. else
  206. ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
  207. LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
  208. endif
  209. endif
  210. endif # !LOGO_BMP
  211. #
  212. # Use native tools and options
  213. # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
  214. # Define _GNU_SOURCE to obtain the getline prototype from stdio.h
  215. #
  216. HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
  217. $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
  218. -I$(srctree)/lib/libfdt \
  219. -I$(srctree)/tools \
  220. -DUSE_HOSTCC \
  221. -D__KERNEL_STRICT_NAMES \
  222. -D_GNU_SOURCE
  223. __build: $(LOGO-y)
  224. $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
  225. $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
  226. $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
  227. $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
  228. # Let clean descend into subdirs
  229. subdir- += env
  230. ifneq ($(CROSS_BUILD_TOOLS),)
  231. override HOSTCC = $(CC)
  232. quiet_cmd_crosstools_strip = STRIP $^
  233. cmd_crosstools_strip = $(STRIP) $^; touch $@
  234. $(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y)))
  235. $(call cmd,crosstools_strip)
  236. always += .strip
  237. endif
  238. clean-files += .strip