uboot.mk 18 KB

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