From patchwork Wed Nov 8 11:06:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 742229 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp228024wrw; Wed, 8 Nov 2023 03:09:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHF70gEjKeUPQP+xB/6XpB+ME5U8+aYBPfsLaUjNFKg1jZtOBikY5xxFC4jkecGsGoqt9S+ X-Received: by 2002:a50:c31d:0:b0:544:fc51:cd9f with SMTP id a29-20020a50c31d000000b00544fc51cd9fmr1090886edb.42.1699441763720; Wed, 08 Nov 2023 03:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699441763; cv=none; d=google.com; s=arc-20160816; b=X1wjM9XNOCdSIVlllFIxW04c6f5lvMPvUgeRZ99vzW5KevkNsXX3oYG34WW7K9pwsq 8V7CzHyz9+dibuYMkRgYaVLizvOovFQVSOPfV5HX2uDV3UZusWkkQxWEvfLUNGclcW/R 1HWTAa737aUGntiSh+2fTxPnHRdwp+JwYGMPVJYJ2/nEarIC9HJr425WILaV647mZ6Hy eB47kvRmHRGWfR3jlADpKONId4/g3KpoP/Mp2wRnTcu0a5tDK0HsrnAFhj9XLmVwKo82 zr7jOlFQhUpjExGqsJ2rWsB8wxm8/mPNSpzXbkNShISjvhaqz0/+GUwmGOOSnGUWeOT5 YcbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x3tGXQ7IJXQZQ/S0nkhUtkKMN2OsrFTTbgmtRgH9/3w=; fh=UwEaQaZSKscgV8VKorL4WxKMlykH7WzwOcMeBrHkxSs=; b=e/q5RnNpHo0mh2mX5liVLCSRoPcp1PxtquHpkB2Wte9CEpPrzG326oMy6ZCrX4OqMm v5vOWN82/2tqdlJUHejFDaLmfAmhQBdbiNjoa5xgUPKqdmx1O2fipa9xJpWEzeXcsQtf CCZyorM/EaAai2Duc90bV89abS8C7jBQGJsMBUjjKv+1IuOxc6ndk3fiiWKRFl3NxYdQ K+3JfPAvxoi8JYg6ook49RJk8EZvaIcrMCfHGL84ScukyCuCbGmG0nruZalqlxJzaSG4 D+rMl5F9c9yfE+Utc5VOu6iRDydiJmGHI68ymEzvPVK0bCVsVSj3wJoxT+AaAfV/Gbgs 3cNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6XXOXSM; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id v27-20020a50d59b000000b0053de7c28d98si5984361edi.620.2023.11.08.03.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 03:09:23 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6XXOXSM; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 519BE8771E; Wed, 8 Nov 2023 12:08:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="Y6XXOXSM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA62E875DB; Wed, 8 Nov 2023 12:08:19 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 71EB187253 for ; Wed, 8 Nov 2023 12:08:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6be1bc5aa1cso6810000b3a.3 for ; Wed, 08 Nov 2023 03:08:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699441695; x=1700046495; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x3tGXQ7IJXQZQ/S0nkhUtkKMN2OsrFTTbgmtRgH9/3w=; b=Y6XXOXSMfb7efGcPvoU+Hh/vMLLyCDiY/Sxx73TtXdFppFzjLj8N9gqLOxUQ0DQ2QA CgVcN45XZzd9lL1VfAiM8RsV50qjprd3eTa2SSWz+C5MdcXbJP7lyxu0IjWMAkiWbygv RrpNW729cmxkScPI+4wG6TRzW765SqjXiacBv0A8JBGIyOWYqcwxx3F60Pml+Vmlt0dh 8ImWMvfrIqrxkg7J5AwYL5VY0kPdjj+5/CtNFCQn+4DLx088qyPDO3/wQ0XfSHhSSWj/ qAaVpxCnJvhsp5a/Ftn0MRb8WcYniMZTzKkXXWSu66/UbujGKsq5iC7m+5aXW3loRo3A AQuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699441695; x=1700046495; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x3tGXQ7IJXQZQ/S0nkhUtkKMN2OsrFTTbgmtRgH9/3w=; b=ooOy7dyHvX1Dp7q56A8/XYarPAL+SPXN6+37bLxY4aVCz+IHtBJAQLWrFfGG22sZLc AdeHX6iX5rO3/TNTd2fQ8WUy/gKYdJobzQwKNEvzUBFb8mPXvtwkTwYQOKrNIJIQ6lkU 0qMgUXAvk/WJRaUDUbnrZRQayuig4Fs/czANftJbrEe1r6fJGnbK/afSU1F2YAAxa7XI b7/B1hpSzKzrmBwtbps2X7whTjsaeKp+f3LN2zlcoIHoZCWq4Y5+bVDjujxuTHj+eWXN GdVGL5qK5wyaty0RJ7dKu8S6YsdMw2im18bA3SFoAxhequOwv1OAVKOJzCkdkmSxZkKD VgRw== X-Gm-Message-State: AOJu0YxGTLjTNaBiYxoRtvra7FtLukgqmvSl1Ne7Bl/QlWPRrD8ENUc6 KUynwcCcocvCSwQuKlKgyipgfO4IrTZA611LbCg= X-Received: by 2002:a05:6a20:441f:b0:181:10ee:20ea with SMTP id ce31-20020a056a20441f00b0018110ee20eamr2071223pzb.49.1699441695108; Wed, 08 Nov 2023 03:08:15 -0800 (PST) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id d3-20020a170902cec300b001c57aac6e5esm1497956plg.23.2023.11.08.03.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 03:08:14 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Michal Simek , Masahisa Kojima , Joe Hershberger , Ramon Fried Subject: [PATCH v11 8/9] cmd: efidebug: add uri device path Date: Wed, 8 Nov 2023 20:06:35 +0900 Message-Id: <20231108110637.3691441-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231108110637.3691441-1-masahisa.kojima@linaro.org> References: <20231108110637.3691441-1-masahisa.kojima@linaro.org> MIME-Version: 1.0 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 This adds the URI device path option for 'boot add' subcommand. User can add the URI load option for downloading ISO image file or EFI application through network. Currently HTTP is only supported. Signed-off-by: Masahisa Kojima Acked-by: Ilias Apalodimas Reviewed-by: Simon Glass --- cmd/efidebug.c | 51 ++++++++++++++++++++++++++++++++++++ include/net.h | 8 ++++++ net/wget.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 201531ac19..42b306e708 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -829,6 +830,53 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, argc -= 1; argv += 1; break; +#if (IS_ENABLED(CONFIG_EFI_HTTP_BOOT)) + case 'u': + { + char *pos; + int uridp_len; + struct efi_device_path_uri *uridp; + + if (argc < 3 || lo.label) { + r = CMD_RET_USAGE; + goto out; + } + + id = (int)hextoul(argv[1], &endp); + if (*endp != '\0' || id > 0xffff) + return CMD_RET_USAGE; + + label = efi_convert_string(argv[2]); + if (!label) + return CMD_RET_FAILURE; + + if (!wget_validate_uri(argv[3])) { + printf("ERROR: invalid URI\n"); + r = CMD_RET_FAILURE; + goto out; + } + + efi_create_indexed_name(var_name16, sizeof(var_name16), + "Boot", id); + lo.label = label; + + uridp_len = sizeof(struct efi_device_path) + strlen(argv[3]) + 1; + fp_size += uridp_len + sizeof(END); + fp_free = efi_alloc(fp_size); + uridp = (struct efi_device_path_uri *)fp_free; + uridp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; + uridp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_URI; + uridp->dp.length = uridp_len; + strcpy(uridp->uri, argv[3]); + pos = (char *)uridp + uridp_len; + memcpy(pos, &END, sizeof(END)); + file_path = (struct efi_device_path *)uridp; + argc -= 3; + argv += 3; + break; + } +#endif + default: r = CMD_RET_USAGE; goto out; @@ -1491,6 +1539,9 @@ U_BOOT_LONGHELP(efidebug, " -b|-B