From patchwork Sun Oct 15 23:49:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 733898 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp2466698wrv; Sun, 15 Oct 2023 16:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzWJw/iX26xK9NJBi9BwVgNhoeGrRwUN65M9GhIIUVfvUYtwRXeiPViqPkZjCeHbp62NNN X-Received: by 2002:adf:e744:0:b0:32d:9541:b1e3 with SMTP id c4-20020adfe744000000b0032d9541b1e3mr7697283wrn.26.1697414198853; Sun, 15 Oct 2023 16:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697414198; cv=none; d=google.com; s=arc-20160816; b=IbRS7TgfKlxAbd0fGTa1YserXFQQYtBt38EaXFuuK0BCVqXC8TRg48u2x2y3pP1Y1k wXBAYjASECrQBY43k8C9hzeG8BgQLlLw6ds0CrEcfEaG2VmaTPFBTmBq2qL0dLWcq6Mz +vZDpI54dPGH29wdiwJUTf+ITZOqXGo+bGcFEUu3nGDW2bun5xL3/quGuds+847SmTjT QxF0gP26T5q6wOHzHtxHTz+pIf4ne4fKohBovyxeB6P/YsW7/hAm8la6RWlAuaqGJ9ur CXcSMulQVgZC7k+t2C+rNsGQAkpAU12zZdOVhI8gIuksyn5QCxGP4UNfG8SuHkiYZT9S Qt7A== 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=Ix7OkLuT2UMlsZ+CYDlpWbnES/L/lF+FUZtbgDuoIRo=; fh=UwEaQaZSKscgV8VKorL4WxKMlykH7WzwOcMeBrHkxSs=; b=x3xTSfIxyewXlWhVgfMGGwQODoyEg0NJYkCNytUquyMzJIWyHe40H1IJ0cpxKCKYBR cBr/AXr/1OpWMULORV+2CbIfu+/U5WUmAtKtgVRGa0lGJdlqHfHHSVzK2CX8KntdnKeG 82Nd4WuLCKLL69ftyzo3zedT8lrrV5/yq7hvxGAUA9ccvtQRzvffnA+xlxn+/+VE014K RrbnKFerKzPsIbNPQq59+BmgyoYHoEMO6TbKtAnj2d7+4pZrH+GczXzWHsRjNAockG11 Ii4oYZ8Pa1GvLuY6h7/YUbzyTWsBDAtRf+IxYHwNu2Iw4Tbjug65vM8X5Wt0LCYa33dm qo2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PhvjuYgJ; 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 a9-20020a5d4569000000b0032d4835245asi5657443wrc.940.2023.10.15.16.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 16:56: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=PhvjuYgJ; 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 4E78D86DE8; Mon, 16 Oct 2023 01:53:06 +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="PhvjuYgJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9C9E6867F6; Mon, 16 Oct 2023 01:51:30 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (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 CE80086AE9 for ; Mon, 16 Oct 2023 01:51:15 +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-x62d.google.com with SMTP id d9443c01a7336-1c88b467ef8so26463245ad.0 for ; Sun, 15 Oct 2023 16:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697413859; x=1698018659; 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=Ix7OkLuT2UMlsZ+CYDlpWbnES/L/lF+FUZtbgDuoIRo=; b=PhvjuYgJLU2ytdZOqlM+5TCppOA3hSTebD0bpENYOEjAcOIgJiQEhtv8aXsnrIaKIh 5UOYsvu77ir3mLWdZmFq5cXGqsrL+QRPS01cM3XRdgbSVgdb53iEWyVSY7OQmHydzqf/ lhyBQOgNkta6EFmaVIwfRFH8D+TVCjcwJoV8ThUOM46lBs6VV9sRVLUZ24jwhpnQk/D+ iqlo5TPzuelTfuTdGEo1x60ytNX/f7d4ItrtZp3JG2bOIqWpKQrOCcjuuX2tPr3NUG3f uBavR5b2l6mbFsyt4+Qp2P85/KkZGMLIhdC5v9I80nKTCOyHcA1ihm6Pm+JgJeOAVLpn uTeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697413859; x=1698018659; 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=Ix7OkLuT2UMlsZ+CYDlpWbnES/L/lF+FUZtbgDuoIRo=; b=FivuVcnBC/wvVIUHdJkfeAFR+VLO4aM4vofYMTj2380vbWCoLHCGNtTF7VbIY3yjJn oAMzTLxuynrX9f4xc7tcAG6aHNHP+qLXzG2Y+aL6IOzBDI5FzxYLPcuY9ax03c/darji Dsk5YNzZy32x0aBAk5pjf03/KjWJiWBt8/8Zj2uPiwOJBdTjoR1sP7NLIegGOaMy+pvi LNumXfYxX3A9QbjbtfU8tDTdpHv0p98J1OuYqD+yeN879oinbCJf3fewH4xc0+VeWvqP znD2U4oPzDkhDAyVfzsizpncLdV/vWbC0TZ9XLmP1CrqHyI7q3wTTRzW7Cow5zmnkxkU kO7Q== X-Gm-Message-State: AOJu0Yy+lrgDsC8EdHWFIG2KjrhEGbSfy5MtHC1z0kRz03XdzITIisIV 9ef4rlYjtI92plv1+v9Y+tKaIBKNS68P7abeFn0= X-Received: by 2002:a17:903:cb:b0:1ca:7dcf:a74 with SMTP id x11-20020a17090300cb00b001ca7dcf0a74mr836146plc.22.1697413859187; Sun, 15 Oct 2023 16:50:59 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id i18-20020a170902eb5200b001bdeedd8579sm7206879pli.252.2023.10.15.16.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 16:50:58 -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 v6 8/9] cmd: efidebug: add uri device path Date: Mon, 16 Oct 2023 08:49:06 +0900 Message-Id: <20231015234907.2362717-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231015234907.2362717-1-masahisa.kojima@linaro.org> References: <20231015234907.2362717-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 | 8 ++++++ net/wget.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 0be3af3e76..5f392d2ffd 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_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; + + 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