mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs
@ 2022-01-24 12:09 Michael Riesch
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 1/5] platforms: add section for non-free " Michael Riesch
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Michael Riesch @ 2022-01-24 12:09 UTC (permalink / raw)
  To: ptxdist; +Cc: m.tretter, Michael Riesch

Hi all,

The fifth version of this patch series considers the comments by
Michael Olbrich. As a consequence, the fourth patch is split into
a generic part that is ready to be applied as far as I am concerned,
and a RFC patch that showcases the usage of the features introduced
in this series. It has been pointed out that the exact usage of the
features may need further discussion. However, this discussion is
restricted to the name and the location of the binary blobs and is
not expected to require changes in the generic part.

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (5):
  platforms: add section for non-free firmware blobs
  add package for rockchip firmware binaries
  scripts: add helper to inject files into a source directory
  barebox: add integration of firmware blobs
  barebox.rockchip: add binary firmware blobs for quartz64 and
    rk3568-evb1

 platforms/Kconfig                      | 10 ++++
 platforms/barebox.in                   |  8 +++
 platforms/barebox.rockchip.in          | 14 +++++
 platforms/firmware-rockchip.in         | 41 ++++++++++++++
 rules/barebox.make                     |  6 +++
 rules/barebox.rockchip.make            | 18 +++++++
 rules/firmware-rockchip.make           | 74 ++++++++++++++++++++++++++
 rules/post/ptxd_make_world_inject.make | 19 +++++++
 scripts/lib/ptxd_make_world_inject.sh  | 42 +++++++++++++++
 9 files changed, 232 insertions(+)
 create mode 100644 platforms/barebox.rockchip.in
 create mode 100644 platforms/firmware-rockchip.in
 create mode 100644 rules/barebox.rockchip.make
 create mode 100644 rules/firmware-rockchip.make
 create mode 100644 rules/post/ptxd_make_world_inject.make
 create mode 100644 scripts/lib/ptxd_make_world_inject.sh

