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

Hi all,

The fourth version of this series considers the suggestion by
Michael Olbrich that uses separate rule files to define which
firmware blobs are injected into barebox. In order to implement
this suggestion, the (original) third patch has been split into
two patches for the sake of clarity.

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (4):
  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

 platforms/Kconfig                      | 10 ++++
 platforms/barebox.in                   |  8 +++
 platforms/barebox.rockchip.in          | 10 ++++
 platforms/firmware-rockchip.in         | 41 ++++++++++++++
 rules/barebox.make                     |  4 ++
 rules/barebox.rockchip.make            | 16 ++++++
 rules/firmware-rockchip.make           | 74 ++++++++++++++++++++++++++
 rules/post/ptxd_make_world_inject.make | 19 +++++++
 scripts/lib/ptxd_make_world_inject.sh  | 42 +++++++++++++++
 9 files changed, 224 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] 14+ messages in thread

* [ptxdist] [PATCH v4 1/4] platforms: add section for non-free firmware blobs
  2021-12-20 12:08 [ptxdist] [PATCH v4 0/4] Add support for Rockchip firmware blobs Michael Riesch
@ 2021-12-20 12:08 ` Michael Riesch
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries Michael Riesch
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Michael Riesch @ 2021-12-20 12:08 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] 14+ messages in thread

* [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries
  2021-12-20 12:08 [ptxdist] [PATCH v4 0/4] Add support for Rockchip firmware blobs Michael Riesch
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 1/4] platforms: add section for non-free " Michael Riesch
@ 2021-12-20 12:08 ` Michael Riesch
  2022-01-07 13:56   ` Michael Olbrich
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 3/4] scripts: add helper to inject files into a source directory Michael Riesch
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs Michael Riesch
  3 siblings, 1 reply; 14+ messages in thread
From: Michael Riesch @ 2021-12-20 12:08 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] 14+ messages in thread

* [ptxdist] [PATCH v4 3/4] scripts: add helper to inject files into a source directory
  2021-12-20 12:08 [ptxdist] [PATCH v4 0/4] Add support for Rockchip firmware blobs Michael Riesch
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 1/4] platforms: add section for non-free " Michael Riesch
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries Michael Riesch
@ 2021-12-20 12:08 ` Michael Riesch
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs Michael Riesch
  3 siblings, 0 replies; 14+ messages in thread
From: Michael Riesch @ 2021-12-20 12:08 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] 14+ messages in thread

* [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs
  2021-12-20 12:08 [ptxdist] [PATCH v4 0/4] Add support for Rockchip firmware blobs Michael Riesch
                   ` (2 preceding siblings ...)
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 3/4] scripts: add helper to inject files into a source directory Michael Riesch
@ 2021-12-20 12:08 ` Michael Riesch
  2022-01-07 14:09   ` Michael Olbrich
  3 siblings, 1 reply; 14+ messages in thread
From: Michael Riesch @ 2021-12-20 12:08 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 | 10 ++++++++++
 rules/barebox.make            |  4 ++++
 rules/barebox.rockchip.make   | 16 ++++++++++++++++
 4 files changed, 38 insertions(+)
 create mode 100644 platforms/barebox.rockchip.in
 create mode 100644 rules/barebox.rockchip.make

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..238798ce1
--- /dev/null
+++ b/platforms/barebox.rockchip.in
@@ -0,0 +1,10 @@
+## 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
+	help
+	  Select this if barebox needs the non-free Rockchip firmware
+	  blobs.
diff --git a/rules/barebox.make b/rules/barebox.make
index bea9f3adc..cc70a6ff5 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -94,6 +94,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)
 
 # ----------------------------------------------------------------------------
diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
new file mode 100644
index 000000000..33795bee4
--- /dev/null
+++ b/rules/barebox.rockchip.make
@@ -0,0 +1,16 @@
+# -*-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_PATH	+= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware
+BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
+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
+
+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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries Michael Riesch
@ 2022-01-07 13:56   ` Michael Olbrich
  2022-01-10  6:05     ` Michael Riesch
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Olbrich @ 2022-01-07 13:56 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Mon, Dec 20, 2021 at 01:08:55PM +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

Right, the options must be part of the barebox integration, otherwise they
may be disabled here and then missing later.

I'll comment some more on the other patch.

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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs
  2021-12-20 12:08 ` [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs Michael Riesch
@ 2022-01-07 14:09   ` Michael Olbrich
  2022-01-10  6:39     ` Michael Riesch
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Olbrich @ 2022-01-07 14:09 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Mon, Dec 20, 2021 at 01:08:57PM +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 | 10 ++++++++++
>  rules/barebox.make            |  4 ++++
>  rules/barebox.rockchip.make   | 16 ++++++++++++++++
>  4 files changed, 38 insertions(+)
>  create mode 100644 platforms/barebox.rockchip.in
>  create mode 100644 rules/barebox.rockchip.make
> 
> 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

If you split out the generic parts and add empty files with just the
"## SECTION=" header (for both new sections) then we could maybe get that
merged while we figure out how to handle the rockchip part.

> +
>  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..238798ce1
> --- /dev/null
> +++ b/platforms/barebox.rockchip.in
> @@ -0,0 +1,10 @@
> +## 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
> +	help
> +	  Select this if barebox needs the non-free Rockchip firmware
> +	  blobs.
> diff --git a/rules/barebox.make b/rules/barebox.make
> index bea9f3adc..cc70a6ff5 100644
> --- a/rules/barebox.make
> +++ b/rules/barebox.make
> @@ -94,6 +94,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)
>  
>  # ----------------------------------------------------------------------------
> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
> new file mode 100644
> index 000000000..33795bee4
> --- /dev/null
> +++ b/rules/barebox.rockchip.make
> @@ -0,0 +1,16 @@
> +# -*-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_PATH	+= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware

This should be in barebox.make. BAREBOX_INJECT_PATH is a ':' separated
path, so expanding it like this doesn't work anyways.

So in general I've been thinking which parts make sense in PTXdist upstream
and which parts should be in the BSPs. I mean it doesn't really scale, if
we add firmware files for all boards into PTXdist upstream. So I had the
vague idea that we could add files that are SoC specific to PTXdist and
leave the board specific files in the BSP. Then I saw this:

> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin

My understanding was that this file is the code that does the SDRAM timing
calibration. So I expected it to be SoC specific and therefore in a more
generic path, not the board directory.
Am I missing something here?

> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin

That's TF-A right?

> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin

I expected these files to be board specific, but they are in a generic
directory? Also, I would expect those to be built from source.

And about the suboptions: Do we actually need them? I mean, if we copy a
few extra files, then barebox will just ignore them, right?

Regards,
Michael

> +
> +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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries
  2022-01-07 13:56   ` Michael Olbrich
@ 2022-01-10  6:05     ` Michael Riesch
  2022-01-21  7:28       ` Michael Olbrich
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Riesch @ 2022-01-10  6:05 UTC (permalink / raw)
  To: ptxdist, m.olbrich; +Cc: m.tretter

Hello Michael,

On 1/7/22 2:56 PM, Michael Olbrich wrote:
> On Mon, Dec 20, 2021 at 01:08:55PM +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
> 
> Right, the options must be part of the barebox integration, otherwise they
> may be disabled here and then missing later.

Are you sure? In principle u-boot could use those binaries as well (if
anyone is keen on using it), couldn't it?

But the dependencies are missing here I guess.

Best regards,
Michael

> 
> I'll comment some more on the other patch.
> 
> 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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs
  2022-01-07 14:09   ` Michael Olbrich
@ 2022-01-10  6:39     ` Michael Riesch
  2022-01-21  7:54       ` Michael Olbrich
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Riesch @ 2022-01-10  6:39 UTC (permalink / raw)
  To: ptxdist, m.olbrich; +Cc: m.tretter

Hello Michael,

On 1/7/22 3:09 PM, Michael Olbrich wrote:
> On Mon, Dec 20, 2021 at 01:08:57PM +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 | 10 ++++++++++
>>  rules/barebox.make            |  4 ++++
>>  rules/barebox.rockchip.make   | 16 ++++++++++++++++
>>  4 files changed, 38 insertions(+)
>>  create mode 100644 platforms/barebox.rockchip.in
>>  create mode 100644 rules/barebox.rockchip.make
>>
>> 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
> 
> If you split out the generic parts and add empty files with just the
> "## SECTION=" header (for both new sections) then we could maybe get that
> merged while we figure out how to handle the rockchip part.

OK, I'll consider this in v5.

>> +
>>  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..238798ce1
>> --- /dev/null
>> +++ b/platforms/barebox.rockchip.in
>> @@ -0,0 +1,10 @@
>> +## 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
>> +	help
>> +	  Select this if barebox needs the non-free Rockchip firmware
>> +	  blobs.
>> diff --git a/rules/barebox.make b/rules/barebox.make
>> index bea9f3adc..cc70a6ff5 100644
>> --- a/rules/barebox.make
>> +++ b/rules/barebox.make
>> @@ -94,6 +94,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)
>>  
>>  # ----------------------------------------------------------------------------
>> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
>> new file mode 100644
>> index 000000000..33795bee4
>> --- /dev/null
>> +++ b/rules/barebox.rockchip.make
>> @@ -0,0 +1,16 @@
>> +# -*-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_PATH	+= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware
> 
> This should be in barebox.make. BAREBOX_INJECT_PATH is a ':' separated
> path, so expanding it like this doesn't work anyways.

Will fix this in v5!

> So in general I've been thinking which parts make sense in PTXdist upstream
> and which parts should be in the BSPs. I mean it doesn't really scale, if
> we add firmware files for all boards into PTXdist upstream. So I had the
> vague idea that we could add files that are SoC specific to PTXdist and
> leave the board specific files in the BSP. 

Not sure whether this is a SoC-specific/board-specific issue, but I
agree that there are a manifold of possibilities here and naturally we
cannot cover everything. I would say the aim here is to provide some
generic means to integrate binary blobs into packages and (optionally)
provide some reasonable defaults. As you stated previously, the defaults
can be overwritten if desired.

> Then I saw this:
> 
>> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
> 
> My understanding was that this file is the code that does the SDRAM timing
> calibration. So I expected it to be SoC specific and therefore in a more
> generic path, not the board directory.
> Am I missing something here?

As far as I understand, the binary contains the SDRAM setup (rows, cols,
etc.) which may be board specific. But you may want to talk to Sascha
for more details.

>> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
> 
> That's TF-A right?

Yes.

>> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
> 
> I expected these files to be board specific, but they are in a generic
> directory? Also, I would expect those to be built from source.

Again, Sascha is the expert here. For all I know those are SoC-specific
and barebox expects them to reside at this particular location.

Indeed one may want to generate these binaries from the mainline
sources. However, at the moment those sources are not available for
RK356x. Rockchip tends to provide only a binary blob when a new SoC is
released, the sources follow about 1-2 years later.

So what do you think? Are there any things in particular that can be
improved in a v5? Or should we leave out the barebox.rockchip.make
altogether (and maybe add it to DistroKit)?

> And about the suboptions: Do we actually need them? I mean, if we copy a
> few extra files, then barebox will just ignore them, right?

The intention was to provide a switch to e.g., disable copying the
binary TF-A blob in case TF-A is build from the mainline sources. I
think it is cleaner that way, but I am not going to insist on that this
is absolutely required. What do you prefer?

Best regards,
Michael

> 
> Regards,
> Michael
> 
>> +
>> +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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries
  2022-01-10  6:05     ` Michael Riesch
@ 2022-01-21  7:28       ` Michael Olbrich
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Olbrich @ 2022-01-21  7:28 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter

On Mon, Jan 10, 2022 at 07:05:56AM +0100, Michael Riesch wrote:
> Hello Michael,
> 
> On 1/7/22 2:56 PM, Michael Olbrich wrote:
> > On Mon, Dec 20, 2021 at 01:08:55PM +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
> > 
> > Right, the options must be part of the barebox integration, otherwise they
> > may be disabled here and then missing later.
> 
> Are you sure? In principle u-boot could use those binaries as well (if
> anyone is keen on using it), couldn't it?
> 
> But the dependencies are missing here I guess.

You're just copying some file to sysroot here. It does not matter if there
are some extra unused files. That happens all the time. No need for an
option here, because the option is needed at the other end anyways.

Michael

> > I'll comment some more on the other patch.
> > 
> > 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
> 

-- 
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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs
  2022-01-10  6:39     ` Michael Riesch
@ 2022-01-21  7:54       ` Michael Olbrich
  2022-01-21  8:43         ` Sascha Hauer
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Olbrich @ 2022-01-21  7:54 UTC (permalink / raw)
  To: Michael Riesch; +Cc: ptxdist, m.tretter, Sascha Hauer

On Mon, Jan 10, 2022 at 07:39:20AM +0100, Michael Riesch wrote:
> On 1/7/22 3:09 PM, Michael Olbrich wrote:
> > On Mon, Dec 20, 2021 at 01:08:57PM +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 | 10 ++++++++++
> >>  rules/barebox.make            |  4 ++++
> >>  rules/barebox.rockchip.make   | 16 ++++++++++++++++
> >>  4 files changed, 38 insertions(+)
> >>  create mode 100644 platforms/barebox.rockchip.in
> >>  create mode 100644 rules/barebox.rockchip.make
> >>
> >> 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
> > 
> > If you split out the generic parts and add empty files with just the
> > "## SECTION=" header (for both new sections) then we could maybe get that
> > merged while we figure out how to handle the rockchip part.
> 
> OK, I'll consider this in v5.
> 
> >> +
> >>  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..238798ce1
> >> --- /dev/null
> >> +++ b/platforms/barebox.rockchip.in
> >> @@ -0,0 +1,10 @@
> >> +## 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
> >> +	help
> >> +	  Select this if barebox needs the non-free Rockchip firmware
> >> +	  blobs.
> >> diff --git a/rules/barebox.make b/rules/barebox.make
> >> index bea9f3adc..cc70a6ff5 100644
> >> --- a/rules/barebox.make
> >> +++ b/rules/barebox.make
> >> @@ -94,6 +94,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)
> >>  
> >>  # ----------------------------------------------------------------------------
> >> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
> >> new file mode 100644
> >> index 000000000..33795bee4
> >> --- /dev/null
> >> +++ b/rules/barebox.rockchip.make
> >> @@ -0,0 +1,16 @@
> >> +# -*-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_PATH	+= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware
> > 
> > This should be in barebox.make. BAREBOX_INJECT_PATH is a ':' separated
> > path, so expanding it like this doesn't work anyways.
> 
> Will fix this in v5!
> 
> > So in general I've been thinking which parts make sense in PTXdist upstream
> > and which parts should be in the BSPs. I mean it doesn't really scale, if
> > we add firmware files for all boards into PTXdist upstream. So I had the
> > vague idea that we could add files that are SoC specific to PTXdist and
> > leave the board specific files in the BSP. 
> 
> Not sure whether this is a SoC-specific/board-specific issue, but I
> agree that there are a manifold of possibilities here and naturally we
> cannot cover everything. I would say the aim here is to provide some
> generic means to integrate binary blobs into packages and (optionally)
> provide some reasonable defaults. As you stated previously, the defaults
> can be overwritten if desired.
> 
> > Then I saw this:
> > 
> >> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
> > 
> > My understanding was that this file is the code that does the SDRAM timing
> > calibration. So I expected it to be SoC specific and therefore in a more
> > generic path, not the board directory.
> > Am I missing something here?
> 
> As far as I understand, the binary contains the SDRAM setup (rows, cols,
> etc.) which may be board specific. But you may want to talk to Sascha
> for more details.

Sascha, can comment on this? I think it would be nice to provide any binary
blobs that can be used by multiple board in PTXdist upstream. However, for
that to work we would need a generic location in the barebox source tree.
Any reason why a board specific location is used here?

> >> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
> > 
> > That's TF-A right?
> 
> Yes.
> 
> >> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
> > 
> > I expected these files to be board specific, but they are in a generic
> > directory? Also, I would expect those to be built from source.
> 
> Again, Sascha is the expert here. For all I know those are SoC-specific
> and barebox expects them to reside at this particular location.

Sascha, same here, just the reverse.

> Indeed one may want to generate these binaries from the mainline
> sources. However, at the moment those sources are not available for
> RK356x. Rockchip tends to provide only a binary blob when a new SoC is
> released, the sources follow about 1-2 years later.

And if you need to make board specific changes? :-/

> So what do you think? Are there any things in particular that can be
> improved in a v5? Or should we leave out the barebox.rockchip.make
> altogether (and maybe add it to DistroKit)?

Can we finish up the rest first? I'd like to get that merged. Having the
Rockchip stuff in the series really helped to figure out what how to do
this, but I think it will take some time to figure out what goes on there.

> > And about the suboptions: Do we actually need them? I mean, if we copy a
> > few extra files, then barebox will just ignore them, right?
> 
> The intention was to provide a switch to e.g., disable copying the
> binary TF-A blob in case TF-A is build from the mainline sources. I
> think it is cleaner that way, but I am not going to insist on that this
> is absolutely required. What do you prefer?

I see your point. Leave it as it is for now. We'll revisit this point once
we decide where to put this.

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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs
  2022-01-21  7:54       ` Michael Olbrich
@ 2022-01-21  8:43         ` Sascha Hauer
  2022-01-21  9:47           ` Michael Olbrich
  0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2022-01-21  8:43 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: ptxdist, Michael Riesch, m.tretter

On Fri, Jan 21, 2022 at 08:54:49AM +0100, Michael Olbrich wrote:
> On Mon, Jan 10, 2022 at 07:39:20AM +0100, Michael Riesch wrote:
> > On 1/7/22 3:09 PM, Michael Olbrich wrote:
> > > On Mon, Dec 20, 2021 at 01:08:57PM +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 | 10 ++++++++++
> > >>  rules/barebox.make            |  4 ++++
> > >>  rules/barebox.rockchip.make   | 16 ++++++++++++++++
> > >>  4 files changed, 38 insertions(+)
> > >>  create mode 100644 platforms/barebox.rockchip.in
> > >>  create mode 100644 rules/barebox.rockchip.make
> > >>
> > >> 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
> > > 
> > > If you split out the generic parts and add empty files with just the
> > > "## SECTION=" header (for both new sections) then we could maybe get that
> > > merged while we figure out how to handle the rockchip part.
> > 
> > OK, I'll consider this in v5.
> > 
> > >> +
> > >>  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..238798ce1
> > >> --- /dev/null
> > >> +++ b/platforms/barebox.rockchip.in
> > >> @@ -0,0 +1,10 @@
> > >> +## 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
> > >> +	help
> > >> +	  Select this if barebox needs the non-free Rockchip firmware
> > >> +	  blobs.
> > >> diff --git a/rules/barebox.make b/rules/barebox.make
> > >> index bea9f3adc..cc70a6ff5 100644
> > >> --- a/rules/barebox.make
> > >> +++ b/rules/barebox.make
> > >> @@ -94,6 +94,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)
> > >>  
> > >>  # ----------------------------------------------------------------------------
> > >> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
> > >> new file mode 100644
> > >> index 000000000..33795bee4
> > >> --- /dev/null
> > >> +++ b/rules/barebox.rockchip.make
> > >> @@ -0,0 +1,16 @@
> > >> +# -*-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_PATH	+= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware
> > > 
> > > This should be in barebox.make. BAREBOX_INJECT_PATH is a ':' separated
> > > path, so expanding it like this doesn't work anyways.
> > 
> > Will fix this in v5!
> > 
> > > So in general I've been thinking which parts make sense in PTXdist upstream
> > > and which parts should be in the BSPs. I mean it doesn't really scale, if
> > > we add firmware files for all boards into PTXdist upstream. So I had the
> > > vague idea that we could add files that are SoC specific to PTXdist and
> > > leave the board specific files in the BSP. 
> > 
> > Not sure whether this is a SoC-specific/board-specific issue, but I
> > agree that there are a manifold of possibilities here and naturally we
> > cannot cover everything. I would say the aim here is to provide some
> > generic means to integrate binary blobs into packages and (optionally)
> > provide some reasonable defaults. As you stated previously, the defaults
> > can be overwritten if desired.
> > 
> > > Then I saw this:
> > > 
> > >> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
> > > 
> > > My understanding was that this file is the code that does the SDRAM timing
> > > calibration. So I expected it to be SoC specific and therefore in a more
> > > generic path, not the board directory.
> > > Am I missing something here?
> > 
> > As far as I understand, the binary contains the SDRAM setup (rows, cols,
> > etc.) which may be board specific. But you may want to talk to Sascha
> > for more details.
> 
> Sascha, can comment on this? I think it would be nice to provide any binary
> blobs that can be used by multiple board in PTXdist upstream. However, for
> that to work we would need a generic location in the barebox source tree.
> Any reason why a board specific location is used here?

