From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 20 Dec 2021 12:03:13 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mzGRl-00CZRK-5Z for lore@lore.pengutronix.de; Mon, 20 Dec 2021 12:03:13 +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 1mzGRk-0004T6-4Y; Mon, 20 Dec 2021 12:03:12 +0100 Received: from mail-eopbgr10041.outbound.protection.outlook.com ([40.107.1.41] helo=EUR02-HE1-obe.outbound.protection.outlook.com) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzGR6-0004SS-C1; Mon, 20 Dec 2021 12:02:33 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSin+yECg7qw+IweFVUs1hiJfBhrU/unrM9R7rlDddm7hGHB+Xceq1AIJEUkBS4UEi8TtjjLIZTDlA5SyB8//1wAZhsMRPjDBENrA/vh50fEK8M129AE9up5Yb2iHF6GsxhT7fF5SDIzpLn4KPdGDAPKER6VSAEa8W5LkXqvcx8uemSjv1ZVjeCHfQi6oeL5FxBckP8zRd/7915Y3HVJ7qZvoBlgE2T8V1xQag+6dL5rA7EO8i167Ti1TWdcrdfpsZxvuiONxuGMG+hPpLTjpEFSVizSto7ahmUVE2D+Jcf2D8OXcKvNW8zeFpwGl4gb8xvGvixcxBdMUl/RTFsUxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IQ1RdaR/oHNO/bc/HFME7+/PLhZu7uLdEihPUdljrUQ=; b=kwUcQke8J645es4x8pQZqGyzYEI3ZYGAqaKRiPnH15seYFV3YYoQTSzAQzKsc2S71dqznzblEd4x0aJu+vuOZM4fB7ZBfATUYTpZGhuWS3qOLag7WLJk1po0/N8UJ0w5sKV0BGY1BzJGOZn4bCLu8ZM+GnIHT7J6G2EvStOSGBUIyZ9eucFOEfKIS2yMjcLgvjKFlhplhH4IrH5Ywl4ri8EF99UvBpW6UvPZB/4QTI3rj7VChhnhDhGzOTc+wOvy+aFCozKmV9Qjfti29PB5grqzcXmGjm5XKGGbzauEzjaXRLlZ05b0mssWnW3IP1dqPxGygq4nMV+7swzc1Mp5qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IQ1RdaR/oHNO/bc/HFME7+/PLhZu7uLdEihPUdljrUQ=; b=ZSpOK5fRWzrhcFaEp6dgIJQAdyJqVuBk8JAj4o524gIIRFnv7hJN8D/0b+eY89PbsMdY51NzkD/U9LPea8nynmYjx8BhYuEPvf24JoroYJ0WUqQqtXL1rmdv5LMDEChMLM/9C4zKIe/FpP7+w4SvSkcYJUIbCeGzvvXnmN7IDrA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from DBBPR08MB4523.eurprd08.prod.outlook.com (2603:10a6:10:c8::19) by DB7PR08MB3068.eurprd08.prod.outlook.com (2603:10a6:5:18::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.17; Mon, 20 Dec 2021 11:02:29 +0000 Received: from DBBPR08MB4523.eurprd08.prod.outlook.com ([fe80::81d1:d448:4016:1956]) by DBBPR08MB4523.eurprd08.prod.outlook.com ([fe80::81d1:d448:4016:1956%4]) with mapi id 15.20.4801.020; Mon, 20 Dec 2021 11:02:29 +0000 To: ptxdist@pengutronix.de, m.olbrich@pengutronix.de References: <20211209061049.2975739-1-michael.riesch@wolfvision.net> <20211209061049.2975739-4-michael.riesch@wolfvision.net> <20211210150228.GY15196@pengutronix.de> <7d8ddd07-4bd4-e75b-a59a-3b098c073864@wolfvision.net> From: Michael Riesch Message-ID: Date: Mon, 20 Dec 2021 12:02:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US X-ClientProxiedBy: ZR0P278CA0006.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::16) To DBBPR08MB4523.eurprd08.prod.outlook.com (2603:10a6:10:c8::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31b5ddc9-a730-4687-d249-08d9c3a83701 X-MS-TrafficTypeDiagnostic: DB7PR08MB3068:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1186; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XSLOzTFvOH8GHII74aGVT++blIisPTq/UWOnCxQZwZBEMOcLkMDDWHqKBICD7TIhba1iaGOym3cwuRJJlc1G0+ZBYMW9ir0SmgaAbIKQDnQvkNZ6z0vlWtlOVpZjCwKbLg9HY8MzJ59CHTBrrWOqOxyw83Ympa9/ylezAYhilODb6xqfmXW5VSNn1QfLE9l5APUHjjWUZiR+0Ag5P8XonSbnUMocYRWqEtZ26WdWTnPPeVx3kIMTZh3BaVnv6IEg25EcgpKwZMgOxIVLNeVH+lGZLS5c5FlFqKCuPZvmjuB8gn5qJoBApMzt0WCn0hZo2CM3aqEd9Tus8mv+xv/XHtniGrF8R3+dFitN2anQeCRpwS0ENRvv+14ySkhn/tcK6Z1qqO+X5sbaXQZkD2wvg4Xpc+bS3cJfCYVKE0DvGKiXf7a3u8Mwg8uaGTxavFaw8S4F+FcnbxUP/oq17s6cC6uJ3bIMq4wARRqHedJ+u5XNPO1cg6hQn3lzDFRqDQcA3K/F/2SVBuwf5XngwfH6Xj/NvP6JoTzmX7VQTdCBE3Md58N3ypltJaHFbSORcz3ZG4HFQkVMLWzg3Hb2aLDnFNFMUO3Me1r3BtDxfgPafGkmxZeaAYxQXm8E5j49FWVHeKPBwY/WF3YwN6LBxknBR4EnkQAfvAFEyCXEpiCVA8xcx0ZM9bBOvzkvX0fVtk+4+0zpJXOsgCLZNPV0LyH5Vfji1syiSgYLwkwlW4nzyYI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR08MB4523.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(346002)(376002)(39840400004)(366004)(136003)(83380400001)(8936002)(508600001)(186003)(66556008)(36756003)(66946007)(6512007)(66476007)(4326008)(44832011)(8676002)(6506007)(53546011)(2616005)(450100002)(52116002)(316002)(30864003)(5660300002)(38100700002)(6486002)(2906002)(86362001)(31686004)(31696002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SVFJMno0K1NpUm1VbW9UcHBncG9Bcmp6enVjOUp5cGFMYTNlT0hpRlNXd0VX?= =?utf-8?B?UXpoQnNLVEZmcU1hemVGMUNrU1A1SE0yVXJBNHFYYXVUUC91N2FJanNJUno4?= =?utf-8?B?cFVNNVEzZ3VaL1hZM1BnQkRDeWhVcFIyZ083NzUrei9TL1J5UEJMT1o4Y2Zh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zcySTJWY1lyZmFP?= =?utf-8?B?QVVLUnBNSGQyOU91aGlGV200N1liVm13SFdYZnZOMUhhVDl6d0dyamdIZ0RF?= =?utf-8?B?Q3MxbkxNYjdUZGJDT0xlZURlRGNlR29NaGF6dVJKKzEyQ01Pc3FNeXEyQzNl?= =?utf-8?B?VWs4Q3FwaDh6M3JhUE9PK2Zpa1V4K1pWNXBaZkJxTHhrNHR5ZHpkdjFKRzFp?= =?utf-8?B?SFRNR29rS1J1VEhraTVVWkUrbzR3d0dkNEp5VVN0aDlyVWllTGRUK215OVZT?= =?utf-8?B?enhaNkwwL1c3Q3JxU2p5T3RoSEd4VEE2YiswK2MrSStENWV3ekZxL2JJckhq?= =?utf-8?B?dXNpYThjQ0FUcHhXSERZd0RIcTg1Vm1xcWQvWVdEaGZ0SFVIRzVjUT09?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 31b5ddc9-a730-4687-d249-08d9c3a83701 X-MS-Exchange-CrossTenant-AuthSource: DBBPR08MB4523.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2021 11:02:29.6273 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IxyDbqUZh6onuR3ziOm2UUj+RytQJQ/5kuXqwwGhi4hSa9BZpplaCXjbwtwc1bRedQwPAtX0URgTOKHY5E5pduwOeLqR03Ab09aEmv6s8MM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3068 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-4.0 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [ptxdist] [PATCH v3 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: 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 Hello Michael, Thanks for the detailed response. On 12/17/21 8:35 AM, Michael Olbrich wrote: > On Sat, Dec 11, 2021 at 08:03:40AM +0100, Michael Riesch wrote: >> Hello Michael, >> >> On 12/10/21 4:03 PM, Michael Olbrich wrote: >>> On Thu, Dec 09, 2021 at 07:10:49AM +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. >>> >>> So, I've been thinking about this some more. And I think this needs a >>> different approach. >>> >>> With SDRAM calibration and TF-A and stuff like that, there will be a lot of >>> blobs that need to be integrated into barebox. >>> And it will be different for each vendor and possibly SOC family. And maybe >>> a upstream and a downstream version. >>> >>> Modifying barebox.in for each of them will not scale. Especially because in >>> most cases we'll carry a modified version until it's merged into ptxdist >>> master and the BSP is updated to the new version. >>> >>> And from what I've seen with TF-A, it's not uncommon to start with some >>> ugly downstream stuff and switch to upstream later. >>> >>> So I'd like this to be more flexible. More below. >> >> Agreed. While I don't fully understand yet your alternative approach >> (questions below), it seems way more elegant. >> >> It seems to me that the first two patches are not affected, though. >> Provided there are no other objections, could they be merged so we can >> focus on the third patch under discussion? > > The first one cannot be applied alone. Creating a new section without > anything in it does not work. And I think the second one should should > include the barebox integration once we've decided how exactly that will > work. OK! I'll come up with a v4 soon. Best regards, Michael > >>> >>>> Signed-off-by: Michael Riesch >>>> --- >>>> platforms/barebox.in | 35 +++++++++++++++++++++ >>>> rules/barebox.make | 6 ++++ >>>> rules/post/ptxd_make_world_inject.make | 19 ++++++++++++ >>>> scripts/lib/ptxd_make_world_inject.sh | 42 ++++++++++++++++++++++++++ >>>> 4 files changed, 102 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..63e9929e5 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,32 @@ 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 ':'. A relative path will be expanded relative >>>> + to the workspace and all other layers. Only one of the specified paths >>>> + can be a relative path. >>> >>> I think we can just define a fixed directory for this. For exceptions, and >>> absolute file path will work as well. >>> >>>> +config BAREBOX_FIRMWARE_FILES >>>> + string "firmware blob file(s)" >>>> + default ".bin:firmware" >>> >>> I don't like having this in the config. The problem ist, that the user will >>> need to know, which files to copy and where to. >>> >>>> + help >>>> + Select the firmware blob(s) to be integrated into the barebox >>>> + source before compilation. Each entry consists of :, >>>> + where is an optional path relative to the barebox source >>>> + directory. Multiple entries can be specified, separated by spaces. >>>> + >>>> +endif >>>> + >>>> config BAREBOX_EXTRA_ENV >>>> prompt "extend the builtin barebox environment" >>>> bool >>>> @@ -146,4 +173,12 @@ 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 >>>> + depends on ARCH_ARM64 >>>> + help >>>> + Select this if barebox needs the non-free Rockchip firmware >>>> + blobs. >>> >>> As I said, I don't want to modify barebox.in for each vendor / SOC family. >>> >>> So how about something like this: >>> >>> ------------------------------------ >>> menu "firmware blobs" >>> >>> source barebox_firmware.in >>> >>> endmenu >>> ------------------------------------ >> >> Right, this enters barebox.in and provides a slot to plug one or more >> barebox-firmware-xyz.in into the config. >> The @$(call world/inject, BAREBOX) is added to the barebox.make rule >> file and considers BAREBOX_INJECT_FILES. > > Yes, exactly. > >>> And the firmware package will have an extra menu file, e.g. >>> barebox-firmware-rockchip.in: >>> >>> ------------------------------------ >>> ## SECTION=barebox_firmware >>> >>> config BAREBOX >>> select FIRMWARE_ROCKCHIP if BAREBOX_NEEDS_FIRMWARE_ROCKCHIP >>> >>> config BAREBOX_NEEDS_FIRMWARE_ROCKCHIP >>> prompt "barebox needs firmware-rockchip" >>> ... >>> >>> ------------------------------------ >>> Maybe some suboptions for individual SoCs / boards. >> >> The barebox-firmware-rockchip.in as example of such a config plugin. > > yes. > >>> And an extra rule file, e.g. barebox.rockchip.make: >>> ------------------------------------ >>> >>> BAREBOX_INJECT_FILES += source-file:target-file >>> >>> ------------------------------------ >> >> Finally, we need a rule file that adjusts the BAREBOX_INJECT_FILES. So >> far I get it. >> >> In ptxdist there is a lot of implicit magic going on behind the scenes. >> So what guarantees that the barebox.rockchip.make is considered before >> barebox.make (or the barebox prepare stage, to be precise)? Is the >> naming "barebox.rockchip.make" relevant (it resembles a custom stage of >> the barebox rule)? > > The naming is relevant insofar that this makes it possible to overwrite the > file in the BSP or another layer. Any other makefile that is not directly > linked to a package will always be included. > > In general, the order in which the rules are read is random. For > .*.make, they are explicitly read immediately after .make > > Expanding BAREBOX_INJECT_FILES like this relies on how make works: Any > variable used within the build commands of a target is evaluated when the > target is executed. So something like this works just fine: > > my-target: > echo $(message) > > message = "Hello World!" > >> It seems that usually the rule files have a corresponding *.in file. >> Would it make sense to align the names barebox-firmware-rockchip.in and >> barebox.rockchip.make in some way? > > Good idea. But the rule file must be called barebox..make. It > doesn't matter what name the menu file has, so we can align it accordingly. > >> Do we need some explicit dependencies in the barebox-firmware-rockchip.in? > > Barebox must select the firmare package to ensure the build order. I've > added that to my example above. > > In Kconfig, you can declare the same Symbol multiple times. All instances > will be merged, so you just need to avoid conflicts. So: > > config BAREBOX > tristate > > config BAREBOX > prompt "barebox" > > config BAREBOX > select FIRMWARE_ROCKCHIP > > has exactly the same effect as: > > config BAREBOX > tristate > prompt "barebox" > select FIRMWARE_ROCKCHIP > > Regards, > Michael > >>> Maybe with some conditions depending on the suboptions. >>> And if absolutely necessary, the source-file could expand to an absolute >>> path here. >>> >>> Once the core support is upstream in ptxdist. These small drop-ins can be >>> easily maintained in a BSP but are also easier to upstream because there >>> are no conflicting changes to barebox.in. >>> >>> And with the latest ptxdist version, ..make can be >>> overwritten in the BSP just like the regular rule file. So if the upstream >>> version of such a drop-in has a bug, fixing that in the BSP is possible. >>> >>> Michael >>> >>>> + >>>> 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..c2e45ad42 >>>> --- /dev/null >>>> +++ b/scripts/lib/ptxd_make_world_inject.sh >>>> @@ -0,0 +1,42 @@ >>>> +#!/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 >>>> + >>>> + 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 $(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 >>>> >>> >> >> _______________________________________________ >> 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