Skip to contentSkip to conversation

Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board

PATCH Superseded sunil at amarulasolutions.com 1 participant 12 messages Mar 18, 2020

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board

From: Suniel Mahesh <[email protected]>

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 for Rockchip rk3399 platform (has a cortex-m0 core). 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.
Update DEVELOPERS file.

The patch set is tested on roc-rk3399-pc, a rk3399 based target. Compile tested on orangepi.
---
Changes for v3:
Added one patch to this series. Split one changeset from patch #4 and made
it patch #5
patch #1 (Disable bin copy for rk3399)
- 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.
patch #2 (new package)
- no change
patch #3 (add support for rockchip rk3399)
- no change
patch #4 (new defconfig)
- dropped DEVELOPERS file
patch #5 (Add me as a co-maintainer)
- seperated this changeset

Changes for v2:
Changed cover letter description to add more meaning.
patch #1 (Disable bin copy for rk3399)
- Added Cc tag
patch #2 (new package)
- More Description added to justify why a secondary bare metal toolchain is required patch #3 (add support for rockchip rk3399)
- no change
patch #4 (new defconfig)
- updated readme.txt to help with the build/boot process
- modified file permissions of post-build.sh to 'x'

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

Suniel Mahesh (4):
package/arm-gnu-a-toolchain: new package boot/arm-trusted-firmware: add support for rockchip rk3399 configs/roc-rk3399-pc: new defconfig
DEVELOPERS: add me as a co-maintainer for rk3399 based targets

 .gitlab-ci.yml                                     |  1 +
 DEVELOPERS                                         |  3 ++
 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             | 48 ++++++++++++++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk  | 10 +++-
 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 +++++++++++
 10 files changed, 174 insertions(+), 2 deletions(-)
 create mode 100644 board/firefly/roc-rk3399-pc/extlinux.conf
 create mode 100644 board/firefly/roc-rk3399-pc/genimage.cfg
 create mode 100755 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
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/5 boot/arm-trusted-firmware: Disable bin copy for rk3399

From: Jagan Teki <[email protected]>

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 at amarulasolutions.com

---
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(-)
boot/arm-trusted-firmware/arm-trusted-firmware.mk +4 -2
index 3473701..7722954 100644
@@ -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
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 1/5 boot/arm-trusted-firmware: Disable bin copy for rk3399

On Wed, Mar 18, 2020 at 7:01 PM <[email protected]> wrote:

Ignore this patch.

Suniel

Quoted 63 lines

From: Jagan Teki <[email protected]>

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 at amarulasolutions.com

---
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(-)
boot/arm-trusted-firmware/arm-trusted-firmware.mk +4 -3
index 3473701..7722954 100644
@@ -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
--

2.7.4

#3 lore raw

PATCH v3 2/5 package/arm-gnu-a-toolchain: new package

In reply to sunil at amarulasolutions.com

From: Suniel Mahesh <[email protected]>

arm trusted firmware requires a bare metal toolchain to build Rockchip rk3399 platform and rk3399 has a cortex-m0 core. 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

---
Changes for v3:
- no change

Changes for v2:
- Added lines in description regarding why bare metal toolchain is required, as suggested by Jagan and pointed out by Sergey

 .../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
package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash new file +3 -0
new file mode 100644
index 0000000..aa0a23a
@@ -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
package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk new file +27 -0
new file mode 100644
index 0000000..55dce4d
@@ -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))
Signature · 1 line
2.7.4
#4 lore raw

PATCH v3 2/5 package/arm-gnu-a-toolchain: new package

On Wed, Mar 18, 2020 at 7:02 PM <[email protected]> wrote:

Ignore this patch.

Suniel

Quoted 75 lines

From: Suniel Mahesh <[email protected]>

arm trusted firmware requires a bare metal toolchain to build Rockchip rk3399 platform and rk3399 has a cortex-m0 core. 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

---
Changes for v3:
- no change

Changes for v2:
- Added lines in description regarding why bare metal toolchain is required, as suggested by Jagan and pointed out by Sergey

 .../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
package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash new file +3 -0
new file mode 100644
index 0000000..aa0a23a
@@ -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
package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk new file +27 -1
new file mode 100644
index 0000000..55dce4d
@@ -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

#5 lore raw

PATCH v3 3/5 boot/arm-trusted-firmware: add support for rockchip rk3399

In reply to sunil at amarulasolutions.com

From: Suniel Mahesh <[email protected]>

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

---
Changes for v3:
- no change

Changes for v2:
- no changes

 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
 1 file changed, 4 insertions(+)
boot/arm-trusted-firmware/arm-trusted-firmware.mk +4 -0
index 7722954..3002f5f 100644
@@ -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)
Signature · 1 line
2.7.4
#6 lore raw

PATCH v3 3/5 boot/arm-trusted-firmware: add support for rockchip rk3399

On Wed, Mar 18, 2020 at 7:02 PM <[email protected]> wrote:

Ignore this patch. Sorry

Suniel

Quoted 34 lines

From: Suniel Mahesh <[email protected]>

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

---
Changes for v3:
- no change

Changes for v2:
- no changes

 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
 1 file changed, 4 insertions(+)
boot/arm-trusted-firmware/arm-trusted-firmware.mk +4 -1
index 7722954..3002f5f 100644
@@ -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

#7 lore raw

PATCH v3 4/5 configs/roc-rk3399-pc: new defconfig

In reply to sunil at amarulasolutions.com

From: Suniel Mahesh <[email protected]>

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

---
Changes for v3:
- dropped changes in DEVELOPERS file

Changes for v2:
- update readme.txt.
- changed file permissions to 'x' for post-build.sh.

 .gitlab-ci.yml                            |  1 +
 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    | 48 ++++++++++++++++++++++++++++
 configs/roc_pc_rk3399_defconfig           | 53 +++++++++++++++++++++++++++++++
 6 files changed, 133 insertions(+)
 create mode 100644 board/firefly/roc-rk3399-pc/extlinux.conf
 create mode 100644 board/firefly/roc-rk3399-pc/genimage.cfg
 create mode 100755 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
.gitlab-ci.yml +1 -0
index 4b84a5b..d9519c3 100644
@@ -302,6 +302,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 }
board/firefly/roc-rk3399-pc/extlinux.conf new file +4 -0
new file mode 100644
index 0000000..50a358f
@@ -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
board/firefly/roc-rk3399-pc/genimage.cfg new file +22 -0
new file mode 100644
index 0000000..966c869
@@ -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"
+	}
+}
board/firefly/roc-rk3399-pc/post-build.sh new file +5 -0
new file mode 100755
index 0000000..1f5ff6a
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+
+install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf
board/firefly/roc-rk3399-pc/readme.txt new file +48 -0

48 lines not on this page · raw message

configs/roc_pc_rk3399_defconfig new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH v3 4/5 configs/roc-rk3399-pc: new defconfig

On Wed, Mar 18, 2020 at 7:02 PM <[email protected]> wrote:

Ignore this patch. sorry

Suniel

Quoted 208 lines

From: Suniel Mahesh <[email protected]>

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

---
Changes for v3:
- dropped changes in DEVELOPERS file

Changes for v2:
- update readme.txt.
- changed file permissions to 'x' for post-build.sh.

 .gitlab-ci.yml                            |  1 +
 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    | 48 ++++++++++++++++++++++++++++
 configs/roc_pc_rk3399_defconfig           | 53 +++++++++++++++++++++++++++++++
 6 files changed, 133 insertions(+)
 create mode 100644 board/firefly/roc-rk3399-pc/extlinux.conf
 create mode 100644 board/firefly/roc-rk3399-pc/genimage.cfg
 create mode 100755 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
.gitlab-ci.yml +1 -0
index 4b84a5b..d9519c3 100644
@@ -302,6 +302,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 }
board/firefly/roc-rk3399-pc/extlinux.conf new file +4 -0
new file mode 100644
index 0000000..50a358f
@@ -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
board/firefly/roc-rk3399-pc/genimage.cfg new file +22 -0
new file mode 100644
index 0000000..966c869
@@ -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"
+       }
+}
board/firefly/roc-rk3399-pc/post-build.sh new file +5 -0
new file mode 100755
index 0000000..1f5ff6a
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+
+install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf
board/firefly/roc-rk3399-pc/readme.txt new file +48 -0
new file mode 100644
index 0000000..ebf91c1
@@ -0,0 +1,48 @@
+Libre Computer Board ROC-RK3399-PC
+===================================
+
+ROC-RK3399-PC is highest performance platforms leveraging the popular
+Rockchip RK3399 SoC from Firefly and Libretech.
+
+Build:
+
+  $ make roc_pc_rk3399_defconfig
+  $ make
+
+Files created in output directory
+=================================
+
+output/images
+
+??? bl31.elf
+??? idbloader.img
+??? Image
+??? rk3399-roc-pc.dtb
+??? rootfs.ext2
+??? rootfs.ext4 -> rootfs.ext2
+??? rootfs.tar
+??? sdcard.img
+??? u-boot.bin
+??? u-boot.itb
+
+Creating bootable SD card:
+==========================
+
+Simply invoke (as root)
+
+sudo dd if=output/images/sdcard.img of=/dev/sdX && sync
+
+Where X is your SD card device
+
+Serial console
+--------------
+
+Baudrate for this board is 1500000
+
+
+Wiki link:
+https://wiki.amarulasolutions.com/bsp/rockchip/rk3399/roc-rk3399-pc.html
+
+--
+Suniel Mahesh <[email protected]>
+10-Feb-2020
configs/roc_pc_rk3399_defconfig new file +53 -1
new file mode 100644
index 0000000..e5a82da
@@ -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

#9 lore raw

PATCH v3 5/5 DEVELOPERS: add me as a co-maintainer for rk3399 based targets

In reply to sunil at amarulasolutions.com

From: Suniel Mahesh <[email protected]>

---
Changes for v3:
New patch added to this series. Split one changeset from patch #4 and made it patch #5

