uboot.mk 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. ################################################################################
  2. #
  3. # uboot
  4. #
  5. ################################################################################
  6. UBOOT_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_VERSION))
  7. UBOOT_BOARD_NAME = $(call qstrip,$(BR2_TARGET_UBOOT_BOARDNAME))
  8. UBOOT_LICENSE = GPL-2.0+
  9. ifeq ($(BR2_TARGET_UBOOT_LATEST_VERSION),y)
  10. UBOOT_LICENSE_FILES = Licenses/gpl-2.0.txt
  11. endif
  12. UBOOT_INSTALL_IMAGES = YES
  13. # u-boot 2020.01+ needs make 4.0+
  14. UBOOT_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY)
  15. UBOOT_MAKE = $(BR2_MAKE)
  16. ifeq ($(UBOOT_VERSION),custom)
  17. # Handle custom U-Boot tarballs as specified by the configuration
  18. UBOOT_TARBALL = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION))
  19. UBOOT_SITE = $(patsubst %/,%,$(dir $(UBOOT_TARBALL)))
  20. UBOOT_SOURCE = $(notdir $(UBOOT_TARBALL))
  21. else ifeq ($(BR2_TARGET_UBOOT_CUSTOM_GIT),y)
  22. UBOOT_SITE = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_REPO_URL))
  23. UBOOT_SITE_METHOD = git
  24. else ifeq ($(BR2_TARGET_UBOOT_CUSTOM_HG),y)
  25. UBOOT_SITE = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_REPO_URL))
  26. UBOOT_SITE_METHOD = hg
  27. else ifeq ($(BR2_TARGET_UBOOT_CUSTOM_SVN),y)
  28. UBOOT_SITE = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_REPO_URL))
  29. UBOOT_SITE_METHOD = svn
  30. else
  31. # Handle stable official U-Boot versions
  32. UBOOT_SITE = https://ftp.denx.de/pub/u-boot
  33. UBOOT_SOURCE = u-boot-$(UBOOT_VERSION).tar.bz2
  34. endif
  35. ifeq ($(BR2_TARGET_UBOOT)$(BR2_TARGET_UBOOT_LATEST_VERSION),y)
  36. BR_NO_CHECK_HASH_FOR += $(UBOOT_SOURCE)
  37. endif
  38. ifeq ($(BR2_TARGET_UBOOT_FORMAT_BIN),y)
  39. UBOOT_BINS += u-boot.bin
  40. endif
  41. ifeq ($(BR2_TARGET_UBOOT_FORMAT_ELF),y)
  42. UBOOT_BINS += u-boot
  43. # To make elf usable for debuging on ARC use special target
  44. ifeq ($(BR2_arc),y)
  45. UBOOT_MAKE_TARGET += mdbtrick
  46. endif
  47. endif
  48. # Call 'make all' unconditionally
  49. UBOOT_MAKE_TARGET += all
  50. ifeq ($(BR2_TARGET_UBOOT_FORMAT_KWB),y)
  51. UBOOT_BINS += u-boot.kwb
  52. UBOOT_MAKE_TARGET += u-boot.kwb
  53. endif
  54. ifeq ($(BR2_TARGET_UBOOT_FORMAT_AIS),y)
  55. UBOOT_BINS += u-boot.ais
  56. UBOOT_MAKE_TARGET += u-boot.ais
  57. endif
  58. ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND_BIN),y)
  59. UBOOT_BINS += u-boot-nand.bin
  60. endif
  61. ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMG),y)
  62. UBOOT_BINS += u-boot-dtb.img
  63. UBOOT_MAKE_TARGET += u-boot-dtb.img
  64. endif
  65. ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMX),y)
  66. UBOOT_BINS += u-boot-dtb.imx
  67. UBOOT_MAKE_TARGET += u-boot-dtb.imx
  68. endif
  69. ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_BIN),y)
  70. UBOOT_BINS += u-boot-dtb.bin
  71. UBOOT_MAKE_TARGET += u-boot-dtb.bin
  72. endif
  73. ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y)
  74. UBOOT_BINS += u-boot.img
  75. UBOOT_MAKE_TARGET += u-boot.img
  76. endif
  77. ifeq ($(BR2_TARGET_UBOOT_FORMAT_ITB),y)
  78. UBOOT_BINS += u-boot.itb
  79. UBOOT_MAKE_TARGET += u-boot.itb
  80. endif
  81. ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX),y)
  82. UBOOT_BINS += u-boot.imx
  83. UBOOT_MAKE_TARGET += u-boot.imx
  84. endif
  85. ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
  86. UBOOT_BINS += u-boot.sb
  87. UBOOT_MAKE_TARGET += u-boot.sb
  88. # mxsimage needs OpenSSL
  89. UBOOT_DEPENDENCIES += host-elftosb host-openssl
  90. endif
  91. ifeq ($(BR2_TARGET_UBOOT_FORMAT_SD),y)
  92. # BootStream (.sb) is generated by U-Boot, we convert it to SD format
  93. UBOOT_BINS += u-boot.sd
  94. UBOOT_MAKE_TARGET += u-boot.sb
  95. UBOOT_DEPENDENCIES += host-elftosb host-openssl
  96. endif
  97. ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND),y)
  98. UBOOT_BINS += u-boot.nand
  99. UBOOT_MAKE_TARGET += u-boot.sb
  100. UBOOT_DEPENDENCIES += host-elftosb host-openssl
  101. endif
  102. ifeq ($(BR2_TARGET_UBOOT_FORMAT_STM32),y)
  103. UBOOT_BINS += u-boot.stm32
  104. UBOOT_MAKE_TARGET += u-boot.stm32
  105. endif
  106. ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
  107. UBOOT_BINS += $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
  108. endif
  109. ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
  110. UBOOT_BINS += u-boot.bin
  111. UBOOT_BIN_IFT = u-boot.bin.ift
  112. endif
  113. # The kernel calls AArch64 'arm64', but U-Boot calls it just 'arm', so
  114. # we have to special case it. Similar for i386/x86_64 -> x86
  115. ifeq ($(KERNEL_ARCH),arm64)
  116. UBOOT_ARCH = arm
  117. else ifneq ($(filter $(KERNEL_ARCH),i386 x86_64),)
  118. UBOOT_ARCH = x86
  119. else
  120. UBOOT_ARCH = $(KERNEL_ARCH)
  121. endif
  122. UBOOT_MAKE_OPTS += \
  123. CROSS_COMPILE="$(TARGET_CROSS)" \
  124. ARCH=$(UBOOT_ARCH) \
  125. HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
  126. HOSTLDFLAGS="$(HOST_LDFLAGS)" \
  127. $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS))
  128. ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y)
  129. UBOOT_DEPENDENCIES += arm-trusted-firmware
  130. ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y)
  131. UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf
  132. else
  133. UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin
  134. endif
  135. endif
  136. ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y)
  137. UBOOT_DEPENDENCIES += host-dtc
  138. endif
  139. ifeq ($(BR2_TARGET_UBOOT_NEEDS_PYTHON2),y)
  140. UBOOT_DEPENDENCIES += host-python
  141. else ifeq ($(BR2_TARGET_UBOOT_NEEDS_PYTHON3),y)
  142. UBOOT_DEPENDENCIES += host-python3
  143. endif
  144. ifeq ($(BR2_TARGET_UBOOT_NEEDS_PYLIBFDT),y)
  145. UBOOT_DEPENDENCIES += host-swig
  146. endif
  147. ifeq ($(BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS),y)
  148. ifeq ($(BR2_TARGET_UBOOT_NEEDS_PYTHON2),y)
  149. UBOOT_DEPENDENCIES += host-python-pyelftools
  150. else ifeq ($(BR2_TARGET_UBOOT_NEEDS_PYTHON3),y)
  151. UBOOT_DEPENDENCIES += host-python3-pyelftools
  152. endif
  153. endif
  154. ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPENSSL),y)
  155. UBOOT_DEPENDENCIES += host-openssl
  156. endif
  157. ifeq ($(BR2_TARGET_UBOOT_NEEDS_LZOP),y)
  158. UBOOT_DEPENDENCIES += host-lzop
  159. endif
  160. # prior to u-boot 2013.10 the license info was in COPYING. Copy it so
  161. # legal-info finds it
  162. define UBOOT_COPY_OLD_LICENSE_FILE
  163. if [ -f $(@D)/COPYING ]; then \
  164. $(INSTALL) -m 0644 -D $(@D)/COPYING $(@D)/Licenses/gpl-2.0.txt; \
  165. fi
  166. endef
  167. UBOOT_POST_EXTRACT_HOOKS += UBOOT_COPY_OLD_LICENSE_FILE
  168. UBOOT_POST_RSYNC_HOOKS += UBOOT_COPY_OLD_LICENSE_FILE
  169. ifneq ($(ARCH_XTENSA_OVERLAY_FILE),)
  170. define UBOOT_XTENSA_OVERLAY_EXTRACT
  171. $(call arch-xtensa-overlay-extract,$(@D),u-boot)
  172. endef
  173. UBOOT_POST_EXTRACT_HOOKS += UBOOT_XTENSA_OVERLAY_EXTRACT
  174. UBOOT_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
  175. endif
  176. # Analogous code exists in linux/linux.mk. Basically, the generic
  177. # package infrastructure handles downloading and applying remote
  178. # patches. Local patches are handled depending on whether they are
  179. # directories or files.
  180. UBOOT_PATCHES = $(call qstrip,$(BR2_TARGET_UBOOT_PATCH))
  181. UBOOT_PATCH = $(filter ftp://% http://% https://%,$(UBOOT_PATCHES))
  182. define UBOOT_APPLY_LOCAL_PATCHES
  183. for p in $(filter-out ftp://% http://% https://%,$(UBOOT_PATCHES)) ; do \
  184. if test -d $$p ; then \
  185. $(APPLY_PATCHES) $(@D) $$p \*.patch || exit 1 ; \
  186. else \
  187. $(APPLY_PATCHES) $(@D) `dirname $$p` `basename $$p` || exit 1; \
  188. fi \
  189. done
  190. endef
  191. UBOOT_POST_PATCH_HOOKS += UBOOT_APPLY_LOCAL_PATCHES
  192. # Fixup inclusion of libfdt headers, which can fail in older u-boot versions
  193. # when libfdt-devel is installed system-wide.
  194. # The core change is equivalent to upstream commit
  195. # e0d20dc1521e74b82dbd69be53a048847798a90a (first in v2018.03). However, the fixup
  196. # is complicated by the fact that the underlying u-boot code changed multiple
  197. # times in history:
  198. # - The directory scripts/dtc/libfdt only exists since upstream commit
  199. # c0e032e0090d6541549b19cc47e06ccd1f302893 (first in v2017.11). For earlier
  200. # versions, create a dummy scripts/dtc/libfdt directory with symlinks for the
  201. # fdt-related files. This allows to use the same -I<path> option for both
  202. # cases.
  203. # - The variable 'srctree' used to be called 'SRCTREE' before upstream commit
  204. # 01286329b27b27eaeda045b469d41b1d9fce545a (first in v2014.04).
  205. # - The original location for libfdt, 'lib/libfdt/', used to be simply
  206. # 'libfdt' before upstream commit 0de71d507157c4bd4fddcd3a419140d2b986eed2
  207. # (first in v2010.06). Make the 'lib' part optional in the substitution to
  208. # handle this.
  209. define UBOOT_FIXUP_LIBFDT_INCLUDE
  210. $(Q)if [ ! -d $(@D)/scripts/dtc/libfdt ]; then \
  211. mkdir -p $(@D)/scripts/dtc/libfdt; \
  212. cd $(@D)/scripts/dtc/libfdt; \
  213. ln -s ../../../include/fdt.h .; \
  214. ln -s ../../../include/libfdt*.h .; \
  215. ln -s ../../../lib/libfdt/libfdt_internal.h .; \
  216. fi
  217. $(Q)$(SED) \
  218. 's%-I\ *\$$(srctree)/lib/libfdt%-I$$(srctree)/scripts/dtc/libfdt%; \
  219. s%-I\ *\$$(SRCTREE)\(/lib\)\?/libfdt%-I$$(SRCTREE)/scripts/dtc/libfdt%' \
  220. $(@D)/tools/Makefile
  221. endef
  222. UBOOT_POST_PATCH_HOOKS += UBOOT_FIXUP_LIBFDT_INCLUDE
  223. ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY),y)
  224. define UBOOT_CONFIGURE_CMDS
  225. $(TARGET_CONFIGURE_OPTS) \
  226. $(UBOOT_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
  227. $(UBOOT_BOARD_NAME)_config
  228. endef
  229. else ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG),y)
  230. ifeq ($(BR2_TARGET_UBOOT_USE_DEFCONFIG),y)
  231. UBOOT_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_TARGET_UBOOT_BOARD_DEFCONFIG))_defconfig
  232. else ifeq ($(BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG),y)
  233. UBOOT_KCONFIG_FILE = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE))
  234. endif # BR2_TARGET_UBOOT_USE_DEFCONFIG
  235. UBOOT_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES))
  236. UBOOT_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
  237. # UBOOT_MAKE_OPTS overrides HOSTCC / HOSTLDFLAGS to allow the build to
  238. # find our host-openssl. However, this triggers a bug in the kconfig
  239. # build script that causes it to build with /usr/include/ncurses.h
  240. # (which is typically wchar) but link with
  241. # $(HOST_DIR)/lib/libncurses.so (which is not). We don't actually
  242. # need any host-package for kconfig, so remove the HOSTCC/HOSTLDFLAGS
  243. # override again. In addition, host-ccache is not ready at kconfig
  244. # time, so use HOSTCC_NOCCACHE.
  245. UBOOT_KCONFIG_OPTS = $(UBOOT_MAKE_OPTS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTLDFLAGS=""
  246. define UBOOT_HELP_CMDS
  247. @echo ' uboot-menuconfig - Run U-Boot menuconfig'
  248. @echo ' uboot-savedefconfig - Run U-Boot savedefconfig'
  249. @echo ' uboot-update-defconfig - Save the U-Boot configuration to the path specified'
  250. @echo ' by BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE'
  251. endef
  252. endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
  253. UBOOT_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH))
  254. define UBOOT_BUILD_CMDS
  255. $(if $(UBOOT_CUSTOM_DTS_PATH),
  256. cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
  257. )
  258. $(TARGET_CONFIGURE_OPTS) \
  259. $(UBOOT_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
  260. $(UBOOT_MAKE_TARGET)
  261. $(if $(BR2_TARGET_UBOOT_FORMAT_SD),
  262. $(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
  263. $(if $(BR2_TARGET_UBOOT_FORMAT_NAND),
  264. $(@D)/tools/mxsboot \
  265. -w $(BR2_TARGET_UBOOT_FORMAT_NAND_PAGE_SIZE) \
  266. -o $(BR2_TARGET_UBOOT_FORMAT_NAND_OOB_SIZE) \
  267. -e $(BR2_TARGET_UBOOT_FORMAT_NAND_ERASE_SIZE) \
  268. nand $(@D)/u-boot.sb $(@D)/u-boot.nand)
  269. endef
  270. define UBOOT_BUILD_OMAP_IFT
  271. $(HOST_DIR)/bin/gpsign -f $(@D)/u-boot.bin \
  272. -c $(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG))
  273. endef
  274. define UBOOT_INSTALL_IMAGES_CMDS
  275. $(foreach f,$(UBOOT_BINS), \
  276. cp -dpf $(@D)/$(f) $(BINARIES_DIR)/
  277. )
  278. $(if $(BR2_TARGET_UBOOT_FORMAT_NAND),
  279. cp -dpf $(@D)/u-boot.sb $(BINARIES_DIR))
  280. $(if $(BR2_TARGET_UBOOT_SPL),
  281. $(foreach f,$(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME)), \
  282. cp -dpf $(@D)/$(f) $(BINARIES_DIR)/
  283. )
  284. )
  285. endef
  286. ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y)
  287. UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW))
  288. ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),)
  289. UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW)
  290. BR_NO_CHECK_HASH_FOR += $(notdir $(UBOOT_ZYNQMP_PMUFW))
  291. UBOOT_ZYNQMP_PMUFW_PATH = $(UBOOT_DL_DIR)/$(notdir $(UBOOT_ZYNQMP_PMUFW))
  292. else ifneq ($(UBOOT_ZYNQMP_PMUFW),)
  293. UBOOT_ZYNQMP_PMUFW_PATH = $(shell readlink -f $(UBOOT_ZYNQMP_PMUFW))
  294. endif
  295. define UBOOT_ZYNQMP_KCONFIG_PMUFW
  296. $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH)")
  297. endef
  298. UBOOT_ZYNQMP_PM_CFG = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PM_CFG))
  299. ifneq ($(UBOOT_ZYNQMP_PM_CFG),)
  300. UBOOT_ZYNQMP_PM_CFG_BIN = $(UBOOT_DIR)/pm_cfg_obj.bin
  301. define UBOOT_ZYNQMP_KCONFIG_PM_CFG
  302. $(call KCONFIG_SET_OPT,CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE,"$(UBOOT_ZYNQMP_PM_CFG_BIN)", \
  303. $(@D)/.config)
  304. endef
  305. define UBOOT_ZYNQMP_PM_CFG_CONVERT
  306. $(UBOOT_DIR)/tools/zynqmp_pm_cfg_obj_convert.py \
  307. "$(UBOOT_ZYNQMP_PM_CFG)" \
  308. "$(UBOOT_ZYNQMP_PM_CFG_BIN)"
  309. endef
  310. UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PM_CFG_CONVERT
  311. endif
  312. UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))
  313. UBOOT_ZYNQMP_PSU_INIT_PATH = $(shell readlink -f $(UBOOT_ZYNQMP_PSU_INIT))
  314. ifneq ($(UBOOT_ZYNQMP_PSU_INIT),)
  315. define UBOOT_ZYNQMP_KCONFIG_PSU_INIT
  316. $(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(UBOOT_ZYNQMP_PSU_INIT_PATH)")
  317. endef
  318. endif
  319. endif # BR2_TARGET_UBOOT_ZYNQMP
  320. define UBOOT_INSTALL_OMAP_IFT_IMAGE
  321. cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/
  322. endef
  323. ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
  324. ifeq ($(BR_BUILDING),y)
  325. ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG)),)
  326. $(error No gpsign config file. Check your BR2_TARGET_UBOOT_OMAP_IFT_CONFIG setting)
  327. endif
  328. ifeq ($(wildcard $(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG))),)
  329. $(error gpsign config file $(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG) not found. Check your BR2_TARGET_UBOOT_OMAP_IFT_CONFIG setting)
  330. endif
  331. endif
  332. UBOOT_DEPENDENCIES += host-omap-u-boot-utils
  333. UBOOT_POST_BUILD_HOOKS += UBOOT_BUILD_OMAP_IFT
  334. UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_INSTALL_OMAP_IFT_IMAGE
  335. endif
  336. ifeq ($(BR2_TARGET_UBOOT_ZYNQ_IMAGE),y)
  337. define UBOOT_GENERATE_ZYNQ_IMAGE
  338. $(HOST_DIR)/bin/python2 \
  339. $(HOST_DIR)/bin/zynq-boot-bin.py \
  340. -u $(@D)/$(firstword $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))) \
  341. -o $(BINARIES_DIR)/BOOT.BIN
  342. endef
  343. UBOOT_DEPENDENCIES += host-zynq-boot-bin
  344. UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_GENERATE_ZYNQ_IMAGE
  345. endif
  346. ifeq ($(BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC),y)
  347. ifeq ($(BR2_TARGET_UBOOT_SPL),y)
  348. UBOOT_CRC_ALTERA_SOCFPGA_INPUT_IMAGES = $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))
  349. UBOOT_CRC_ALTERA_SOCFPGA_HEADER_VERSION = 0
  350. else
  351. UBOOT_CRC_ALTERA_SOCFPGA_INPUT_IMAGES = u-boot-dtb.bin
  352. UBOOT_CRC_ALTERA_SOCFPGA_HEADER_VERSION = 1
  353. endif
  354. define UBOOT_CRC_ALTERA_SOCFPGA_IMAGE
  355. $(foreach f,$(UBOOT_CRC_ALTERA_SOCFPGA_INPUT_IMAGES), \
  356. $(HOST_DIR)/bin/mkpimage \
  357. -v $(UBOOT_CRC_ALTERA_SOCFPGA_HEADER_VERSION) \
  358. -o $(BINARIES_DIR)/$(notdir $(call qstrip,$(f))).crc \
  359. $(@D)/$(call qstrip,$(f))
  360. )
  361. endef
  362. UBOOT_DEPENDENCIES += host-mkpimage
  363. UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_ALTERA_SOCFPGA_IMAGE
  364. endif
  365. define UBOOT_KCONFIG_FIXUP_CMDS
  366. $(UBOOT_ZYNQMP_KCONFIG_PMUFW)
  367. $(UBOOT_ZYNQMP_KCONFIG_PM_CFG)
  368. $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT)
  369. endef
  370. ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy)
  371. #
  372. # Check U-Boot board name (for legacy) or the defconfig/custom config
  373. # file options (for kconfig)
  374. #
  375. ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY),y)
  376. ifeq ($(UBOOT_BOARD_NAME),)
  377. $(error No U-Boot board name set. Check your BR2_TARGET_UBOOT_BOARDNAME setting)
  378. endif # UBOOT_BOARD_NAME
  379. else ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG),y)
  380. ifeq ($(BR2_TARGET_UBOOT_USE_DEFCONFIG),y)
  381. ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_BOARD_DEFCONFIG)),)
  382. $(error No board defconfig name specified, check your BR2_TARGET_UBOOT_BOARD_DEFCONFIG setting)
  383. endif # qstrip BR2_TARGET_UBOOT_BOARD_DEFCONFIG
  384. endif # BR2_TARGET_UBOOT_USE_DEFCONFIG
  385. ifeq ($(BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG),y)
  386. ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE)),)
  387. $(error No board configuration file specified, check your BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE setting)
  388. endif # qstrip BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE
  389. endif # BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG
  390. endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
  391. #
  392. # Check custom version option
  393. #
  394. ifeq ($(BR2_TARGET_UBOOT_CUSTOM_VERSION),y)
  395. ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE)),)
  396. $(error No custom U-Boot version specified. Check your BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE setting)
  397. endif # qstrip BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE
  398. endif # BR2_TARGET_UBOOT_CUSTOM_VERSION
  399. #
  400. # Check custom tarball option
  401. #
  402. ifeq ($(BR2_TARGET_UBOOT_CUSTOM_TARBALL),y)
  403. ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION)),)
  404. $(error No custom U-Boot tarball specified. Check your BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION setting)
  405. endif # qstrip BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION
  406. endif # BR2_TARGET_UBOOT_CUSTOM_TARBALL
  407. #
  408. # Check Git/Mercurial repo options
  409. #
  410. ifeq ($(BR2_TARGET_UBOOT_CUSTOM_GIT)$(BR2_TARGET_UBOOT_CUSTOM_HG),y)
  411. ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_REPO_URL)),)
  412. $(error No custom U-Boot repository URL specified. Check your BR2_TARGET_UBOOT_CUSTOM_REPO_URL setting)
  413. endif # qstrip BR2_TARGET_UBOOT_CUSTOM_CUSTOM_REPO_URL
  414. ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION)),)
  415. $(error No custom U-Boot repository version specified. Check your BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION setting)
  416. endif # qstrip BR2_TARGET_UBOOT_CUSTOM_CUSTOM_REPO_VERSION
  417. endif # BR2_TARGET_UBOOT_CUSTOM_GIT || BR2_TARGET_UBOOT_CUSTOM_HG
  418. endif # BR2_TARGET_UBOOT && BR_BUILDING
  419. ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY),y)
  420. UBOOT_DEPENDENCIES += \
  421. $(BR2_BISON_HOST_DEPENDENCY) \
  422. $(BR2_FLEX_HOST_DEPENDENCY)
  423. $(eval $(generic-package))
  424. else ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG),y)
  425. UBOOT_MAKE_ENV = $(TARGET_MAKE_ENV)
  426. UBOOT_KCONFIG_DEPENDENCIES = \
  427. $(BR2_BISON_HOST_DEPENDENCY) \
  428. $(BR2_FLEX_HOST_DEPENDENCY)
  429. $(eval $(kconfig-package))
  430. endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY