Browse Source

libfdt: Fix the Python pack() function

This currently fails to reduce the device-tree bytearray size. Fix this.

This stands in for a pending upstream change.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 6 năm trước cách đây
mục cha
commit
a1e0085519
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      scripts/dtc/pylibfdt/libfdt.i_shipped

+ 5 - 1
scripts/dtc/pylibfdt/libfdt.i_shipped

@@ -442,7 +442,11 @@ class Fdt:
         Raises:
             FdtException if any error occurs
         """
-        return check_err(fdt_pack(self._fdt), quiet)
+        err = check_err(fdt_pack(self._fdt), quiet)
+        if err:
+            return err
+        del self._fdt[self.totalsize():]
+        return err
 
     def getprop(self, nodeoffset, prop_name, quiet=()):
         """Get a property from a node