uboot.mk 16 KB

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