From patchwork Tue Nov 10 20:25:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1397794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=VC+KraZZ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CVzsh3BBrz9s0b for ; Wed, 11 Nov 2020 07:26:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0FA81821A4; Tue, 10 Nov 2020 21:26:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="VC+KraZZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E3B6D80404; Tue, 10 Nov 2020 21:26:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0726.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::726]) (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 081C380404 for ; Tue, 10 Nov 2020 21:26:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e9Z9aM6q4UbDfme93ymn3XUAaO3XJUWMZ3R78g7FrV1GmJ43GCc6+UqxeevplQ1okvfkI0gZE0q3XtNid0gF7UjsKzJq5+UwdeB6IoWQPeXIZ64FXssn4d3oSvXOd6Kbp5+yQvx8zZLXwcuAqBFiZ2ohDbvlbP05E+D3MTfzA/NdaDUvZklsf7NxPwribj840vR/49pCPJ2xYX9VScEnBGuf3Db7Eot7PX+SZn/mMcdLSjDw1B7SdDrR8Y2ZYJ2wzxWYwasjgzl59H+5Nvryf+ot/6W9Ime4cRKm4ycCDwcDITBZCEZrcbqgRhmZ+KTgoQm7ULrHBvOSCq5EXpK4dA== 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-SenderADCheck; bh=HKZIzv5RvGsdhRdSVarg2yas4tGQt7iCdVQncyVmgkg=; b=dCGqq6MgiKXMKO9TEtJc7yhmvNFgzxeivrFlN05hQQvV11hcOnYChxf1xYBqxikirxyekGGX3OUOP/NVBwvjJzr43sV4WUYR3bGWYHiBCV5AaxgFJ9B9txYmHHqHcYmAGnnS1rkIwW6hKRRqGOCAEIYMjYAC6wfeiXCpoqX/TFdfi2KFG6v/Fei090HErgxNNqU2yAW0rbpzt9X7Nck+oGa7duDsv4bFu7REH5bt/rYxgb//2pCDFblTRfxlcdwIq0tbt7XmVt+t7yPjKAyr95Rr7OyOE5oukYwKCZnd20pyhv/K1On6ZSflc+YMU2M1sCXj5WKf/XVVDvmd5zVh7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HKZIzv5RvGsdhRdSVarg2yas4tGQt7iCdVQncyVmgkg=; b=VC+KraZZHkr2FIY84DDKso7x9K7/4HKrub1KCSUc3mP8cpYwx3uhCdt6QGXLQ7QBAef5zfKvCsKhqtJcmruwuuEYZUBu3vGvP66gosLxZ/HRAIJ5U1lSbKIFmdlSULUbzp+A/i1vrJlHfmIYS42n4pWRtvceFRrpvaLIs4D2hoY= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3299.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:188::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.30; Tue, 10 Nov 2020 20:26:11 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9dc3:9785:dc4e:ad62]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9dc3:9785:dc4e:ad62%6]) with mapi id 15.20.3499.032; Tue, 10 Nov 2020 20:26:11 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Joe Hershberger , Wolfgang Denk , Patrick Delaunay , Tom Rini , Rasmus Villemoes Subject: [PATCH 0/5] allow default environment to be amended from dtb Date: Tue, 10 Nov 2020 21:25:58 +0100 Message-Id: <20201110202603.20944-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR0202CA0067.eurprd02.prod.outlook.com (2603:10a6:20b:3a::44) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR0202CA0067.eurprd02.prod.outlook.com (2603:10a6:20b:3a::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.21 via Frontend Transport; Tue, 10 Nov 2020 20:26:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ff4b996-9eb4-438e-72fc-08d885b6dd44 X-MS-TrafficTypeDiagnostic: AM0PR10MB3299: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kouu9fLP0sd/qquWWCV8xZIaoX9/OCiBdHg/tAaV1Q7sBFubV+3BRH9WEGGzR3NBefNesSoP1R4qyeujJUrNm5DkLm3h+54gMfMSucirMTI8c/ooj/BR7NIHsqrllFsvOrQ58RWKlvM4ApeKXF67ne7eNXdK7aqvxyVDShdEK6qhzk0uumV0z+dnFjxE3/H9b2Xa3OzNeBm6H7VMbsMX06xbGNuQfqUtq7paRR8+AXLHmObLG/ef3NFxa6CWtLmMpclFmTf9U4dfUQz4lMk37xgG8EjllLdJMKopIDf60JWfnN0fpuNsNN2VHK0GCxnMrlb7fmqcuAx3ZQMKtbqEpQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(396003)(39830400003)(136003)(376002)(366004)(346002)(6486002)(5660300002)(52116002)(2906002)(316002)(107886003)(8936002)(6506007)(8676002)(66556008)(66476007)(66946007)(83380400001)(956004)(86362001)(8976002)(6916009)(44832011)(478600001)(16526019)(6512007)(186003)(54906003)(4326008)(1076003)(6666004)(36756003)(2616005)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Ry0QFdMObWhrm5kHq5zCbgC4K6k1K1HAvn0XWj6+xqCQf04SVOghehaHtzMl4TMcuyFxSt0Gcioxyqk44ZhTe7GJn7VxJ/sm4VZnfiWqm8OFkS0HnoqGdGgFIMbsMhf5lbSAvHwhS1pxrkNqo2UwMzmO2hSlzsVyBEvQFP0qCn19hG/8BcboSrBscmkaF36ic1QlcNtqAmGr6MZdpAW3l2JbFIlRy8hMf0YLkPrcxfMB5VvIgH/dUeGlmsTFym+JAG5Y2/acLjSXOjpWe3vSHyFBsOiWHIX4xqD83fx/uM8h0B7eF+RtDdwKN7jcw4HZBblIGLZPOCshaJsQU2hS/ovPArcNNBrkOJOF4//g6bBTrxRgkkJzte2l/r4V7bpbkHUV76WRyyEvMytt+Dy32UCnU3WB5RDYdvHd/6pkV4monw0hIfPFIawUX5sUvoZeSMwZcnAXxbHLfUlqa0MWfY+tGbxIRcjnE1xLZO4FX07YRD0yNiZeWcupdq/6a/Akd8ezudbhuCwn6caaC3gOZNeCPXrmEHuBhhyctEONI4l3fKBOpgFEcN+27p2fxJQHQly7DA/4yx72jsUwrKFNUC7NYS70yvGIIplfLSBTmZjxgb16JvxwEJ1s+huxnqUEH/kCJcVbVLEmltzVDRLh+w== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 8ff4b996-9eb4-438e-72fc-08d885b6dd44 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2020 20:26:11.7017 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ut0zPbTKhx+61dalfkBR4a9AeG15kXAUGvBH8FsLtiY0UP/QTFFF3PXoJO5W/XXUVA/I6O2RMa1FQ8fGIRcmHN9Bf9m42BjeoNUGAc9SyJA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3299 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean These patches introduce the ability to amend the default environment baked into the U-Boot binary by a DT property under /config. This is useful to create a few different images based on the same U-Boot binary, e.g. one for normal use, one for development and one for bootstrapping the board. It's also useful when SPL loads U-Boot from a FIT image and decides between multiple possible control DTBs; those control DTBs can then contain tweaks of the default environment suitable for that particular board variant. There are already various /config/ properties one can use for some of this; e.g. /config/bootdelay overrides any bootdelay set in the environment. This is intended as a flexible way to achieve these kinds of tweaks instead of adding more /config/* properties. [It should be noted that adding "bootdelay=123" to /config/default-environment is not a drop-in replacement for setting /config/bootdelay to 123, as the latter takes effect whether the environment is the default one or one loaded from storage.] It does not affect the case where an environment is loaded from a storage device, nor is there any change if the new CONFIG_ option is not selected. Rasmus Villemoes (5): fdtdec: make fdtdec_get_config_string() return const char* fdtdec: introduce fdtdec_get_config_property env: make env_set_default_vars() return void env: allow default environment to be amended from control dtb test: add tests for default environment arch/arm/mach-exynos/include/mach/mipi_dsim.h | 2 +- arch/arm/mach-rockchip/rk3188/rk3188.c | 2 +- board/dhelectronics/dh_stm32mp1/board.c | 2 +- board/firefly/firefly-rk3288/firefly-rk3288.c | 2 +- board/st/stm32mp1/stm32mp1.c | 2 +- cmd/nvedit.c | 37 +++++++ common/cli.c | 2 +- configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + env/Kconfig | 21 ++++ env/common.c | 23 +++- include/configs/sandbox.h | 8 +- include/env.h | 2 +- include/fdtdec.h | 16 ++- lib/fdtdec.c | 29 +++-- test/env/Makefile | 1 + test/env/default.c | 102 ++++++++++++++++++ 17 files changed, 227 insertions(+), 26 deletions(-) create mode 100644 test/env/default.c