The files are board specific so it felt natural to put them in a board
specific location.

Anyway, having a single directory where such files are located seems to
be a good idea. Not only that it helps external build systems like
ptxdist, but we could also create tarballs or repositories with binary
blobs which could be taken as-is and the files wouldn't have to be
copied to special locations in the barebox tree.

> 
> > >> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
> > > 
> > > That's TF-A right?
> > 
> > Yes.
> > 
> > >> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
> > > 
> > > I expected these files to be board specific, but they are in a generic
> > > directory? Also, I would expect those to be built from source.
> > 
> > Again, Sascha is the expert here. For all I know those are SoC-specific
> > and barebox expects them to reside at this particular location.
> 
> Sascha, same here, just the reverse.

OP-TEE files are not necessarily board specific. Often enough they are,
because things like serial ports are hardcoded, but in theory OP-TEE
could take a device tree and may not even be SoC specific. I think the
current OP-TEE codebase makes it hard to actually create board or SoC
agnostic images, but who knows how things develop in the future.

> 
> > Indeed one may want to generate these binaries from the mainline
> > sources. However, at the moment those sources are not available for
> > RK356x. Rockchip tends to provide only a binary blob when a new SoC is
> > released, the sources follow about 1-2 years later.
> 
> And if you need to make board specific changes? :-/

I guess you know the answer :)

Generally I like the idea of having a single directory with binary blobs
and other firmware files. This would also allow us to let barebox take
board specific blobs which could point to more generic files using
symlinks.
I think ptxdist could provide ways to either extract specific files from
a tarball or to let the user choose to build certain things like OP-TEE
or TF-A himself.

Sounds like some work for cleaning that up in barebox, but doable and
worthwile.

Sascha

