From patchwork Fri Sep 15 10:16:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 723109 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp285896wro; Fri, 15 Sep 2023 03:18:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSJExaP8fJIZ9p0jtBSAZnUbdwafcqDVUF3RnoyT9VJe24e/X13qFuwTYvllCZyrsFRxT2 X-Received: by 2002:a5d:4b07:0:b0:31f:e89f:b3fe with SMTP id v7-20020a5d4b07000000b0031fe89fb3femr1053637wrq.1.1694773112809; Fri, 15 Sep 2023 03:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694773112; cv=none; d=google.com; s=arc-20160816; b=HDFfePbPr4SDLAeus1zOO5LKwU9+u30Bjm9L2ZspE4HFf2t6CqM1BCBwn/abv3Z5Xn gUbV1kOtf1Nvl7VghRgku9FXVS7oK9GHuDB0ZlFrqCOm6aO0MpGucbL8qaYX0B4AfNSx eviXXtj7J5DbFzA3lJK9BR8eWGUwbecnG0EouKl9ANwWzHbuN80V46ZY418yL6SvaPXn zOzZkiCyetmN/FNZe8Ar/ymj0lWfoHSasvlX7bUHWpeAxQHqy+I2lRY7J83c7fjxuxmz SKMLHQ/CKioUIQvMlTyGFesyTM/IRzJXQY34U2ew5yg3JyZSEn684FLJDDYq27bBlDoH N9zA== 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=2LWiqwehaOJfaSmRgwHlzxULDaEEZ5775jRQ1ZEyTgk=; fh=O5Tcc7OxYmMQkVi+jNNm3q1qDsnUZdKiJar3RqhYUSs=; b=RP9ARJ4bLrKBD18yH3p0Mmh+c22s0z+//kAHraja8Au+UnlNDbvitjImbNUuhwkEI9 sOfi5dKUGlF1S7eyyXBCLNESmHWgTzCejfxJtJx6pZihaqLl0nzJVwa7xRZFkYSvegRq vgNRu57V+EGC9OjQde/cQ0NpTipB0pZ+3ANol6heSc5rEE+3frtBjKXqS2G2AZBnoh0F 7F2L3g1G7Ml6NXVQiOsnQVsgD4xt9NL1+yKfstZd1oazvnjJ3sPMetGh0cmpJ8+Ge/+x SgRgyf9tnpZgsxbGEBCARZp7NevMwVaMPqd7ZnC6wxQ/nd1whawT794BU7tAkW3m9Q1t GmGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eNJP4UWF; 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 t5-20020a5d49c5000000b0031ff8c394f3si176659wrs.522.2023.09.15.03.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:18:32 -0700 (PDT) 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=eNJP4UWF; 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 53EF386900; Fri, 15 Sep 2023 12:18:08 +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="eNJP4UWF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 99DD586900; Fri, 15 Sep 2023 12:18:07 +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-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (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 73E9886906 for ; Fri, 15 Sep 2023 12:18:05 +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-oi1-x233.google.com with SMTP id 5614622812f47-3ab3aceaf2aso1168524b6e.2 for ; Fri, 15 Sep 2023 03:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694773083; x=1695377883; 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=2LWiqwehaOJfaSmRgwHlzxULDaEEZ5775jRQ1ZEyTgk=; b=eNJP4UWFg3MAd/bdMq19PDu5HrjTqepyaXI8JiCeesInuUrCHCqtpPvqM8axt1DASl IHyZP/2KK7LywvtS/qwXW6X192Tg/DHkBULXtqEM1tkr95WaMqikVvRCLoH6j7rqQ7LD ERwwUR9TkZpsywn9TsYBlM9HF3g01BLHWFLVoumGoGQz5LuBzHtTA63JKiztjPWMLTgO 0Fes0FIL1c36MSjfphWDaAE8VPgKXm+3rWanS1BH5s4xbDHmZUL94mK9f9kJQtrJzSFd E+ufZ3slxD0/DPfCO2ifKvMJke9zRF02cwmUZkf+wx/N8qQw4QcWpfS85gmANNuEUxWM nBFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694773083; x=1695377883; 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=2LWiqwehaOJfaSmRgwHlzxULDaEEZ5775jRQ1ZEyTgk=; b=BiM7aDteQRYYDDGMRQ1/VQtOWY9wKrKj6guCEwgOcISO/N2wGQh0+1gjxoywEftrV5 sdB28GqxDXQOSKfSAyBpWfkWt27oRY/lhTYTz+Kiug7Iv8lUVWkZ5WvXZ5E6VC3QuTDA Rh7RqghJ9I0sgLyLS5t7PuHbbDodft5OmzhXyZkj5rJM2+lGtSaa1bVjniSS7RcCZDVc Nk1VZvatqLfasNUhHg3SG6vYpoGY8bdRgxBu4NP28T5KwUEB3rQi6hcJQzy+xoyiyjRA Phzw95sBrJKpqqxBB7rqT77t0e5fluhKcTwDit8Nv8lO8BR8TMuHWa2PVFviWz/O0a/J /Ucw== X-Gm-Message-State: AOJu0Yz+eBZxUyK3XXM3n3tXQiS7f/QYYzwXQ08ahFF8c8K9qRlADzyg OpbQzHMSo8G/Tp9Cmk/HNrxa/kNxbO4DBclSyH0= X-Received: by 2002:a05:6808:242:b0:3a8:43c6:3cf with SMTP id m2-20020a056808024200b003a843c603cfmr1064408oie.57.1694773083579; Fri, 15 Sep 2023 03:18:03 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id i16-20020aa78b50000000b0068883728c16sm2782583pfd.144.2023.09.15.03.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:18:02 -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 v3 6/7] cmd: efidebug: add uri device path Date: Fri, 15 Sep 2023 19:16:39 +0900 Message-Id: <20230915101640.1166332-7-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915101640.1166332-1-masahisa.kojima@linaro.org> References: <20230915101640.1166332-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 | 1 + net/wget.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 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