All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board
@ 2020-02-13  5:52 sunil at amarulasolutions.com
  2020-02-13  5:52 ` [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399 sunil at amarulasolutions.com
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: sunil at amarulasolutions.com @ 2020-02-13  5:52 UTC (permalink / raw)
  To: buildroot

From: Suniel Mahesh <sunil@amarulasolutions.com>

This patch set does the following:
Fix ATF v2.2 build for rk3399 SoC's.
Add arm-gnu-a-toolchain package, which acts as a secondary bare metal toolchain
to build ATF. The required pre-built toolchain is taken from ARM developers site and
installed in host filesystem only.
Add rk3399 support for building ATF.
Add new defconfig file for roc-rk3399-pc.

The patch set is tested on roc-rk3399-pc, a rk3399 based target. 

Jagan Teki (1):
  boot/arm-trusted-firmware: Disable bin copy for rk3399

Suniel Mahesh (3):
  package/arm-gnu-a-toolchain: new package
  boot/arm-trusted-firmware: add support for rockchip rk3399
  configs/roc-rk3399-pc: new defconfig

 .gitlab-ci.yml                                     |  1 +
 DEVELOPERS                                         |  4 ++
 board/firefly/roc-rk3399-pc/extlinux.conf          |  4 ++
 board/firefly/roc-rk3399-pc/genimage.cfg           | 22 +++++++++
 board/firefly/roc-rk3399-pc/post-build.sh          |  5 ++
 board/firefly/roc-rk3399-pc/readme.txt             | 17 +++++++
 boot/arm-trusted-firmware/Config.in                |  2 +-
 boot/arm-trusted-firmware/arm-trusted-firmware.mk  |  4 ++
 configs/roc_pc_rk3399_defconfig                    | 53 ++++++++++++++++++++++
 .../arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash   |  3 ++
 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk | 27 +++++++++++
 11 files changed, 141 insertions(+), 1 deletion(-)
 create mode 100644 board/firefly/roc-rk3399-pc/extlinux.conf
 create mode 100644 board/firefly/roc-rk3399-pc/genimage.cfg
 create mode 100644 board/firefly/roc-rk3399-pc/post-build.sh
 create mode 100644 board/firefly/roc-rk3399-pc/readme.txt
 create mode 100644 configs/roc_pc_rk3399_defconfig
 create mode 100644 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash
 create mode 100644 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk

-- 
2.7.4

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-13  5:52 [Buildroot] [PATCH 0/4] Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board sunil at amarulasolutions.com
@ 2020-02-13  5:52 ` sunil at amarulasolutions.com
  2020-02-13  7:23   ` Sergey Matyukevich
  2020-02-13  5:52 ` [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package sunil at amarulasolutions.com
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 23+ messages in thread
From: sunil at amarulasolutions.com @ 2020-02-13  5:52 UTC (permalink / raw)
  To: buildroot

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."

So, select default binary boot images as *.bin only if it's not rk3399.

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

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

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Suniel Mahesh <sunil@amarulasolutions.com>
---
 boot/arm-trusted-firmware/Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in
index 373591d..0006931 100644
--- a/boot/arm-trusted-firmware/Config.in
+++ b/boot/arm-trusted-firmware/Config.in
@@ -155,7 +155,7 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG
 
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES
 	string "Binary boot images"
-	default "*.bin"
+	default "*.bin" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM!=rk3399
 	help
 	  Names of generated image files that are installed in the
 	  output images/ directory.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13  5:52 [Buildroot] [PATCH 0/4] Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board sunil at amarulasolutions.com
  2020-02-13  5:52 ` [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399 sunil at amarulasolutions.com
@ 2020-02-13  5:52 ` sunil at amarulasolutions.com
  2020-02-13  7:34   ` Sergey Matyukevich
  2020-02-13  5:52 ` [Buildroot] [PATCH 3/4] boot/arm-trusted-firmware: add support for rockchip rk3399 sunil at amarulasolutions.com
  2020-02-13  5:52 ` [Buildroot] [PATCH 4/4] configs/roc-rk3399-pc: new defconfig sunil at amarulasolutions.com
  3 siblings, 1 reply; 23+ messages in thread
From: sunil at amarulasolutions.com @ 2020-02-13  5:52 UTC (permalink / raw)
  To: buildroot

From: Suniel Mahesh <sunil@amarulasolutions.com>

arm trusted firmware requires a bare metal toolchain for its build.
Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
family processors to avoid the following build error.

make[3]: arm-none-eabi-gcc: Command not found

pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
/opt/gcc-arm-none-eabi.

https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
---
 .../arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash   |  3 +++
 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk | 27 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash
 create mode 100644 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk

diff --git a/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash
new file mode 100644
index 0000000..aa0a23a
--- /dev/null
+++ b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+#sha256 bb17109f0ee697254a5d4ae6e5e01440e3ea8f0277f2e8169bf95d07c7d5fe69 gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
+sha256 ac952d89ae0fc3543e81099e7d34917efc621f5def112eee843fd1ce755eca8c  gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
diff --git a/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk
new file mode 100644
index 0000000..74e0bee
--- /dev/null
+++ b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk
@@ -0,0 +1,27 @@
+################################################################################
+#
+# arm-gnu-a-toolchain
+#
+################################################################################
+
+ARM_GNU_A_TOOLCHAIN_SITE = https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel
+ARM_GNU_A_TOOLCHAIN_VERSION = 9.2-2019.12
+ARM_GNU_A_TOOLCHAIN_SOURCE = gcc-arm-$(ARM_GNU_A_TOOLCHAIN_VERSION)-x86_64-arm-none-eabi.tar.xz
+ARM_GNU_A_TOOLCHAIN_LICENSE = GPL-3.0+
+ARM_GNU_A_TOOLCHAIN_LICENSE_FILES =
+
+HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR = $(HOST_DIR)/opt/gcc-arm-none-eabi 
+
+define HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_CMDS
+    rm -rf $(HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR)
+    mkdir -p $(HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR)
+    cp -rf $(@D)/* $(HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR)
+
+    cd $(HOST_DIR)/bin && \
+	for i in $(HOST_DIR)/opt/gcc-arm-none-eabi/bin/*; do \
+        ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
+    done
+
+endef
+
+$(eval $(host-generic-package))
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 3/4] boot/arm-trusted-firmware: add support for rockchip rk3399
  2020-02-13  5:52 [Buildroot] [PATCH 0/4] Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board sunil at amarulasolutions.com
  2020-02-13  5:52 ` [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399 sunil at amarulasolutions.com
  2020-02-13  5:52 ` [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package sunil at amarulasolutions.com
@ 2020-02-13  5:52 ` sunil at amarulasolutions.com
  2020-02-14  8:25   ` Sergey Matyukevich
  2020-02-13  5:52 ` [Buildroot] [PATCH 4/4] configs/roc-rk3399-pc: new defconfig sunil at amarulasolutions.com
  3 siblings, 1 reply; 23+ messages in thread
From: sunil at amarulasolutions.com @ 2020-02-13  5:52 UTC (permalink / raw)
  To: buildroot

From: Suniel Mahesh <sunil@amarulasolutions.com>

Add support for TF-A image builds for Rockchip rk3399 chip.

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
---
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 3473701..cc757b5 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -90,6 +90,10 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
 ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
 endif
 
+ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM)),rk3399)
+ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-arm-gnu-a-toolchain
+endif
+
 ARM_TRUSTED_FIRMWARE_MAKE_TARGETS = all
 
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP),y)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 4/4] configs/roc-rk3399-pc: new defconfig
  2020-02-13  5:52 [Buildroot] [PATCH 0/4] Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board sunil at amarulasolutions.com
                   ` (2 preceding siblings ...)
  2020-02-13  5:52 ` [Buildroot] [PATCH 3/4] boot/arm-trusted-firmware: add support for rockchip rk3399 sunil at amarulasolutions.com
@ 2020-02-13  5:52 ` sunil at amarulasolutions.com
  2020-02-13  8:22   ` Jagan Teki
  3 siblings, 1 reply; 23+ messages in thread
From: sunil at amarulasolutions.com @ 2020-02-13  5:52 UTC (permalink / raw)
  To: buildroot

From: Suniel Mahesh <sunil@amarulasolutions.com>

This initial support includes:
Linux 5.4
U-Boot 2020.01
Arm Trusted Firmware v2.2
Buildroot default packages.

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
---
 .gitlab-ci.yml                            |  1 +
 DEVELOPERS                                |  4 +++
 board/firefly/roc-rk3399-pc/extlinux.conf |  4 +++
 board/firefly/roc-rk3399-pc/genimage.cfg  | 22 +++++++++++++
 board/firefly/roc-rk3399-pc/post-build.sh |  5 +++
 board/firefly/roc-rk3399-pc/readme.txt    | 17 ++++++++++
 configs/roc_pc_rk3399_defconfig           | 53 +++++++++++++++++++++++++++++++
 7 files changed, 106 insertions(+)
 create mode 100644 board/firefly/roc-rk3399-pc/extlinux.conf
 create mode 100644 board/firefly/roc-rk3399-pc/genimage.cfg
 create mode 100644 board/firefly/roc-rk3399-pc/post-build.sh
 create mode 100644 board/firefly/roc-rk3399-pc/readme.txt
 create mode 100644 configs/roc_pc_rk3399_defconfig

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a6436a8..8140243 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -301,6 +301,7 @@ raspberrypi4_64_defconfig: { extends: .defconfig }
 raspberrypi4_defconfig: { extends: .defconfig }
 raspberrypi_defconfig: { extends: .defconfig }
 riotboard_defconfig: { extends: .defconfig }
+roc_pc_rk3399_defconfig: { extends: .defconfig }
 rock64_defconfig: { extends: .defconfig }
 roseapplepi_defconfig: { extends: .defconfig }
 s6lx9_microboard_defconfig: { extends: .defconfig }
diff --git a/DEVELOPERS b/DEVELOPERS
index cb13035..a60c9fd 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2342,6 +2342,10 @@ N:	Steven Noonan <steven@uplinklabs.net>
 F:	package/hwloc/
 F:	package/powertop/
 
+N:	Suniel Mahesh <sunil@amarulasolutions.com>
+F:	board/firefly/
+F:	configs/roc_pc_rk3399_defconfig
+
 N:	Sven Haardiek <sven.haardiek@iotec-gmbh.de>
 F:	package/lcdproc/
 F:	package/python-influxdb/
