-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bsp: tegra: systemd-boot: double dtb buffer size
This is probably due to fact systemd-boot does not allocate any extra space for the device tree. Without the modification, because there is not any extra space, the UEFI will fail applying the overlay changes from its .dtbo files Fixes: | EFI stub: ERROR: Invalid header detected on UEFI supplied FDT, ignoring ... | EFI stub: Generating empty DTB References: anduril/jetpack-nixos#111 Signed-off-by: Jose Quaresma <[email protected]>
- Loading branch information
1 parent
9e3c500
commit 535b689
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...p/dynamic-layers/tegra/recipes-core/systemd/systemd-boot/0001-Increase-the-dtb-size.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
From 919601f2598eb3dd17fe88d26cafed88420daad2 Mon Sep 17 00:00:00 2001 | ||
From: Brian McGillion <[email protected]> | ||
Date: Thu, 23 Jan 2025 13:08:15 +0400 | ||
Subject: [PATCH] Increase the dtb size | ||
|
||
This is probably due to fact systemd-boot does not allocate any extra space for the device tree. | ||
Without the modification, because there is not any extra space, the UEFI will fail applying the | ||
overlay changes from its .dtbo files | ||
|
||
Fixes: | ||
| EFI stub: ERROR: Invalid header detected on UEFI supplied FDT, ignoring ... | ||
| EFI stub: Generating empty DTB | ||
|
||
References: | ||
https://github.com/anduril/jetpack-nixos/issues/111 | ||
|
||
Upstream-Status: Pending [https://github.com/tiiuae/ghaf/blob/main/modules/common/systemd/systemd-boot-double-dtb-buffer-size.patch] | ||
|
||
Signed-off-by: Brian McGillion <[email protected]> | ||
Signed-off-by: Jose Quaresma <[email protected]> | ||
--- | ||
src/boot/efi/devicetree.c | 8 +++++++- | ||
1 file changed, 7 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/boot/efi/devicetree.c b/src/boot/efi/devicetree.c | ||
index 61a43cd77d..f939a79963 100644 | ||
--- a/src/boot/efi/devicetree.c | ||
+++ b/src/boot/efi/devicetree.c | ||
@@ -3,6 +3,7 @@ | ||
#include "devicetree.h" | ||
#include "proto/dt-fixup.h" | ||
#include "util.h" | ||
+#include <endian.h> | ||
|
||
#define FDT_V1_SIZE (7*4) | ||
|
||
@@ -88,7 +89,8 @@ EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir | ||
/* 32MB device tree blob doesn't seem right */ | ||
return EFI_INVALID_PARAMETER; | ||
|
||
- len = info->FileSize; | ||
+ /* Double the length to be allocated so there's space for modifications */ | ||
+ len = info->FileSize * 4; | ||
|
||
err = devicetree_allocate(state, len); | ||
if (err != EFI_SUCCESS) | ||
@@ -102,6 +104,10 @@ EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir | ||
if (err != EFI_SUCCESS) | ||
return err; | ||
|
||
+ /* Double the size inside the device tree structure */ | ||
+ uint32_t *totalsize = (uint32_t *)(((char *)PHYSICAL_ADDRESS_TO_POINTER(state->addr) + 4)); | ||
+ (*totalsize) = htobe32(be32toh(*totalsize) * 4); | ||
+ | ||
return BS->InstallConfigurationTable( | ||
MAKE_GUID_PTR(EFI_DTB_TABLE), PHYSICAL_ADDRESS_TO_POINTER(state->addr)); | ||
} | ||
-- | ||
2.48.1 | ||
|
3 changes: 3 additions & 0 deletions
3
meta-lmp-bsp/dynamic-layers/tegra/recipes-core/systemd/systemd-boot_%.bbappend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" | ||
|
||
SRC_URI:append:orin-nano = " file://0001-Increase-the-dtb-size.patch" |