From patchwork Mon Oct 16 04:23:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 734014 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1045:b0:32d:baff:b0ca with SMTP id c5csp35011wrx; Sun, 15 Oct 2023 21:30:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuKnHpaizfSHLWeVFJiG7nPOA67NNlT2E+YwREUKEciVyD0NbjKi8SePB2lYGi363WgvBq X-Received: by 2002:a5d:46c1:0:b0:32d:87c8:b54e with SMTP id g1-20020a5d46c1000000b0032d87c8b54emr11018634wrs.1.1697430629187; Sun, 15 Oct 2023 21:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697430629; cv=none; d=google.com; s=arc-20160816; b=0nW1HeET/RKQ85r2nhylVKx4xQO/GxH9B8b+NK83G43AolffZfkzODkF2F2bhrcBap xp6uz9oL/V4giVaR/MSoYRVC+Nd2rD2vMBRJbH9uJxVThU1R+hmiHNOgzZFZz9e+L7HH uS0XWu7WF1g7UU5EM6COqeVdOjkiVDe8RIY+RZZuAqAgvNpRNjcPTYDbQgFBa+dEeGfG QXlFZnJjigQS0QzBYK8os+vfPJRBosPCY+Z7zmCIIpgufZ7T+p2iiowOVGY7OR5pV4Eo f43xnlAfR94JNXcIrbte28nGJOx8m6a3Qhar+mMDxBY9DeNvaIC6UHFiAMZdS5cuNIo1 00kg== 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=HxYWG2IUR4hdo1kglN9y0+zSpVCikjM1OXe79pVViwZNALR1Zyp3tmGCR80jXPFRTF sBRkYqM37gCFPlToBTaj8x5PhbOrRJZQsCtSa7g+gGZzvf782tcNeFxsYv0DK0uHaou7 +FVpbknBhnbHntuL3W+qp3dAyFio9lAKtmioZDpxbuuc2l0EskA3Z5MNfFHY5Fx+HvLu PiQFZHfFcBbARXZH2obwSU81Dm8Ksc40vKHeBdLzowoaCa/gV3x7IcMZzhermwz0T37G Zx9N/SNtTfu4MvvJEdPoEbrl9hko7wPLxjI6X5m5SuBl8vW8vOV4ykCLWNClKb9Mg9g8 NvcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RP2uyRU4; 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 e18-20020adffc52000000b0031fe20d6a39si3572636wrs.220.2023.10.15.21.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 21:30:29 -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=RP2uyRU4; 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 82F2486DD5; Mon, 16 Oct 2023 06:30:21 +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="RP2uyRU4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9BEA586524; Mon, 16 Oct 2023 06:25:36 +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-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (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 5141D86E22 for ; Mon, 16 Oct 2023 06:24:57 +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-pg1-x529.google.com with SMTP id 41be03b00d2f7-58e119bb28eso3877170a12.1 for ; Sun, 15 Oct 2023 21:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697430295; x=1698035095; 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=RP2uyRU4WNmviYjpjtKrJLYWiPxo3MqM5ekqaMJMEyPGMbVTaU6a98WD8/SBvQhOar H+I5Vholo7PmrYdNjfVfWu8CxKtT+BFKQ5y+5QBo6Dk3MKxHJoFa7KZYjLvPEh/gxPRK kEzFO5VQuYzkd3VIkJPb9mPiC2D/Vg0VRUOpJC541F5XOdaEaSa75mAZKN5tsjNL6bNy 982bAPx9hIzK0eJNi9+cGcuBCUb4q5x4R3ZuCy6RFndQYI0fB9mgP6/W9nH+77Ka16yR o84MtPVWOkJONAfHWWBw4Zg1kVoXtVNnC2vK3LgzdIQW0KrijD9HExzAGAzSvq6Cc+CY HfpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697430295; x=1698035095; 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=APnRJ2omboQkiOEJbMg+gJLUPl4cswLKlisjE85SgB3uPcvs8Gf6lvI6/7gckJy3fp HKFcUfNxunhDlWn51rdTSdWpVbhfolzjz6wnvAUrH+nFSlHoSo5xFv0XetXSnO0JJkPX RrwCLiFagHbc3RcT6MpzWye3GVIvokXE1nD3/OPTSicfbfoztrAFJj2p/mRdxP8R/R4V LBhwH9F+0BnXYajR7mMXIYUCJlK9z09fq2gXaNAxgZ8c2jdo/FNuFKHIVET4WSOv+xH6 9jT5FU6JNovmO0XPchvkbJHUWoaZxd+KdcuvAIY1MFv7+qf3GQswtBa3VzCZWyNGtMzb gaPA== X-Gm-Message-State: AOJu0YwtoPJKxtshUw91wf9K+F4KQ7hem9PXpNK/R4FF1lWBpyemRw3j 7n9DZpeM01wR4PV725yWjVWGdAlNMS/sUjR3Ssw= X-Received: by 2002:a05:6a20:9150:b0:140:d536:d434 with SMTP id x16-20020a056a20915000b00140d536d434mr9432129pzc.10.1697430295444; Sun, 15 Oct 2023 21:24:55 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id y123-20020a636481000000b005b628aa2a8dsm1769166pgb.69.2023.10.15.21.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 21:24:54 -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: [RESEND PATCH v6 8/9] cmd: efidebug: add uri device path Date: Mon, 16 Oct 2023 13:23:07 +0900 Message-Id: <20231016042309.2386387-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016042309.2386387-1-masahisa.kojima@linaro.org> References: <20231016042309.2386387-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