From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 08 Dec 2021 09:00:16 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1murs8-0004TX-Sb for lore@lore.pengutronix.de; Wed, 08 Dec 2021 09:00:16 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1murs8-0002GS-Im; Wed, 08 Dec 2021 09:00:16 +0100 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1murrj-0002GD-7m; Wed, 08 Dec 2021 08:59:51 +0100 Received: from mol by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1murri-0002eN-GQ; Wed, 08 Dec 2021 08:59:50 +0100 Date: Wed, 8 Dec 2021 08:59:50 +0100 From: Michael Olbrich To: Michael Riesch Message-ID: <20211208075950.GE15196@pengutronix.de> Mail-Followup-To: Michael Riesch , ptxdist@pengutronix.de, m.tretter@pengutronix.de References: <20211206075431.1238025-1-michael.riesch@wolfvision.net> <20211206075431.1238025-4-michael.riesch@wolfvision.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211206075431.1238025-4-michael.riesch@wolfvision.net> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:52:59 up 293 days, 11:16, 141 users, load average: 0.03, 0.05, 0.06 User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [ptxdist] [PATCH v2 3/3] barebox: add integration of firmware blobs X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: ptxdist@pengutronix.de, m.tretter@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false On Mon, Dec 06, 2021 at 08:54:31AM +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 which > are injected in the barebox source directory during > preparation. > > Signed-off-by: Michael Riesch > --- > platforms/barebox.in | 31 +++++++++++++++++++ > rules/barebox.make | 6 ++++ > rules/post/ptxd_make_world_inject.make | 19 ++++++++++++ > scripts/lib/ptxd_make_world_inject.sh | 43 ++++++++++++++++++++++++++ > 4 files changed, 99 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..150fcc77b 100644 > --- a/platforms/barebox.in > +++ b/platforms/barebox.in > @@ -15,6 +15,7 @@ menuconfig BAREBOX > select HOST_IMX_CST if BAREBOX_NEEDS_HOST_IMX_CST > select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP > select CODE_SIGNING if BAREBOX_NEEDS_KEYS > + select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP > prompt "barebox " > bool > help > @@ -55,6 +56,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 ':'. It works the same way as KERNEL_DTS_PATH, so just copy the rest of the description. > + > +config BAREBOX_FIRMWARE_FILES > + string "firmware blob file(s)" > + default ".bin" > + help > + Select the firmware blob to be integrated into the barebox > + source before compilation. Multiple dts files can be > + specified, separated by spaces. 'dts'? Copy paste error? >>From what I read below, each file can be : so that should be documented here. > + > +endif > + > config BAREBOX_EXTRA_ENV > prompt "extend the builtin barebox environment" > bool > @@ -146,4 +170,11 @@ config BAREBOX_NEEDS_HOST_LZOP > lzop is used in order to compile lzop for your development > host. > > +config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP > + prompt "barebox needs firmware-rockchip" > + bool > + help > + Select this if barebox needs the non-free Rockchip firmware > + blobs. This should depend on ARCH_ARM64, or something like that. > + > endif > 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 > +# > +# 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..bc06b9503 > --- /dev/null > +++ b/scripts/lib/ptxd_make_world_inject.sh > @@ -0,0 +1,43 @@ > +#!/bin/bash > +# > +# Copyright (C) 2021 by Michael Riesch > +# > +# 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 Use ${} for all variables and don't forget the quotes. > + > + if [[ "${source}" =~ ^/.* ]]; then > + ptxd_bailout "'${source}' must not be an absolute path!" \ > + "Use _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 $source into $target..." same here. Use ptxd_print_path to shorten the output. > + cp $source $target Michael > +} > +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 > -- 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