On 8/26/23 11:06, Sughosh Ganu wrote:

Provide a way for removing certain devicetree nodes and/or properties
from the devicetree. This is needed to purge certain nodes and
properties which may be relevant only in U-Boot. Such nodes and
properties are then removed from the devicetree before it is passed to
the kernel. This ensures that the devicetree passed to the OS does not
contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an
EVT_FT_FIXUP handler. I am not sure if the removal code needs to be
behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64
virt platform. This being a RFC, I have not put this through a CI run.

We should have a test for the new functionality. E.g. add some
superfluous properties and nodes to arch/sandbox/dts/test.dts, delete
them via the DT_PURGE macro, and check that the device-tree passed to an
EFI binary does not contain these properties and nodes.

Best regards

Heinrich


Sughosh Ganu (5):
   dt: Provide a way to remove non-compliant nodes and properties
   fwu: Add the fwu-mdata node for removal from devicetree
   capsule: Add the capsule-key property for removal from devicetree
   bootefi: Call the EVT_FT_FIXUP event handler
   doc: Add a document for non-compliant DT node/property removal

  cmd/bootefi.c                                 | 18 +++++
  .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
  drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
  include/dt-structs.h                          | 11 +++
  lib/Makefile                                  |  1 +
  lib/dt_purge.c                                | 73 +++++++++++++++++++
  lib/efi_loader/efi_capsule.c                  |  7 ++
  7 files changed, 179 insertions(+)
  create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
  create mode 100644 lib/dt_purge.c

Reply via email to