From patchwork Mon Oct 16 06:45:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 734028 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1045:b0:32d:baff:b0ca with SMTP id c5csp70205wrx; Sun, 15 Oct 2023 23:48:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWiwVj0sB6pfmQ6ewXf2jmjZe9bhWl8x0psgRk7lsuzwSjfcU7sU+YaXcoFT0juT2C0IHB X-Received: by 2002:a5d:4bd0:0:b0:32c:f8cb:f908 with SMTP id l16-20020a5d4bd0000000b0032cf8cbf908mr13650016wrt.59.1697438926474; Sun, 15 Oct 2023 23:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697438926; cv=none; d=google.com; s=arc-20160816; b=A4+ZpLIxi5L+aMXOPJaiaWyzzCmUfxDCDAM1aURiy9JAXX9mA4fcj1iqYWbNp8Dq8Z 71RnTe2kvL+My67FgiCcQLXXq4zqo+I56s1CSUhjqoz0xvJ+nCX2TWpe9f8HcQX96GVF u5meWQwkaKV9nVg1DDPR3uZLhigA3b4btJFfQBcSUHarl41W7XBBIhO0DNovw3vpM8ZS 7nxtmPMw8XBE9UA0M84zugxfD8GeRuP+AYujKmjmFVpH3YYW/QUckpXLyz7cqm20hR4e L9kR3ljc+zTyxcj3NhwPsdcKACB/Q4toXKIBlw8vzJq3Ow7PXi7JShpBNrTUDbMrhX9q TDHg== 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=Ix7OkLuT2UMlsZ+CYDlpWbnES/L/lF+FUZtbgDuoIRo=; fh=UwEaQaZSKscgV8VKorL4WxKMlykH7WzwOcMeBrHkxSs=; b=Ikv98LRO57+4GHfoyhxpJF70KLe7lLX7dQLvzIA+zV+c+5uqWHkZv+Ait4bAnMtPqM LJqzS4uWph5E4AZt8hh7v6j6KUxTyC638NnQmwY3ood5Mh77lWBSNOgN5XiND6OrksEK RtecgRXp4nacuqXFCwbPP/UXFsgYfgpIMXV8sqI4YFScUIosCvFENEbhzQTFXVmZyHrF gl8kv50a3xeAWxOw16ApDle5hcogPgEgsnXrwjfx5MppqRhNf2gGoJXuOVf0MMZAw2Zy kd0VZRsMjG7OkORf01iFCQjar0ZzyN3s8ziSP4iLcvMtTxWQ3HETsKUTL1QFzNSYfd2O do0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZTzy6iDY; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id i15-20020adff30f000000b0032488913d60si2421623wro.405.2023.10.15.23.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 23:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZTzy6iDY; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 BA38C86EDB; Mon, 16 Oct 2023 08:47:30 +0200 (CEST) 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="ZTzy6iDY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD07486B79; Mon, 16 Oct 2023 08:47:27 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc36.google.com (mail-oo1-xc36.google.com [IPv6:2607:f8b0:4864:20::c36]) (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 6D1398477A for ; Mon, 16 Oct 2023 08:47:14 +0200 (CEST) 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-oo1-xc36.google.com with SMTP id 006d021491bc7-57bca5b9b0aso2229492eaf.3 for ; Sun, 15 Oct 2023 23:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697438832; x=1698043632; 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=Ix7OkLuT2UMlsZ+CYDlpWbnES/L/lF+FUZtbgDuoIRo=; b=ZTzy6iDYOui4sEWY6hpRWhQzatIPAN3YiQYImg+zwsiFAPqyAcGinQpoTINNgVRtFR y6sL2FZfa1NXf0kjaw3NlinFcXYx6LwBLB0SrorBFl5Qq+AUPwGwsBalPzXj+7lFrb3l KYH+AtF2JElIS5bfgQQWilAL9YBL05EBPAcjNGHdnB7ktmZqYObiSVLnwGHU7rimAuF6 P/zb5ROjJcr4uUbZFK5A3jzadzjE09N0bFK+Xw74iJI7EasWnXj5q+g4/nswxneIJ0WI JUM2haKM0temvPh6iyVOyD2vbHBbLftaicN7FZUcLW1lmoaaAV7k3Alj45lNA13nqoz4 Pqag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697438832; x=1698043632; 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=Ix7OkLuT2UMlsZ+CYDlpWbnES/L/lF+FUZtbgDuoIRo=; b=wTfn/RcX/Mb9c92JKZGCICSug5hsi6nNbez7PXn7qoChTAa0Ec3RKvYM4Fo9sROnfN 95raTAgu7fsWR5Mull2XBdbsgCxqta+2lI3sxV956Zi+iEZr+ztA/ZbtghQbsNvSEWPo fv1uQ5Se3NcJZDE1IOeVXrvLed62ojbimPs/SEiN1UP+XnjZCF6fDjlJiFbuDZf8zSEH sDPvrWVeVf0WwmYAjykgrkYJcfsCt0/r+sH9KecAa2o9SzGpK5Q253+SHhFTel/DaVkt MqIn+i5/bNo+3jLj1j0KuEnQg2VFahwht+NnXSV4meDELmEorKZDl8V8EvuuLk5Wis24 Wh8Q== X-Gm-Message-State: AOJu0YyJxpCzhnxR8Ws+ymyTp85UdPf28uguc+M/FScn0uBJA1xo8XBr jUqLMGaf3rM5/Q0hlCg2p7cJt5KVcLEaf92xWVE= X-Received: by 2002:a05:6358:2820:b0:13a:a85b:a4ce with SMTP id k32-20020a056358282000b0013aa85ba4cemr34758613rwb.16.1697438832532; Sun, 15 Oct 2023 23:47:12 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id b12-20020aa7950c000000b006bd26bdc909sm2417569pfp.72.2023.10.15.23.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 23:47:11 -0700 (PDT) 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 v7 8/9] cmd: efidebug: add uri device path Date: Mon, 16 Oct 2023 15:45:25 +0900 Message-Id: <20231016064526.2410856-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016064526.2410856-1-masahisa.kojima@linaro.org> References: <20231016064526.2410856-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 --- cmd/efidebug.c | 50 +++++++++++++++++++++++++++++++++++ include/net.h | 8 ++++++ net/wget.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 0be3af3e76..5f392d2ffd 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -829,6 +830,52 @@ 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; + + efi_create_indexed_name(var_name16, sizeof(var_name16), + "Boot", id); + + label = efi_convert_string(argv[2]); + if (!label) + return CMD_RET_FAILURE; + lo.label = label; + + uridp_len = sizeof(struct efi_device_path) + strlen(argv[3]) + 1; + fp_free = efi_alloc(uridp_len + sizeof(END)); + 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; + if (!wget_validate_uri(argv[3])) { + printf("ERROR: invalid URI\n"); + r = CMD_RET_FAILURE; + goto out; + } + + strcpy(uridp->uri, argv[3]); + pos = (char *)uridp + uridp_len; + memcpy(pos, &END, sizeof(END)); + fp_size += uridp_len + sizeof(END); + file_path = (struct efi_device_path *)uridp; + argc -= 3; + argv += 3; + break; + } +#endif + default: r = CMD_RET_USAGE; goto out; @@ -1492,6 +1539,9 @@ static char efidebug_help_text[] = " -b|-B