summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-12-12 19:15:37 +0000
committerLeif Lindholm <leif.lindholm@linaro.org>2014-12-15 16:23:10 +0000
commit186d3be3e251c8997b14dc9f3be771389db1501c (patch)
tree1241033ccb88c352a2ec8826dc331b772285f777
parent5559e2931dd83c64332291944a4c0f65c4725925 (diff)
ArmPkg/BdsLib: Update the size of the Device Tree before booting Linux
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
-rw-r--r--ArmPkg/Library/BdsLib/BdsLinuxFdt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsLinuxFdt.c b/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
index fb7bd5646..e3795527f 100644
--- a/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
+++ b/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
@@ -554,6 +554,9 @@ PrepareFdt (
// If we succeeded to generate the new Device Tree then free the old Device Tree
gBS->FreePages (*FdtBlobBase, EFI_SIZE_TO_PAGES (*FdtBlobSize));
+ // Update the real size of the Device Tree
+ fdt_pack ((VOID*)(UINTN)(NewFdtBlobBase));
+
*FdtBlobBase = NewFdtBlobBase;
*FdtBlobSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(NewFdtBlobBase));
return EFI_SUCCESS;