From patchwork Tue Jul 2 06:48:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Funke X-Patchwork-Id: 1955071 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=weidmueller.com header.i=@weidmueller.com header.a=rsa-sha256 header.s=selector2 header.b=pMTY1R4L; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WCtn41th2z1xpP for ; Tue, 2 Jul 2024 16:49:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 776748871A; Tue, 2 Jul 2024 08:49:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=weidmueller.com header.i=@weidmueller.com header.b="pMTY1R4L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6A299884CD; Tue, 2 Jul 2024 08:49:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20701.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::701]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6C48E88712 for ; Tue, 2 Jul 2024 08:49:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Lukas.Funke-oss@weidmueller.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FIq63rpyCYWwQVzeLtT6pc4jkzVMmf1uMSVCF+IdR4O4F7tHScjJ/eqX61+nuSEeXxy4HCwgJZKZVWy6fsP6XqXZ1Q97w7WmTvK3r52kSHyguo4WYKQDM0NzXbr6qL2O+pauxGX4E2QXPsukizDuWmhz4R0jeoe1IqjiaAbGhacXA52NwRBciSxvOMm249SY0PXCFVhuGvZIHmLK/gGE+MnLHYo05jQzY4PVNL6R2dDv6xxsUZCCb8l7ZeDFwfroMON3/100RnS8C7inLrBpyTzScZwzYbtkJf3vrwHNZuB3R/Jj6wwYa+SIc/YxJdXIS98IEmnNIdbOX3d3htN8rQ== 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=7qFYj+oWuayadb6TLUjX4K99L9cwrd8o+6o80D4ND4E=; b=m9urNxqskIMRP+onPV1HIP9fNJ4QpFoQIfZhkSU1+gxmcfIDPjam2yJZnMYEakR6ooke2/Tewn+8BS6ehV7pibmy/6xojyb1El8OHAeNQkmdadLu6IgnRcShi1mt9aiu4CxpCBxy8NobMofhoSij+9V26olG0kgwSBsOcEIvN5iUQVMKYNMnZLJUqwm/xTjkq5YV3+eG5BI3qoxAQiu2Aag4eKHPKUrwkUKz3xRZKuKQeEloLMKzCW5n9NmFdU2TsJzN3FdReoap3pOfejEEBsNO0CfR/ZwRnhNaLwiW9Ou94/tJVvIn3emU7ou7EswGmeB6JW56BW7OHcwPXvZBXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=weidmueller.com; dmarc=pass action=none header.from=weidmueller.com; dkim=pass header.d=weidmueller.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weidmueller.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7qFYj+oWuayadb6TLUjX4K99L9cwrd8o+6o80D4ND4E=; b=pMTY1R4LY/XTX46kY7k9xJTZ+j/pUZ3Ge+fcBRq1wcDrqUGxEpAfWEjWv8UpB8HUWuB8/TnbgXupCp20yB2ra4w4G0hwwRKg9C/fz9/YNJcF3gXt6K6hINV1KlWBYmvL04NkBuG3S9vOtPcWUyPMXrB6Kc99q1kl9KyUjxekpdktDbwyX8muI54wgUbvTo5oQ74rZuB0ffwovT04sWUGaMd3l8lw7AkrA0ZaMjzqv5z+xCVjoqMOpfzsXTeoT52Obuzagtam26NDNxqhuo6/B1t3LIFa2zsIjpGjxTP+7CsS+aQ/YY8N3zzzBRh7HbeI8YOFFqR5tiXFuBMYn4eneg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=weidmueller.com; Received: from AS2PR08MB8431.eurprd08.prod.outlook.com (2603:10a6:20b:55a::18) by AM8PR08MB6356.eurprd08.prod.outlook.com (2603:10a6:20b:36b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Tue, 2 Jul 2024 06:48:59 +0000 Received: from AS2PR08MB8431.eurprd08.prod.outlook.com ([fe80::aeb:1738:d59a:cee6]) by AS2PR08MB8431.eurprd08.prod.outlook.com ([fe80::aeb:1738:d59a:cee6%2]) with mapi id 15.20.7719.028; Tue, 2 Jul 2024 06:48:59 +0000 From: lukas.funke-oss@weidmueller.com To: u-boot@lists.denx.de Cc: Niko Mauno , Lukas Funke , Ashok Reddy Soma , Emmanuel Di Fede , Ivan Orlov , Joe Hershberger , Kever Yang , Laurentiu Tudor , Marek Vasut , Michal Simek , Paul Barker , Quentin Schulz , Simon Glass , Tom Rini , Venkatesh Yadav Abbarapu Subject: [PATCH 1/2] env: Add function to import environment variables from FIT conf node Date: Tue, 2 Jul 2024 08:48:33 +0200 Message-Id: <20240702064834.9543-2-lukas.funke-oss@weidmueller.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240702064834.9543-1-lukas.funke-oss@weidmueller.com> References: <20240702064834.9543-1-lukas.funke-oss@weidmueller.com> X-ClientProxiedBy: FR5P281CA0057.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f0::15) To AS2PR08MB8431.eurprd08.prod.outlook.com (2603:10a6:20b:55a::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS2PR08MB8431:EE_|AM8PR08MB6356:EE_ X-MS-Office365-Filtering-Correlation-Id: d17ddc25-b1fd-4379-e8b8-08dc9a630ce5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 7j5B6jektX9gBoi28ObMHSs0D8M5DCGAL0TUG8jxfz25LczrB9Pk59fgWuOupZwLOdzR+XjCrey7S6ubriT/PyzAnm86699B6nTLqmyY2bmqcvyrrjylK7kIhk/F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mFPronp7Wf6GGZog0vGInPRjClTDpw3eY8fnxMXJNY4pyRTyjqUuDG2TZIzAtCH84jg7pk0f+CCRpvDyT/Sx5e7JyynuulVvwUasZTJg14idjgIU/+GvJC0VmVm/r0hnz4M/7u6scJsBG9Npkn5AGtHeEQNs9178ekZs0cgeS1DEvdeXE1CkHtMcz3xcVzByJJDJCssMizYxBUA4yK4tSjnxWE/rJuey6y29M8FUAQqDQw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS2PR08MB8431.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +FuxLYnNsi/Jor02ByxhRgJeN30b1uqAUl0SH6xpSsznmG7v97wvnkCNTH1ppzj+SgQCh4H0IFRp+Wh33LciqPZgVE5PIuFg5V30KI1z+WsJNdV2jGBfifFWK+u0wIBwJkVgVdNhD+q57GtCOZ9gxYL7zhHBx+RhS4aRtrCqsFrB3xpNVTKgVnZpg6tlbJvzRsEkChgua6X5u9QafaPwLoarpJmpj60q6ZomktE0g7bpxc2IAREnUmSJRFWfYC/9qegdvuUivYM4SHKyn1pQIGnCEME9a5dfLIxi/aGZC/VB3Ez0IvoVgLZC12uWI2+ENltVAycVqwMmL7SuJu+RcHG5zGeS51kHPMJBGNYD82KYC/1Dqp48EetJHbva3Edq0kG4n0s/PslFkrMOA9FYUPCYd1fmn07OwXLCCmZ0nwwtvhoSKokXH85DAhmAs3xIZtO85tDYDAIaBnxDzr4ifdDDja5/9y8/+7JEhEmkNgIsxI57mN0oT9JBOnJkjuwVWLayqnmESIyly1/GWUwZBA7psRcO57arJ61iIBy0htAcG/GC8a7/jcCs0y1gM5VOz/ozslcB7pOB25wDoDaDNsLltgSYVqrzFE7o/K+uoqUMsB/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change-CrossTenant-AuthSource: AS2PR08MB8431.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2024 06:48:58.9738 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e4289438-1c5f-4c95-a51a-ee553b8b18ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UNh2vavjjG9QAlsKWCKF5SWyUnQ0uvlQ6NraSllQsR/GKlAQuD4NhHIE8zJYPeB+feAge4smOue+DCEm5Pn/xQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6356 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Lukas Funke Add function which reads properties from FIT conf node prefixed with "env,". Import property name (without 'env,') and it's value as runtime environment variables. Note: this only works with string properties Example: configurations { default = "conf-1"; conf-1 { kernel = "kernel-1"; fdt = "fdt-1"; env,foo = "somevalue"; env,bar = "someothervalue"; }; }; => env print foo foo=somevalue Signed-off-by: Lukas Funke --- boot/image-fit.c | 4 ++++ env/Kconfig | 10 ++++++++++ env/common.c | 28 ++++++++++++++++++++++++++++ include/env.h | 11 +++++++++++ 4 files changed, 53 insertions(+) diff --git a/boot/image-fit.c b/boot/image-fit.c index 89e377563ce..0ca31c5f851 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -34,6 +34,7 @@ DECLARE_GLOBAL_DATA_PTR; #endif /* !USE_HOSTCC*/ +#include #include #include #include @@ -2128,6 +2129,9 @@ int fit_image_load(struct bootm_headers *images, ulong addr, puts("OK\n"); } +#if !defined(USE_HOSTCC) + env_import_fit_conf(fit, cfg_noffset); +#endif bootstage_mark(BOOTSTAGE_ID_FIT_CONFIG); noffset = fit_conf_get_prop_node(fit, cfg_noffset, prop_name, diff --git a/env/Kconfig b/env/Kconfig index 1f8e90af55e..01b802e54b9 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -748,6 +748,16 @@ config ENV_FDT_PATH help The initial value of the env_fdt_path variable. +config ENV_IMPORT_FIT_CONF + bool "Amend environment by FIT configuration node properties" + depends on OF_CONTROL + help + If selected, after the environment has been loaded from its + persistent location, the "env,*" properties in the conf-node + of FIT image are used to update the run-time environment. This + can be useful in order to transport signed environment variables + to the kernel cmdline. + config ENV_APPEND bool "Always append the environment with new data" help diff --git a/env/common.c b/env/common.c index 48a565107c1..c8aa59447e9 100644 --- a/env/common.c +++ b/env/common.c @@ -24,6 +24,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -661,3 +662,30 @@ void env_import_fdt(void) } } #endif + +#define FIT_CONF_ENV_PROPERTY_PREFIX "env," +void env_import_fit_conf(const void *fdt, int conf_node) +{ + int offset, len; + const char *name; + const void *value; + const struct fdt_property *property; + + if (!CONFIG_IS_ENABLED(ENV_IMPORT_FIT_CONF)) + return; + + fdt_for_each_property_offset(offset, fdt, conf_node) { + property = fdt_get_property_by_offset(fdt, offset, NULL); + + name = fdt_get_string(fdt, fdt32_to_cpu(property->nameoff), NULL); + if (strncmp(name, FIT_CONF_ENV_PROPERTY_PREFIX, + sizeof(FIT_CONF_ENV_PROPERTY_PREFIX) - 1)) + continue; + + value = fdt_getprop(fdt, conf_node, name, &len); + /* Get the actual variable name "env,somename" -> "somename" */ + name += sizeof(FIT_CONF_ENV_PROPERTY_PREFIX) - 1; + + env_set(name, value); + } +} diff --git a/include/env.h b/include/env.h index d2a5954ded8..fa4c67056e7 100644 --- a/include/env.h +++ b/include/env.h @@ -382,4 +382,15 @@ void env_import_fdt(void); static inline void env_import_fdt(void) {} #endif +/** + * env_import_fit_conf() - Import environment values from FIT configuration node + * + * This imports environment variables from FIT configuration node. Each + * property name starting with an "env,"-prefix is imported as variable where + * the variable name is the suffix of the property name. + * + * Example: env,somevalue = "foobar" --> somevalue=foobar + */ +void env_import_fit_conf(const void *fdt, int conf_node); + #endif From patchwork Tue Jul 2 06:48:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Funke X-Patchwork-Id: 1955072 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=weidmueller.com header.i=@weidmueller.com header.a=rsa-sha256 header.s=selector2 header.b=AXhgbrcT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WCtn64KMKz1xpP for ; Tue, 2 Jul 2024 16:49:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 006C588722; Tue, 2 Jul 2024 08:49:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=weidmueller.com header.i=@weidmueller.com header.b="AXhgbrcT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1DF3988714; Tue, 2 Jul 2024 08:49:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20727.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::727]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 072A388718 for ; Tue, 2 Jul 2024 08:49:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Lukas.Funke-oss@weidmueller.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVIQ7Efg3g5plM/JtJzqdRgiDmQcIMKCIJi+yN5MWaq3Lxf4rmBPd4NzlfNK460L8Vgi9rdrhG2zYyCRaNlKGjXU3YEX6InpJYiBt5PkAjTMcc4Rwlm8UWX5UVrovOEoasm5lA886T8A5MVRM3gOeUFMO4Lsgx35WuIfAuvEFC2Lj//kAvHoLwWEGbeltDiZ6qV07jo9EveP5kq9h9aa55KVJpf8NwfbzmyEjIV6NXUjI+DaUGgHijektIw2UPvfAYeHbE5oabHFXvJs7wkUa/1pl7oOvPQAixIMgtk5FmdNRr/GDUzTVoda4M9yTAblZP2BUYU8eMIWaMizXlfE5Q== 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=vyYsmZO8UMwy6pWoV0fP/e1vazi5QueSmbpsBtBL2Kw=; b=TXQutU7QJtTQ3D2zkiZKOuPcEMDGPikvyRuk+eO+ZI7nqGehkX9wsyNduEuNSpRlVcE3G3Sev1dHiicZvUe3weUGVlUczo63mgJzP1JLDcc6aYQSCadK9vDqOJ1h9UWUa7ROM0fai1Ru+xt69n9SX9z5uKunEnEmW5jrCDT429nOgemf3z4dMOvXsqejCFVls9+U+aGH+gOXfB1dEXV7anx5Dezs9FRWcwRGg91AZeKpijViWzT4zpjw6iTk2kLjx8xBS/kJmwYhytBAs/vIqmUm3Gy9LmXuTjA6nyMIBNrv2OYl95Kxb3vnJHC/Q3vDg8Ej4PxCuG1dOAbcn+llkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=weidmueller.com; dmarc=pass action=none header.from=weidmueller.com; dkim=pass header.d=weidmueller.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weidmueller.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vyYsmZO8UMwy6pWoV0fP/e1vazi5QueSmbpsBtBL2Kw=; b=AXhgbrcTM0xc8hakNHA44Rzd2MTcuytTqBaytzC6chaLmFsFHYdu65tT0snAulYaGPbRyDqF2ebdSP+i3THw187upn/ye5OO3R6rZF4Z5FfD5bfsFLhGpxJQdeLZQ6GnrgctkYJmS34NNlVjead6KArBxbWVDUv72TtGPkhMa6PIPn4dX3ryq8qCdcbhIz5YqcknmrunubdHpS0fmFinV0fl2oRq9VIgZfiPJjkiNgefgLyZJ1eqGPeS60Vg34KbC1T3yKsVhoHL0enmpmfwJcXsCOC0NcbJmheEThWhKV+DpSgOKQLH1SwdBv71fm2Rl+ZLzf//Ys1NBoiI7hKc9Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=weidmueller.com; Received: from AS2PR08MB8431.eurprd08.prod.outlook.com (2603:10a6:20b:55a::18) by AM8PR08MB6356.eurprd08.prod.outlook.com (2603:10a6:20b:36b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Tue, 2 Jul 2024 06:48:59 +0000 Received: from AS2PR08MB8431.eurprd08.prod.outlook.com ([fe80::aeb:1738:d59a:cee6]) by AS2PR08MB8431.eurprd08.prod.outlook.com ([fe80::aeb:1738:d59a:cee6%2]) with mapi id 15.20.7719.028; Tue, 2 Jul 2024 06:48:59 +0000 From: lukas.funke-oss@weidmueller.com To: u-boot@lists.denx.de Cc: Niko Mauno , Lukas Funke , AKASHI Takahiro , Abdellatif El Khlifi , Alexander Gendin , Heinrich Schuchardt , Ilias Apalodimas , Joshua Watt , Marek Vasut , Piotr Kubik , Sean Anderson , Simon Glass , Tom Rini Subject: [PATCH 2/2] test: fit: Add test to check environment extraction from FIT conf node Date: Tue, 2 Jul 2024 08:48:34 +0200 Message-Id: <20240702064834.9543-3-lukas.funke-oss@weidmueller.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240702064834.9543-1-lukas.funke-oss@weidmueller.com> References: <20240702064834.9543-1-lukas.funke-oss@weidmueller.com> X-ClientProxiedBy: FR5P281CA0057.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f0::15) To AS2PR08MB8431.eurprd08.prod.outlook.com (2603:10a6:20b:55a::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS2PR08MB8431:EE_|AM8PR08MB6356:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fa3ea3e-c6da-486e-ab48-08dc9a630d59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: KZAIL0r3s2mah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E7emy2gTKoWf+f22kA6BQHZaB9vKdctah8cp5OCtn5kVo61ryLP+iIHLFspbXWo6vtpo73vfZRCwZJiPmPEItm3MtlejU11QefqutvbO8oCHvx+IAVWQ3RcbnPI++ctBkd+1d5/ys32mhueNk08O4RXhhiPhZlSASGU9xILrA6GRo1OSHFHFDYpZ37IFEJpnfZOxlh/e28dR2KnvWWHwJNw4D2JTef4GMtCpF/i8sg+6TQ/xzcezw9fUXM/2DX+aEDlneUHMoVFuc7NzUuQFdTXsvQ99Py/T/FHRi4/Y94ViZh0VIbZg2tisOTDNMQEImjjdbL96wm9RcTT7gw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS2PR08MB8431.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JlHgPMnTz2FElFRbDhN/74hCnkLoX6KGKHxJ4p8BJv9pV9HZeppmhsklhDXDB8xqq2f0mjxN66xhHYP0est6Eu9UPlCKdrfZDh/F51y0FYVwemsr7UiT+kdRmRnCr5oeHhv/7RIW2qfEZ5vuSn/VuwRngmTgt9ipOgpYS7qFwX6c4tdeNUMjv0HUBjgoi13xXz54jjqEWjO9dBSCUOmxKyE/kBH/wLWCWIamRCLQcYKjqCCE170PUcTPPBIh/7fcAzFkGn1Fv8kr4TOoDobp/jTaBdpuM0Qv7CF4HtG0dn18lLV2wGjpn9/uFda68WQnOCkgKd7ZcT2/ySSQ1zbzqm1xYoKOQflNvhhTM7xW7YcNLT8dv5TM6DeCq7dhrVSe+l6pSwqRIkD99ycf9DNWYmuyn6JPxg8l3CTLiK5BQBFirQxDPUctzzecrRgNyKWLdh3f9VkY14akIikmfGKV/L8CycsNV8Dj7tgI8GxxnKqpaKnNyXHUzkM9QmOIqj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l31MLoCesfsW++QqmUIrSaiVZoxJfHdZJQ== X-OriginatorOrg: weidmueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fa3ea3e-c6da-486e-ab48-08dc9a630d59 X-MS-Exchange-CrossTenant-AuthSource: AS2PR08MB8431.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2024 06:48:59.7369 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e4289438-1c5f-4c95-a51a-ee553b8b18ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: V6yt1DT1YJpRt2koaNpwEBq7cbSsUZudfj6y6xtX/quHyB4D3/ULID09IAxY8G81y/6/05Xf8ur54xH3lmauHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6356 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Lukas Funke Add test which adds environment variables to the FIT configuration node and checks whether they are exported to the runtime environment. Signed-off-by: Lukas Funke --- configs/sandbox_defconfig | 1 + test/py/tests/test_fit.py | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 93b52f2de5c..7431c8a910e 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -142,6 +142,7 @@ CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host" CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_ENV_IMPORT_FDT=y +CONFIG_ENV_IMPORT_FIT_CONF=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py index 8f9c4b26411..2a3aba74502 100755 --- a/test/py/tests/test_fit.py +++ b/test/py/tests/test_fit.py @@ -74,6 +74,8 @@ base_its = ''' fdt = "fdt-1"; %(ramdisk_config)s %(loadables_config)s + %(env_var0)s + %(env_var1)s }; }; }; @@ -308,6 +310,13 @@ def test_fit(u_boot_console): 'loadables_config' : '', 'compression' : 'none', + + 'env_var0': '', + 'env_var0_name': 'foo', + 'env_var0_value': 'somevalue', + 'env_var1': '', + 'env_var1_name': 'bar', + 'env_var1_value': 'anothervalue', } # Make a basic FIT and a script to load it @@ -396,6 +405,42 @@ def test_fit(u_boot_console): check_not_equal(ramdisk, ramdisk_out, 'Ramdisk got decompressed?') check_equal(ramdisk + '.gz', ramdisk_out, 'Ramdist not loaded') + # Now a kernel, FDT and environment variables + with cons.log.section('Kernel + FDT load + env'): + params['fdt_load'] = 'load = <%#x>;' % params['fdt_addr'] + params['env_var0'] = ('env,%s = "%s";' % + (params['env_var0_name'], + params['env_var0_value'])) + params['env_var1'] = ('env,%s = "%s";' % + (params['env_var1_name'], + params['env_var1_value'])) + fit = fit_util.make_fit(cons, mkimage, base_its, params) + cons.restart_uboot() + + output = cons.run_command_list(cmd.splitlines()) + check_equal(kernel, kernel_out, 'Kernel not loaded') + check_equal(control_dtb, fdt_out, 'FDT not loaded') + check_not_equal(ramdisk, ramdisk_out, + 'Ramdisk loaded but should not be') + + # Check if bootargs strings substitution works + output = cons.run_command_list([ + 'env set bootargs \\\"\'my_boot_var=${%s}\'\\\"' % params['env_var0_name'], + 'bootm prep', + 'env print %s' % params['env_var0_name'], + 'env print %s' % params['env_var1_name'], + 'env print bootargs']) + assert ('%s=%s' % + (params['env_var0_name'], + params['env_var0_value'])) \ + in output, "Environment not loaded from configuration" + assert ('%s=%s' % + (params['env_var1_name'], + params['env_var1_value'])) \ + in output, "Environment not loaded from configuration" + assert 'bootargs="my_boot_var=%s"' % params['env_var0_value'] \ + in output, "Bootargs strings not substituted" + cons = u_boot_console # We need to use our own device tree file. Remember to restore it