]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/BdsLib: Update the size of the Device Tree before booting Linux
authorOlivier Martin <olivier.martin@arm.com>
Fri, 12 Dec 2014 19:15:37 +0000 (19:15 +0000)
committeroliviermartin <oliviermartin@Edk2>
Fri, 12 Dec 2014 19:15:37 +0000 (19:15 +0000)
The memory reserved to load the device tree is over-allocated when
UEFI loads the blob to update the device tree with additional
information such as the command line, the initrd, etc.

This change ensures the total size declared by the device tree matches
the actual data (and not the over-allocated size value).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16517 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Library/BdsLib/BdsLinuxFdt.c

index fb7bd5646e874155244b1c31b1e595f01d87c0d6..e3795527f2d3d0a738d10095f4a30cd59b6a8c4e 100644 (file)
@@ -554,6 +554,9 @@ PrepareFdt (
   // If we succeeded to generate the new Device Tree then free the old Device Tree\r
   gBS->FreePages (*FdtBlobBase, EFI_SIZE_TO_PAGES (*FdtBlobSize));\r
 \r
+  // Update the real size of the Device Tree\r
+  fdt_pack ((VOID*)(UINTN)(NewFdtBlobBase));\r
+\r
   *FdtBlobBase = NewFdtBlobBase;\r
   *FdtBlobSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(NewFdtBlobBase));\r
   return EFI_SUCCESS;\r