From patchwork Fri Sep 22 07:11:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 725215 Delivered-To: patch@linaro.org Received: by 2002:adf:ea87:0:b0:31d:da82:a3b4 with SMTP id s7csp875807wrm; Fri, 22 Sep 2023 00:11:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHT90Hwtmk0JVJIwnZk0DepgNYfzCphszakFR/sOs4QvRcf6A0TSFrGwKzJn29znHO3n5nN X-Received: by 2002:a1c:791a:0:b0:403:8fb9:8d69 with SMTP id l26-20020a1c791a000000b004038fb98d69mr7321315wme.25.1695366717186; Fri, 22 Sep 2023 00:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695366717; cv=none; d=google.com; s=arc-20160816; b=BRWKBBAGMEi3knfbRErzyWzRUPWqTMKp4rkkipRimyr8YxajWjDaE+SRGLlNVDOJ0F cMv5GrotpuuXGoIAsEKEYkAZPUimwQosdd3xUXTN7+wYIwiA0DE2woK0N+i5+37AROGP AhmlhpKJc9OokvlEh8GFQcrh8fqC7hDuGXHQ+sb7m/mjqzDH6TPQvrw2gzQ5+KHfHoOa C1zxOOt9wyMcqW9U8hRyCWoXm/ti3vtMKnadIjajKrkBAzrR87g3GziV25C/cfbFYzOd ZCGD8ceCshszLqrynSgb3d1RdK9SsxD1w9Gj4L542C64Q0KTEAfjb8V52TrQ/DSWKOgA ybjQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=KEVY7zumXmIbns82dkk+NFbgvnnddL5MmiwKJM4jOqw=; fh=XwOfspvhog7otCudZV1ecvxibH3YToEgjgP70JntENo=; b=VVYf7btM/2811QwihdwTjL/jOx9vXxprtAQfwwNi+7hKSOA814yDcPorf2z3jdHTxw 7esR6aSBnsVr4wa600l2gMS9Czcp6BHsLvL4jz56oK/5OgfLAfd8f42tfMSQW83GWu34 y7pQsqINDGw61WJbpS5pTOUm++8vEE1uTlUTT+5GXlq/DUeKgCR9ACj1mJxgkboCaT9R aPlCWKl2o4HvqssW4hmAJJSf8nHOBbWIYWa5d6j+hwwycMZavYqn613lZIgiFJdda2JO e1P0PpSbLTpipUt35RpttVIwzHKrwXkX4zcwkxvU9k2V4UlnlSA66n1y3e+mno86Lru0 W77w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qQGzdfc6; 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 n20-20020a05600c501400b0040540a0dc25si157843wmr.80.2023.09.22.00.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 00:11:57 -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=qQGzdfc6; 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 26477863DE; Fri, 22 Sep 2023 09:11: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="qQGzdfc6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 089DD864DD; Fri, 22 Sep 2023 09:11:55 +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=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NORMAL_HTTP_TO_IP, NUMERIC_HTTP_ADDR,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) (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 3FF338634D for ; Fri, 22 Sep 2023 09:11:52 +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-x42e.google.com with SMTP id d2e1a72fcca58-68c576d35feso1655285b3a.2 for ; Fri, 22 Sep 2023 00:11:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695366710; x=1695971510; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KEVY7zumXmIbns82dkk+NFbgvnnddL5MmiwKJM4jOqw=; b=qQGzdfc6pyuNj4u5CvlkYgysOJpe1B6BD83PbwbklbRe3Kw3u/BxCNo7iaT+ZHlszC ONJsv/aRnr+SrIpHF2PuP/pbEl6qU1GAneBGnbtDPbzfp2/ukyuF9h6pLvHwRj+BsJ15 j6aAuNH1QX4oUJiyTJUt+mLr6KuzwNRcoJ+aF4c5u58vqdDrREZXZTHHNd48Lfm2yavA 4VJvJuKNwUSvQ3D/cWwtm9K/q51J2t1R8m9LSVVSn8AQA6RWlOrbYdi1+QhoWMHDO2ct wcQQpwNc1Xa2Y+CPFzHPUDuY/XirknDr7v4TFhGoTt53tu33mSOUtSY5qz9pm4W8/HTC AUMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695366710; x=1695971510; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KEVY7zumXmIbns82dkk+NFbgvnnddL5MmiwKJM4jOqw=; b=XUkeszQ+ISNx8hQu68+tI5p2JiRM0ibUOma2UZuDZxha44NZLa+/PKbHXrC166j+F5 C0uEnSaldyG5VlvyuHpzQESE28ZnhLRJ+gzIUx4bXRR1evBU8EJo+9q6NQArZv7arKPA YLEW3spu9sbEF8ssksI22F4pAAxDmwYD6WfzMO0rZFZIyArLih7hcI5ZyniH6blXowC4 lkH5Xo6fhQr9VxA2TuYrLQmKh19EsT0jC8lkQtKYVNcIm20y6gXF/xw/S+VrXyvVeIkL 4WtzlWZ6B767JW1Y4OR6wTkRHpLqXRsgbLBRjLwtaVXv8LjbFPXLaicbajYhIBlgiiWy RcPA== X-Gm-Message-State: AOJu0YyErAtuHZgy4ALVghi26axMqwgr0ywaeU9n7XOZnJDwe44GPk2A JrJzwUXZqiee1vAFJUELgzV8hoqR6IYEMAeWHe0= X-Received: by 2002:a05:6a20:96d7:b0:15d:c1a8:c329 with SMTP id hq23-20020a056a2096d700b0015dc1a8c329mr761937pzc.48.1695366710412; Fri, 22 Sep 2023 00:11:50 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id y10-20020a056a001c8a00b006926e3dc2besm1833323pfw.108.2023.09.22.00.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 00:11:49 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Masahisa Kojima Subject: [PATCH v4 0/8] Add EFI HTTP boot support Date: Fri, 22 Sep 2023 16:11:11 +0900 Message-Id: <20230922071119.1439482-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 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 series adds the EFI HTTP boot support. User can add the URI device path with "efidebug boot add" command. efibootmgr handles the URI device path, download the specified file using wget, mount the downloaded image with blkmap, then boot with the default file(e.g. EFI/BOOT/BOOTAA64.EFI). This version still does not include the test. To enable EFI HTTP boot, we need to enable the following Kconfig options. CONFIG_CMD_DNS CONFIG_CMD_WGET CONFIG_BLKMAP On the Socionext Developerbox, enter the following commands then debian installer is downloaded into "loadaddr" and installer automatically starts. => dhcp => setenv serverip 192.168.1.1 => efidebug boot add -u 3 debian-netinst http://ftp.riken.jp/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso => efidebug boot order 3 => bootefi bootmgr Note that this debian installer can not proceed the installation bacause RAM disk of installer image is not recogniged by the kernel. I'm still investigating this issue, but drivers/nvdimm/of_pmem.c in linux will be one of the solution to recognize RAM disk from kernel. (In EDK2, the equivalent solution is called ACPI NFIT.) On QEMU, I can not make DNS work from the QEMU guest. The following commands work on qemu_arm64(manually set the http server ip in URI). => dhcp => setenv gatewayip 10.0.2.2 => setenv httpserverip 134.160.38.1 => efidebug boot add -u 3 debian-netinst http://134.160.38.1/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso => efidebug boot order 3 => bootefi bootmgr [TODO] - add test - stricter wget uri check - omit the dns process if the given uri has ip address -> this will be supported when the lwip migration completes - uri device path support in eficonfig [change log] v3 -> v4 - patch#8 is added to simplify the bootmgr default boot process - add function comments v2 -> v3 - Patch#6 is added, reserve the whole ramdisk memory region - remove .efi file extension check for PE-COFF image - use "if IS_ENABLED(..)" as much as possible - 1024 should be sizeof(net_boot_file_name) - call net_set_state(NETLOOP_FAIL) when wget encounters error - describe DNS ip address host name limitation in document v1 -> v2 - carve out the network handling(wget and dns code) under net/wget.c - carve out ramdisk creation code under drivers/block/blkmap_helper.c - wget supports the valid range check to store the received blocks using lmb - support when the downloaded image have no partiton table but a file system - not start the .efi file in try_load_entry() - call efi_check_pe() for .efi file to check the file is PE-COFF image - add documentation for EFI HTTP Boot Masahisa Kojima (8): net: wget: prevent overwriting reserved memory net: wget: add wget with dns utility function blk: blkmap: add ramdisk creation utility function efi_loader: support boot from URI device path efi_loader: set EFI HTTP Boot download buffer as reserved cmd: efidebug: add uri device path doc: uefi: add HTTP Boot support efi_loader: create BlockIo device boot option cmd/efidebug.c | 50 +++++++ doc/develop/uefi/uefi.rst | 30 ++++ drivers/block/Makefile | 1 + drivers/block/blkmap.c | 15 -- drivers/block/blkmap_helper.c | 53 +++++++ include/blkmap.h | 29 ++++ include/efi_loader.h | 3 + include/net.h | 17 +++ lib/efi_loader/efi_bootmgr.c | 241 +++++++++++++++++++++++++++++-- lib/efi_loader/efi_device_path.c | 20 +++ lib/efi_loader/efi_dt_fixup.c | 2 +- net/wget.c | 206 +++++++++++++++++++++++++- 12 files changed, 628 insertions(+), 39 deletions(-) create mode 100644 drivers/block/blkmap_helper.c