diff --git a/board/firefly/roc-rk3399-pc/extlinux.conf b/board/firefly/roc-rk3399-pc/extlinux.conf
new file mode 100644
index 0000000..50a358f
--- /dev/null
+++ b/board/firefly/roc-rk3399-pc/extlinux.conf
@@ -0,0 +1,4 @@
+label RK3399RocPC linux
+  kernel /boot/Image
+  devicetree /boot/rk3399-roc-pc.dtb
+  append earlycon=uart8250,mmio32,0xff1a0000 root=/dev/mmcblk0p1 rootwait
diff --git a/board/firefly/roc-rk3399-pc/genimage.cfg b/board/firefly/roc-rk3399-pc/genimage.cfg
new file mode 100644
index 0000000..966c869
--- /dev/null
+++ b/board/firefly/roc-rk3399-pc/genimage.cfg
@@ -0,0 +1,22 @@
+image sdcard.img {
+	hdimage {
+	}
+
+	partition u-boot-tpl-spl-dtb {
+		in-partition-table = "no"
+		image = "idbloader.img"
+		offset = 32K
+	}
+
+	partition u-boot-dtb {
+		in-partition-table = "no"
+		image = "u-boot.itb"
+		offset = 8M
+		size = 30M
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+	}
+}
diff --git a/board/firefly/roc-rk3399-pc/post-build.sh b/board/firefly/roc-rk3399-pc/post-build.sh
new file mode 100644
index 0000000..1f5ff6a
--- /dev/null
+++ b/board/firefly/roc-rk3399-pc/post-build.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+
+install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf
diff --git a/board/firefly/roc-rk3399-pc/readme.txt b/board/firefly/roc-rk3399-pc/readme.txt
new file mode 100644
index 0000000..f8367fb
--- /dev/null
+++ b/board/firefly/roc-rk3399-pc/readme.txt
@@ -0,0 +1,17 @@
+Libre Computer Board ROC-RK3399-PC
+===================================
+
+ROC-RK3399-PC is highest performance platforms leveraging the popular
+Rockchip RK3399 SoC from Firefly and Libretech.
+
+Wiki link:
+https://wiki.amarulasolutions.com/bsp/rockchip/rk3399/roc-rk3399-pc.html
+
+Build:
+
+  $ make roc_pc_rk3399_defconfig
+  $ make
+
+--
+Suniel Mahesh <sunil@amarulasolutions.com>
+10-Feb-2020
diff --git a/configs/roc_pc_rk3399_defconfig b/configs/roc_pc_rk3399_defconfig
new file mode 100644
index 0000000..e5a82da
--- /dev/null
+++ b/configs/roc_pc_rk3399_defconfig
@@ -0,0 +1,53 @@
+# Architecture
+BR2_aarch64=y
+BR2_cortex_a72_a53=y
+
+# Linux headers same as kernel, a 5.4 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
+
+# Firmware
+BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL="https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="v2.2"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="rk3399"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31=y
+
+# Bootloader
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.01"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="roc-pc-rk3399"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
+BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y
+BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="idbloader.img"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.18"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="rockchip/rk3399-roc-pc"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+
+# Filesystem
+BR2_TARGET_GENERIC_HOSTNAME="roc-rk3399-pc"
+BR2_TARGET_GENERIC_ISSUE="Welcome to ROC-RK3399-PC!"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/firefly/roc-rk3399-pc/genimage.cfg"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/firefly/roc-rk3399-pc/post-build.sh"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-13  5:52 ` [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399 sunil at amarulasolutions.com
@ 2020-02-13  7:23   ` Sergey Matyukevich
  2020-02-13  8:06     ` Jagan Teki
  0 siblings, 1 reply; 23+ messages in thread
From: Sergey Matyukevich @ 2020-02-13  7:23 UTC (permalink / raw)
  To: buildroot

Hi, 

> 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."
> 
> So, select default binary boot images as *.bin only if it's not rk3399.
> 
> This fixes the atf build on rk3399 with v2.2.
> 
> Note: the same can be applied to rest of rockchip platforms if
> they use v2.2 TF-A.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> Tested-by: Suniel Mahesh <sunil@amarulasolutions.com>
> ---
>  boot/arm-trusted-firmware/Config.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

...

>  config BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES
>  	string "Binary boot images"
> -	default "*.bin"
> +	default "*.bin" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM!=rk3399
>  	help
>  	  Names of generated image files that are installed in the
>  	  output images/ directory.

IIUC, it should be customized in your board defconfig.

Regards,
Sergey

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13  5:52 ` [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package sunil at amarulasolutions.com
@ 2020-02-13  7:34   ` Sergey Matyukevich
  2020-02-13  8:10     ` Jagan Teki
  0 siblings, 1 reply; 23+ messages in thread
From: Sergey Matyukevich @ 2020-02-13  7:34 UTC (permalink / raw)
  To: buildroot

> arm trusted firmware requires a bare metal toolchain for its build.
> Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> family processors to avoid the following build error.
> 
> make[3]: arm-none-eabi-gcc: Command not found
> 
> pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> /opt/gcc-arm-none-eabi.
> 
> https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> 
> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
>

Hi,

Could you please clarify why a separate toolchain is required to build
ATF for this platform ? Is there any specific requirements other than
this particular build error ?

Regards,
Sergey

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-13  7:23   ` Sergey Matyukevich
@ 2020-02-13  8:06     ` Jagan Teki
  2020-02-14  4:20       ` Thomas Petazzoni
  0 siblings, 1 reply; 23+ messages in thread
From: Jagan Teki @ 2020-02-13  8:06 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 13, 2020 at 12:53 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
>
> Hi,
>
> > 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."
> >
> > So, select default binary boot images as *.bin only if it's not rk3399.
> >
> > This fixes the atf build on rk3399 with v2.2.
> >
> > Note: the same can be applied to rest of rockchip platforms if
> > they use v2.2 TF-A.
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > Tested-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > ---
> >  boot/arm-trusted-firmware/Config.in | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> ...
>
> >  config BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES
> >       string "Binary boot images"
> > -     default "*.bin"
> > +     default "*.bin" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM!=rk3399
> >       help
> >         Names of generated image files that are installed in the
> >         output images/ directory.
>
> IIUC, it should be customized in your board defconfig.

Not sure of it. Technically this is how rockchip SoC behaves wrt ATF
build. If we mark BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES="" to all
supporting boards of  rockchip start with rk3399, rk3288 etc.. it
ended up huge and meaningless change, IMHO.

Jagan.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13  7:34   ` Sergey Matyukevich
@ 2020-02-13  8:10     ` Jagan Teki
  2020-02-13  9:20       ` Sergey Matyukevich
  0 siblings, 1 reply; 23+ messages in thread
From: Jagan Teki @ 2020-02-13  8:10 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
>
> > arm trusted firmware requires a bare metal toolchain for its build.
> > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> > family processors to avoid the following build error.
> >
> > make[3]: arm-none-eabi-gcc: Command not found
> >
> > pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> > /opt/gcc-arm-none-eabi.
> >
> > https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> >
> > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> >
>
> Hi,
>
> Could you please clarify why a separate toolchain is required to build
> ATF for this platform ? Is there any specific requirements other than
> this particular build error ?

Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
and then environment should have arm32 cross toolchain to make it
build successfully.

I think, Sunil need to write something more on this requirement on
commit message.

Jagan.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 4/4] configs/roc-rk3399-pc: new defconfig
  2020-02-13  5:52 ` [Buildroot] [PATCH 4/4] configs/roc-rk3399-pc: new defconfig sunil at amarulasolutions.com
@ 2020-02-13  8:22   ` Jagan Teki
  0 siblings, 0 replies; 23+ messages in thread