-- 
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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs
  2022-01-21  8:43         ` Sascha Hauer
@ 2022-01-21  9:47           ` Michael Olbrich
  2022-01-24  8:33             ` Michael Riesch
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Olbrich @ 2022-01-21  9:47 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: ptxdist, Michael Riesch, m.tretter

On Fri, Jan 21, 2022 at 09:43:41AM +0100, Sascha Hauer wrote:
> On Fri, Jan 21, 2022 at 08:54:49AM +0100, Michael Olbrich wrote:
> > On Mon, Jan 10, 2022 at 07:39:20AM +0100, Michael Riesch wrote:
> > > On 1/7/22 3:09 PM, Michael Olbrich wrote:
> > > > On Mon, Dec 20, 2021 at 01:08:57PM +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 | 10 ++++++++++
> > > >>  rules/barebox.make            |  4 ++++
> > > >>  rules/barebox.rockchip.make   | 16 ++++++++++++++++
> > > >>  4 files changed, 38 insertions(+)
> > > >>  create mode 100644 platforms/barebox.rockchip.in
> > > >>  create mode 100644 rules/barebox.rockchip.make
> > > >>
> > > >> 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
> > > > 
> > > > If you split out the generic parts and add empty files with just the
> > > > "## SECTION=" header (for both new sections) then we could maybe get that
> > > > merged while we figure out how to handle the rockchip part.
> > > 
> > > OK, I'll consider this in v5.
> > > 
> > > >> +
> > > >>  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..238798ce1
> > > >> --- /dev/null
> > > >> +++ b/platforms/barebox.rockchip.in
> > > >> @@ -0,0 +1,10 @@
> > > >> +## 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
> > > >> +	help
> > > >> +	  Select this if barebox needs the non-free Rockchip firmware
> > > >> +	  blobs.
> > > >> diff --git a/rules/barebox.make b/rules/barebox.make
> > > >> index bea9f3adc..cc70a6ff5 100644
> > > >> --- a/rules/barebox.make
> > > >> +++ b/rules/barebox.make
> > > >> @@ -94,6 +94,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)
> > > >>  
> > > >>  # ----------------------------------------------------------------------------
> > > >> diff --git a/rules/barebox.rockchip.make b/rules/barebox.rockchip.make
> > > >> new file mode 100644
> > > >> index 000000000..33795bee4
> > > >> --- /dev/null
> > > >> +++ b/rules/barebox.rockchip.make
> > > >> @@ -0,0 +1,16 @@
> > > >> +# -*-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_PATH	+= ${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware
> > > > 
> > > > This should be in barebox.make. BAREBOX_INJECT_PATH is a ':' separated
> > > > path, so expanding it like this doesn't work anyways.
> > > 
> > > Will fix this in v5!
> > > 
> > > > So in general I've been thinking which parts make sense in PTXdist upstream
> > > > and which parts should be in the BSPs. I mean it doesn't really scale, if
> > > > we add firmware files for all boards into PTXdist upstream. So I had the
> > > > vague idea that we could add files that are SoC specific to PTXdist and
> > > > leave the board specific files in the BSP. 
> > > 
> > > Not sure whether this is a SoC-specific/board-specific issue, but I
> > > agree that there are a manifold of possibilities here and naturally we
> > > cannot cover everything. I would say the aim here is to provide some
> > > generic means to integrate binary blobs into packages and (optionally)
> > > provide some reasonable defaults. As you stated previously, the defaults
> > > can be overwritten if desired.
> > > 
> > > > Then I saw this:
> > > > 
> > > >> +BAREBOX_INJECT_FILES	+= rk3568_ddr_1560MHz_v1.08.bin:arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
> > > > 
> > > > My understanding was that this file is the code that does the SDRAM timing
> > > > calibration. So I expected it to be SoC specific and therefore in a more
> > > > generic path, not the board directory.
> > > > Am I missing something here?
> > > 
> > > As far as I understand, the binary contains the SDRAM setup (rows, cols,
> > > etc.) which may be board specific. But you may want to talk to Sascha
> > > for more details.
> > 
> > Sascha, can comment on this? I think it would be nice to provide any binary
> > blobs that can be used by multiple board in PTXdist upstream. However, for
> > that to work we would need a generic location in the barebox source tree.
> > Any reason why a board specific location is used here?
> 
> The files are board specific so it felt natural to put them in a board
> specific location.

Ok, makes sense. I just wasn't sure if they are board specific.

> Anyway, having a single directory where such files are located seems to
> be a good idea. Not only that it helps external build systems like
> ptxdist, but we could also create tarballs or repositories with binary
> blobs which could be taken as-is and the files wouldn't have to be
> copied to special locations in the barebox tree.
> 
> > 
> > > >> +BAREBOX_INJECT_FILES	+= rk3568_bl31_v1.24.elf:firmware/rk3568-bl31.bin
> > > > 
> > > > That's TF-A right?
> > > 
> > > Yes.
> > > 
> > > >> +BAREBOX_INJECT_FILES	+= rk3568_bl32_v1.05.bin:firmware/rk3568-op-tee.bin
> > > > 
> > > > I expected these files to be board specific, but they are in a generic
> > > > directory? Also, I would expect those to be built from source.
> > > 
> > > Again, Sascha is the expert here. For all I know those are SoC-specific
> > > and barebox expects them to reside at this particular location.
> > 
> > Sascha, same here, just the reverse.
> 
> OP-TEE files are not necessarily board specific. Often enough they are,
> because things like serial ports are hardcoded, but in theory OP-TEE
> could take a device tree and may not even be SoC specific. I think the
> current OP-TEE codebase makes it hard to actually create board or SoC
> agnostic images, but who knows how things develop in the future.

But the TF-A is always board specific, right? Anyways, I'd say separate
location for each board make more sense here. A symlink or copy is easy
when you actually want to share the same file. But a patch is needed when
you need different files and two boards use the same path.

> > 
> > > Indeed one may want to generate these binaries from the mainline
> > > sources. However, at the moment those sources are not available for
> > > RK356x. Rockchip tends to provide only a binary blob when a new SoC is
> > > released, the sources follow about 1-2 years later.
> > 
> > And if you need to make board specific changes? :-/
> 
> I guess you know the answer :)
> 
> Generally I like the idea of having a single directory with binary blobs
> and other firmware files. This would also allow us to let barebox take
> board specific blobs which could point to more generic files using
> symlinks.
> I think ptxdist could provide ways to either extract specific files from
> a tarball or to let the user choose to build certain things like OP-TEE
> or TF-A himself.
> 
> Sounds like some work for cleaning that up in barebox, but doable and
> worthwile.

We're looking at what to do in PTXdist right now. Currently, the idea is
that one package dumps all files somewhere in sysroot. Then we have some
minimal barebox integration that adds the individual files with source and
destination to a list. And in the barebox prepare stage all files in that
list are copied into the barebox source tree.

Just dumping all files from a tarball into the barebox source tree would be
easier, but I don't think its feasible. Just look at the current case: We
have an upstream Tarball with fixed names that include versions. So we need
to do some mapping somewhere anyways.

But having consistent locations where to put the files would make writing
the mappings easier.

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] 14+ messages in thread

* Re: [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs
  2022-01-21  9:47           ` Michael Olbrich