Changes for v2:
didn't exist

 DEVELOPERS | 3 +++
 1 file changed, 3 insertions(+)
DEVELOPERS +3 -0
index 98220a9..faa72a4 100644
@@ -1114,6 +1114,7 @@ N:	Ismael Luceno <[email protected]>
 F:	package/axel/
 
 N:	Jagan Teki <[email protected]>
+N:	Suniel Mahesh <[email protected]>
 F:	board/amarula/
 F:	board/asus/
 F:	board/bananapi/
@@ -1129,6 +1130,7 @@ F:	board/orangepi/orangepi-prime/
 F:	board/orangepi/orangepi-win/
 F:	board/orangepi/orangepi-zero-plus2/
 F:	board/pine64/
+F:	board/firefly/
 F:	configs/amarula_a64_relic_defconfig
 F:	configs/amarula_vyasa_rk3288_defconfig
 F:	configs/asus_tinker_rk3288_defconfig
@@ -1151,6 +1153,7 @@ F:	configs/orangepi_win_defconfig
 F:	configs/orangepi_zero_plus2_defconfig
 F:	configs/pine64_defconfig
 F:	configs/pine64_sopine_defconfig
+F:	configs/roc_pc_rk3399_defconfig
 
 N:	James Hilliard <[email protected]>
 F:	package/gensio/
Signature · 1 line
2.7.4
#10 lore raw

PATCH v3 5/5 DEVELOPERS: add me as a co-maintainer for rk3399 based targets

On Wed, Mar 18, 2020 at 7:02 PM <[email protected]> wrote:

Ignore this patch.

Suniel

Quoted 46 lines

From: Suniel Mahesh <[email protected]>

---
Changes for v3:
New patch added to this series. Split one changeset from patch #4 and made it patch #5

Changes for v2:
didn't exist

 DEVELOPERS | 3 +++
 1 file changed, 3 insertions(+)
DEVELOPERS +3 -1
index 98220a9..faa72a4 100644
@@ -1114,6 +1114,7 @@ N:        Ismael Luceno <[email protected]>
 F:     package/axel/
 
 N:     Jagan Teki <[email protected]>
+N:     Suniel Mahesh <[email protected]>
 F:     board/amarula/
 F:     board/asus/
 F:     board/bananapi/
@@ -1129,6 +1130,7 @@ F:        board/orangepi/orangepi-prime/
 F:     board/orangepi/orangepi-win/
 F:     board/orangepi/orangepi-zero-plus2/
 F:     board/pine64/
+F:     board/firefly/
 F:     configs/amarula_a64_relic_defconfig
 F:     configs/amarula_vyasa_rk3288_defconfig
 F:     configs/asus_tinker_rk3288_defconfig
@@ -1151,6 +1153,7 @@ F:        configs/orangepi_win_defconfig
 F:     configs/orangepi_zero_plus2_defconfig
 F:     configs/pine64_defconfig
 F:     configs/pine64_sopine_defconfig
+F:     configs/roc_pc_rk3399_defconfig
 
 N:     James Hilliard <[email protected]>
 F:     package/gensio/
--

2.7.4

#11 lore raw

v3 cover Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board

In reply to sunil at amarulasolutions.com

On Wed, Mar 18, 2020 at 7:01 PM <[email protected]> wrote:

Ignore this patch.

Suniel

Quoted 73 lines

From: Suniel Mahesh <[email protected]>

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 for Rockchip rk3399 platform (has a cortex-m0 core). 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.
Update DEVELOPERS file.

The patch set is tested on roc-rk3399-pc, a rk3399 based target. Compile tested on orangepi.
---
Changes for v3:
Added one patch to this series. Split one changeset from patch #4 and made
it patch #5
patch #1 (Disable bin copy for rk3399)
- 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.
patch #2 (new package)
- no change
patch #3 (add support for rockchip rk3399)
- no change
patch #4 (new defconfig)
- dropped DEVELOPERS file
patch #5 (Add me as a co-maintainer)
- seperated this changeset

Changes for v2:
Changed cover letter description to add more meaning.
patch #1 (Disable bin copy for rk3399)
- Added Cc tag
patch #2 (new package)
- More Description added to justify why a secondary bare metal toolchain is required patch #3 (add support for rockchip rk3399)
- no change
patch #4 (new defconfig)
- updated readme.txt to help with the build/boot process
- modified file permissions of post-build.sh to 'x'

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

Suniel Mahesh (4):
package/arm-gnu-a-toolchain: new package boot/arm-trusted-firmware: add support for rockchip rk3399 configs/roc-rk3399-pc: new defconfig
DEVELOPERS: add me as a co-maintainer for rk3399 based targets

 .gitlab-ci.yml                                     |  1 +
 DEVELOPERS                                         |  3 ++
 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             | 48 ++++++++++++++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk  | 10 +++-
 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 +++++++++++
 10 files changed, 174 insertions(+), 2 deletions(-)
 create mode 100644 board/firefly/roc-rk3399-pc/extlinux.conf
 create mode 100644 board/firefly/roc-rk3399-pc/genimage.cfg
 create mode 100755 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