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

Hi all,

The sixth version of this patch series considers further comments
by Michael Olbrich. Again, the series includes an RFC patch that
showcases the usage of the introduced features. After fixing the
dependencies (as pointed out by Michael) a circular dependency
of Kconfig symbols popped up. I tried to fix this by introducing
a new symbol BAREBOX_DEPENDENCIES. This approach seems to work
just fine here, but as I am no Kconfig expert please review it
carefully.

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.firmware.in          |  7 +++
 platforms/barebox.in                   | 13 +++++
 platforms/barebox.rockchip.in          | 16 ++++++
 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 +++++++++++++++
 10 files changed, 246 insertions(+)
 create mode 100644 platforms/barebox.firmware.in
 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] 13+ messages in thread

* [ptxdist] [PATCH v6 1/5] platforms: add section for non-free firmware blobs
  2022-01-29  7:03 [ptxdist] [PATCH v6 0/5] Add support for Rockchip firmware blobs Michael Riesch
@ 2022-01-29  7:03 ` Michael Riesch
  2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 2/5] add package for rockchip firmware binaries Michael Riesch
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Michael Riesch @ 2022-01-29  7:03 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] 13+ messages in thread

* [ptxdist] [PATCH v6 2/5] add package for rockchip firmware binaries
  2022-01-29  7:03 [ptxdist] [PATCH v6 0/5] Add support for Rockchip firmware blobs Michael Riesch
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 1/5] platforms: add section for non-free " Michael Riesch
@ 2022-01-29  7:03 ` Michael Riesch
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory Michael Riesch
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Michael Riesch @ 2022-01-29  7:03 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] 13+ messages in thread

* [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory
  2022-01-29  7:03 [ptxdist] [PATCH v6 0/5] Add support for Rockchip firmware blobs Michael Riesch
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 1/5] platforms: add section for non-free " Michael Riesch
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 2/5] add package for rockchip firmware binaries Michael Riesch
@ 2022-01-29  7:03 ` Michael Riesch
  2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
                     ` (2 more replies)
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 4/5] barebox: add integration of firmware blobs Michael Riesch
  2022-01-29  7:03 ` [ptxdist] [RFC PATCH v6 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch
  4 siblings, 3 replies; 13+ messages in thread
From: Michael Riesch @ 2022-01-29  7:03 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>
---

Notes:
    v6:
    - replaced 'break' with 'return'

 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..fe4eb8363
--- /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 || return
+
+    for inject_file in ${pkg_inject_files}; do
+	ptxd_make_inject || return
+    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] 13+ messages in thread

* [ptxdist] [PATCH v6 4/5] barebox: add integration of firmware blobs
  2022-01-29  7:03 [ptxdist] [PATCH v6 0/5] Add support for Rockchip firmware blobs Michael Riesch
                   ` (2 preceding siblings ...)
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory Michael Riesch
@ 2022-01-29  7:03 ` Michael Riesch
  2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
  2022-01-29  7:03 ` [ptxdist] [RFC PATCH v6 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch
  4 siblings, 1 reply; 13+ messages in thread
From: Michael Riesch @ 2022-01-29  7:03 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.

The virtual symbol BAREBOX_DEPENDENCIES is introduced in this
patch to allow for the addition of dependencies on e.g.,
firmware packages.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---

Notes:
    v6:
    - added "barebox.firmware.in" as empty placeholder
    - introduced BAREBOX_DEPENDENCIES symbol in Kconfig

 platforms/barebox.firmware.in |  7 +++++++
 platforms/barebox.in          | 13 +++++++++++++
 rules/barebox.make            |  6 ++++++
 3 files changed, 26 insertions(+)
 create mode 100644 platforms/barebox.firmware.in

diff --git a/platforms/barebox.firmware.in b/platforms/barebox.firmware.in
new file mode 100644
index 000000000..c7275e6d3
--- /dev/null
+++ b/platforms/barebox.firmware.in
@@ -0,0 +1,7 @@
+## SECTION=barebox_firmware
+
+#
+# This file does only exist to create a defined entry in the "barebox_firmware"
+# section, so that the toplevel Kconfig can include generated/barebox_firmware.in
+# even if no package is in that category.
+#
diff --git a/platforms/barebox.in b/platforms/barebox.in
index d35d16501..245b272a3 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -8,7 +8,12 @@ config BAREBOX_ARCH_STRING
 	default "ppc"			if ARCH_PPC
 	default "x86"			if ARCH_X86
 
+config BAREBOX_DEPENDENCIES
+	tristate
+	select VIRTUAL
+
 menuconfig BAREBOX
+	select BAREBOX_DEPENDENCIES
 	select BOOTLOADER
 	select HOST_LIBUSB if BAREBOX_NEEDS_HOST_LIBUSB
 	select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL
@@ -55,6 +60,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/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] 13+ messages in thread