-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* [ptxdist] [PATCH v5 1/5] platforms: add section for non-free firmware blobs
  2022-01-24 12:09 [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs Michael Riesch
@ 2022-01-24 12:09 ` Michael Riesch
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries Michael Riesch
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Michael Riesch @ 2022-01-24 12:09 UTC (permalink / raw)
  To: ptxdist; +Cc: m.tretter, Michael Riesch

Add a dedicated section for non-free firmware binary blobs, such
as SDRAM initialization binaries.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 platforms/Kconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/platforms/Kconfig b/platforms/Kconfig
index 0bfe34cdc..047ac2b13 100644
--- a/platforms/Kconfig
+++ b/platforms/Kconfig
@@ -40,3 +40,13 @@ source "generated/hosttools_noprompt.in"
 source "generated/hosttools_platform.in"
 
 source "generated/platform_project_specific.in"
+
+menuconfig NON_FREE_FIRMWARE
+	bool
+	prompt "non-free firmware blobs       "
+	help
+	  Enable integration of non-free firmware blobs.
+
+if NON_FREE_FIRMWARE
+source "generated/non_free_firmware.in"
+endif
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries
  2022-01-24 12:09 [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs Michael Riesch
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 1/5] platforms: add section for non-free " Michael Riesch
@ 2022-01-24 12:09 ` Michael Riesch
  2022-01-28 12:31   ` Michael Olbrich
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory Michael Riesch
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Michael Riesch @ 2022-01-24 12:09 UTC (permalink / raw)
  To: ptxdist; +Cc: m.tretter, Michael Riesch

Rockchip provides the SDRAM initialization as well as BL31/BL32
firmware for their SoCs in binary form. Add a package that downloads
those binaries for further use in e.g., barebox.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
[revised and extended Kconfig]
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 platforms/firmware-rockchip.in | 41 +++++++++++++++++++
 rules/firmware-rockchip.make   | 74 ++++++++++++++++++++++++++++++++++
 2 files changed, 115 insertions(+)
 create mode 100644 platforms/firmware-rockchip.in
 create mode 100644 rules/firmware-rockchip.make

diff --git a/platforms/firmware-rockchip.in b/platforms/firmware-rockchip.in
new file mode 100644
index 000000000..aa702416d
--- /dev/null
+++ b/platforms/firmware-rockchip.in
@@ -0,0 +1,41 @@
+## SECTION=non_free_firmware
+
+menuconfig FIRMWARE_ROCKCHIP
+	bool
+	prompt "Rockchip firmware binaries    "
+	help
+	  Rockchip prebuilt SDRAM initialization and TF-A binaries.
+
+if FIRMWARE_ROCKCHIP
+
+config FIRMWARE_ROCKCHIP_RK3566_SDRAM
+	bool
+	prompt "RK3566 SDRAM init"
+	help
+	  Rockchip RK3566 SDRAM initialization binary.
+	  Compatible with e.g., the Pine64 Quartz64 Model A board.
+
+config FIRMWARE_ROCKCHIP_RK3568_SDRAM
+	bool
+	prompt "RK3568 SDRAM init"
+	help
+	  Rockchip RK3568 SDRAM initialization binary.
+	  Compatible with e.g., the Rockchip RK3568 EVB1 board.
+
+config FIRMWARE_ROCKCHIP_RK356x_BL31
+	bool
+	prompt "RK356x BL31 binary"
+	help
+	  Rockchip RK3566/RK3568 BL31 binary.
+	  Compatible with e.g., the Pine64 Quartz64 Model A board
+	  and the Rockchip RK3568 EVB1 board.
+
+config FIRMWARE_ROCKCHIP_RK356x_BL32
+	bool
+	prompt "RK356x BL32 binary"
+	help
+	  Rockchip RK3566/RK3568 BL32 binary.
+	  Compatible with e.g., the Pine64 Quartz64 Model A board
+	  and the Rockchip RK3568 EVB1 board.
+
+endif
diff --git a/rules/firmware-rockchip.make b/rules/firmware-rockchip.make
new file mode 100644
index 000000000..dd50c865a
--- /dev/null
+++ b/rules/firmware-rockchip.make
@@ -0,0 +1,74 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Michael Tretter <m.tretter@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_FIRMWARE_ROCKCHIP) += firmware-rockchip
+
+FIRMWARE_ROCKCHIP_VERSION	:= 2021-06-01-g7d631e0d
+FIRMWARE_ROCKCHIP_MD5		:= 4ca62f76ca75019dc708c4cb7cc31b0a
+FIRMWARE_ROCKCHIP		:= firmware-rockchip-$(FIRMWARE_ROCKCHIP_VERSION)
+FIRMWARE_ROCKCHIP_SUFFIX	:= zip
+FIRMWARE_ROCKCHIP_URL		:= https://github.com/rockchip-linux/rkbin/archive/$(FIRMWARE_ROCKCHIP_VERSION).$(FIRMWARE_ROCKCHIP_SUFFIX)
+FIRMWARE_ROCKCHIP_SOURCE	:= $(SRCDIR)/$(FIRMWARE_ROCKCHIP).$(FIRMWARE_ROCKCHIP_SUFFIX)
+FIRMWARE_ROCKCHIP_DIR		:= $(BUILDDIR)/$(FIRMWARE_ROCKCHIP)
+FIRMWARE_ROCKCHIP_LICENSE	:= proprietary
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+FIRMWARE_ROCKCHIP_CONF_TOOL := NO
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/firmware-rockchip.compile:
+	@$(call targetinfo)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/firmware-rockchip.install:
+	@$(call targetinfo)
+
+ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK3566_SDRAM
+	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3566_ddr_1056MHz_v1.08.bin \
+		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3566_ddr_1056MHz_v1.08.bin
+endif
+
+ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK3568_SDRAM
+	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_ddr_1560MHz_v1.08.bin \
+		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_ddr_1560MHz_v1.08.bin
+endif
+
+ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK356x_BL31
+	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_bl31_v1.24.elf \
+		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_bl31_v1.24.elf
+endif
+
+ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK356x_BL32
+	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_bl32_v1.05.bin \
+		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_bl32_v1.05.bin
+endif
+
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/firmware-rockchip.targetinstall:
+	@$(call targetinfo)
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory
  2022-01-24 12:09 [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs Michael Riesch
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 1/5] platforms: add section for non-free " Michael Riesch
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries Michael Riesch
@ 2022-01-24 12:09 ` Michael Riesch
  2022-01-28 12:27   ` Michael Olbrich
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 4/5] barebox: add integration of firmware blobs Michael Riesch
  2022-01-24 12:09 ` [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch
  4 siblings, 1 reply; 17+ messages in thread
From: Michael Riesch @ 2022-01-24 12:09 UTC (permalink / raw)
  To: ptxdist; +Cc: m.tretter, Michael Riesch

Some packages may require certain files that are maintained
or generated outside of their source repository. For example,
binary firmware blobs could be excluded from the sources due
to licensing issues. Add a helper that allows to inject certain
files into the source directory (usually in the prepare stage).

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 rules/post/ptxd_make_world_inject.make | 19 ++++++++++++
 scripts/lib/ptxd_make_world_inject.sh  | 42 ++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 rules/post/ptxd_make_world_inject.make
 create mode 100644 scripts/lib/ptxd_make_world_inject.sh

diff --git a/rules/post/ptxd_make_world_inject.make b/rules/post/ptxd_make_world_inject.make
new file mode 100644
index 000000000..b7d28e92f
--- /dev/null
+++ b/rules/post/ptxd_make_world_inject.make
@@ -0,0 +1,19 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+world/inject/env = \
+	$(call world/env, $(1)) \
+	pkg_inject_path="$($(1)_INJECT_PATH)" \
+	pkg_inject_files="$($(1)_INJECT_FILES)" \
+	pkg_source="$($(1)_DIR)"
+
+world/inject = \
+	$(call world/inject/env,$(strip $(1))) \
+	ptxd_make_world_inject
+
+# vim: syntax=make
diff --git a/scripts/lib/ptxd_make_world_inject.sh b/scripts/lib/ptxd_make_world_inject.sh
new file mode 100644
index 000000000..c2e45ad42
--- /dev/null
+++ b/scripts/lib/ptxd_make_world_inject.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_make_inject() {
+    local source target
+
+    source="$(echo ${inject_file} | cut -d ":" -f 1)"
+    target="${pkg_source}/$(echo ${inject_file} | cut -d ":" -f 2)"
+    if [ -z "${target}" ]; then
+	target="${source}"
+    fi
+
+    if [[ "${source}" =~ ^/.* ]]; then
+	ptxd_bailout "'${source}' must not be an absolute path!" \
+	    "Use <PKG>_INJECT_PATH to specify the search path."
+    fi
+
+    if ! ptxd_in_path pkg_inject_path "${source}"; then
+	ptxd_bailout "Blob '${source}' not found in '${pkg_inject_path}'."
+    fi
+    source="${ptxd_reply}"
+
+    echo -e "\nInject file $(ptxd_print_path ${source}) into" \
+	 "$(ptxd_print_path ${target})..."
+    cp ${source} ${target}
+}
+export -f ptxd_make_inject
+
+
+ptxd_make_world_inject() {
+    ptxd_make_world_init || break
+
+    for inject_file in ${pkg_inject_files}; do
+	ptxd_make_inject || break
+    done
+}
+export -f ptxd_make_world_inject
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* [ptxdist] [PATCH v5 4/5] barebox: add integration of firmware blobs
  2022-01-24 12:09 [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs Michael Riesch
                   ` (2 preceding siblings ...)
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory Michael Riesch
@ 2022-01-24 12:09 ` Michael Riesch
  2022-01-28 12:28   ` Michael Olbrich
  2022-01-24 12:09 ` [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch
  4 siblings, 1 reply; 17+ messages in thread
From: Michael Riesch @ 2022-01-24 12:09 UTC (permalink / raw)
  To: ptxdist; +Cc: m.tretter, Michael Riesch

In some cases barebox requires firmware blobs, which may be
provided in binary form by the vendor or compiled in a
preceding step. Add the possibility to specify files (in
separate rule files) which are injected in the barebox source
directory during preparation.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 platforms/barebox.in          | 8 ++++++++
 platforms/barebox.rockchip.in | 1 +
 rules/barebox.make            | 6 ++++++
 3 files changed, 15 insertions(+)
 create mode 100644 platforms/barebox.rockchip.in

diff --git a/platforms/barebox.in b/platforms/barebox.in
index d35d16501..8a81be40f 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -55,6 +55,14 @@ config BAREBOX_CONFIG
 	  This entry specifies the .config file used to compile
 	  barebox.
 
+menuconfig BAREBOX_FIRMWARE
+	bool
+	prompt "integrate firmware blobs      "
+
+if BAREBOX_FIRMWARE
+source "generated/barebox_firmware.in"
+endif
+
 config BAREBOX_EXTRA_ENV
 	prompt "extend the builtin barebox environment"
 	bool
diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
new file mode 100644
index 000000000..8ecdb0762
--- /dev/null
+++ b/platforms/barebox.rockchip.in
@@ -0,0 +1 @@
+## SECTION=barebox_firmware
diff --git a/rules/barebox.make b/rules/barebox.make
index bea9f3adc..1c8463e63 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -34,6 +34,8 @@ BAREBOX_CONFIG		:= $(call ptx/in-platformconfigdir, \
 # Prepare
 # ----------------------------------------------------------------------------
 
+BAREBOX_INJECT_PATH	:= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware
+
 # use host pkg-config for host tools
 BAREBOX_PATH		:= PATH=$(HOST_PATH)
 
@@ -94,6 +96,10 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
 	@rm -rf $(BAREBOX_BUILD_DIR)/defaultenv/barebox_default_env
 endif
 
+ifdef PTXCONF_BAREBOX_FIRMWARE
+	@$(call world/inject, BAREBOX)
+endif
+
 	@$(call touch)
 
 # ----------------------------------------------------------------------------
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1
  2022-01-24 12:09 [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs Michael Riesch
                   ` (3 preceding siblings ...)
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 4/5] barebox: add integration of firmware blobs Michael Riesch
@ 2022-01-24 12:09 ` Michael Riesch
  2022-01-28 12:33   ` Michael Olbrich
  4 siblings, 1 reply; 17+ messages in thread
From: Michael Riesch @ 2022-01-24 12:09 UTC (permalink / raw)
  To: ptxdist; +Cc: m.tretter, Michael Riesch

Currently, the mainline OP-TEE and TF-A sources do not support the
RK356x SoCs. Therefore, the only option is to use the binary blobs
provided by Rockchip. This patch integrates these blobs (along the SDRAM
initialization binary) for the Pine64 Quartz64 board and the RK3568
EVB1 into barebox.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 platforms/barebox.rockchip.in | 13 +++++++++++++
 rules/barebox.rockchip.make   | 18 ++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 rules/barebox.rockchip.make

diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
index 8ecdb0762..9aad4eaf8 100644
--- a/platforms/barebox.rockchip.in
+++ b/platforms/barebox.rockchip.in
@@ -1 +1,14 @@
 ## SECTION=barebox_firmware
+
+config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+	prompt "barebox needs firmware-rockchip"
+	bool
+	depends on ARCH_ARM64
+	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+	select FIRMWARE_ROCKCHIP_RK356x_BL31 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+	select FIRMWARE_ROCKCHIP_RK356x_BL32 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+	select FIRMWARE_ROCKCHIP_RK3566_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+	select FIRMWARE_ROCKCHIP_RK3568_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+	help
+	  Select this if barebox needs the non-free Rockchip firmware
+	  blobs.
diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
new file mode 100644
index 000000000..0255b2b4d
--- /dev/null
+++ b/rules/barebox.rockchip.make
@@ -0,0 +1,18 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ifdef PTXCONF_BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+
+BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
+BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
+
+BAREBOX_INJECT_FILES	+= rk3566_ddr_1056MHz_v1.08.bin:arch/arm/boards/pine64-quartz64/sdram-init.bin
+
+BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
+
+endif
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory Michael Riesch
@ 2022-01-28 12:27   ` Michael Olbrich
  0 siblings, 0 replies; 17+ messages in thread
From: Michael Olbrich @ 2022-01-28 12:27 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Mon, Jan 24, 2022 at 01:09:40PM +0100, Michael Riesch wrote:
> Some packages may require certain files that are maintained
> or generated outside of their source repository. For example,
> binary firmware blobs could be excluded from the sources due
> to licensing issues. Add a helper that allows to inject certain
> files into the source directory (usually in the prepare stage).
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
>  rules/post/ptxd_make_world_inject.make | 19 ++++++++++++
>  scripts/lib/ptxd_make_world_inject.sh  | 42 ++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+)
>  create mode 100644 rules/post/ptxd_make_world_inject.make
>  create mode 100644 scripts/lib/ptxd_make_world_inject.sh
> 
> diff --git a/rules/post/ptxd_make_world_inject.make b/rules/post/ptxd_make_world_inject.make
> new file mode 100644
> index 000000000..b7d28e92f
> --- /dev/null
> +++ b/rules/post/ptxd_make_world_inject.make
> @@ -0,0 +1,19 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +world/inject/env = \
> +	$(call world/env, $(1)) \
> +	pkg_inject_path="$($(1)_INJECT_PATH)" \
> +	pkg_inject_files="$($(1)_INJECT_FILES)" \
> +	pkg_source="$($(1)_DIR)"
> +
> +world/inject = \
> +	$(call world/inject/env,$(strip $(1))) \
> +	ptxd_make_world_inject
> +
> +# vim: syntax=make
> diff --git a/scripts/lib/ptxd_make_world_inject.sh b/scripts/lib/ptxd_make_world_inject.sh
> new file mode 100644
> index 000000000..c2e45ad42
> --- /dev/null
> +++ b/scripts/lib/ptxd_make_world_inject.sh
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +ptxd_make_inject() {
> +    local source target
> +
> +    source="$(echo ${inject_file} | cut -d ":" -f 1)"
> +    target="${pkg_source}/$(echo ${inject_file} | cut -d ":" -f 2)"
> +    if [ -z "${target}" ]; then
> +	target="${source}"
> +    fi
> +
> +    if [[ "${source}" =~ ^/.* ]]; then
> +	ptxd_bailout "'${source}' must not be an absolute path!" \
> +	    "Use <PKG>_INJECT_PATH to specify the search path."
> +    fi
> +
> +    if ! ptxd_in_path pkg_inject_path "${source}"; then
> +	ptxd_bailout "Blob '${source}' not found in '${pkg_inject_path}'."
> +    fi
> +    source="${ptxd_reply}"
> +
> +    echo -e "\nInject file $(ptxd_print_path ${source}) into" \
> +	 "$(ptxd_print_path ${target})..."
> +    cp ${source} ${target}
> +}
> +export -f ptxd_make_inject
> +
> +
> +ptxd_make_world_inject() {
> +    ptxd_make_world_init || break

'return' instead of 'break'

> +
> +    for inject_file in ${pkg_inject_files}; do
> +	ptxd_make_inject || break

same here. Otherwise, the failure won't be propagated. I missed that in the
last review but luckily it failed when I tested it because the barebox
version I used didn't have the target directory...

Michael

> +    done
> +}
> +export -f ptxd_make_world_inject
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [PATCH v5 4/5] barebox: add integration of firmware blobs
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 4/5] barebox: add integration of firmware blobs Michael Riesch
@ 2022-01-28 12:28   ` Michael Olbrich
  0 siblings, 0 replies; 17+ messages in thread
From: Michael Olbrich @ 2022-01-28 12:28 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Mon, Jan 24, 2022 at 01:09:41PM +0100, Michael Riesch wrote:
> In some cases barebox requires firmware blobs, which may be
> provided in binary form by the vendor or compiled in a
> preceding step. Add the possibility to specify files (in
> separate rule files) which are injected in the barebox source
> directory during preparation.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
>  platforms/barebox.in          | 8 ++++++++
>  platforms/barebox.rockchip.in | 1 +
>  rules/barebox.make            | 6 ++++++
>  3 files changed, 15 insertions(+)
>  create mode 100644 platforms/barebox.rockchip.in
> 
> diff --git a/platforms/barebox.in b/platforms/barebox.in
> index d35d16501..8a81be40f 100644
> --- a/platforms/barebox.in
> +++ b/platforms/barebox.in
> @@ -55,6 +55,14 @@ config BAREBOX_CONFIG
>  	  This entry specifies the .config file used to compile
>  	  barebox.
>  
> +menuconfig BAREBOX_FIRMWARE
> +	bool
> +	prompt "integrate firmware blobs      "
> +
> +if BAREBOX_FIRMWARE
> +source "generated/barebox_firmware.in"
> +endif
> +
>  config BAREBOX_EXTRA_ENV
>  	prompt "extend the builtin barebox environment"
>  	bool
> diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
> new file mode 100644
> index 000000000..8ecdb0762
> --- /dev/null
> +++ b/platforms/barebox.rockchip.in
> @@ -0,0 +1 @@
> +## SECTION=barebox_firmware

I meant a dummy file that we keep. See e.g. rules/project_specific.in

Michael

> diff --git a/rules/barebox.make b/rules/barebox.make
> index bea9f3adc..1c8463e63 100644
> --- a/rules/barebox.make
> +++ b/rules/barebox.make
> @@ -34,6 +34,8 @@ BAREBOX_CONFIG		:= $(call ptx/in-platformconfigdir, \
>  # Prepare
>  # ----------------------------------------------------------------------------
>  
> +BAREBOX_INJECT_PATH	:= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware
> +
>  # use host pkg-config for host tools
>  BAREBOX_PATH		:= PATH=$(HOST_PATH)
>  
> @@ -94,6 +96,10 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
>  	@rm -rf $(BAREBOX_BUILD_DIR)/defaultenv/barebox_default_env
>  endif
>  
> +ifdef PTXCONF_BAREBOX_FIRMWARE
> +	@$(call world/inject, BAREBOX)
> +endif
> +
>  	@$(call touch)
>  
>  # ----------------------------------------------------------------------------
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries
  2022-01-24 12:09 ` [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries Michael Riesch
@ 2022-01-28 12:31   ` Michael Olbrich
  2022-01-28 12:46     ` Michael Riesch
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Olbrich @ 2022-01-28 12:31 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Mon, Jan 24, 2022 at 01:09:39PM +0100, Michael Riesch wrote:
> Rockchip provides the SDRAM initialization as well as BL31/BL32
> firmware for their SoCs in binary form. Add a package that downloads
> those binaries for further use in e.g., barebox.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> [revised and extended Kconfig]
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
>  platforms/firmware-rockchip.in | 41 +++++++++++++++++++
>  rules/firmware-rockchip.make   | 74 ++++++++++++++++++++++++++++++++++
>  2 files changed, 115 insertions(+)
>  create mode 100644 platforms/firmware-rockchip.in
>  create mode 100644 rules/firmware-rockchip.make
> 
> diff --git a/platforms/firmware-rockchip.in b/platforms/firmware-rockchip.in
> new file mode 100644
> index 000000000..aa702416d
> --- /dev/null
> +++ b/platforms/firmware-rockchip.in
> @@ -0,0 +1,41 @@
> +## SECTION=non_free_firmware
> +
> +menuconfig FIRMWARE_ROCKCHIP
> +	bool
> +	prompt "Rockchip firmware binaries    "
> +	help
> +	  Rockchip prebuilt SDRAM initialization and TF-A binaries.
> +
> +if FIRMWARE_ROCKCHIP
> +
> +config FIRMWARE_ROCKCHIP_RK3566_SDRAM

I still don't like the sub-options here. But I'm still thinking about
whether this part should go into PTXdist itself, so no need to touch this
for now.

Michael

> +	bool
> +	prompt "RK3566 SDRAM init"
> +	help
> +	  Rockchip RK3566 SDRAM initialization binary.
> +	  Compatible with e.g., the Pine64 Quartz64 Model A board.
> +
> +config FIRMWARE_ROCKCHIP_RK3568_SDRAM
> +	bool
> +	prompt "RK3568 SDRAM init"
> +	help
> +	  Rockchip RK3568 SDRAM initialization binary.
> +	  Compatible with e.g., the Rockchip RK3568 EVB1 board.
> +
> +config FIRMWARE_ROCKCHIP_RK356x_BL31
> +	bool
> +	prompt "RK356x BL31 binary"
> +	help
> +	  Rockchip RK3566/RK3568 BL31 binary.
> +	  Compatible with e.g., the Pine64 Quartz64 Model A board
> +	  and the Rockchip RK3568 EVB1 board.
> +
> +config FIRMWARE_ROCKCHIP_RK356x_BL32
> +	bool
> +	prompt "RK356x BL32 binary"
> +	help
> +	  Rockchip RK3566/RK3568 BL32 binary.
> +	  Compatible with e.g., the Pine64 Quartz64 Model A board
> +	  and the Rockchip RK3568 EVB1 board.
> +
> +endif
> diff --git a/rules/firmware-rockchip.make b/rules/firmware-rockchip.make
> new file mode 100644
> index 000000000..dd50c865a
> --- /dev/null
> +++ b/rules/firmware-rockchip.make
> @@ -0,0 +1,74 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Michael Tretter <m.tretter@pengutronix.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_FIRMWARE_ROCKCHIP) += firmware-rockchip
> +
> +FIRMWARE_ROCKCHIP_VERSION	:= 2021-06-01-g7d631e0d
> +FIRMWARE_ROCKCHIP_MD5		:= 4ca62f76ca75019dc708c4cb7cc31b0a
> +FIRMWARE_ROCKCHIP		:= firmware-rockchip-$(FIRMWARE_ROCKCHIP_VERSION)
> +FIRMWARE_ROCKCHIP_SUFFIX	:= zip
> +FIRMWARE_ROCKCHIP_URL		:= https://github.com/rockchip-linux/rkbin/archive/$(FIRMWARE_ROCKCHIP_VERSION).$(FIRMWARE_ROCKCHIP_SUFFIX)
> +FIRMWARE_ROCKCHIP_SOURCE	:= $(SRCDIR)/$(FIRMWARE_ROCKCHIP).$(FIRMWARE_ROCKCHIP_SUFFIX)
> +FIRMWARE_ROCKCHIP_DIR		:= $(BUILDDIR)/$(FIRMWARE_ROCKCHIP)
> +FIRMWARE_ROCKCHIP_LICENSE	:= proprietary
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +FIRMWARE_ROCKCHIP_CONF_TOOL := NO
> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/firmware-rockchip.compile:
> +	@$(call targetinfo)
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/firmware-rockchip.install:
> +	@$(call targetinfo)
> +
> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK3566_SDRAM
> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3566_ddr_1056MHz_v1.08.bin \
> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3566_ddr_1056MHz_v1.08.bin
> +endif
> +
> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK3568_SDRAM
> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_ddr_1560MHz_v1.08.bin \
> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_ddr_1560MHz_v1.08.bin
> +endif
> +
> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK356x_BL31
> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_bl31_v1.24.elf \
> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_bl31_v1.24.elf
> +endif
> +
> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK356x_BL32
> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_bl32_v1.05.bin \
> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_bl32_v1.05.bin
> +endif
> +
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/firmware-rockchip.targetinstall:
> +	@$(call targetinfo)
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1
  2022-01-24 12:09 ` [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch
@ 2022-01-28 12:33   ` Michael Olbrich
  2022-01-28 15:26     ` Michael Riesch
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Olbrich @ 2022-01-28 12:33 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Mon, Jan 24, 2022 at 01:09:42PM +0100, Michael Riesch wrote:
> Currently, the mainline OP-TEE and TF-A sources do not support the
> RK356x SoCs. Therefore, the only option is to use the binary blobs
> provided by Rockchip. This patch integrates these blobs (along the SDRAM
> initialization binary) for the Pine64 Quartz64 board and the RK3568
> EVB1 into barebox.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
>  platforms/barebox.rockchip.in | 13 +++++++++++++
>  rules/barebox.rockchip.make   | 18 ++++++++++++++++++
>  2 files changed, 31 insertions(+)
>  create mode 100644 rules/barebox.rockchip.make
> 
> diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
> index 8ecdb0762..9aad4eaf8 100644
> --- a/platforms/barebox.rockchip.in
> +++ b/platforms/barebox.rockchip.in
> @@ -1 +1,14 @@
>  ## SECTION=barebox_firmware
> +
> +config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> +	prompt "barebox needs firmware-rockchip"
> +	bool
> +	depends on ARCH_ARM64
> +	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP

This does not work. It must look like this or the build dependency is not
created:

config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
	prompt "barebox needs firmware-rockchip"
	bool
	depends on ARCH_ARM64

config BAREBOX
	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP

Multiple occurrences of the same symbol are merged, so this works just
fine as long as 'BAREBOX' is fully defined somewhere else.

Michael

> +	select FIRMWARE_ROCKCHIP_RK356x_BL31 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> +	select FIRMWARE_ROCKCHIP_RK356x_BL32 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> +	select FIRMWARE_ROCKCHIP_RK3566_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> +	select FIRMWARE_ROCKCHIP_RK3568_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> +	help
> +	  Select this if barebox needs the non-free Rockchip firmware
> +	  blobs.
> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
> new file mode 100644
> index 000000000..0255b2b4d
> --- /dev/null
> +++ b/rules/barebox.rockchip.make
> @@ -0,0 +1,18 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +ifdef PTXCONF_BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> +
> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
> +
> +BAREBOX_INJECT_FILES	+= rk3566_ddr_1056MHz_v1.08.bin:arch/arm/boards/pine64-quartz64/sdram-init.bin
> +
> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
> +
> +endif
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries
  2022-01-28 12:31   ` Michael Olbrich
@ 2022-01-28 12:46     ` Michael Riesch
  2022-01-28 12:59       ` Michael Olbrich
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Riesch @ 2022-01-28 12:46 UTC (permalink / raw)
  To: ptxdist, m.olbrich; +Cc: m.tretter

Hi Michael,

On 1/28/22 13:31, Michael Olbrich wrote:
> On Mon, Jan 24, 2022 at 01:09:39PM +0100, Michael Riesch wrote:
>> Rockchip provides the SDRAM initialization as well as BL31/BL32
>> firmware for their SoCs in binary form. Add a package that downloads
>> those binaries for further use in e.g., barebox.
>>
>> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
>> [revised and extended Kconfig]
>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
>> ---
>>  platforms/firmware-rockchip.in | 41 +++++++++++++++++++
>>  rules/firmware-rockchip.make   | 74 ++++++++++++++++++++++++++++++++++
>>  2 files changed, 115 insertions(+)
>>  create mode 100644 platforms/firmware-rockchip.in
>>  create mode 100644 rules/firmware-rockchip.make
>>
>> diff --git a/platforms/firmware-rockchip.in b/platforms/firmware-rockchip.in
>> new file mode 100644
>> index 000000000..aa702416d
>> --- /dev/null
>> +++ b/platforms/firmware-rockchip.in
>> @@ -0,0 +1,41 @@
>> +## SECTION=non_free_firmware
>> +
>> +menuconfig FIRMWARE_ROCKCHIP
>> +	bool
>> +	prompt "Rockchip firmware binaries    "
>> +	help
>> +	  Rockchip prebuilt SDRAM initialization and TF-A binaries.
>> +
>> +if FIRMWARE_ROCKCHIP
>> +
>> +config FIRMWARE_ROCKCHIP_RK3566_SDRAM
> 
> I still don't like the sub-options here. But I'm still thinking about
> whether this part should go into PTXdist itself, so no need to touch this
> for now.

Care to give us some insight in your current state of reasoning as to
whether or not this should enter ptxdist?

Best regards,
Michael

> 
> Michael
> 
>> +	bool
>> +	prompt "RK3566 SDRAM init"
>> +	help
>> +	  Rockchip RK3566 SDRAM initialization binary.
>> +	  Compatible with e.g., the Pine64 Quartz64 Model A board.
>> +
>> +config FIRMWARE_ROCKCHIP_RK3568_SDRAM
>> +	bool
>> +	prompt "RK3568 SDRAM init"
>> +	help
>> +	  Rockchip RK3568 SDRAM initialization binary.
>> +	  Compatible with e.g., the Rockchip RK3568 EVB1 board.
>> +
>> +config FIRMWARE_ROCKCHIP_RK356x_BL31
>> +	bool
>> +	prompt "RK356x BL31 binary"
>> +	help
>> +	  Rockchip RK3566/RK3568 BL31 binary.
>> +	  Compatible with e.g., the Pine64 Quartz64 Model A board
>> +	  and the Rockchip RK3568 EVB1 board.
>> +
>> +config FIRMWARE_ROCKCHIP_RK356x_BL32
>> +	bool
>> +	prompt "RK356x BL32 binary"
>> +	help
>> +	  Rockchip RK3566/RK3568 BL32 binary.
>> +	  Compatible with e.g., the Pine64 Quartz64 Model A board
>> +	  and the Rockchip RK3568 EVB1 board.
>> +
>> +endif
>> diff --git a/rules/firmware-rockchip.make b/rules/firmware-rockchip.make
>> new file mode 100644
>> index 000000000..dd50c865a
>> --- /dev/null
>> +++ b/rules/firmware-rockchip.make
>> @@ -0,0 +1,74 @@
>> +# -*-makefile-*-
>> +#
>> +# Copyright (C) 2021 by Michael Tretter <m.tretter@pengutronix.de>
>> +#
>> +# For further information about the PTXdist project and license conditions
>> +# see the README file.
>> +#
>> +
>> +#
>> +# We provide this package
>> +#
>> +PACKAGES-$(PTXCONF_FIRMWARE_ROCKCHIP) += firmware-rockchip
>> +
>> +FIRMWARE_ROCKCHIP_VERSION	:= 2021-06-01-g7d631e0d
>> +FIRMWARE_ROCKCHIP_MD5		:= 4ca62f76ca75019dc708c4cb7cc31b0a
>> +FIRMWARE_ROCKCHIP		:= firmware-rockchip-$(FIRMWARE_ROCKCHIP_VERSION)
>> +FIRMWARE_ROCKCHIP_SUFFIX	:= zip
>> +FIRMWARE_ROCKCHIP_URL		:= https://github.com/rockchip-linux/rkbin/archive/$(FIRMWARE_ROCKCHIP_VERSION).$(FIRMWARE_ROCKCHIP_SUFFIX)
>> +FIRMWARE_ROCKCHIP_SOURCE	:= $(SRCDIR)/$(FIRMWARE_ROCKCHIP).$(FIRMWARE_ROCKCHIP_SUFFIX)
>> +FIRMWARE_ROCKCHIP_DIR		:= $(BUILDDIR)/$(FIRMWARE_ROCKCHIP)
>> +FIRMWARE_ROCKCHIP_LICENSE	:= proprietary
>> +
>> +# ----------------------------------------------------------------------------
>> +# Prepare
>> +# ----------------------------------------------------------------------------
>> +
>> +FIRMWARE_ROCKCHIP_CONF_TOOL := NO
>> +
>> +# ----------------------------------------------------------------------------
>> +# Compile
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/firmware-rockchip.compile:
>> +	@$(call targetinfo)
>> +	@$(call touch)
>> +
>> +# ----------------------------------------------------------------------------
>> +# Install
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/firmware-rockchip.install:
>> +	@$(call targetinfo)
>> +
>> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK3566_SDRAM
>> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3566_ddr_1056MHz_v1.08.bin \
>> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3566_ddr_1056MHz_v1.08.bin
>> +endif
>> +
>> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK3568_SDRAM
>> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_ddr_1560MHz_v1.08.bin \
>> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_ddr_1560MHz_v1.08.bin
>> +endif
>> +
>> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK356x_BL31
>> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_bl31_v1.24.elf \
>> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_bl31_v1.24.elf
>> +endif
>> +
>> +ifdef PTXCONF_FIRMWARE_ROCKCHIP_RK356x_BL32
>> +	install -v -D -m644 $(FIRMWARE_ROCKCHIP_DIR)/bin/rk35/rk3568_bl32_v1.05.bin \
>> +		$(FIRMWARE_ROCKCHIP_PKGDIR)/usr/lib/firmware/rk3568_bl32_v1.05.bin
>> +endif
>> +
>> +	@$(call touch)
>> +
>> +# ----------------------------------------------------------------------------
>> +# Target-Install
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/firmware-rockchip.targetinstall:
>> +	@$(call targetinfo)
>> +	@$(call touch)
>> +
>> +# vim: syntax=make
>> -- 
>> 2.30.2
>>
>>
>> _______________________________________________
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>
> 

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries
  2022-01-28 12:46     ` Michael Riesch
@ 2022-01-28 12:59       ` Michael Olbrich
  2022-01-28 13:46         ` Michael Riesch
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Olbrich @ 2022-01-28 12:59 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Fri, Jan 28, 2022 at 01:46:25PM +0100, Michael Riesch wrote:
> On 1/28/22 13:31, Michael Olbrich wrote:
> > On Mon, Jan 24, 2022 at 01:09:39PM +0100, Michael Riesch wrote:
> >> Rockchip provides the SDRAM initialization as well as BL31/BL32
> >> firmware for their SoCs in binary form. Add a package that downloads
> >> those binaries for further use in e.g., barebox.
> >>
> >> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> >> [revised and extended Kconfig]
> >> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> >> ---
> >>  platforms/firmware-rockchip.in | 41 +++++++++++++++++++
> >>  rules/firmware-rockchip.make   | 74 ++++++++++++++++++++++++++++++++++
> >>  2 files changed, 115 insertions(+)
> >>  create mode 100644 platforms/firmware-rockchip.in
> >>  create mode 100644 rules/firmware-rockchip.make
> >>
> >> diff --git a/platforms/firmware-rockchip.in b/platforms/firmware-rockchip.in
> >> new file mode 100644
> >> index 000000000..aa702416d
> >> --- /dev/null
> >> +++ b/platforms/firmware-rockchip.in
> >> @@ -0,0 +1,41 @@
> >> +## SECTION=non_free_firmware
> >> +
> >> +menuconfig FIRMWARE_ROCKCHIP
> >> +	bool
> >> +	prompt "Rockchip firmware binaries    "
> >> +	help
> >> +	  Rockchip prebuilt SDRAM initialization and TF-A binaries.
> >> +
> >> +if FIRMWARE_ROCKCHIP
> >> +
> >> +config FIRMWARE_ROCKCHIP_RK3566_SDRAM
> > 
> > I still don't like the sub-options here. But I'm still thinking about
> > whether this part should go into PTXdist itself, so no need to touch this
> > for now.
> 
> Care to give us some insight in your current state of reasoning as to
> whether or not this should enter ptxdist?

It's still somewhat unclear to me, but it seems that all of these files are
only useful for one specific board. I'm reluctant to add it just for that.

But it could also serve as an example for this whole infrastructure...

Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries
  2022-01-28 12:59       ` Michael Olbrich
@ 2022-01-28 13:46         ` Michael Riesch
  0 siblings, 0 replies; 17+ messages in thread
From: Michael Riesch @ 2022-01-28 13:46 UTC (permalink / raw)
  To: ptxdist, m.tretter

Hi again,

On 1/28/22 13:59, Michael Olbrich wrote:
> On Fri, Jan 28, 2022 at 01:46:25PM +0100, Michael Riesch wrote:
>> On 1/28/22 13:31, Michael Olbrich wrote:
>>> On Mon, Jan 24, 2022 at 01:09:39PM +0100, Michael Riesch wrote:
>>>> Rockchip provides the SDRAM initialization as well as BL31/BL32
>>>> firmware for their SoCs in binary form. Add a package that downloads
>>>> those binaries for further use in e.g., barebox.
>>>>
>>>> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
>>>> [revised and extended Kconfig]
>>>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
>>>> ---
>>>>  platforms/firmware-rockchip.in | 41 +++++++++++++++++++
>>>>  rules/firmware-rockchip.make   | 74 ++++++++++++++++++++++++++++++++++
>>>>  2 files changed, 115 insertions(+)
>>>>  create mode 100644 platforms/firmware-rockchip.in
>>>>  create mode 100644 rules/firmware-rockchip.make
>>>>
>>>> diff --git a/platforms/firmware-rockchip.in b/platforms/firmware-rockchip.in
>>>> new file mode 100644
>>>> index 000000000..aa702416d
>>>> --- /dev/null
>>>> +++ b/platforms/firmware-rockchip.in
>>>> @@ -0,0 +1,41 @@
>>>> +## SECTION=non_free_firmware
>>>> +
>>>> +menuconfig FIRMWARE_ROCKCHIP
>>>> +	bool
>>>> +	prompt "Rockchip firmware binaries    "
>>>> +	help
>>>> +	  Rockchip prebuilt SDRAM initialization and TF-A binaries.
>>>> +
>>>> +if FIRMWARE_ROCKCHIP
>>>> +
>>>> +config FIRMWARE_ROCKCHIP_RK3566_SDRAM
>>>
>>> I still don't like the sub-options here. But I'm still thinking about
>>> whether this part should go into PTXdist itself, so no need to touch this
>>> for now.
>>
>> Care to give us some insight in your current state of reasoning as to
>> whether or not this should enter ptxdist?
> 
> It's still somewhat unclear to me, but it seems that all of these files are
> only useful for one specific board. I'm reluctant to add it just for that.

OK, let me emphasize once more that the same OP-TEE/TF-A binaries are
currently used to kick-start
 - the Rockchip RK3568 EVB1
 - the Pine64 Quartz64 board (RK3566)
 - the BananaPi R2 Pro (RK3568)
and possibly more, so that's at least more than one ;-) As I already
stated in [0] there are no alternatives at the moment, so any RK356x
board is bound to require this until Rockchip finally opens up their
TF-A magic.

Eventually the RK356x boards will not need this package anymore, but I
would guess for the promised-for-some-years-and-finally-to-be-released
RK3588 the situation will be quite similar. I believe the package can be
extended to provide those binaries once they are available, as Rockchip
tends to provide the binaries for all SoCs in the same GitHub repository.

The SDRAM init blobs are more specific, but in some form they will
always be required (unless someone really brave steps up and
reverse-engineers the SDRAM initialization, which I don't see coming).
Then it would be nice to provide a rule file that downloads the binaries
and puts them into sysroot. Other rule files can use them subsequently.

Convinced? ;-)

Best regards,
Michael

> 
> But it could also serve as an example for this whole infrastructure...
> 
> Michael
> 

[0]
https://lore.ptxdist.org/ptxdist/b2e89ae2-0ad6-4ac5-5355-3fa64ebde78c@wolfvision.net/

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1
  2022-01-28 12:33   ` Michael Olbrich
@ 2022-01-28 15:26     ` Michael Riesch
  2022-01-28 16:10       ` Michael Olbrich
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Riesch @ 2022-01-28 15:26 UTC (permalink / raw)
  To: ptxdist, m.olbrich; +Cc: m.tretter

Hello Michael,

Thanks for your review. I'll prepare a v6!

On 1/28/22 13:33, Michael Olbrich wrote:
> On Mon, Jan 24, 2022 at 01:09:42PM +0100, Michael Riesch wrote:
>> Currently, the mainline OP-TEE and TF-A sources do not support the
>> RK356x SoCs. Therefore, the only option is to use the binary blobs
>> provided by Rockchip. This patch integrates these blobs (along the SDRAM
>> initialization binary) for the Pine64 Quartz64 board and the RK3568
>> EVB1 into barebox.
>>
>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
>> ---
>>  platforms/barebox.rockchip.in | 13 +++++++++++++
>>  rules/barebox.rockchip.make   | 18 ++++++++++++++++++
>>  2 files changed, 31 insertions(+)
>>  create mode 100644 rules/barebox.rockchip.make
>>
>> diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
>> index 8ecdb0762..9aad4eaf8 100644
>> --- a/platforms/barebox.rockchip.in
>> +++ b/platforms/barebox.rockchip.in
>> @@ -1 +1,14 @@
>>  ## SECTION=barebox_firmware
>> +
>> +config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>> +	prompt "barebox needs firmware-rockchip"
>> +	bool
>> +	depends on ARCH_ARM64
>> +	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> 
> This does not work. It must look like this or the build dependency is not
> created:
> 
> config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> 	prompt "barebox needs firmware-rockchip"
> 	bool
> 	depends on ARCH_ARM64
> 
> config BAREBOX
> 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> 
> Multiple occurrences of the same symbol are merged, so this works just
> fine as long as 'BAREBOX' is fully defined somewhere else.

I tried this approach but it returns the error

.../ptxdist/platforms/barebox.in:11:error: recursive dependency detected!
.../ptxdist/platforms/barebox.in:11:	symbol BAREBOX depends on BAREBOX

Any idea what could be wrong here?

Thanks and best regards,
Michael

> 
> Michael
> 
>> +	select FIRMWARE_ROCKCHIP_RK356x_BL31 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>> +	select FIRMWARE_ROCKCHIP_RK356x_BL32 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>> +	select FIRMWARE_ROCKCHIP_RK3566_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>> +	select FIRMWARE_ROCKCHIP_RK3568_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>> +	help
>> +	  Select this if barebox needs the non-free Rockchip firmware
>> +	  blobs.
>> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
>> new file mode 100644
>> index 000000000..0255b2b4d
>> --- /dev/null
>> +++ b/rules/barebox.rockchip.make
>> @@ -0,0 +1,18 @@
>> +# -*-makefile-*-
>> +#
>> +# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
>> +#
>> +# For further information about the PTXdist project and license conditions
>> +# see the README file.
>> +#
>> +
>> +ifdef PTXCONF_BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>> +
>> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
>> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
>> +
>> +BAREBOX_INJECT_FILES	+= rk3566_ddr_1056MHz_v1.08.bin:arch/arm/boards/pine64-quartz64/sdram-init.bin
>> +
>> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
>> +
>> +endif
>> -- 
>> 2.30.2
>>
>>
>> _______________________________________________
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>
> 

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1
  2022-01-28 15:26     ` Michael Riesch
@ 2022-01-28 16:10       ` Michael Olbrich
  2022-01-28 16:48         ` Michael Riesch
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Olbrich @ 2022-01-28 16:10 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Fri, Jan 28, 2022 at 04:26:23PM +0100, Michael Riesch wrote:
> Hello Michael,
> 
> Thanks for your review. I'll prepare a v6!
> 
> On 1/28/22 13:33, Michael Olbrich wrote:
> > On Mon, Jan 24, 2022 at 01:09:42PM +0100, Michael Riesch wrote:
> >> Currently, the mainline OP-TEE and TF-A sources do not support the
> >> RK356x SoCs. Therefore, the only option is to use the binary blobs
> >> provided by Rockchip. This patch integrates these blobs (along the SDRAM
> >> initialization binary) for the Pine64 Quartz64 board and the RK3568
> >> EVB1 into barebox.
> >>
> >> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> >> ---
> >>  platforms/barebox.rockchip.in | 13 +++++++++++++
> >>  rules/barebox.rockchip.make   | 18 ++++++++++++++++++
> >>  2 files changed, 31 insertions(+)
> >>  create mode 100644 rules/barebox.rockchip.make
> >>
> >> diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
> >> index 8ecdb0762..9aad4eaf8 100644
> >> --- a/platforms/barebox.rockchip.in
> >> +++ b/platforms/barebox.rockchip.in
> >> @@ -1 +1,14 @@
> >>  ## SECTION=barebox_firmware
> >> +
> >> +config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >> +	prompt "barebox needs firmware-rockchip"
> >> +	bool
> >> +	depends on ARCH_ARM64
> >> +	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> > 
> > This does not work. It must look like this or the build dependency is not
> > created:
> > 
> > config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> > 	prompt "barebox needs firmware-rockchip"
> > 	bool
> > 	depends on ARCH_ARM64
> > 
> > config BAREBOX
> > 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> > 
> > Multiple occurrences of the same symbol are merged, so this works just
> > fine as long as 'BAREBOX' is fully defined somewhere else.
> 
> I tried this approach but it returns the error
> 
> .../ptxdist/platforms/barebox.in:11:error: recursive dependency detected!
> .../ptxdist/platforms/barebox.in:11:	symbol BAREBOX depends on BAREBOX
> 
> Any idea what could be wrong here?

Ah, if we resolve any 'source' commands etc. then the whole thing looks
basically like this:

if BAREBOX
if BAREBOX_FIRMWARE

config BAREBOX
	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP

endif
endif

and that's the same as

config BAREBOX
	depends on BAREBOX
	depends on BAREBOX_FIRMWARE
	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP

I think, the only idea is to split that in two files. On with
SECTION=barebox_firmware and one with SECTION=bootloader.

It's not very nice, but I don't have a better idea.

Michael


> >> +	select FIRMWARE_ROCKCHIP_RK356x_BL31 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >> +	select FIRMWARE_ROCKCHIP_RK356x_BL32 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >> +	select FIRMWARE_ROCKCHIP_RK3566_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >> +	select FIRMWARE_ROCKCHIP_RK3568_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >> +	help
> >> +	  Select this if barebox needs the non-free Rockchip firmware
> >> +	  blobs.
> >> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
> >> new file mode 100644
> >> index 000000000..0255b2b4d
> >> --- /dev/null
> >> +++ b/rules/barebox.rockchip.make
> >> @@ -0,0 +1,18 @@
> >> +# -*-makefile-*-
> >> +#
> >> +# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
> >> +#
> >> +# For further information about the PTXdist project and license conditions
> >> +# see the README file.
> >> +#
> >> +
> >> +ifdef PTXCONF_BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >> +
> >> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
> >> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
> >> +
> >> +BAREBOX_INJECT_FILES	+= rk3566_ddr_1056MHz_v1.08.bin:arch/arm/boards/pine64-quartz64/sdram-init.bin
> >> +
> >> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
> >> +
> >> +endif
> >> -- 
> >> 2.30.2
> >>
> >>
> >> _______________________________________________
> >> ptxdist mailing list
> >> ptxdist@pengutronix.de
> >> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> >>
> > 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1
  2022-01-28 16:10       ` Michael Olbrich
@ 2022-01-28 16:48         ` Michael Riesch
  2022-01-28 20:08           ` Michael Olbrich
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Riesch @ 2022-01-28 16:48 UTC (permalink / raw)
  To: ptxdist, m.olbrich; +Cc: m.tretter

Hello Michael,

On 1/28/22 17:10, Michael Olbrich wrote:
> On Fri, Jan 28, 2022 at 04:26:23PM +0100, Michael Riesch wrote:
>> Hello Michael,
>>
>> Thanks for your review. I'll prepare a v6!
>>
>> On 1/28/22 13:33, Michael Olbrich wrote:
>>> On Mon, Jan 24, 2022 at 01:09:42PM +0100, Michael Riesch wrote:
>>>> Currently, the mainline OP-TEE and TF-A sources do not support the
>>>> RK356x SoCs. Therefore, the only option is to use the binary blobs
>>>> provided by Rockchip. This patch integrates these blobs (along the SDRAM
>>>> initialization binary) for the Pine64 Quartz64 board and the RK3568
>>>> EVB1 into barebox.
>>>>
>>>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
>>>> ---
>>>>  platforms/barebox.rockchip.in | 13 +++++++++++++
>>>>  rules/barebox.rockchip.make   | 18 ++++++++++++++++++
>>>>  2 files changed, 31 insertions(+)
>>>>  create mode 100644 rules/barebox.rockchip.make
>>>>
>>>> diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
>>>> index 8ecdb0762..9aad4eaf8 100644
>>>> --- a/platforms/barebox.rockchip.in
>>>> +++ b/platforms/barebox.rockchip.in
>>>> @@ -1 +1,14 @@
>>>>  ## SECTION=barebox_firmware
>>>> +
>>>> +config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>> +	prompt "barebox needs firmware-rockchip"
>>>> +	bool
>>>> +	depends on ARCH_ARM64
>>>> +	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>
>>> This does not work. It must look like this or the build dependency is not
>>> created:
>>>
>>> config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>> 	prompt "barebox needs firmware-rockchip"
>>> 	bool
>>> 	depends on ARCH_ARM64
>>>
>>> config BAREBOX
>>> 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>
>>> Multiple occurrences of the same symbol are merged, so this works just
>>> fine as long as 'BAREBOX' is fully defined somewhere else.
>>
>> I tried this approach but it returns the error
>>
>> .../ptxdist/platforms/barebox.in:11:error: recursive dependency detected!
>> .../ptxdist/platforms/barebox.in:11:	symbol BAREBOX depends on BAREBOX
>>
>> Any idea what could be wrong here?
> 
> Ah, if we resolve any 'source' commands etc. then the whole thing looks
> basically like this:
> 
> if BAREBOX
> if BAREBOX_FIRMWARE
> 
> config BAREBOX
> 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> 
> endif
> endif
> 
> and that's the same as
> 
> config BAREBOX
> 	depends on BAREBOX
> 	depends on BAREBOX_FIRMWARE
> 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> 
> I think, the only idea is to split that in two files. On with
> SECTION=barebox_firmware and one with SECTION=bootloader.

Would some kind of dependency symbol do the trick? For example,

in barebox.in:

config BAREBOXDEP

menuconfig BAREBOX
        select BAREBOXDEP

if BAREBOX
menuconfig BAREBOX_FIRMWARE
...
endif

and in barebox.rockchip.in:

config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP

config BAREBOXDEP
        select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP

?

Thanks and best regards,
Michael

> 
> It's not very nice, but I don't have a better idea.
> 
> Michael
> 
> 
>>>> +	select FIRMWARE_ROCKCHIP_RK356x_BL31 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>> +	select FIRMWARE_ROCKCHIP_RK356x_BL32 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>> +	select FIRMWARE_ROCKCHIP_RK3566_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>> +	select FIRMWARE_ROCKCHIP_RK3568_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>> +	help
>>>> +	  Select this if barebox needs the non-free Rockchip firmware
>>>> +	  blobs.
>>>> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
>>>> new file mode 100644
>>>> index 000000000..0255b2b4d
>>>> --- /dev/null
>>>> +++ b/rules/barebox.rockchip.make
>>>> @@ -0,0 +1,18 @@
>>>> +# -*-makefile-*-
>>>> +#
>>>> +# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
>>>> +#
>>>> +# For further information about the PTXdist project and license conditions
>>>> +# see the README file.
>>>> +#
>>>> +
>>>> +ifdef PTXCONF_BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
>>>> +
>>>> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
>>>> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
>>>> +
>>>> +BAREBOX_INJECT_FILES	+= rk3566_ddr_1056MHz_v1.08.bin:arch/arm/boards/pine64-quartz64/sdram-init.bin
>>>> +
>>>> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
>>>> +
>>>> +endif
>>>> -- 
>>>> 2.30.2
>>>>
>>>>
>>>> _______________________________________________
>>>> ptxdist mailing list
>>>> ptxdist@pengutronix.de
>>>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>>>
>>>
>>
> 

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* Re: [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1
  2022-01-28 16:48         ` Michael Riesch
@ 2022-01-28 20:08           ` Michael Olbrich
  0 siblings, 0 replies; 17+ messages in thread
From: Michael Olbrich @ 2022-01-28 20:08 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Fri, Jan 28, 2022 at 05:48:11PM +0100, Michael Riesch wrote:
> Hello Michael,
> 
> On 1/28/22 17:10, Michael Olbrich wrote:
> > On Fri, Jan 28, 2022 at 04:26:23PM +0100, Michael Riesch wrote:
> >> Hello Michael,
> >>
> >> Thanks for your review. I'll prepare a v6!
> >>
> >> On 1/28/22 13:33, Michael Olbrich wrote:
> >>> On Mon, Jan 24, 2022 at 01:09:42PM +0100, Michael Riesch wrote:
> >>>> Currently, the mainline OP-TEE and TF-A sources do not support the
> >>>> RK356x SoCs. Therefore, the only option is to use the binary blobs
> >>>> provided by Rockchip. This patch integrates these blobs (along the SDRAM
> >>>> initialization binary) for the Pine64 Quartz64 board and the RK3568
> >>>> EVB1 into barebox.
> >>>>
> >>>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> >>>> ---
> >>>>  platforms/barebox.rockchip.in | 13 +++++++++++++
> >>>>  rules/barebox.rockchip.make   | 18 ++++++++++++++++++
> >>>>  2 files changed, 31 insertions(+)
> >>>>  create mode 100644 rules/barebox.rockchip.make
> >>>>
> >>>> diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
> >>>> index 8ecdb0762..9aad4eaf8 100644
> >>>> --- a/platforms/barebox.rockchip.in
> >>>> +++ b/platforms/barebox.rockchip.in
> >>>> @@ -1 +1,14 @@
> >>>>  ## SECTION=barebox_firmware
> >>>> +
> >>>> +config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>> +	prompt "barebox needs firmware-rockchip"
> >>>> +	bool
> >>>> +	depends on ARCH_ARM64
> >>>> +	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>
> >>> This does not work. It must look like this or the build dependency is not
> >>> created:
> >>>
> >>> config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>> 	prompt "barebox needs firmware-rockchip"
> >>> 	bool
> >>> 	depends on ARCH_ARM64
> >>>
> >>> config BAREBOX
> >>> 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>
> >>> Multiple occurrences of the same symbol are merged, so this works just
> >>> fine as long as 'BAREBOX' is fully defined somewhere else.
> >>
> >> I tried this approach but it returns the error
> >>
> >> .../ptxdist/platforms/barebox.in:11:error: recursive dependency detected!
> >> .../ptxdist/platforms/barebox.in:11:	symbol BAREBOX depends on BAREBOX
> >>
> >> Any idea what could be wrong here?
> > 
> > Ah, if we resolve any 'source' commands etc. then the whole thing looks
> > basically like this:
> > 
> > if BAREBOX
> > if BAREBOX_FIRMWARE
> > 
> > config BAREBOX
> > 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> > 
> > endif
> > endif
> > 
> > and that's the same as
> > 
> > config BAREBOX
> > 	depends on BAREBOX
> > 	depends on BAREBOX_FIRMWARE
> > 	select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> > 
> > I think, the only idea is to split that in two files. On with
> > SECTION=barebox_firmware and one with SECTION=bootloader.
> 
> Would some kind of dependency symbol do the trick? For example,
> 
> in barebox.in:
> 
> config BAREBOXDEP

Hmmm, try this:

config BAREBOXDEP
	tristate
	select VIRTUAL

But I think that will still create a dependency loop because BAREBOX
selects BAREBOXDEP and BAREBOXDEP depends on BAREBOX.

Michael

> 
> menuconfig BAREBOX
>         select BAREBOXDEP
> 
> if BAREBOX
> menuconfig BAREBOX_FIRMWARE
> ...
> endif
> 
> and in barebox.rockchip.in:
> 
> config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> 
> config BAREBOXDEP
>         select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> 
> ?
> 
> Thanks and best regards,
> Michael
> 
> > 
> > It's not very nice, but I don't have a better idea.
> > 
> > Michael
> > 
> > 
> >>>> +	select FIRMWARE_ROCKCHIP_RK356x_BL31 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>> +	select FIRMWARE_ROCKCHIP_RK356x_BL32 if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>> +	select FIRMWARE_ROCKCHIP_RK3566_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>> +	select FIRMWARE_ROCKCHIP_RK3568_SDRAM if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>> +	help
> >>>> +	  Select this if barebox needs the non-free Rockchip firmware
> >>>> +	  blobs.
> >>>> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
> >>>> new file mode 100644
> >>>> index 000000000..0255b2b4d
> >>>> --- /dev/null
> >>>> +++ b/rules/barebox.rockchip.make
> >>>> @@ -0,0 +1,18 @@
> >>>> +# -*-makefile-*-
> >>>> +#
> >>>> +# Copyright (C) 2021 by Michael Riesch <michael.riesch@wolfvision.net>
> >>>> +#
> >>>> +# For further information about the PTXdist project and license conditions
> >>>> +# see the README file.
> >>>> +#
> >>>> +
> >>>> +ifdef PTXCONF_BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
> >>>> +
> >>>> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
> >>>> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
> >>>> +
> >>>> +BAREBOX_INJECT_FILES	+= rk3566_ddr_1056MHz_v1.08.bin:arch/arm/boards/pine64-quartz64/sdram-init.bin
> >>>> +
> >>>> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
> >>>> +
> >>>> +endif
> >>>> -- 
> >>>> 2.30.2
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> ptxdist mailing list
> >>>> ptxdist@pengutronix.de
> >>>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> >>>>
> >>>
> >>
> > 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

end of thread, other threads:[~2022-01-28 20:09 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 12:09 [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs Michael Riesch
2022-01-24 12:09 ` [ptxdist] [PATCH v5 1/5] platforms: add section for non-free " Michael Riesch
2022-01-24 12:09 ` [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries Michael Riesch
2022-01-28 12:31   ` Michael Olbrich
2022-01-28 12:46     ` Michael Riesch
2022-01-28 12:59       ` Michael Olbrich
2022-01-28 13:46         ` Michael Riesch
2022-01-24 12:09 ` [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory Michael Riesch
2022-01-28 12:27   ` Michael Olbrich
2022-01-24 12:09 ` [ptxdist] [PATCH v5 4/5] barebox: add integration of firmware blobs Michael Riesch
2022-01-28 12:28   ` Michael Olbrich
2022-01-24 12:09 ` [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch
2022-01-28 12:33   ` Michael Olbrich
2022-01-28 15:26     ` Michael Riesch
2022-01-28 16:10       ` Michael Olbrich
2022-01-28 16:48         ` Michael Riesch
2022-01-28 20:08           ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox