From patchwork Mon Nov 6 11:39:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 741378 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1036408wrr; Mon, 6 Nov 2023 03:42:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbcSwsgS9H3GcUizN99ru16yowYyjiurJf7QQJGHpHiz/tXXx5qvAKCkQYObPpsXusd9sf X-Received: by 2002:a17:906:794d:b0:9b2:b2ad:2a76 with SMTP id l13-20020a170906794d00b009b2b2ad2a76mr12498303ejo.16.1699270967633; Mon, 06 Nov 2023 03:42:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699270967; cv=none; d=google.com; s=arc-20160816; b=Hm+sn3A8/pvSPRhRhVLlEcjt5Dgc8C7P4hlt3ByALBt4soV8qHUUH6OR78xcVqMTkH bNEoxpL9kb8KNIAEaKaq3o4p5iTWAbM1JUzZcZNlX2YMi0bjTyFOEcrkjOYUvkz53Ikq 4p0PtKuaxzT/WXwQ7NTAJ94DXYYvgsTSiZEvyRfTmW0Xh3OHA6ek0ZpiCbrbXYG5SKQA xj3mRtqPKkQ7S/cTfNVHkvhV25sSW+hzDIjNp5WJEmqgsRmyQPyxXyhMkzVsLxrQpPkq 9MgqUhe6Hf2ZeQL3m+XP6llx20FqkbXKJPyBr705a6l6z+/03fZ53UEn6M/Hj7yvWpq7 YWQg== 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=NRTsxwjx6uyxrzBkByQmAcAmnN6eXCzsBhcbAfmc9rakYdbEpXyjPnV/tPU4BQgkAy ldqzLhZbMsDpwCPLuwsk5Fw14fO+AfGsoLREWCYjKF/wJnjYN+eY4dm1aTKetOWdl2Sj EjUoNJ01CkOuT5AC6JaxHbeGfNrmjcBNJk3iJzx+mEuolMS7XdIwCfUfXnprIeLUhPLQ erIGy5Bpb7gfAaW2BaBgWwEtNPrJbFdH49tRok1a7Jlo+foDSak8L2UZVeA1bv72by2U AGOxJojCGwwEbOebqayjuBq57MIdmI1/H1lYzadJcvaI8vVlJqEefqO0xYH8AK9z6yzK wyUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gbN6LObX; 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 i13-20020a1709064fcd00b009ad87fd04dasi4197708ejw.105.2023.11.06.03.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 03:42:47 -0800 (PST) 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=gbN6LObX; 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 B786087061; Mon, 6 Nov 2023 12:41:30 +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="gbN6LObX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F17068702F; Mon, 6 Nov 2023 12:41: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-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (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 8E78886E40 for ; Mon, 6 Nov 2023 12:40:58 +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-pg1-x529.google.com with SMTP id 41be03b00d2f7-5aa7172bafdso2769231a12.1 for ; Mon, 06 Nov 2023 03:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699270856; x=1699875656; 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=gbN6LObXXHttAbZ4c6o1uBUasAD5mcTw4DnqJWSjKB+oY8wx5IZSAk2/gHHMYq4knG MrXMcVe07TXyiQ+ZGl7vzOWcPfaQ1/cLYwhFxqijXX4AuK1Q3muTuSWqsh0q3zfUEov+ OSpha8+/YQyq2u744OQUYvERdJ9Zvm4gwRkkbWXhWhpd4KPDrLUI90gC733yWMPsnKoW ZXVWPqsOqxFRutUr9Qs0bCsW4BlP0ebrHFL13myOza8T+e3/rOs8IiDbQ+4AKOiSv/oG 2Pn/9/vcY/pO5f+fwc/we3wT9b9ZbbEaKFClOnJKO3FeqpedFvBtu/hg0gCT+NAsmKhw gbQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699270856; x=1699875656; 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=ZgRAFNKzIzlCmysQp5DIe9tlJpKgTzZg8mpzsEcv3gw9bn7Sih1F7I92yc8aKttcff NL0ef2F/FKM13LI/UwJMYuIHqyq1AhiP19/pygwGpKM6ajB+ZWsnPMo0/9ONuaEWhkAG me/Mc0YOhSsLczhMQx+i/GpXjttmzHN15wuatwec3n3OdMGBj+wEvZEGthNA0sG7dnoq fx/2vMpocapK5TpqqAb3zPX47sJ+/c2U71BmsNn9wyUJhQw1fU+MTIUm3T0sWGacorRi 61nj4r0d06+Ls74DIR9iqJZh2jPm7a0T5ULR5H1CvecWSphbCOJfgZZxqaa0RiU66qBp sUTA== X-Gm-Message-State: AOJu0YxUP0i2HtfxINcF5B8eo0SqudycuglS17GrbCyvQCJ9Exbs8o1m rA+ZvY+DgOEqasiSV8ywPqOKRhyNC3cRcnE19Rw= X-Received: by 2002:a05:6a21:7802:b0:181:44c:d59 with SMTP id be2-20020a056a21780200b00181044c0d59mr15855508pzc.31.1699270856197; Mon, 06 Nov 2023 03:40:56 -0800 (PST) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id jw5-20020a170903278500b001bbb7af4963sm5736137plb.68.2023.11.06.03.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 03:40:55 -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: [RESEND PATCH v10 8/9] cmd: efidebug: add uri device path Date: Mon, 6 Nov 2023 20:39:19 +0900 Message-Id: <20231106113920.3631591-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106113920.3631591-1-masahisa.kojima@linaro.org> References: <20231106113920.3631591-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 --- 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