From: Jagan Teki @ 2020-02-13  8:22 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 13, 2020 at 11:23 AM <sunil@amarulasolutions.com> wrote:
>
> From: Suniel Mahesh <sunil@amarulasolutions.com>
>
> This initial support includes:
> Linux 5.4
> U-Boot 2020.01
> Arm Trusted Firmware v2.2
> Buildroot default packages.
>
> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> ---
>  .gitlab-ci.yml                            |  1 +
>  DEVELOPERS                                |  4 +++
>  board/firefly/roc-rk3399-pc/extlinux.conf |  4 +++
>  board/firefly/roc-rk3399-pc/genimage.cfg  | 22 +++++++++++++
>  board/firefly/roc-rk3399-pc/post-build.sh |  5 +++
>  board/firefly/roc-rk3399-pc/readme.txt    | 17 ++++++++++
>  configs/roc_pc_rk3399_defconfig           | 53 +++++++++++++++++++++++++++++++
>  7 files changed, 106 insertions(+)
>  create mode 100644 board/firefly/roc-rk3399-pc/extlinux.conf
>  create mode 100644 board/firefly/roc-rk3399-pc/genimage.cfg
>  create mode 100644 board/firefly/roc-rk3399-pc/post-build.sh
>  create mode 100644 board/firefly/roc-rk3399-pc/readme.txt
>  create mode 100644 configs/roc_pc_rk3399_defconfig
>
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index a6436a8..8140243 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -301,6 +301,7 @@ raspberrypi4_64_defconfig: { extends: .defconfig }
>  raspberrypi4_defconfig: { extends: .defconfig }
>  raspberrypi_defconfig: { extends: .defconfig }
>  riotboard_defconfig: { extends: .defconfig }
> +roc_pc_rk3399_defconfig: { extends: .defconfig }
>  rock64_defconfig: { extends: .defconfig }
>  roseapplepi_defconfig: { extends: .defconfig }
>  s6lx9_microboard_defconfig: { extends: .defconfig }
> diff --git a/DEVELOPERS b/DEVELOPERS
> index cb13035..a60c9fd 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2342,6 +2342,10 @@ N:       Steven Noonan <steven@uplinklabs.net>
>  F:     package/hwloc/
>  F:     package/powertop/
>
> +N:     Suniel Mahesh <sunil@amarulasolutions.com>
> +F:     board/firefly/
> +F:     configs/roc_pc_rk3399_defconfig
> +
>  N:     Sven Haardiek <sven.haardiek@iotec-gmbh.de>
>  F:     package/lcdproc/
>  F:     package/python-influxdb/
> diff --git a/board/firefly/roc-rk3399-pc/extlinux.conf b/board/firefly/roc-rk3399-pc/extlinux.conf
> new file mode 100644
> index 0000000..50a358f
> --- /dev/null
> +++ b/board/firefly/roc-rk3399-pc/extlinux.conf
> @@ -0,0 +1,4 @@
> +label RK3399RocPC linux

s/RK3399RocPC/ROC-RK3399-PC

> +  kernel /boot/Image
> +  devicetree /boot/rk3399-roc-pc.dtb
> +  append earlycon=uart8250,mmio32,0xff1a0000 root=/dev/mmcblk0p1 rootwait
> diff --git a/board/firefly/roc-rk3399-pc/genimage.cfg b/board/firefly/roc-rk3399-pc/genimage.cfg
> new file mode 100644
> index 0000000..966c869
> --- /dev/null
> +++ b/board/firefly/roc-rk3399-pc/genimage.cfg
> @@ -0,0 +1,22 @@
> +image sdcard.img {
> +       hdimage {
> +       }
> +
> +       partition u-boot-tpl-spl-dtb {
> +               in-partition-table = "no"
> +               image = "idbloader.img"
> +               offset = 32K
> +       }
> +
> +       partition u-boot-dtb {
> +               in-partition-table = "no"
> +               image = "u-boot.itb"
> +               offset = 8M
> +               size = 30M
> +       }
> +
> +       partition rootfs {
> +               partition-type = 0x83
> +               image = "rootfs.ext4"
> +       }
> +}
> diff --git a/board/firefly/roc-rk3399-pc/post-build.sh b/board/firefly/roc-rk3399-pc/post-build.sh
> new file mode 100644
> index 0000000..1f5ff6a
> --- /dev/null
> +++ b/board/firefly/roc-rk3399-pc/post-build.sh
> @@ -0,0 +1,5 @@
> +#!/bin/sh
> +
> +BOARD_DIR="$(dirname $0)"
> +
> +install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf
> diff --git a/board/firefly/roc-rk3399-pc/readme.txt b/board/firefly/roc-rk3399-pc/readme.txt
> new file mode 100644
> index 0000000..f8367fb
> --- /dev/null
> +++ b/board/firefly/roc-rk3399-pc/readme.txt
> @@ -0,0 +1,17 @@
> +Libre Computer Board ROC-RK3399-PC
> +===================================
> +
> +ROC-RK3399-PC is highest performance platforms leveraging the popular
> +Rockchip RK3399 SoC from Firefly and Libretech.
> +
> +Wiki link:
> +https://wiki.amarulasolutions.com/bsp/rockchip/rk3399/roc-rk3399-pc.html
> +
> +Build:
> +
> +  $ make roc_pc_rk3399_defconfig
> +  $ make
> +

Add information about how to program the image?

Jagan.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13  8:10     ` Jagan Teki
@ 2020-02-13  9:20       ` Sergey Matyukevich
  2020-02-13  9:43         ` Jagan Teki
                           ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Sergey Matyukevich @ 2020-02-13  9:20 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 13, 2020 at 01:40:43PM +0530, Jagan Teki wrote:
> On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
> >
> > > arm trusted firmware requires a bare metal toolchain for its build.
> > > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> > > family processors to avoid the following build error.
> > >
> > > make[3]: arm-none-eabi-gcc: Command not found
> > >
> > > pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> > > /opt/gcc-arm-none-eabi.
> > >
> > > https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> > >
> > > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > >
> >
> > Hi,
> >
> > Could you please clarify why a separate toolchain is required to build
> > ATF for this platform ? Is there any specific requirements other than
> > this particular build error ?
> 
> Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> and then environment should have arm32 cross toolchain to make it
> build successfully.
> 
> I think, Sunil need to write something more on this requirement on
> commit message.

Well, I mean that other ATF firmwares can be built with standard buildroot
toolchain. I guess this is the case for Rockchip ATF as well. You just need
to specify available toolchain using environment variable or something.
In the worst case, some patch modifing Makefiles in Rockchip ATF
source tree is needed.

Regards,
Sergey

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13  9:20       ` Sergey Matyukevich
@ 2020-02-13  9:43         ` Jagan Teki
  2020-02-13 10:01         ` Sunil Kumar Mahesh
  2020-02-14  4:17         ` Thomas Petazzoni
  2 siblings, 0 replies; 23+ messages in thread
From: Jagan Teki @ 2020-02-13  9:43 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 13, 2020 at 2:50 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
>
> On Thu, Feb 13, 2020 at 01:40:43PM +0530, Jagan Teki wrote:
> > On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
> > >
> > > > arm trusted firmware requires a bare metal toolchain for its build.
> > > > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> > > > family processors to avoid the following build error.
> > > >
> > > > make[3]: arm-none-eabi-gcc: Command not found
> > > >
> > > > pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> > > > /opt/gcc-arm-none-eabi.
> > > >
> > > > https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> > > >
> > > > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > > >
> > >
> > > Hi,
> > >
> > > Could you please clarify why a separate toolchain is required to build
> > > ATF for this platform ? Is there any specific requirements other than
> > > this particular build error ?
> >
> > Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> > and then environment should have arm32 cross toolchain to make it
> > build successfully.
> >
> > I think, Sunil need to write something more on this requirement on
> > commit message.
>
> Well, I mean that other ATF firmwares can be built with standard buildroot
> toolchain. I guess this is the case for Rockchip ATF as well. You just need
> to specify available toolchain using environment variable or something.
> In the worst case, some patch modifing Makefiles in Rockchip ATF
> source tree is needed.

It is a known requirement that rockchip rk3399 AFT would require arm32
toolchain as well. For testing, if you try to build ATF manually w/o
the environment has arm32 toolchain, build would fail. Since it is not
supported earlier, Thomas has reverted rk3399 boards in previous
release. This is something similar to "32-bit code generation for
Armv8 targets" in this thread [1].

[1] http://lists.busybox.net/pipermail/buildroot/2019-February/242453.html

Jagan.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13  9:20       ` Sergey Matyukevich
  2020-02-13  9:43         ` Jagan Teki
@ 2020-02-13 10:01         ` Sunil Kumar Mahesh
  2020-02-14  4:19           ` Thomas Petazzoni
  2020-02-14  4:17         ` Thomas Petazzoni
  2 siblings, 1 reply; 23+ messages in thread
From: Sunil Kumar Mahesh @ 2020-02-13 10:01 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 13, 2020 at 2:50 PM Sergey Matyukevich <geomatsi@gmail.com>
wrote:

> On Thu, Feb 13, 2020 at 01:40:43PM +0530, Jagan Teki wrote:
> > On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com>
> wrote:
> > >
> > > > arm trusted firmware requires a bare metal toolchain for its build.
> > > > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm
> Cortex-A
> > > > family processors to avoid the following build error.
> > > >
> > > > make[3]: arm-none-eabi-gcc: Command not found
> > > >
> > > > pre-built bate metal ARM GNU-A toolchain installs into the host file
> system folder
> > > > /opt/gcc-arm-none-eabi.
> > > >
> > > >
> https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> > > >
> > > > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > > >
> > >
> > > Hi,
> > >
> > > Could you please clarify why a separate toolchain is required to build
> > > ATF for this platform ? Is there any specific requirements other than
> > > this particular build error ?
> >
> > Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> > and then environment should have arm32 cross toolchain to make it
> > build successfully.
> >
> > I think, Sunil need to write something more on this requirement on
> > commit message.
>
> Well, I mean that other ATF firmwares can be built with standard buildroot
> toolchain. I guess this is the case for Rockchip ATF as well. You just need
> to specify available toolchain using environment variable or something.
> In the worst case, some patch modifing Makefiles in Rockchip ATF
> source tree is needed.
>

One of the requirements to build ATF is to have Baremetal GNU GCC tools.
This is stated in
ATF documentation (ATF/docs/getting_started/user-guide.rst - section Tools)

Suniel

>
> Regards,
> Sergey
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200213/c7734b51/attachment.html>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13  9:20       ` Sergey Matyukevich
  2020-02-13  9:43         ` Jagan Teki
  2020-02-13 10:01         ` Sunil Kumar Mahesh
@ 2020-02-14  4:17         ` Thomas Petazzoni
  2 siblings, 0 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2020-02-14  4:17 UTC (permalink / raw)
  To: buildroot

On Thu, 13 Feb 2020 12:20:05 +0300
Sergey Matyukevich <geomatsi@gmail.com> wrote:

