qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] hw/arm: Pack the QEMU generated device tree


From: Bin Meng
Subject: [PATCH 2/3] hw/arm: Pack the QEMU generated device tree
Date: Mon, 15 Jan 2024 12:34:29 +0800

By default QEMU generates a 1 MiB sized device tree. Let's pack it
to save some room.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 hw/arm/boot.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index ff1173299f..511ec10ed0 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -662,6 +662,17 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info 
*binfo,
         binfo->modify_dtb(binfo, fdt);
     }
 
+    /*
+     * By default QEMU generates a 1 MiB sized device tree.
+     * Let's pack it to save some room.
+     */
+    if (binfo->get_dtb) {
+        rc = fdt_pack(fdt);
+        /* Should only fail if we've built a corrupted tree */
+        g_assert(rc == 0);
+        size = fdt_totalsize(fdt);
+    }
+
     qemu_fdt_dumpdtb(fdt, size);
 
     /* Put the DTB into the memory map as a ROM image: this will ensure
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]