diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2022-11-05 19:00:32 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2022-11-05 19:00:32 +0000 |
commit | 0737be3fd643321afc9b0b8e2503e327ba5b0e2b (patch) | |
tree | 3b05d68ef904f4dce47875da907bc6647707ccec /sys/arch/arm64/stand | |
parent | 26b03fce17e3d4aa6a7f2010f001007ecb368617 (diff) |
Not every device tree we're getting passed has an /aliases or /chosen node,
but our code assumes so. It's useful to have them, so create them if they
do not exist.
ok kettenis@
Diffstat (limited to 'sys/arch/arm64/stand')
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiboot.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c index 5f28c2a4fcc..ecadf5f4aab 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.c +++ b/sys/arch/arm64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.43 2022/11/05 18:58:24 patrick Exp $ */ +/* $OpenBSD: efiboot.c,v 1.44 2022/11/05 19:00:31 patrick Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -604,10 +604,15 @@ efi_makebootargs(char *bootargs, int howto) if (!fdt_init(fdt)) return NULL; + /* Create common nodes which might not exist when using mach dtb */ + node = fdt_find_node("/aliases"); + if (node == NULL) + fdt_node_add_node(fdt_find_node("/"), "aliases", &node); node = fdt_find_node("/chosen"); - if (!node) - return NULL; + if (node == NULL) + fdt_node_add_node(fdt_find_node("/"), "chosen", &node); + node = fdt_find_node("/chosen"); len = strlen(bootargs) + 1; fdt_node_add_property(node, "bootargs", bootargs, len); fdt_node_add_property(node, "openbsd,boothowto", |