> > > Could you please clarify why a separate toolchain is required to build
> > > ATF for this platform ? Is there any specific requirements other than
> > > this particular build error ?  
> > 
> > Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> > and then environment should have arm32 cross toolchain to make it
> > build successfully.
> > 
> > I think, Sunil need to write something more on this requirement on
> > commit message.  
> 
> Well, I mean that other ATF firmwares can be built with standard buildroot
> toolchain. I guess this is the case for Rockchip ATF as well. You just need
> to specify available toolchain using environment variable or something.
> In the worst case, some patch modifing Makefiles in Rockchip ATF
> source tree is needed.

No, this is not correct. Depending on the platform, ATF may include
code that runs on ARM32 co-processors, and ARM32 code cannot be built
with an ARM64 toolchain.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package
  2020-02-13 10:01         ` Sunil Kumar Mahesh
@ 2020-02-14  4:19           ` Thomas Petazzoni
  0 siblings, 0 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2020-02-14  4:19 UTC (permalink / raw)
  To: buildroot

On Thu, 13 Feb 2020 15:31:59 +0530
Sunil Kumar Mahesh <sunil@amarulasolutions.com> wrote:

> One of the requirements to build ATF is to have Baremetal GNU GCC tools.
> This is stated in
> ATF documentation (ATF/docs/getting_started/user-guide.rst - section Tools)

No, the problem is not to have access to baremetal GC tools. On most
platforms we built ATF with a non-bare metal toolchain, and this works
just fine.

What justifies adding this toolchain is that the target platform is
ARM64, but ATF needs to be built bits of code for some ARM32
co-processor, and you can't build ARM32 code with an ARM64 toolchain.

Since all we need for ARM32 is to build bare-metal code, we use a
bare-metal ARM32 toolchain for that. But everything else in ATF will be
built by the regular non-bare-metal ARM64 toolchain built by Buildroot.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-13  8:06     ` Jagan Teki
@ 2020-02-14  4:20       ` Thomas Petazzoni
  2020-02-14  6:55         ` Jagan Teki
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Petazzoni @ 2020-02-14  4:20 UTC (permalink / raw)
  To: buildroot

On Thu, 13 Feb 2020 13:36:53 +0530
Jagan Teki <jagan@amarulasolutions.com> wrote:

> > >  config BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES
> > >       string "Binary boot images"
> > > -     default "*.bin"
> > > +     default "*.bin" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM!=rk3399
> > >       help
> > >         Names of generated image files that are installed in the
> > >         output images/ directory.  
> >
> > IIUC, it should be customized in your board defconfig.  
> 
> Not sure of it. Technically this is how rockchip SoC behaves wrt ATF
> build. If we mark BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES="" to all
> supporting boards of  rockchip start with rk3399, rk3288 etc.. it
> ended up huge and meaningless change, IMHO.

Sergey is right here: I don't think we want to encode platform-specific
stuff like this in Kconfig files.

What is the problem if you leave this to the default of *.bin ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-14  4:20       ` Thomas Petazzoni
@ 2020-02-14  6:55         ` Jagan Teki
  2020-02-14  7:26           ` Thomas Petazzoni
  0 siblings, 1 reply; 23+ messages in thread
From: Jagan Teki @ 2020-02-14  6:55 UTC (permalink / raw)
  To: buildroot

On Fri, Feb 14, 2020 at 9:50 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Thu, 13 Feb 2020 13:36:53 +0530
> Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> > > >  config BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES
> > > >       string "Binary boot images"
> > > > -     default "*.bin"
> > > > +     default "*.bin" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM!=rk3399
> > > >       help
> > > >         Names of generated image files that are installed in the
> > > >         output images/ directory.
> > >
> > > IIUC, it should be customized in your board defconfig.
> >
> > Not sure of it. Technically this is how rockchip SoC behaves wrt ATF
> > build. If we mark BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES="" to all
> > supporting boards of  rockchip start with rk3399, rk3288 etc.. it
> > ended up huge and meaningless change, IMHO.
>
> Sergey is right here: I don't think we want to encode platform-specific
> stuff like this in Kconfig files.
>
> What is the problem if you leave this to the default of *.bin ?

Is looking for *.bin in build/rk3399/release/*.bin but v2.2 is not
creating any bin since rk3399 (or rockchip) doesn't need bins.

.mk file change:

define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
        $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
                cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
        )

Build log:

>>> arm-trusted-firmware v2.2 Installing to images directory
cp -dpf /mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin
/mnt/out/images/
cp: cannot stat
'/mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin':
No such file or directory
package/pkg-generic.mk:339: recipe for target
'/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed'
failed
make[1]: *** [/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed]
Error 1
Makefile:23: recipe for target '_all' failed
make: *** [_all] Error 2

So, we have tried 3 set of changes

1. Kconfig (like in this patch)
2. *.mk check for rk3399, and v2.2 to not to execute above foreach loop
3. defined BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES="" board defconfig

Out of the above 3 possibilities, option 1) seem meaningful for me.
Let us know your comments?

Jagan.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-14  6:55         ` Jagan Teki
@ 2020-02-14  7:26           ` Thomas Petazzoni
  2020-02-14  7:34             ` Jagan Teki
  2020-02-14 10:57             ` Sunil Kumar Mahesh
  0 siblings, 2 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2020-02-14  7:26 UTC (permalink / raw)
  To: buildroot

On Fri, 14 Feb 2020 12:25:37 +0530
Jagan Teki <jagan@amarulasolutions.com> wrote:

> > Sergey is right here: I don't think we want to encode platform-specific
> > stuff like this in Kconfig files.
> >
> > What is the problem if you leave this to the default of *.bin ?  
> 
> Is looking for *.bin in build/rk3399/release/*.bin but v2.2 is not
> creating any bin since rk3399 (or rockchip) doesn't need bins.
> 
> .mk file change:
> 
> define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
>         $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
>                 cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
>         )
> 
> Build log:
> 
> >>> arm-trusted-firmware v2.2 Installing to images directory  
> cp -dpf /mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin
> /mnt/out/images/
> cp: cannot stat
> '/mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin':
> No such file or directory
> package/pkg-generic.mk:339: recipe for target
> '/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed'
> failed
> make[1]: *** [/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed]
> Error 1
> Makefile:23: recipe for target '_all' failed
> make: *** [_all] Error 2

What is your image name then? You don't install any image?

One possibility is to change:

-         $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
+         $(foreach f,$(wilard $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES))), \

But still, it would be nice to understand what is your image name. I
guess I could find that out by doing a build, though :)

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-14  7:26           ` Thomas Petazzoni
@ 2020-02-14  7:34             ` Jagan Teki
  2020-02-14 10:57             ` Sunil Kumar Mahesh
  1 sibling, 0 replies; 23+ messages in thread
From: Jagan Teki @ 2020-02-14  7:34 UTC (permalink / raw)
  To: buildroot

On Fri, Feb 14, 2020 at 12:56 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Fri, 14 Feb 2020 12:25:37 +0530
> Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> > > Sergey is right here: I don't think we want to encode platform-specific
> > > stuff like this in Kconfig files.
> > >
> > > What is the problem if you leave this to the default of *.bin ?
> >
> > Is looking for *.bin in build/rk3399/release/*.bin but v2.2 is not
> > creating any bin since rk3399 (or rockchip) doesn't need bins.
> >
> > .mk file change:
> >
> > define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
> >         $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
> >                 cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
> >         )
> >
> > Build log:
> >
> > >>> arm-trusted-firmware v2.2 Installing to images directory
> > cp -dpf /mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin
> > /mnt/out/images/
> > cp: cannot stat
> > '/mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin':
> > No such file or directory
> > package/pkg-generic.mk:339: recipe for target
> > '/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed'
> > failed
> > make[1]: *** [/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed]
> > Error 1
> > Makefile:23: recipe for target '_all' failed
> > make: *** [_all] Error 2
>
> What is your image name then? You don't install any image?

As I said, the image that required for rk3399 is elf  it is bl31.elf.

We have enabled BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF in defconfig on
this series. elf copy is already supported in buildroot on this commit
cab8bd3b46badb11e734e64747aee848c2b4282d

Jagan.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 3/4] boot/arm-trusted-firmware: add support for rockchip rk3399
  2020-02-13  5:52 ` [Buildroot] [PATCH 3/4] boot/arm-trusted-firmware: add support for rockchip rk3399 sunil at amarulasolutions.com
@ 2020-02-14  8:25   ` Sergey Matyukevich
  2020-02-14  9:35     ` Sunil Kumar Mahesh
  0 siblings, 1 reply; 23+ messages in thread
From: Sergey Matyukevich @ 2020-02-14  8:25 UTC (permalink / raw)
  To: buildroot

> Add support for TF-A image builds for Rockchip rk3399 chip.
> 
> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> ---
>  boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> index 3473701..cc757b5 100644
> --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> @@ -90,6 +90,10 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
>  ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
>  endif
>  
> +ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM)),rk3399)
> +ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-arm-gnu-a-toolchain
> +endif
> +

As per explanation by Thomas and Jagan, RK3399 ATF needs 32bit ARM
toolchain. Taking into account that different vendors may re-use
the same hardware blocks, it probably makes sense to describe this
dependency in a more generic way, not specific to RK3399 chip.

Following the existing patterns in ATF package mk file, new ATF
config option can be introduced:

diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 34737018aa..160884e0ff 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -75,6 +75,10 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UB
 ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot
 endif
 
+ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_32BIT_ARM_REQUIRED),y)
+ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-arm-gnu-a-toolchain
+endif
+
 ifeq ($(BR2_TARGET_VEXPRESS_FIRMWARE),y)

This option BR2_TARGET_ARM_TRUSTED_FIRMWARE_32BIT_ARM_REQUIRED then
can be specified in a defconfig for specific board.

Thoughts ? Comments ?

Regards,
Sergey

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 3/4] boot/arm-trusted-firmware: add support for rockchip rk3399
  2020-02-14  8:25   ` Sergey Matyukevich
@ 2020-02-14  9:35     ` Sunil Kumar Mahesh
  0 siblings, 0 replies; 23+ messages in thread
From: Sunil Kumar Mahesh @ 2020-02-14  9:35 UTC (permalink / raw)
  To: buildroot

On Fri, Feb 14, 2020 at 1:55 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
>
> > Add support for TF-A image builds for Rockchip rk3399 chip.
> >
> > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > ---
> >  boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> > index 3473701..cc757b5 100644
> > --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> > +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> > @@ -90,6 +90,10 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
> >  ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
> >  endif
> >
> > +ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM)),rk3399)
> > +ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-arm-gnu-a-toolchain
> > +endif
> > +
>
> As per explanation by Thomas and Jagan, RK3399 ATF needs 32bit ARM
> toolchain. Taking into account that different vendors may re-use
> the same hardware blocks, it probably makes sense to describe this
> dependency in a more generic way, not specific to RK3399 chip.
>
> Following the existing patterns in ATF package mk file, new ATF
> config option can be introduced:
>
> diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> index 34737018aa..160884e0ff 100644
> --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> @@ -75,6 +75,10 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UB
>  ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot
>  endif
>
> +ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_32BIT_ARM_REQUIRED),y)
> +ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-arm-gnu-a-toolchain
> +endif
> +
>  ifeq ($(BR2_TARGET_VEXPRESS_FIRMWARE),y)
>
> This option BR2_TARGET_ARM_TRUSTED_FIRMWARE_32BIT_ARM_REQUIRED then
> can be specified in a defconfig for specific board.
>
> Thoughts ? Comments ?

This will add an extra config option per board (which has such
requirement). Is it an appropriate solution ?
Suniel
>
> Regards,
> Sergey

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-14  7:26           ` Thomas Petazzoni
  2020-02-14  7:34             ` Jagan Teki
@ 2020-02-14 10:57             ` Sunil Kumar Mahesh
  2020-02-14 12:33               ` Sunil Kumar Mahesh
  1 sibling, 1 reply; 23+ messages in thread
From: Sunil Kumar Mahesh @ 2020-02-14 10:57 UTC (permalink / raw)
  To: buildroot

On Fri, Feb 14, 2020 at 12:56 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Fri, 14 Feb 2020 12:25:37 +0530
> Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> > > Sergey is right here: I don't think we want to encode platform-specific
> > > stuff like this in Kconfig files.
> > >
> > > What is the problem if you leave this to the default of *.bin ?
> >
> > Is looking for *.bin in build/rk3399/release/*.bin but v2.2 is not
> > creating any bin since rk3399 (or rockchip) doesn't need bins.
> >
> > .mk file change:
> >
> > define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
> >         $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
> >                 cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
> >         )
> >
> > Build log:
> >
> > >>> arm-trusted-firmware v2.2 Installing to images directory
> > cp -dpf /mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin
> > /mnt/out/images/
> > cp: cannot stat
> > '/mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin':
> > No such file or directory
> > package/pkg-generic.mk:339: recipe for target
> > '/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed'
> > failed
> > make[1]: *** [/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed]
> > Error 1
> > Makefile:23: recipe for target '_all' failed
> > make: *** [_all] Error 2
>
> What is your image name then? You don't install any image?
>
> One possibility is to change:
>
> -         $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
> +         $(foreach f,$(wilard $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES))), \
>

Yes wildcard function is working. tested with the above change in BR.
Suniel

> But still, it would be nice to understand what is your image name. I
> guess I could find that out by doing a build, though :)
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399
  2020-02-14 10:57             ` Sunil Kumar Mahesh
@ 2020-02-14 12:33               ` Sunil Kumar Mahesh
  0 siblings, 0 replies; 23+ messages in thread
From: Sunil Kumar Mahesh @ 2020-02-14 12:33 UTC (permalink / raw)
  To: buildroot

On Fri, Feb 14, 2020 at 4:27 PM Sunil Kumar Mahesh
<sunil@amarulasolutions.com> wrote:
>
> On Fri, Feb 14, 2020 at 12:56 PM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > On Fri, 14 Feb 2020 12:25:37 +0530
> > Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > > > Sergey is right here: I don't think we want to encode platform-specific
> > > > stuff like this in Kconfig files.
> > > >
> > > > What is the problem if you leave this to the default of *.bin ?
> > >
> > > Is looking for *.bin in build/rk3399/release/*.bin but v2.2 is not
> > > creating any bin since rk3399 (or rockchip) doesn't need bins.
> > >
> > > .mk file change:
> > >
> > > define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
> > >         $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
> > >                 cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
> > >         )
> > >
> > > Build log:
> > >
> > > >>> arm-trusted-firmware v2.2 Installing to images directory
> > > cp -dpf /mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin
> > > /mnt/out/images/
> > > cp: cannot stat
> > > '/mnt/out/build/arm-trusted-firmware-v2.2/build/rk3399/release/*.bin':
> > > No such file or directory
> > > package/pkg-generic.mk:339: recipe for target
> > > '/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed'
> > > failed
> > > make[1]: *** [/mnt/out/build/arm-trusted-firmware-v2.2/.stamp_images_installed]
> > > Error 1
> > > Makefile:23: recipe for target '_all' failed
> > > make: *** [_all] Error 2
> >
> > What is your image name then? You don't install any image?
> >
> > One possibility is to change:
> >
> > -         $(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
> > +         $(foreach f,$(wilard $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES))), \
> >
>
> Yes wildcard function is working. tested with the above change in BR.
> Suniel

Sorry, my bad, need to test other targets which might depend on this
changeset. will update
Suniel
>
> > But still, it would be nice to understand what is your image name. I
> > guess I could find that out by doing a build, though :)
> >
> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-02-14 12:33 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13  5:52 [Buildroot] [PATCH 0/4] Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board sunil at amarulasolutions.com
2020-02-13  5:52 ` [Buildroot] [PATCH 1/4] boot/arm-trusted-firmware: Disable bin copy for rk3399 sunil at amarulasolutions.com
2020-02-13  7:23   ` Sergey Matyukevich
2020-02-13  8:06     ` Jagan Teki
2020-02-14  4:20       ` Thomas Petazzoni
2020-02-14  6:55         ` Jagan Teki
2020-02-14  7:26           ` Thomas Petazzoni
2020-02-14  7:34             ` Jagan Teki
2020-02-14 10:57             ` Sunil Kumar Mahesh
2020-02-14 12:33               ` Sunil Kumar Mahesh
2020-02-13  5:52 ` [Buildroot] [PATCH 2/4] package/arm-gnu-a-toolchain: new package sunil at amarulasolutions.com
2020-02-13  7:34   ` Sergey Matyukevich
2020-02-13  8:10     ` Jagan Teki
2020-02-13  9:20       ` Sergey Matyukevich
2020-02-13  9:43         ` Jagan Teki
2020-02-13 10:01         ` Sunil Kumar Mahesh
2020-02-14  4:19           ` Thomas Petazzoni
2020-02-14  4:17         ` Thomas Petazzoni
2020-02-13  5:52 ` [Buildroot] [PATCH 3/4] boot/arm-trusted-firmware: add support for rockchip rk3399 sunil at amarulasolutions.com
2020-02-14  8:25   ` Sergey Matyukevich
2020-02-14  9:35     ` Sunil Kumar Mahesh
2020-02-13  5:52 ` [Buildroot] [PATCH 4/4] configs/roc-rk3399-pc: new defconfig sunil at amarulasolutions.com
2020-02-13  8:22   ` Jagan Teki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.