[fdt] Populate boot arguments in constructed device tree

When creating a device tree to pass to a booted operating system,
ensure that the "chosen" node exists, and populate the "bootargs"
property with the image command line.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-01 16:53:02 +01:00
parent d853448887
commit 7e64e9b670
5 changed files with 433 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/efi/efi.h>
extern int efi_fdt_install ( void );
extern int efi_fdt_install ( const char *cmdline );
extern int efi_fdt_uninstall ( void );
#endif /* _IPXE_EFI_FDT_H */

View File

@@ -73,6 +73,9 @@ struct fdt_prop {
/** Alignment of structure block */
#define FDT_STRUCTURE_ALIGN ( sizeof ( fdt_token_t ) )
/** Maximum alignment of any block */
#define FDT_MAX_ALIGN 8
/** A device tree */
struct fdt {
/** Tree data */
@@ -96,6 +99,13 @@ struct fdt {
size_t strings_len;
/** Offset to memory reservation block */
unsigned int reservations;
/** Reallocate device tree
*
* @v fdt Device tree
* @v len New length
* @ret rc Return status code
*/
int ( * realloc ) ( struct fdt *fdt, size_t len );
};
extern struct image_tag fdt_image __image_tag;
@@ -113,7 +123,7 @@ extern int fdt_mac ( struct fdt *fdt, unsigned int offset,
struct net_device *netdev );
extern int fdt_parse ( struct fdt *fdt, struct fdt_header *hdr,
size_t max_len );
extern int fdt_create ( struct fdt_header **hdr );
extern int fdt_create ( struct fdt_header **hdr, const char *cmdline );
extern void fdt_remove ( struct fdt_header *hdr );
#endif /* _IPXE_FDT_H */