@ 2022-01-24  8:33             ` Michael Riesch
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Riesch @ 2022-01-24  8:33 UTC (permalink / raw)
  To: ptxdist, m.olbrich; +Cc: m.tretter, Sascha Hauer

Hello Michael,

On 1/21/22 10:47, Michael Olbrich wrote:
> [...]
> We're looking at what to do in PTXdist right now. Currently, the idea is
> that one package dumps all files somewhere in sysroot. Then we have some
> minimal barebox integration that adds the individual files with source and
> destination to a list. And in the barebox prepare stage all files in that
> list are copied into the barebox source tree.
> 
> Just dumping all files from a tarball into the barebox source tree would be
> easier, but I don't think its feasible. Just look at the current case: We
> have an upstream Tarball with fixed names that include versions. So we need
> to do some mapping somewhere anyways.
> 
> But having consistent locations where to put the files would make writing
> the mappings easier.
> 
> Michael

If I understand correctly the remaining open issue are the mappings from
files in sysroot (installed by binary vendor packages and/or open-source
packages) to files in the barebox source tree. These mappings are
implemented in the barebox.insertvendorhere.make rule files, which are
likely to be maintained in board support packages.

Therefore I am going to submit a v5 of the series that adds
 - the section for binary firmware blobs
 - the firmware-rockchip package as example of a binary vendor package
 - the generic helpers to inject files into a package source tree
 - the generic usage of those helpers in the barebox package

(i.e., the generic part) and includes a mapping barebox.rockchip.make,
which implements the only currently available (and hence best) way to
integrate sdram init, OPTEE and TF-A for recent Rockchip RK356x boards,
to showcase how this feature is supposed to be used. This mapping shall
be marked as RFC and can be considered for inclusion in ptxdist (as
reasonable default that can be overwritten) or (at a later stage) in
DistroKit.

This way the exact form of the mappings can be discussed further and the
generic part is moved towards being merged. Sounds good?

Best regards,
Michael

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


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

end of thread, other threads:[~2022-01-24  8:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 12:08 [ptxdist] [PATCH v4 0/4] Add support for Rockchip firmware blobs Michael Riesch
2021-12-20 12:08 ` [ptxdist] [PATCH v4 1/4] platforms: add section for non-free " Michael Riesch
2021-12-20 12:08 ` [ptxdist] [PATCH v4 2/4] add package for rockchip firmware binaries Michael Riesch
2022-01-07 13:56   ` Michael Olbrich
2022-01-10  6:05     ` Michael Riesch
2022-01-21  7:28       ` Michael Olbrich
2021-12-20 12:08 ` [ptxdist] [PATCH v4 3/4] scripts: add helper to inject files into a source directory Michael Riesch
2021-12-20 12:08 ` [ptxdist] [PATCH v4 4/4] barebox: add integration of firmware blobs Michael Riesch
2022-01-07 14:09   ` Michael Olbrich
2022-01-10  6:39     ` Michael Riesch
2022-01-21  7:54       ` Michael Olbrich
2022-01-21  8:43         ` Sascha Hauer
2022-01-21  9:47           ` Michael Olbrich
2022-01-24  8:33             ` Michael Riesch

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