* [ptxdist] [RFC PATCH v6 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1
  2022-01-29  7:03 [ptxdist] [PATCH v6 0/5] Add support for Rockchip firmware blobs Michael Riesch
                   ` (3 preceding siblings ...)
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 4/5] barebox: add integration of firmware blobs Michael Riesch
@ 2022-01-29  7:03 ` Michael Riesch
  4 siblings, 0 replies; 13+ messages in thread
From: Michael Riesch @ 2022-01-29  7:03 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>
---
Notes:
    v6:
    - fixed dependencies and switched to using the new BAREBOX_DEPENDENCIES
      symbol

 platforms/barebox.rockchip.in | 16 ++++++++++++++++
 rules/barebox.rockchip.make   | 18 ++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 platforms/barebox.rockchip.in
 create mode 100644 rules/barebox.rockchip.make

diff --git a/platforms/barebox.rockchip.in b/platforms/barebox.rockchip.in
new file mode 100644
index 000000000..f926585b2
--- /dev/null
+++ b/platforms/barebox.rockchip.in
@@ -0,0 +1,16 @@
+## SECTION=barebox_firmware
+
+config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP
+	prompt "barebox needs firmware-rockchip"
+	bool
+	depends on ARCH_ARM64
+	help
+	  Select this if barebox needs the non-free Rockchip firmware
+	  blobs.
+
+config BAREBOX_DEPENDENCIES
+	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
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] 13+ messages in thread

* Re: [ptxdist] [APPLIED] platforms: add section for non-free firmware blobs
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 1/5] platforms: add section for non-free " Michael Riesch
@ 2022-01-30 15:49   ` Michael Olbrich
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Olbrich @ 2022-01-30 15:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Riesch

Thanks, applied as 16449115567eb71adeea9230fa3244bd6c483c76.

Michael

[sent from post-receive hook]

On Sun, 30 Jan 2022 16:49:46 +0100, Michael Riesch <michael.riesch@wolfvision.net> wrote:
> Add a dedicated section for non-free firmware binary blobs, such
> as SDRAM initialization binaries.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> Message-Id: <20220129070330.2601433-2-michael.riesch@wolfvision.net>
> [mol: menu instead of menuconfig to avoid dependency issues]
> [mol: add dummy menu file]
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/platforms/Kconfig b/platforms/Kconfig
> index 0bfe34cdc16d..d9adc4931cdd 100644
> --- a/platforms/Kconfig
> +++ b/platforms/Kconfig
> @@ -40,3 +40,7 @@ source "generated/hosttools_noprompt.in"
>  source "generated/hosttools_platform.in"
>  
>  source "generated/platform_project_specific.in"
> +
> +menu "non-free firmware blobs       "
> +source "generated/non_free_firmware.in"
> +endmenu
> diff --git a/platforms/non_free_firmware.in b/platforms/non_free_firmware.in
> new file mode 100644
> index 000000000000..c0635859ac0c
> --- /dev/null
> +++ b/platforms/non_free_firmware.in
> @@ -0,0 +1,7 @@
> +## SECTION=non_free_firmware
> +
> +#
> +# This file does only exist to create a defined entry in the "non_free_firmware"
> +# section, so that the toplevel Kconfig can include generated/non_free_firmware.in
> +# even if no package is in that category.
> +#

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


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

* Re: [ptxdist] [APPLIED] scripts: add helper to inject files into a source directory
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory Michael Riesch
@ 2022-01-30 15:49   ` Michael Olbrich
  2024-04-19  9:48   ` [ptxdist] [PATCH v6 3/5] " Alexander Dahl
  2024-04-23 13:52   ` Alexander Dahl
  2 siblings, 0 replies; 13+ messages in thread
