Browse Source

uboot: add support for bundling ATF BL31 into U-Boot

Some ARM64 platforms (such as Allwinner A64/H5) have a boot process
where U-Boot encapsulates the BL31 part of the ARM trusted
firmware. For such platforms, we need to build ATF before U-Boot, and
pass a BL31 variable pointing to ATF bl31.bin to the U-Boot build
process.

This commit introduces a BR2_TARGET_UBOOT_NEEDS_ATF_BL31 variable to
achieve this.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
[Thomas:
 - Rename option to BR2_TARGET_UBOOT_NEEDS_ATF_BL31
 - Drop changes to arm-trusted-firmware.mk, they are taken care of by
   previous commits.
 - Improve Config.in help text
 - Add missing dependency on arm-trusted-firmware when
   BR2_TARGET_UBOOT_NEEDS_ATF_BL31 is enabled.
 - Use bl31.bin from $(BINARIES_DIR) instead of taking it from ATF's
   build dir.]
[Peter: depend on toplevel atf option and select bl31 option.  Ensure it
	cannot be enabled together with ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
	as that would cause circular dependencies]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Jagan Teki 7 years ago
parent
commit
2c4809e608
2 changed files with 17 additions and 0 deletions
  1. 12 0
      boot/uboot/Config.in
  2. 5 0
      boot/uboot/uboot.mk

+ 12 - 0
boot/uboot/Config.in

@@ -158,6 +158,18 @@ config BR2_TARGET_UBOOT_NEEDS_OPENSSL
 	  typically the case when the board configuration has
 	  typically the case when the board configuration has
 	  CONFIG_FIT_SIGNATURE enabled.
 	  CONFIG_FIT_SIGNATURE enabled.
 
 
+config BR2_TARGET_UBOOT_NEEDS_ATF_BL31
+	bool "U-Boot needs ATF BL31"
+	depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE
+	depend on !BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
+	select BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
+	help
+	  Some specific platforms (such as Allwinner A64/H5)
+	  encapsulate the BL31 part of ATF inside U-Boot. This option
+	  makes sure ATF gets built prior to U-Boot, and that the BL31
+	  variable pointing to ATF's BL31 binary, is passed during the
+	  Buildroot build.
+
 menu "U-Boot binary format"
 menu "U-Boot binary format"
 
 
 config BR2_TARGET_UBOOT_FORMAT_AIS
 config BR2_TARGET_UBOOT_FORMAT_AIS

+ 5 - 0
boot/uboot/uboot.mk

@@ -134,6 +134,11 @@ UBOOT_MAKE_OPTS += \
 	HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
 	HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
 	HOSTLDFLAGS="$(HOST_LDFLAGS)"
 	HOSTLDFLAGS="$(HOST_LDFLAGS)"
 
 
+ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y)
+UBOOT_DEPENDENCIES += arm-trusted-firmware
+UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin
+endif
+
 ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y)
 ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y)
 UBOOT_DEPENDENCIES += host-dtc
 UBOOT_DEPENDENCIES += host-dtc
 endif
 endif