diff mbox series

[v4,1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399

Message ID 1584614812-20061-2-git-send-email-sunil@amarulasolutions.com
State Superseded
Headers show
Series Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board | expand

Commit Message

Suniel Mahesh March 19, 2020, 10:46 a.m. UTC
From: Jagan Teki <jagan@amarulasolutions.com>

Unlike other SoC platforms, rockchip platforms doesn't require a binary
generation on TF-A project.

This is due to rockchip platforms have non-continuous memory areas in
the linker script with a huge gap between them, so generating the binary
would require addition padding which indeed increases the size of the binary.

Interestingly this binary generation is disabled in v2.2 of TF-A on below
commit:
 commit <33218d2a8143> "rockchip: Disable binary generation for all SoCs."

Buildroot generally looks for a *.bin in the TF-A build directory but v2.2 is
not creating any bin since rk3399 (or rockchip) doesn't need bins, because of
which build fails.

This changeset checks for a *.bin in the respective TF-A build directory, if
available it copies to the output directory, otherwise skips copy.

This fixes the atf build on rk3399 with v2.2 and above.

Note: the same can be applied to rest of rockchip platforms if
they use v2.2 TF-A and above.

Cc: linux-amarula@amarulasolutions.com
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v4:
- no changes

Changes for v3:
- Based on suggestions from sergey and thomas, instead of encoding
  platform-specific stuff in config files, made changes in .mk files
  based on the build flow.
- Tested on roc-rk3399-pc, a rk3399 based target. Compile tested for orangepi 

Changes for v2:
- added Cc tag.

 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni March 20, 2020, 10:13 p.m. UTC | #1
Hello Sunil,

On Thu, 19 Mar 2020 16:16:49 +0530
sunil@amarulasolutions.com wrote:

>  define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
> +if [ -e $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/*.bin ]; then \
>  	$(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
> -		cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
> -	)
> +		cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/ \
> +	) ; \
> +fi

I'm sorry, but this is still not good. First, why checking for *.bin ?
The value of $(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES) can be something
else ?

In your case, the solution is simple: define
BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES to the empty value in your
defconfig. This loop will then install nothing, which is what you want.

Best regards,

Thomas
diff mbox series

Patch

diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 3473701..7722954 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -150,9 +150,11 @@  define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
 endef
 
 define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
+if [ -e $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/*.bin ]; then \
 	$(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
-		cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
-	)
+		cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/ \
+	) ; \
+fi
 	$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL)
 	$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL_ELF)
 endef