From: Michael Olbrich @ 2022-01-30 15:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Riesch

Thanks, applied as 3ca92677df5bbde0fb01c396acb0ffc64f26fc2b.

Michael

[sent from post-receive hook]

On Sun, 30 Jan 2022 16:49:48 +0100, Michael Riesch <michael.riesch@wolfvision.net> 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>
> Message-Id: <20220129070330.2601433-4-michael.riesch@wolfvision.net>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/rules/post/ptxd_make_world_inject.make b/rules/post/ptxd_make_world_inject.make
> new file mode 100644
> index 000000000000..b7d28e92f25b
> --- /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 000000000000..fe4eb8363619
> --- /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 || return
> +
> +    for inject_file in ${pkg_inject_files}; do
> +	ptxd_make_inject || return
> +    done
> +}
> +export -f ptxd_make_world_inject

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


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

* Re: [ptxdist] [APPLIED] barebox: add integration of firmware blobs
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 4/5] barebox: add integration of firmware blobs Michael Riesch
@ 2022-01-30 15:49   ` Michael Olbrich
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Olbrich @ 2022-01-30 15:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Riesch

Thanks, applied as 6684c552fbd7d96842dcf489647648718a076c1b.

Michael

[sent from post-receive hook]

On Sun, 30 Jan 2022 16:49:49 +0100, Michael Riesch <michael.riesch@wolfvision.net> 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.
> 
> The virtual symbol BAREBOX_DEPENDENCIES is introduced in this
> patch to allow for the addition of dependencies on e.g.,
> firmware packages.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> Message-Id: <20220129070330.2601433-5-michael.riesch@wolfvision.net>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/platforms/barebox.firmware.in b/platforms/barebox.firmware.in
> new file mode 100644
> index 000000000000..c7275e6d3469
> --- /dev/null
> +++ b/platforms/barebox.firmware.in
> @@ -0,0 +1,7 @@
> +## SECTION=barebox_firmware
> +
> +#
> +# This file does only exist to create a defined entry in the "barebox_firmware"
> +# section, so that the toplevel Kconfig can include generated/barebox_firmware.in
> +# even if no package is in that category.
> +#
> diff --git a/platforms/barebox.in b/platforms/barebox.in
> index d35d165011b9..245b272a31da 100644
> --- a/platforms/barebox.in
> +++ b/platforms/barebox.in
> @@ -8,7 +8,12 @@ config BAREBOX_ARCH_STRING
>  	default "ppc"			if ARCH_PPC
>  	default "x86"			if ARCH_X86
>  
> +config BAREBOX_DEPENDENCIES
> +	tristate
> +	select VIRTUAL
> +
>  menuconfig BAREBOX
> +	select BAREBOX_DEPENDENCIES
>  	select BOOTLOADER
>  	select HOST_LIBUSB if BAREBOX_NEEDS_HOST_LIBUSB
>  	select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL
> @@ -55,6 +60,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/rules/barebox.make b/rules/barebox.make
> index bea9f3adcbf8..1c8463e637c2 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)
>  
>  # ----------------------------------------------------------------------------

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


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

* Re: [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory Michael Riesch
  2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
@ 2024-04-19  9:48   ` Alexander Dahl
  2024-05-02 10:08     ` Michael Olbrich
  2024-04-23 13:52   ` Alexander Dahl
  2 siblings, 1 reply; 13+ messages in thread
From: Alexander Dahl @ 2024-04-19  9:48 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich, m.tretter, Michael Riesch

Hei hei,

sorry for digging up this old discussion, but I kind of want to use this 
approach and … see below.

Am Samstag, 29. Januar 2022, 08:03:28 CEST schrieb 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).

Currently trying to build recent U-Boot for i.MX8 and i.MX9 based boards which 
require additional firmware.  However I still want to build OOT to keep my 
source tree clean, especially when building with an external tree (after 
`ptxdist local-src u-boot $HOME/src/u-boot`).

Now U-Boot needs those binaries in the build tree, it does not work using this 
nice inject mechanism putting it in the source tree.

> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
> 
> Notes:
>     v6:
>     - replaced 'break' with 'return'
> 
>  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)"

Here <PKG>_DIR is assigned to pkg_source which makes the source dir the target 
folder.

Did anyone already think of how to extend this approach to be more flexible 
for the target folder?  Maybe even without damaging existing use cases?

Maybe adding a new optional variable <PKG>_INJECT_DEST which defaults to 
<PKG>_DIR and can be overridden?

Greets
Alex

> +
> +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..fe4eb8363
> --- /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 || return
> +
> +    for inject_file in ${pkg_inject_files}; do
> +	ptxd_make_inject || return
> +    done
> +}
> +export -f ptxd_make_world_inject







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

* Re: [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory
  2022-01-29  7:03 ` [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory Michael Riesch
  2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
  2024-04-19  9:48   ` [ptxdist] [PATCH v6 3/5] " Alexander Dahl
@ 2024-04-23 13:52   ` Alexander Dahl
  2024-04-23 16:27     ` Michael Riesch
  2 siblings, 1 reply; 13+ messages in thread
From: Alexander Dahl @ 2024-04-23 13:52 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich, m.tretter, Michael Riesch

Hello Michael,

I know this has been applied already, but while working on the extension I 
asked about last week, I stumbled over some things.  See below.

Am Samstag, 29. Januar 2022, 08:03:28 CEST schrieb 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>
> ---
> 
> Notes:
>     v6:
>     - replaced 'break' with 'return'
> 
>  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)"

Why passing 'pkg_source' here?  world/env/impl and thus world/env has 
'pkg_dir' and it has exactly the same content which is available in the shell 
script later.

Second thing: world/env is assigned in 
'rules/post/ptxd_make_world_common.make' and the interesting part looks like 
this:

    pkg_dir="$(call ptx/escape,$($(1)_DIR))"

Same for all the other variables with paths.  Why was ptx/escape not used on 
<PKG>_INJECT_PATH and <PKG>_INJECT_FILES here?

> +
> +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..fe4eb8363
> --- /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

Here ${target} can never be empty, because if both ${pkg_source} and $(echo …) 
are empty, there's still the '/' in the middle.  So the last three lines of 
this block make no sense.  Some leftover from earlier iterations?

Greets
Alex

> +
> +    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 || return
> +
> +    for inject_file in ${pkg_inject_files}; do
> +	ptxd_make_inject || return
> +    done
> +}
> +export -f ptxd_make_world_inject







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

* Re: [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory
  2024-04-23 13:52   ` Alexander Dahl
@ 2024-04-23 16:27     ` Michael Riesch
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Riesch @ 2024-04-23 16:27 UTC (permalink / raw)
  To: Alexander Dahl, ptxdist; +Cc: Michael Olbrich, m.tretter

Hi Alex,

On 4/23/24 15:52, Alexander Dahl wrote:
> Hello Michael,
> 
> I know this has been applied already, but while working on the extension I 
> asked about last week, I stumbled over some things.  See below.

Great to hear you find this extension useful. I must admit though that I
don't recall most of it anymore... :/ Also, I am still a beginner when
it comes to PTXdist script magic. If you feel that this feature can be
improved and/or cleaned up, I'd be happy to look over your patches. But
apart from that I am afraid I can't help you.

Thanks and best regards,
Michael

> Am Samstag, 29. Januar 2022, 08:03:28 CEST schrieb 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>
>> ---
>>
>> Notes:
>>     v6:
>>     - replaced 'break' with 'return'
>>
>>  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)"
> 
> Why passing 'pkg_source' here?  world/env/impl and thus world/env has 
> 'pkg_dir' and it has exactly the same content which is available in the shell 
> script later.
> 
> Second thing: world/env is assigned in 
> 'rules/post/ptxd_make_world_common.make' and the interesting part looks like 
> this:
> 
>     pkg_dir="$(call ptx/escape,$($(1)_DIR))"
> 
> Same for all the other variables with paths.  Why was ptx/escape not used on 
> <PKG>_INJECT_PATH and <PKG>_INJECT_FILES here?
> 
>> +
>> +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..fe4eb8363
>> --- /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
> 
> Here ${target} can never be empty, because if both ${pkg_source} and $(echo …) 
> are empty, there's still the '/' in the middle.  So the last three lines of 
> this block make no sense.  Some leftover from earlier iterations?
> 
> Greets
> Alex
> 
>> +
>> +    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 || return
>> +
>> +    for inject_file in ${pkg_inject_files}; do
>> +	ptxd_make_inject || return
>> +    done
>> +}
>> +export -f ptxd_make_world_inject
> 
> 
> 
> 



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

