From patchwork Wed Oct 25 06:28:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 737810 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp131563wrq; Tue, 24 Oct 2023 23:31:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8fA9PhNQ0VhanTM10M9KwOC4wIhqPgtThedYcUpxI+7GHF3+5o1oQYddimyPXX1P9Q9Px X-Received: by 2002:adf:fa4f:0:b0:319:67ac:4191 with SMTP id y15-20020adffa4f000000b0031967ac4191mr10872135wrr.37.1698215511652; Tue, 24 Oct 2023 23:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698215511; cv=none; d=google.com; s=arc-20160816; b=hnxRNE4Qu1lBDWwjLw5Rq7pzbGFXrIIT9kuA5Ui+nbS6HjTLnZW8Oi5bTOpwPhXqnt hJW/rZt/cm4XIwKRmrOu+WAOQbYThdE81sZbvXNapxusVe4ApXJ4aZ4Sm/CtmTj0zMc6 ON+KjGKJWaEwvk9LzJPTMLUxH0tBouE6BNgOQ/ZYyhiwdE860pN2N3K7Ui/jaPxcOOLJ BR5JqDD+nCbt0z71TyY3iGoar4gaNuS86NFzDT8fvEMx7KNbRKFHpO93DL4w8p5ECeG7 fVoIdmW049lSQByxBa+kGhefsBXleSFok/XfaAt/IeBUfuhv4+M98UTLUSi3cfNJ1cvM d1tw== 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=v5TVLbar7J9pOoah1wLfcnqqWHtmagxHEMGlbcOsaKE=; fh=UwEaQaZSKscgV8VKorL4WxKMlykH7WzwOcMeBrHkxSs=; b=XX5yxnh+O0TyXcF70ukUWi7+TOh5ot6IQpi7IilA3wgyyQ8KaSBmAOz+S2COVDVLkt sWasyLaYzETeK0q8bnspO4hwMmPhUTxE5Q51uXoAPzXXx6fvDVK6ofvfpvgtDnhQxs4+ kGiatwXFh+ki8VkAJ6xjCdIEeQw/O9WO7ZfNDTGBzTJ5H1h+dYrerHHEWnLaPtrTF3/H gAEFCgc+zFNLiFGAY/q86pSHHti13+UB0HMLYhB60e1nYZ/McmwcCCC/h6UAzjFWGNuG bo3ricAXZNecdS/wCPNW+2YacB6tXEus50XhLC3BRwH8TEJxhFnvzKKceZ7SuKGGTL5o kFvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FZa2zhrW; 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 v4-20020a5d4b04000000b0032d9d0205d3si6959272wrq.579.2023.10.24.23.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:31:51 -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=FZa2zhrW; 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 412CB87A67; Wed, 25 Oct 2023 08:30:41 +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="FZa2zhrW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E88D87A60; Wed, 25 Oct 2023 08:30:39 +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-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 18C6587A58 for ; Wed, 25 Oct 2023 08:30:32 +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-pl1-x62a.google.com with SMTP id d9443c01a7336-1c9d922c039so44948355ad.3 for ; Tue, 24 Oct 2023 23:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698215429; x=1698820229; 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=v5TVLbar7J9pOoah1wLfcnqqWHtmagxHEMGlbcOsaKE=; b=FZa2zhrWxD7iaNfx+KnpN6UarsvlE/Z0RcZaR3HnA6YKvVPUEzZndTIWP5DrKdyYWY dw7Uw8rZtNcr1CqGsunlvF6IeiHbr0RVLVYlZXNOQNzDrZJTdPFfrNHTp4fiZ/vggOt9 3ASiUgu2Pez2xkGgzi2n86ICGFNGfnSb0fr0CdRVeJNjv8T0mDLvZq332+BUNCjqt/FH OJe/E7pe6Llt5heXQwveqsPvdZbZWdcQEoU/4zgEgROvAIODAH4aqjYzOYlcKUtQ9zHN eEimrQIXoA/j7mfjuptsEUU7c9ruwB2e2cHP2hE4FGe58rl2xnuYgspqRVMIyYHobTSD +kGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698215429; x=1698820229; 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=v5TVLbar7J9pOoah1wLfcnqqWHtmagxHEMGlbcOsaKE=; b=LIVmkuE4Osy0q1hpLLAKYcV0Zi+gA2yb9dwZ7vVPaOPD4mPWiAQtzgGku0AxF4Zjsk XQilhjkaLFFjAXOYkgZPLgn9HT+2laoU6utOndvmxmcuLLP+IP5+q1Pss3XIEkgLisLG SNsFygMyADPR28Q2UuZPoAu8C4zbOV1K2/HjpboeeEyUdLQ40vtIF4hKsVrCffNAmquA zPoGDwiXRJLJU2QeWLsY3tg3OG/HcAcV65ceXYSThX4AdAgwx/tI6huCy2vcXUsBcrmm IczKvjRaneWSYbgDZqaxb1Zy6G6wauM/rHtK5J2+mKP96wTNSzHn6/t/z+C3L6N6E0+A tnvQ== X-Gm-Message-State: AOJu0YzyZRGoNRmWydr0G23DJTdYBXRnl3xXjGG0ZtvF5LvF4T+xMfVy jRh8RpbpJbd/qWzRE+EbQbJjF5H+YdstWbXeZF8= X-Received: by 2002:a17:902:d34b:b0:1ca:7ec3:f4f9 with SMTP id l11-20020a170902d34b00b001ca7ec3f4f9mr16977044plk.32.1698215429699; Tue, 24 Oct 2023 23:30:29 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id x14-20020a170902ec8e00b001c62d63b817sm8467816plg.179.2023.10.24.23.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:30:29 -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 v8 6/7] cmd: efidebug: add uri device path Date: Wed, 25 Oct 2023 15:28:44 +0900 Message-Id: <20231025062845.3100964-7-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025062845.3100964-1-masahisa.kojima@linaro.org> References: <20231025062845.3100964-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