mbox series

[v8,0/8] Add pmem node for preserving distro ISO's

Message ID 20250312085424.1201148-1-sughosh.ganu@linaro.org
Headers show
Series Add pmem node for preserving distro ISO's | expand

Message

Sughosh Ganu March 12, 2025, 8:54 a.m. UTC
When installing a distro via EFI HTTP boot some OS installers expect
the .iso image to be preserved and treat it as a "CDROM" to install
packages.

This is problematic in EFI, since U-Boot mounts the image, starts the
installer, and eventually calls ExitBootServices. At that point the
image U-Boot mounted disappears. Some distros don't care and download
the missing packages from a web archive, while others halt the
installation complaining they can't find certain packages.

If the firmware uses ACPI, this is supported by using NFIT which
provides NVDIMM ramdisks to the OS and preserves the image.
We don't have anything in place for Device Trees though. Since DT
supports persistent memory nodes (pmem) use those and preserve the
.iso for installers.

The issue can be reproduced by attempting an EFI HTTP boot with Ubuntu
live server ISO, or a Rocky Linux ISO. The installation would fail
with the failure to locate certain packages.

The patches are adding support for adding the pmem node to the DT that
is being passed to the OS, along with removing the memory region
containing the ISO image from the EFI memory map. This is being done
through a helper function in the blkmap driver which scans for all
blkmap mappings and does the above configurations for the relevant
mappings.

This version of the patchset is adding two patches to the front of the
series, which re-install a device-tree(DT) on the EFI configuration
table afresh on every invocation of efi_install_fdt(). This fixes the
issue of a stale DT being passed on to a OS in the scenario where the
DT was already installed on the configuration table.

Changes since V7:
* Change the type of fdt_pages to efi_uintn_t (patch 2)
* Remove the check for either of fdt_pages or new_fdt_addr being 0
  (patch 2)
* Change the format specifier for fdt_pages in the debug messages for
  size_t (patch 2)
* Put the assignment of new_fdt_addr and fdt_pages on separate lines
  to avoid checkpatch error (patch 2)
* Fix repeated word in the commit message (patch 7)
* Fix checkpatch errors in blkmap.c and efi_helper.c (patch 8)




Ilias Apalodimas (2):
  efi_loader: add a function to remove memory from the EFI map
  efi_loader: preserve installer images in pmem

Masahisa Kojima (1):
  fdt: add support for adding pmem nodes

Sughosh Ganu (5):
  efi_loader: remove unused code from copy_fdt()
  efi_loader: install device-tree on configuration table on every
    invocation
  blkmap: store type of blkmap slice in corresponding structure
  blkmap: add an attribute to preserve the mem mapping
  blkmap: pass information on ISO image to the OS

 boot/fdt_support.c            | 41 +++++++++++++++++-
 boot/image-fdt.c              |  7 +++
 cmd/blkmap.c                  |  9 +++-
 drivers/block/blkmap.c        | 64 +++++++++++++++++++++++++--
 drivers/block/blkmap_helper.c |  2 +-
 include/blkmap.h              | 21 ++++++++-
 include/efi.h                 | 13 ++++++
 include/efi_loader.h          | 18 ++++++++
 include/fdt_support.h         | 14 ++++++
 lib/efi_loader/efi_bootmgr.c  | 22 +++++++---
 lib/efi_loader/efi_helper.c   | 81 ++++++++++++++++++++++++++---------
 lib/efi_loader/efi_memory.c   | 56 +++++++++++++++++-------
 12 files changed, 297 insertions(+), 51 deletions(-)