* Re: [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory
  2024-04-19  9:48   ` [ptxdist] [PATCH v6 3/5] " Alexander Dahl
@ 2024-05-02 10:08     ` Michael Olbrich
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Olbrich @ 2024-05-02 10:08 UTC (permalink / raw)
  To: Alexander Dahl; +Cc: ptxdist, m.tretter, Michael Riesch

On Fri, Apr 19, 2024 at 11:48:51AM +0200, Alexander Dahl wrote:
> sorry for digging up this old discussion, but I kind of want to use this 
> approach and … see below.
> 
> Am Samstag, 29. Januar 2022, 08:03:28 CEST schrieb 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).
> 
> Currently trying to build recent U-Boot for i.MX8 and i.MX9 based boards which 
> require additional firmware.  However I still want to build OOT to keep my 
> source tree clean, especially when building with an external tree (after 
> `ptxdist local-src u-boot $HOME/src/u-boot`).
> 
> Now U-Boot needs those binaries in the build tree, it does not work using this 
> nice inject mechanism putting it in the source tree.
> 
> > 
> > Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> > ---
> > 
> > Notes:
> >     v6:
> >     - replaced 'break' with 'return'
> > 
> >  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)"
> 
> Here <PKG>_DIR is assigned to pkg_source which makes the source dir the target 
> folder.
> 
> Did anyone already think of how to extend this approach to be more flexible 
> for the target folder?  Maybe even without damaging existing use cases?
> 
> Maybe adding a new optional variable <PKG>_INJECT_DEST which defaults to 
> <PKG>_DIR and can be overridden?

Makes sense to me. I would have named it <PKG>_INJECT_DIR but either is
fine with me. And if it's empty, set it to pkg_dir in
ptxd_make_world_inject()

Regards,
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 |



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

end of thread, other threads:[~2024-05-02 10:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-29  7:03 [ptxdist] [PATCH v6 0/5] Add support for Rockchip firmware blobs Michael Riesch
2022-01-29  7:03 ` [ptxdist] [PATCH v6 1/5] platforms: add section for non-free " Michael Riesch
2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
2022-01-29  7:03 ` [ptxdist] [PATCH v6 2/5] add package for rockchip firmware binaries Michael Riesch
2022-01-29  7:03 ` [ptxdist] [PATCH v6 3/5] scripts: add helper to inject files into a source directory Michael Riesch
2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
2024-04-19  9:48   ` [ptxdist] [PATCH v6 3/5] " Alexander Dahl
2024-05-02 10:08     ` Michael Olbrich
2024-04-23 13:52   ` Alexander Dahl
2024-04-23 16:27     ` Michael Riesch
2022-01-29  7:03 ` [ptxdist] [PATCH v6 4/5] barebox: add integration of firmware blobs Michael Riesch
2022-01-30 15:49   ` [ptxdist] [APPLIED] " Michael Olbrich
2022-01-29  7:03 ` [ptxdist] [RFC PATCH v6 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch

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