From patchwork Fri Jan 31 10:59:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Hunter X-Patchwork-Id: 1231823 X-Patchwork-Delegate: trini@ti.com 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=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nvidia.com header.i=@nvidia.com header.a=rsa-sha256 header.s=n1 header.b=Ihxnx0k3; 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 488Dkg1MHYz9sPJ for ; Fri, 31 Jan 2020 21:59:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2461E81843; Fri, 31 Jan 2020 11:59:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nvidia.com header.i=@nvidia.com header.b="Ihxnx0k3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0A44A818B0; Fri, 31 Jan 2020 11:59:32 +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=-0.1 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) (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 EBE77814F5 for ; Fri, 31 Jan 2020 11:59:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nvidia.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jonathanh@nvidia.com Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 31 Jan 2020 02:59:05 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 31 Jan 2020 02:59:26 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 31 Jan 2020 02:59:26 -0800 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 31 Jan 2020 10:59:26 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 31 Jan 2020 10:59:26 +0000 Received: from moonraker.nvidia.com (Not Verified[10.21.133.51]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Fri, 31 Jan 2020 02:59:26 -0800 From: Jon Hunter To: Tom Rini , Subject: [PATCH] distro_bootcmd: Add support for loading user environment Date: Fri, 31 Jan 2020 10:59:17 +0000 Message-ID: <20200131105917.10118-1-jonathanh@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1580468345; bh=chNPieNY6ZJvlPair0lRZ1Sy6ndd1aogfqnGHsPHHYk=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=Ihxnx0k3L4OGGMk28vO5HX+/bvEXqieUxB8vpiKKq0cLUow75akUa9lk9juhVlbGv /fx7WDBVIe5GnpTDwd6uPwmK8lOvejf/Z47i/SvnlzxjoB3S3XhKRKPnhuPp/B0WT3 EfQgARF+qnOWwjIl0vep5FkK6TngBrmvTzjgwb3G4lQmi1XS4QcR/h/Rr3lC8EA9RY fmRpL9fTCGZajPQdqbWjzeTzTdehzkzrD6JgXMZBhWTmELOKtCmpXUarDzbFthfnpG PBNNIt4y7rEiJxU+xCtkJmM58S6CWk6OeBurQu0+faVsB2hts/JhPnxG2LjZPoZiVE sY/WzNk3hAu+Q== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephen Warren , Tom Warren , Jon Hunter Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean U-Boot supports loading a user environment from a file in the file-system. Therefore to make it easier for users to override the default environment, add support to the 'distro_bootcmd' to look for and load a user environment in a file called 'uEnv.txt' in the same locations where an extlinux.conf or boot script might be found. Note that by importing the environment with the '-t' option, the current environment is appended/updated rather than replaced completely. Signed-off-by: Jon Hunter --- include/config_distro_bootcmd.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index fc0935fa21af..5607f382ad73 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -422,6 +422,19 @@ "boot_script_dhcp=boot.scr.uimg\0" \ BOOTENV_BOOT_TARGETS \ \ + "load_user_env=" \ + "load ${devtype} ${devnum}:${distro_bootpart} " \ + "${scriptaddr} ${prefix}uEnv.txt; " \ + "env import -t ${scriptaddr} ${filesize}\0" \ + \ + "scan_dev_for_user_env=" \ + "if test -e ${devtype} " \ + "${devnum}:${distro_bootpart} " \ + "${prefix}uEnv.txt; then " \ + "echo Found ${prefix}uEnv.txt; " \ + "run load_user_env; " \ + "fi\0" \ + \ "boot_syslinux_conf=extlinux/extlinux.conf\0" \ "boot_extlinux=" \ "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \ @@ -457,6 +470,7 @@ "echo Scanning ${devtype} " \ "${devnum}:${distro_bootpart}...; " \ "for prefix in ${boot_prefixes}; do " \ + "run scan_dev_for_user_env; " \ "run scan_dev_for_extlinux; " \ "run scan_dev_for_scripts; " \ "done;" \