From patchwork Fri Sep 1 10:25:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 719515 Delivered-To: patch@linaro.org Received: by 2002:adf:d08b:0:b0:31d:da82:a3b4 with SMTP id y11csp158925wrh; Fri, 1 Sep 2023 03:27:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEen4tQFJnQoSia1Z6zmTh5wqVHc/zj1aiyraknr9SD5G/Si2fw2hvT0zuThYtLcBBwSUa4 X-Received: by 2002:a5d:500a:0:b0:315:a32d:311f with SMTP id e10-20020a5d500a000000b00315a32d311fmr1523581wrt.14.1693564041184; Fri, 01 Sep 2023 03:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693564041; cv=none; d=google.com; s=arc-20160816; b=k6yj5TbJHW+zldSVy3YUFF1YGPSDJDWqA3SZWD8n1sTDx86fwNeirVvbBDmYDo8hCT 3Glw6RG+hiBXZmj/tqrjNHgsIO0Jfqhgaz1LaiyTHE8ChKCbeNB1xcyx7nHl/p7EZTE6 x05tfxTdVSlm6dxsSv+oHu33gbTqOzG28DHCbWTAaMSX+CKQUEvJskIfkudbkbIOo0Xm Id/847deEPekGP+hOf/d2flbwspWKvG1mjLGAZevr3O35OuDVZS1RN/cladlFTL+K+QP oWbUrW4nqKpLGLFqXDCIQJHTGUBgyi0/zYN4zf1tDZQWsRjk1oYMaDfZc+MllV2AMsxe 6euw== 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=+lvF6Z97KxKbq3h008c7NhdQLnxb3iYbPzFOWKZw1+w=; fh=O5Tcc7OxYmMQkVi+jNNm3q1qDsnUZdKiJar3RqhYUSs=; b=nHI0M5iprt5JDzJZHvWMzK9eBng7GFHdbnWLzlv/sstO+6h4NVk6XzE95el5lMmGSC 5ldNt9rVF5dRTsKP4JxOMauzXDawUWPuqZRVIYkgu+L8kTeDbf/aRX+LwQNhBhN2GC+q fhrorhkxYvTpWAHSHRGq20oYejPvMTjmIP/uAZVoZVL99zF6AtAHLKC/92vf0xeJxM0P d15tJeaWynEIZe8uGr6s0cwotNXwUU3F0iEV1vkD5kLtjq9rKrEeu7HO69dMa1YL7aAU 4f0RPJRJl5pq3QrL3dY/nrAQiaMd+TGO1YClixZSL3bP4ijfoQ5w7sImDZ9kzy5djcFj HqYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qhn+ll5l; 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 f15-20020adff44f000000b003141b531e4fsi1602376wrp.900.2023.09.01.03.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 03:27:21 -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=Qhn+ll5l; 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 CCD1286908; Fri, 1 Sep 2023 12:26:54 +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="Qhn+ll5l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E31E186925; Fri, 1 Sep 2023 12:26:53 +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-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (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 DA3D1857BF for ; Fri, 1 Sep 2023 12:26:50 +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-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-26f7f71b9a7so1281055a91.0 for ; Fri, 01 Sep 2023 03:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693564009; x=1694168809; 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=+lvF6Z97KxKbq3h008c7NhdQLnxb3iYbPzFOWKZw1+w=; b=Qhn+ll5ln5U4FFylVW+USeTVBAoDM7NNX67fUeLqkrkTyDFSa/QJBqcp+8RDdE10pv CNcp/fK4DswVaXbwQtFomjSViQdNCnISqTXKjAkALY60Vk8t8P4U9Awn9HCV0YB8JZ7s uom/Brm1gViWKsIE+ePSHkZwtf9GjwDdEWAY3yz4IxspWzV8ACi0/PBrc0vHMF9T9zOd hT0runMKabzQoXwiLe7mw2E6gZToPabJKjLY1nS8Zv3IaZNNmCxscXIHVXyJjus0cRf3 3RLkGMXrm24PDySe2nT0Q6RLQotlbe7GLWQkx81fiiWaVkWKBdlwsU4e3Qea91lvAJB0 PquQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693564009; x=1694168809; 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=+lvF6Z97KxKbq3h008c7NhdQLnxb3iYbPzFOWKZw1+w=; b=AjKwD32rA7dD+LbKMRgMIZEt0wFmK9TvvwW3amGIlI5M5tp3Kfa+3hqpFjiOxdkIpt /QvthmvEOlEMmkcvQNrGdXV06Ba5JrT2WEooee9wnWl3zv6NXZalOdxWdJOkqd66VvMV KSHWlpra7KjOOnxH6UNwZN6GWnT2aCXdA2eTC/dUwUVWvzcVSGxfJlYScxFMxkn9zRA7 ZfnrzKyXIykQrUlqLPH8H/jjY/aOduNEG86PD7fO83yrucPiAbKvyGJbQxPJE7eKYa5c EeFdthebPRgUXabiggO8/e5cePZyrPz7Scgkeux8/sXVcMex1R+Jd0bfGFtqxfepNrpZ rE1w== X-Gm-Message-State: AOJu0YwagMnu6dXfojSvO3xchsAJoonGV/6yvD4tcSXp5LApCdQ/g54M TvBTITto3r58uwZ6clVjrljoVXJWo575jbxCDqo= X-Received: by 2002:a17:90a:bb96:b0:26d:291b:cfc7 with SMTP id v22-20020a17090abb9600b0026d291bcfc7mr1893400pjr.45.1693564008816; Fri, 01 Sep 2023 03:26:48 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a190900b0026b6b17ca5dsm2917358pjg.54.2023.09.01.03.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 03:26:48 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Masahisa Kojima , Joe Hershberger , Ramon Fried Subject: [PATCH v2 5/6] cmd: efidebug: add uri device path Date: Fri, 1 Sep 2023 19:25:41 +0900 Message-Id: <20230901102542.609239-6-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901102542.609239-1-masahisa.kojima@linaro.org> References: <20230901102542.609239-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 | 4 +++ net/wget.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 0be3af3e76..f2fd6ba71d 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_BLKMAP) && IS_ENABLED(CONFIG_CMD_WGET) && IS_ENABLED(CONFIG_CMD_DNS)) + 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