public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v7 0/9] Add EFI HTTP boot support
@ 2023-10-16  6:45 Masahisa Kojima
  2023-10-16  6:45 ` [PATCH v7 1/9] net: wget: prevent overwriting reserved memory Masahisa Kojima
                   ` (8 more replies)
  0 siblings, 9 replies; 33+ messages in thread
From: Masahisa Kojima @ 2023-10-16  6:45 UTC (permalink / raw)
  To: u-boot
  Cc: Heinrich Schuchardt, Ilias Apalodimas, Simon Glass,
	Takahiro Akashi, Michal Simek, Masahisa Kojima

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)
by selecting automatically created boot option when the new disk is
detected.

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
 CONFIG_EFI_HTTP_BOOT

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]
v6 -> v7
- rename the funtion name from load_default_file_boot_option()
  to load_mounted_image()
- move some fix from patch #5 "efi_loader: support boot from URI device path" to
  patch #4 "efi_loader: create default file boot option".
- fix missing free() of default_file_path

v5 -> v6
- add patch #4 "Boot var automatic management for removable medias"
- boot from automatically created boot option
  rather than searching default file on the fly
- introduce new CONFIG_EFI_HTTP_BOOT Kconfig option
- comment in one place
- use log_err() rather than printf()
- use env_get_hex("filesize", 0) instead of return value of net_loop()
- use more suitable error code
- blkmap can be build for SPL/TPL
- add CDROM short-form device path support

v4 -> v5
- add missing else statement
- add NULL check of efi_dp_find_obj() call
- update document to remove "limitation"

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: create default file boot option
  efi_loader: support boot from URI device path
  efi_loader: add CDROM short-form device path
  cmd: efidebug: add uri device path
  doc: uefi: add HTTP Boot support

Raymond Mao (1):
  Boot var automatic management for removable medias

 cmd/efidebug.c                                |  50 +++
 doc/develop/uefi/uefi.rst                     |  30 ++
 drivers/block/Makefile                        |   3 +-
 drivers/block/blkmap.c                        |  15 -
 drivers/block/blkmap_helper.c                 |  53 ++++
 include/blkmap.h                              |  29 ++
 include/efi_loader.h                          |   2 +
 include/net.h                                 |  17 ++
 lib/efi_loader/Kconfig                        |   9 +
 lib/efi_loader/efi_bootmgr.c                  | 284 ++++++++++++++++--
 lib/efi_loader/efi_device_path.c              |   3 +-
 lib/efi_loader/efi_disk.c                     |  18 ++
 lib/efi_loader/efi_dt_fixup.c                 |   2 +-
 lib/efi_loader/efi_setup.c                    |   7 +
 net/wget.c                                    | 205 ++++++++++++-
 test/py/tests/test_efi_secboot/test_signed.py |  42 +--
 .../test_efi_secboot/test_signed_intca.py     |  14 +-
 .../tests/test_efi_secboot/test_unsigned.py   |  14 +-
 .../test_fs/test_squashfs/test_sqfs_ls.py     |   6 +
 19 files changed, 720 insertions(+), 83 deletions(-)
 create mode 100644 drivers/block/blkmap_helper.c


base-commit: c1ab04626d6b05c6e82dfe4d97d3f62f7310d612
-- 
2.34.1


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2023-10-19  8:24 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-16  6:45 [PATCH v7 0/9] Add EFI HTTP boot support Masahisa Kojima
2023-10-16  6:45 ` [PATCH v7 1/9] net: wget: prevent overwriting reserved memory Masahisa Kojima
2023-10-16  6:45 ` [PATCH v7 2/9] net: wget: add wget with dns utility function Masahisa Kojima
2023-10-16  6:45 ` [PATCH v7 3/9] blk: blkmap: add ramdisk creation " Masahisa Kojima
2023-10-16  6:45 ` [PATCH v7 4/9] efi_loader: create default file boot option Masahisa Kojima
2023-10-16  7:06   ` Heinrich Schuchardt
2023-10-16 12:31     ` Ilias Apalodimas
2023-10-16 12:46       ` Heinrich Schuchardt
2023-10-16 12:57         ` Ilias Apalodimas
2023-10-16 13:00         ` Masahisa Kojima
2023-10-16 14:47           ` Heinrich Schuchardt
2023-10-17  5:32             ` Masahisa Kojima
2023-10-17 19:46               ` Ilias Apalodimas
2023-10-18  9:07                 ` Masahisa Kojima
2023-10-18  9:12                   ` Ilias Apalodimas
2023-10-18  9:30                     ` Heinrich Schuchardt
2023-10-19  6:45                     ` Masahisa Kojima
2023-10-19  7:22                       ` Ilias Apalodimas
2023-10-19  8:24                         ` Masahisa Kojima
2023-10-17 20:29               ` Heinrich Schuchardt
2023-10-16  6:45 ` [PATCH v7 5/9] efi_loader: support boot from URI device path Masahisa Kojima
2023-10-18  0:42   ` Heinrich Schuchardt
2023-10-18  8:32     ` Masahisa Kojima
2023-10-16  6:45 ` [PATCH v7 6/9] efi_loader: add CDROM short-form " Masahisa Kojima
2023-10-18 10:19   ` Heinrich Schuchardt
2023-10-19  3:21     ` Masahisa Kojima
2023-10-16  6:45 ` [PATCH v7 7/9] Boot var automatic management for removable medias Masahisa Kojima
2023-10-16  7:58   ` João Marcos Costa
2023-10-16 19:02     ` João Marcos Costa
2023-10-16  6:45 ` [PATCH v7 8/9] cmd: efidebug: add uri device path Masahisa Kojima
2023-10-17 19:27   ` Ilias Apalodimas
2023-10-18  8:38     ` Masahisa Kojima
2023-10-16  6:45 ` [PATCH v7 9/9] doc: uefi: add HTTP Boot support Masahisa Kojima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox