From patchwork Wed Sep 27 09:36:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 726696 Delivered-To: patch@linaro.org Received: by 2002:adf:ea87:0:b0:31d:da82:a3b4 with SMTP id s7csp3430783wrm; Wed, 27 Sep 2023 02:38:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbVPxuCKPOyOET9xJNqYmsZZBi056Eg//3k55nbN6x469QxUXC3qwiCGRqo+KdbaAggf/A X-Received: by 2002:a5d:5944:0:b0:321:c888:1de7 with SMTP id e4-20020a5d5944000000b00321c8881de7mr1201498wri.54.1695807502558; Wed, 27 Sep 2023 02:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695807502; cv=none; d=google.com; s=arc-20160816; b=NbJszhO8vADvDtmZfPP1btC+8EFgYflZ3rFPomdXxE19gMCVXkELAbZVYyIQp4m40R qqAW2Fu4/TwOActNWAgr0u9aUniO6XPFv7yzODeVOwvOmje9wC2ttsIh7BZLSWnu2+EQ mk/IgHdITJ1cd3/a2wq/PSfrYioRHt19azavKsFrHuWRoB0WRFSk8y4OajVWkcecSKvI kTUbwXQEgkRTXFp4VNnr9tCxccf4eBnV52WeILxY1HtetGJ5WqrS53ekw4hVR/dSf1KZ WUXieOjcyuL3gvyaaPrlEPMHYYW4nr1VQtIRnti9GrnTtptHi8kvLyF5PuHc16rP0DRE C7Zw== 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=oaMDGqRnc0d/jvmwKTYWFSifA73Ii6B1GLrcLxcteYI=; fh=O5Tcc7OxYmMQkVi+jNNm3q1qDsnUZdKiJar3RqhYUSs=; b=v+BOKiGoPXOtCrjERfj47tcrGaAB+dBujRsgnbZvPCPo41fP9B6ZuWhKvV7OrwJV91 d3zNAPTpNVRWc1U6L3ChavLwyx8o6LA2DEA694Vczd+Z5+RCYZyDJX0TQdnD5Ru1rvf3 FhbydgE2OYO8VyPDnKjeru+amEBxc5ZUQaSNbEcbUVNcUuo3onB+QZjNcHIdbKIuc9Kg x66++JIqisds6vYXJGAJ0m+BJ8tOeGTm5cnaJmphf8Sq5RIJDOrKu/JGrOCJekIn6Te3 LI6aGSi0a3nA2BPc1b0ZPPcQsfXTk8H1ueWaYeKwv9mbgpcc2oQ/RoVrOxsTk6/fpi8H asvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hwhtFUgY; 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 o16-20020a5d4a90000000b0031c65922bf7si7672819wrq.920.2023.09.27.02.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 02:38:22 -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=hwhtFUgY; 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 3D28386DBC; Wed, 27 Sep 2023 11:37:56 +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="hwhtFUgY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D21286DC5; Wed, 27 Sep 2023 11:37:54 +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-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) (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 F129A86DC1 for ; Wed, 27 Sep 2023 11:37:51 +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-pf1-x42a.google.com with SMTP id d2e1a72fcca58-690bf8fdd1aso8455688b3a.2 for ; Wed, 27 Sep 2023 02:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695807470; x=1696412270; 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=oaMDGqRnc0d/jvmwKTYWFSifA73Ii6B1GLrcLxcteYI=; b=hwhtFUgY4+7K5wDQgIORKkhKWN8wj3zfQY5Uy8BSa8+g7Bw9VgDzCkSJGNUsJAaAsq rj1e0/FwzG1E5SCZXe07y2LpP457d0pyaXG9wUNPy1bYoYJ1cpTpm5JVsYw0HJ+augGR tzABRC0+Zw+6rxE5o2R7h7qk6HQjesejbwG0eARjaq10swY5VYZYuFoeuxbVMe2J8B6B H1WoDpDtbhfUuvAB+7eXlX+472D8QrjJGfV1m0qTdq5hJq7dso4tMnP20BU7PTlDQQ6k U5kCmYFljQkBEdjVZic6nRnQkRdGpUAwvBxzrCLeNJfDieEg4OfGFqxAgXjdOgKeZwwC xnig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695807470; x=1696412270; 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=oaMDGqRnc0d/jvmwKTYWFSifA73Ii6B1GLrcLxcteYI=; b=F1VqEuNo/r1WvewQhBq88WVUELhMJsgrB0ArayhtgTKfWzTIddg2A8dU5NTLHr9F7D ZK34QX5jg0qlxlxk0F9vpBzOsbJIOr5AUxQqk+9ODDaFptI9gT9c0hPBW6+NJv/FUaWc XJoAiGEpGZnwSw2qHGo8Z94F5NNeaNHPoMCX4Yc62xFjmPTbjafNRZtI5LxQclNN2gZl Oyuf/kqiVN2ixV4p9pwIDnaEvRmLDZ8CMJdW0HwEvRsqVaNxxiAxH5pb97GvFLkT3uzo pPR6vF1B9hkINmnGpG/l1nhV7C6++jelCur3Zl8NQB1Ql+CvqZNfDDBrSSSTaxRtZPo5 BU8w== X-Gm-Message-State: AOJu0YznTSma7dC7DuIDm+8glKJnIkSpb9e19jW+LSrOF2gsaR+K1EGj 69sD98NQhupbOCQOxww9JrzhspnVo+TWbv3pqHE= X-Received: by 2002:a05:6a00:2e86:b0:68b:e29c:b61 with SMTP id fd6-20020a056a002e8600b0068be29c0b61mr1520886pfb.19.1695807469955; Wed, 27 Sep 2023 02:37:49 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id x18-20020a62fb12000000b0068fe6ad4e18sm11396151pfm.157.2023.09.27.02.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 02:37:49 -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 v5 5/7] cmd: efidebug: add uri device path Date: Wed, 27 Sep 2023 18:36:29 +0900 Message-Id: <20230927093631.1595494-6-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230927093631.1595494-1-masahisa.kojima@linaro.org> References: <20230927093631.1595494-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 | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 130 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