From patchwork Fri Sep 22 07:11:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 725221 Delivered-To: patch@linaro.org Received: by 2002:adf:ea87:0:b0:31d:da82:a3b4 with SMTP id s7csp876132wrm; Fri, 22 Sep 2023 00:12:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElSQWukMCD1ZvZIpoHx2QmUd3oz7WB3+6BHlCKyRhkqh6BhBn9cZByinjTAf8P6n02PM6w X-Received: by 2002:a5d:604a:0:b0:31f:ebb5:cd51 with SMTP id j10-20020a5d604a000000b0031febb5cd51mr1215817wrt.33.1695366778346; Fri, 22 Sep 2023 00:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695366778; cv=none; d=google.com; s=arc-20160816; b=jyDtD236ilzOuJ5fBBBLsIFaZEUczaaTnKBZPVXCb5VxpeeGNlTMl4nVf3aGaihF3f ZfgFkVCjvVyccvxAISWf2EbAJ4ZScfIcQmWP0Dg0Ji3UlMh52+M5SvMq85dT1MEqSghB gU6eTUkVXpW5ZHh33sl91+GnqJ9C2JuvlY3ULEIKOGrpVXBrlZ3QsVVWBFtEv/syMjWP Xlzd2UajYuiO2lLVNWB45FDt95r3TD+EMAqPWZuvzoXS5D+Qwnqsqf+metaQlydFV6Vc 6URpSLk0tV+ygjx9VcB9oo6RnAmX1/HLAX/HJnRDUuqEco49MjKHYVTEJbp9ZX53MDLU WoVg== 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=CxORb6sAK9YGHrJRPc4/EGoVavmPUJ7pQ6Tyv5AzWilzI2KH4ULuflMlYHo62cQXrP 3Qy8sELHOAaRuEPWy33suC2skQgSaY1dq+nVkaQPWkURDmBbsUHaG9iWQTkG8mXo62W2 89vY3UpKHf7vDOGD4fEDmaxG40oGCplGPFPwPd9LIfX3qDAwkKT9h+vaM221+4CN0Q4B HvqxilRWnj6330+WiYYcDL3LNKJ+SRgdEzI0g9xdHg8c4zMLTla+keG/IhYhlAAzDjTs 1K5cCPHzsdSW+uUZWWmwy262+bIMkjpwOe/ncl/wBi61HQLFXEeLPReC1/qsNytkQAAj ha8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZkhDLqMc; 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 p13-20020adfce0d000000b00319771ae26esi1502677wrn.871.2023.09.22.00.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 00:12:58 -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=ZkhDLqMc; 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 3ABD286925; Fri, 22 Sep 2023 09:12:27 +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="ZkhDLqMc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D9DE886290; Fri, 22 Sep 2023 09:12:25 +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-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (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 A124886996 for ; Fri, 22 Sep 2023 09:12:23 +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-x435.google.com with SMTP id d2e1a72fcca58-690bccb0d8aso1462480b3a.0 for ; Fri, 22 Sep 2023 00:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695366742; x=1695971542; 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=ZkhDLqMcK4w9S1BiGKge44xVGqpnWODV/tmEQ9WaWUpid7rvA8UW/kiABpxZ3CTviT fInoQU9EW3SafTALO6/MjaeqzP0Es8do2DC8bsN763bUqk8DzlxhXpopqmzPTP3mtXkM YytdFPPTUFzhMGWpXnSYcGf6iLPGHAG0RUSL4TsyrYv63CObtm1TMl1ZOqDlo9QNBgAe aanDueUwJ94PM1ghDWccuSm6yod7grhtQbUEWa59UQRjFjhJM9t+9GOrn8c0RZnCMc2F I8WT3OYhuHOucegbmJEPLxdo1GbXxnssXkHTV8nq8bqiSFKHYQ2lZ6pS/HQxbK9x3cuX rMTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695366742; x=1695971542; 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=PHHy8KV7eHprYy0VE4bvPY4LlhSjRhHeRqOFhTWTnPH6grICvpX4Y/LvVsbvtpCGSt WUYeNpodYFsrKL3imUGxEx4YZG8EwLCI9Hdk47t3WVwt8uKrghW64kPKAetJSQHh6aRq NhKsRzcaVgUEHfWkgF45JAmQVU1viInTqjItAvopEiQZvELHRZkdTFg/xGAVwWl7zUEQ qVTt1GkB75EiB3gPruPRALVjrjTK3bzlfr3HEDKR2VQDA+0J+UHxsZzIYxZHgbOW3Pwo Jqk/cTkzb+KFGR9qOhrChx+b7Cv9pfVMVc8jyh9qAhha+SZ20eUXU1ocX94iRH45t3uY os3Q== X-Gm-Message-State: AOJu0YzvtzFT3WlaXU9LpbvQnGDr0FwIAPdL7lpceAdeUOFoVuJeEGnv qpU06wWPnr7douPDQUhE2E0YqOaU4k4gy+mh1x4= X-Received: by 2002:a05:6a20:1585:b0:13e:9dba:ea52 with SMTP id h5-20020a056a20158500b0013e9dbaea52mr9141686pzj.13.1695366741750; Fri, 22 Sep 2023 00:12:21 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id 17-20020a17090a001100b00276a58e37c1sm4545333pja.38.2023.09.22.00.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 00:12:21 -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 v4 6/8] cmd: efidebug: add uri device path Date: Fri, 22 Sep 2023 16:11:17 +0900 Message-Id: <20230922071119.1439482-7-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230922071119.1439482-1-masahisa.kojima@linaro.org> References: <20230922071119.1439482-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