Skip to content

Commit

Permalink
Merge pull request #469 from balena-os/fix_dtb_load
Browse files Browse the repository at this point in the history
Fix custom dtb loading in L4T 36.3
  • Loading branch information
acostach authored Jul 17, 2024
2 parents a43debc + 1662216 commit 69729e7
Show file tree
Hide file tree
Showing 14 changed files with 899 additions and 438 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ SRC_URI = " \
file://0001-Seeed-J4012-Integrate-with-balenaOS-on-L4T-36.3_patch.txt \
file://0001-Seeed-J3010-Integrate-with-balenaOS-on-L4T-36.3_patch.txt \
file://0001-edk2-nvidia-Remove-pva-fw-from-required-list_patch.txt \
file://0001-feat-add-a-null-version-of-the-FwVariableLib_patch.txt \
file://0002-fix-don-t-try-to-erase-early-vars-partition-in-Jetso_patch.txt \
file://0003-fix-reset-the-meas-buffer-after-computing-the-first-_patch.txt \
file://0001-StandaloneMmOptee-Don-t-assert-if-var-store-integrit_patch.txt \
"

Expand All @@ -50,11 +47,6 @@ do_compile () {

IMAGETAG="${PN}:$(date +%s)-${MACHINE}"

if [ -z "$(DOCKER_API_VERSION=1.22 docker images -q ${IMAGETAG} 2> /dev/null)" ]; then
echo "Build tag ${IMAGETAG} found, clean up all build"
DOCKER_API_VERSION=1.22 docker rmi -f ${IMAGETAG}
fi

DOCKER_API_VERSION=1.22 docker build --tag ${IMAGETAG} ${B}/ --build-arg "DEVICE_TYPE=${MACHINE}"
DOCKER_API_VERSION=1.22 docker run --rm -v ${WORKDIR}/out:/out -v "${HOME}":"${HOME}" -e EDK2_DOCKER_USER_HOME="${HOME}" -e DEVICE_TYPE="${MACHINE}" ${IMAGETAG} su /bin/bash -c "/build/build.sh && cp /build/nvidia-uefi/images/uefi_Jetson_DEBUG.bin /out/uefi_jetson.bin && cp /build/nvidia-uefi/images/BOOTAA64_Jetson_DEBUG.efi /out/BOOTAA64.efi"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 1d89db43997d5d9da55a88491a6a63826c37f3a0 Mon Sep 17 00:00:00 2001
From 98de665db6d2a9eb3b12289449b125f69f3d10d2 Mon Sep 17 00:00:00 2001
From: Alexandru Costache <alexandru@balena.io>
Date: Mon, 1 Jul 2024 09:21:33 +0000
Subject: [PATCH] 2 AGX-Orin 32GB: Integrate with balenaOS on L4T 36.3
Date: Tue, 16 Jul 2024 09:17:34 +0000
Subject: [PATCH] AGX-Orin 32GB: Integrate with balenaOS on L4T 36.3

With this patch, the Nvidia bootloader parses resinos_uEnv.txt,
extra_uEnv.txt and bootcount.env in order to load the
Expand All @@ -14,14 +14,14 @@ compatible with the dtb selection mechanism implemented in the
Supervisor for the rest of the boards that use u-boot.

Upstream-status: Inappropriate [configuration]
Signed-off-by: Alexandru Costache <alexandru@balena.io>
Signed-off-by: Alexandru Costache <alexandru@balena.io
---
.../Application/L4TLauncher/L4TLauncher.c | 583 +++++++++++++++++-
.../Application/L4TLauncher/L4TLauncher.h | 15 +-
2 files changed, 578 insertions(+), 20 deletions(-)

diff --git a/Silicon/NVIDIA/Application/L4TLauncher/L4TLauncher.c b/Silicon/NVIDIA/Application/L4TLauncher/L4TLauncher.c
index ab86f3e0..1d5d16ee 100644
index ab86f3e0..9323611e 100644
--- a/Silicon/NVIDIA/Application/L4TLauncher/L4TLauncher.c
+++ b/Silicon/NVIDIA/Application/L4TLauncher/L4TLauncher.c
@@ -1125,6 +1125,147 @@ CheckCommandString (
Expand Down Expand Up @@ -145,7 +145,7 @@ index ab86f3e0..1d5d16ee 100644
+ if (NULL != DtbName) {
+ DtbName += StrLen(L"custom_fdt_file=");
+ UnicodeSPrint(*CustomFdtName, MAX_DTB_PATH_LEN, L"boot\\%s\0", DtbName);
+ Print(L"Selected dtb name is %s:\n", CustomFdtName);
+ Print(L"Selected dtb name is %s\n", *CustomFdtName);
+ Status = CheckDtbExists(DeviceHandle, BootChain, BalenaOSRootFs, *CustomFdtName);
+
+ if (EFI_ERROR(Status)) {
Expand All @@ -155,16 +155,16 @@ index ab86f3e0..1d5d16ee 100644
+ }
+ }
+
+ if (FileHandle != NULL) {
+ FileHandleClose (FileHandle);
+ }
+
+ if (FileLine != NULL) {
+ FreePool (FileLine);
+ FileLine = NULL;
+ }
+ }
+
+ if (FileHandle != NULL) {
+ FileHandleClose (FileHandle);
+ }
+
+ return EFI_SUCCESS;
+}
+
Expand Down Expand Up @@ -391,10 +391,6 @@ index ab86f3e0..1d5d16ee 100644
+ if (StrStr(CleanLine, L"bootcount=")) {
+ *BootCountValue = StrDecimalToUintn(CleanLine + 10);
+ Print(L"%a: BootCount is %d\r\n", __FUNCTION__, *BootCountValue);
+
+ if (FileHandle != NULL) {
+ FileHandleClose (FileHandle);
+ }
+ }
+
+ if (FileLine != NULL) {
Expand All @@ -406,6 +402,9 @@ index ab86f3e0..1d5d16ee 100644
+ if (EFI_ERROR (Status)) {
+ ErrorPrint (L"%a: Failed to write bootcount file value %d\r\n", __FUNCTION__, *BootCountValue);
+ }
+ if (FileHandle != NULL) {
+ FileHandleClose (FileHandle);
+ }
+
+ return Status;
+ }
Expand Down Expand Up @@ -550,16 +549,17 @@ index ab86f3e0..1d5d16ee 100644
+ ErrorPrint(L"%a: Running on fallback slot %u\r\n", __FUNCTION__, BootChain);
+ *IsRunningUpdatedSlot = FALSE;
+ }
+
+ if (FileHandle != NULL) {
+ FileHandleClose (FileHandle);
+ }
+ }
+
+ if (FileLine != NULL) {
+ FreePool (FileLine);
+ FileLine = NULL;
+ }
+
+ if (FileHandle != NULL) {
+ FileHandleClose (FileHandle);
+ }
+
+ return Status;
+ }
+ }
Expand Down
Loading

0 comments on commit 69729e7

Please sign in to comment.