From patchwork Thu Nov 2 06:44:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 740434 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp672822wrv; Wed, 1 Nov 2023 23:48:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNh/G4CBDSFy8EbDWoTWIxrrGSI4Znflv/CGKSV6fcRZWwYvcaIr4JlIL8Pttr21A7dlV2 X-Received: by 2002:adf:fb90:0:b0:32d:bc6e:7f0e with SMTP id a16-20020adffb90000000b0032dbc6e7f0emr13556850wrr.3.1698907718087; Wed, 01 Nov 2023 23:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698907718; cv=none; d=google.com; s=arc-20160816; b=oUqqji9RTTJaK0LKLrsaQWHQE4+OSuYOpT9Pd1WnTiiVKQIw208sQJMSvrBcR80u4z SYAvrtP/L+z+3dXXrFroA/LJZVvJNdzGleVUCAMlSCzGXpKdd7mb9Vud1txvFOK/5ptJ ZQhC24r/BaNgsUIbBG9rGOftINBk/b66YmvKg5oBYN9heE5lnwyfpVBh5RijuyIGZRsH WuypaXxLds1dNHhc67Bg/ax6+wihjpAlfXAA5pA2cf78uOD/1+bcyyDzlQBPquR+KW3w Tpdn/erEkX81wI6JL/hJyDFGjSlH2OkkiLS+TmwgX7kjC8H/AP/6FCaxoZ4AfIp8+zq8 BBVw== 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=dscxJ256AkHeavCaHCd68+r4ZQTQoJ60Mt8bM6f9HvGxOgCT0RLXbt5hfjay4wSoft ylS2jyXTvTtCfKbIJYujPQxNuv7LY44jvA60bF6t9lnnaSKbreKY9MPw5CdIVnZ+W0w4 38nJFRDLYQaju4kbFgeVr0YWI86X7ps4CaTWFl/P9OF5Nlr6OTEZ3SDmb6gNab/0G0NR oMqvbgu4rmutK/i6XzciJ3kGUpuoRihfZylEKFixqCDmD2ird8NiwJpprtqp9FXUy+03 REjQdAEGKLehsxHTbQnfZjgS+8YAzL+QlEPMsUr2lXv0DS8ATmWWbXeO526tCgDHeTBa ptbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CJ2Ferjw; 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 u8-20020a5d5148000000b003231d835794si988268wrt.624.2023.11.01.23.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 23:48:38 -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=CJ2Ferjw; 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 D8F4B86E88; Thu, 2 Nov 2023 07:46:49 +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="CJ2Ferjw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3BA3876FC; Thu, 2 Nov 2023 07:46:48 +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-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (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 54D6D8770D for ; Thu, 2 Nov 2023 07:46:46 +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-oi1-x229.google.com with SMTP id 5614622812f47-3add37de892so337618b6e.1 for ; Wed, 01 Nov 2023 23:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698907604; x=1699512404; 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=CJ2FerjwOd3eZi7TJNkogf35MD5KdL/YjkUNLLP14VhrwjQwrClL2+fhHJAAa3esIK J6jqF9Dv63r0LrjlodEhXfviffzPDpLO359SmQSwKRcOwP2VnxtGo7x8IUU7uxYi5QyJ Oh4FD26+iVBJT5Z6JCPzuIRuNxuCs10Sip6sweQBzZp8rKiP3IUKokPj2iBcLdjPMsrr 2Md21CX5w9HiycjhzSVTaUR3PZUUM5yEltUh0PXu9+PWp+A3RtdVNoI5vdz9vSnR/0cr qstSezulRTDn0mfV4n4IdU/hLMZ3yRVKW7CEHjRFt4iFc9q6El1zeSX8rf3P+xbbrXtC noHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698907604; x=1699512404; 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=j0YcYVo3AtQIISNIgOJagcfqJ79prY1Q+ssmu7NBBSkZiyYONZp9j++eW2s4VjcwYX Z1rd+WYxMn6PjJTBxyJAByCjYfvksjvPlktPQmCOq/cQv0keZfGOMk/zE5meVWm+JYtj 7rD7MbmxQub47EsNvwn7XC1s8aKxrGcAnRULZ62GW2wy3yFHkQ3Fs909KIOplUZMDK4Z GM47lAjifDKLYgNbH2WP5RetdHHs0xgpxVvdt9JByQr8zSAiojyQSu0+hgEv318Q3b8u Sj1AFpuNyVSfRYMOTeb0D/jxW1mKZOcG/iU33LOppo8j1W4AJmPXxCzd33e2X9CrtSQi ynng== X-Gm-Message-State: AOJu0YylBXA9Jf1kGfiJPUnKUeE5bXf8Q1I0fqJu+tilWTAosB9tKuF+ IU0rLWfVVx+2L1VjpHMb053Hbk/vnxVeKOn3UnU= X-Received: by 2002:a05:6808:14d1:b0:3ab:8956:ada4 with SMTP id f17-20020a05680814d100b003ab8956ada4mr19819338oiw.10.1698907604408; Wed, 01 Nov 2023 23:46:44 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id q17-20020a62ae11000000b006b4ca26f3c9sm2196052pff.74.2023.11.01.23.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 23:46:43 -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 v9 8/9] cmd: efidebug: add uri device path Date: Thu, 2 Nov 2023 15:44:58 +0900 Message-Id: <20231102064459.3466953-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102064459.3466953-1-masahisa.kojima@linaro.org> References: <20231102064459.3466953-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