From: Michael Riesch <michael.riesch@wolfvision.net>
To: ptxdist@pengutronix.de
Cc: michael.tretter@pengutronix.de,
Michael Riesch <michael.riesch@wolfvision.net>
Subject: [ptxdist] [RFC PATCH 3/3] barebox: add integration of firmware blobs
Date: Fri, 3 Dec 2021 17:54:40 +0100 [thread overview]
Message-ID: <20211203165440.1180588-4-michael.riesch@wolfvision.net> (raw)
In-Reply-To: <20211203165440.1180588-1-michael.riesch@wolfvision.net>
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 which
are injected in the barebox source directory during
preparation.
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
platforms/barebox.in | 23 +++++++++++++++++++++++
rules/barebox.make | 6 ++++++
rules/post/ptxd_make_world_inject.make | 19 +++++++++++++++++++
scripts/lib/ptxd_make_world_inject.sh | 21 +++++++++++++++++++++
4 files changed, 69 insertions(+)
create mode 100644 rules/post/ptxd_make_world_inject.make
create mode 100644 scripts/lib/ptxd_make_world_inject.sh
diff --git a/platforms/barebox.in b/platforms/barebox.in
index d35d16501..422897a66 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -55,6 +55,29 @@ config BAREBOX_CONFIG
This entry specifies the .config file used to compile
barebox.
+menuconfig BAREBOX_FIRMWARE
+ bool
+ prompt "integrate firmware blobs "
+
+if BAREBOX_FIRMWARE
+
+config BAREBOX_FIRMWARE_PATH
+ string "path(s) to firmware blobs"
+ default "${PTXDIST_SYSROOT_TARGET}/usr/lib/firmware"
+ help
+ Define path to the firmware blob(s). Multiple directories can
+ be specified separated by ':'.
+
+config BAREBOX_FIRMWARE_FILES
+ string "firmware blob file(s)"
+ default "<vendorblob>.bin"
+ help
+ Select the firmware blob to use integrated into the barebox
+ source before compilation. Multiple dts files can be
+ specified, separated by spaces.
+
+endif
+
config BAREBOX_EXTRA_ENV
prompt "extend the builtin barebox environment"
bool
diff --git a/rules/barebox.make b/rules/barebox.make
index bea9f3adc..a81fc86b3 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -26,6 +26,8 @@ BAREBOX_BUILD_DIR := $(BAREBOX_DIR)-build
BAREBOX_LICENSE := GPL-2.0-only
BAREBOX_DEVPKG := NO
BAREBOX_BUILD_OOT := KEEP
+BAREBOX_INJECT_PATH :=$(call remove_quotes,$(PTXCONF_BAREBOX_FIRMWARE_PATH))
+BAREBOX_INJECT_FILES :=$(call remove_quotes,$(PTXCONF_BAREBOX_FIRMWARE_FILES))
BAREBOX_CONFIG := $(call ptx/in-platformconfigdir, \
$(call remove_quotes, $(PTXCONF_BAREBOX_CONFIG)))
@@ -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)
# ----------------------------------------------------------------------------
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..ac3134498
--- /dev/null
+++ b/scripts/lib/ptxd_make_world_inject.sh
@@ -0,0 +1,21 @@
+#!/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_world_inject() {
+ for pair in ${pkg_inject_files}; do
+ # TODO implement lookup
+
+ source=$pkg_inject_path/$(echo $pair | cut -d ":" -f 1)
+ target=$pkg_source/$(echo $pair | cut -d ":" -f 2)
+
+ echo -e "\nInject file $source into $target..."
+ cp $source $target
+
+ 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
prev parent reply other threads:[~2021-12-03 16:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 16:54 [ptxdist] [PATCH 0/3] Add support for Rockchip " Michael Riesch
2021-12-03 16:54 ` [ptxdist] [PATCH 1/3] platforms: add section for non-free " Michael Riesch
2021-12-03 16:54 ` [ptxdist] [PATCH 2/3] add package for rockchip firmware binaries Michael Riesch
2021-12-03 17:55 ` Christian Melki
2021-12-04 7:10 ` Michael Riesch
2021-12-04 15:37 ` Christian Melki
2021-12-06 6:06 ` Michael Riesch
2021-12-05 0:56 ` Roland Hieber
2021-12-05 1:00 ` Roland Hieber
2021-12-05 9:07 ` Michael Riesch
2021-12-06 6:27 ` Michael Riesch
2021-12-03 16:54 ` Michael Riesch [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211203165440.1180588-4-michael.riesch@wolfvision.net \
--to=michael.riesch@wolfvision.net \
--cc=michael.tretter@pengutronix.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox