  if load ${devtype} ${devnum}:${distro_bootpart} ${a_script} uEnv.txt ; then
      env import -t ${a_script} ${filesize}
  fi
-@@ -124,13 +132,12 @@ fi
+ setenv bootargs ${bootargs} console=${console},115200 vmalloc=400M consoleblank=0 rootwait fixrtc cpu=${imx_cpu} board=${board}
+ 
+-if load ${devtype} ${devnum}:${distro_bootpart} ${a_fdt} ${prefix}${fdt_file} ; then
++if load ${devtype} ${devnum}:${resin_root_part} ${a_fdt} boot/${fdt_file} ; then
+ 	fdt addr ${a_fdt}
+ 	setenv fdt_high 0xffffffff
++elif load ${devtype} ${devnum}:${resin_boot_part} ${a_fdt} ${fdt_file} ; then
++        echo "Did not find dtb in root filesystem, loaded it from boot partition"
++        fdt addr ${a_fdt}
++        setenv fdt_high 0xffffffff
+ else
+ 	echo "!!!! Error loading ${prefix}${fdt_file}";
+ 	exit;
+@@ -114,13 +126,12 @@ fi
  if itest.s "x" == "x${bpart}" ; then
  	bpart=2
  fi

 
 if itest.s "x" != "x${disable_msi}" ; then
 	setenv bootargs ${bootargs} pci=nomsi
@@ -174,7 +181,20 @@ if itest.s "x" != "x${show_env}" ; then
 	printenv
 fi
 

From b2984225004e46e73d6d31b1580cacd6bd2180dc Mon Sep 17 00:00:00 2001
From: Alexandru Costache <alexandru@balena.io>
Date: Thu, 15 Apr 2021 11:14:56 +0200
Subject: [PATCH] bootscript-n8mm-dwe: Integrate with BalenaOS

Upstream-status: Inappropriate [configuration]
Signed-off-by: Alexandru Costache <alexandru@balena.io>
---
 .../boundary/bootscripts/bootscript-yocto.txt | 40 +++++++++++++++----
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/board/boundary/bootscripts/bootscript-yocto.txt b/board/boundary/bootscripts/bootscript-yocto.txt
index 8ce490745f..54667f06fa 100644
--- a/board/boundary/bootscripts/bootscript-yocto.txt
+++ b/board/boundary/bootscripts/bootscript-yocto.txt
@@ -68,14 +68,26 @@ if itest.s x${distro_bootpart} == x ; then
 	distro_bootpart=1
 fi
 
