diff --git a/arch/aarch64/arch-dtb.cc b/arch/aarch64/arch-dtb.cc index 462d2fb98d..8e85640c56 100644 --- a/arch/aarch64/arch-dtb.cc +++ b/arch/aarch64/arch-dtb.cc @@ -641,6 +641,7 @@ bool dtb_get_vmm_is_xen() void __attribute__((constructor(init_prio::dtb))) dtb_setup() { + void *olddtb; int node; char *cmdline_override; int len; @@ -680,6 +681,17 @@ void __attribute__((constructor(init_prio::dtb))) dtb_setup() abort("dtb_setup: command line too long.\n"); } + if (fdt_pack(dtb) != 0) { + abort("dtb_setup: failed to pack dtb\n"); + } + + olddtb = dtb; + dtb = (void *)OSV_KERNEL_BASE; + + if (fdt_open_into(olddtb, dtb, 0x10000) != 0) { + abort("dtb_setup: failed to move dtb (dtb too large?)\n"); + } + cmdline = (char *)fdt_getprop(dtb, node, "bootargs", NULL); if (!cmdline) { abort("dtb_setup: cannot find cmdline after dtb move.\n");