From: patrick Date: Sat, 5 Nov 2022 19:00:31 +0000 (+0000) Subject: Not every device tree we're getting passed has an /aliases or /chosen node, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bd928107be11dadbc8bf84931ac921f1c61be012;p=openbsd 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@ --- 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 @@ -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",