aboutsummaryrefslogtreecommitdiff
path: root/scripts/uboot-script-gen
diff options
context:
space:
mode:
authorBrian Woods2021-07-19 15:28:28 -0700
committerStefano Stabellini2021-07-19 17:08:00 -0700
commit4fc035694cdd5b57e73c148654d3cb991ecf9014 (patch)
tree0acd1e1ab8b3cf68f5c047e674648b90f1d534e1 /scripts/uboot-script-gen
parent2845ebb71c017cac08563c953bca26e48daa17e2 (diff)
Add support for device tree overlays
Device tree overlaps support in u-boot means that adding overlay support at boot time is easy. Simply loading the files via tftp/scsi/fit etc and then applying the overlays before the normal imagebuilder fdt edits at boot time allows for applying overlays without changing the device tree files. Signed-off-by: Brian Woods <brian.woods@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Diffstat (limited to 'scripts/uboot-script-gen')
-rwxr-xr-xscripts/uboot-script-gen51
1 files changed, 50 insertions, 1 deletions
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index 2fad339..de7f00f 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -111,6 +111,16 @@ function device_tree_editing()
then
echo "fdt addr $device_tree_addr" >> $UBOOT_SOURCE
echo "fdt resize 1024" >> $UBOOT_SOURCE
+
+ if test $NUM_DT_OVERLAY && test $NUM_DT_OVERLAY -gt 0
+ then
+ i=0
+ while test $i -lt $NUM_DT_OVERLAY
+ do
+ echo "fdt apply ${dt_overlay_addr[$i]}" >> $UBOOT_SOURCE
+ i=$(( $i + 1 ))
+ done
+ fi
fi
dt_set "/chosen" "\#address-cells" "hex" "0x2"
dt_set "/chosen" "\#size-cells" "hex" "0x2"
@@ -515,6 +525,23 @@ do
i=$(( $i + 1 ))
done
+if test $NUM_DT_OVERLAY && test $NUM_DT_OVERLAY -gt 0
+then
+ i=0
+ while test $i -lt $NUM_DT_OVERLAY
+ do
+ if [ ! -f "${DT_OVERLAY[$i]}" ]
+ then
+ echo "Can not find ${DT_OVERLAY[$i]}, exiting"
+ cleanup_and_return_err
+ fi
+ check_file_type "${DT_OVERLAY[$i]}" "Device Tree Blob"
+ dt_overlay_addr[$i]=$memaddr
+ load_file "${DT_OVERLAY[$i]}" "host_fdto${i}"
+ i=$(( $i + 1 ))
+ done
+fi
+
check_file_type $DEVICE_TREE "Device Tree Blob"
device_tree_addr=$memaddr
load_file $DEVICE_TREE "host_fdt"
@@ -642,6 +669,28 @@ then
fi
i=$(( $i + 1 ))
done
+ fdt_line="fdt = \"host_fdt\""
+ if test $NUM_DT_OVERLAY && test $NUM_DT_OVERLAY -gt 0
+ then
+ i=0
+ while test $i -lt $NUM_DT_OVERLAY
+ do
+ cat >> "$its_file" <<- EOF
+ host_fdto${i} {
+ description = "host fdt overlay ${i}";
+ data = /incbin/("${DT_OVERLAY[$i]}");
+ type = "flat_dt";
+ arch = "arm64";
+ compression = "none";
+ load = <${dt_overlay_addr[$i]}>;
+ $fit_algo
+ };
+ EOF
+ fdt_line+=", \"host_fdto${i}\""
+ i=$(( $i + 1 ))
+ done
+ fi
+ fdt_line+=";"
# script for fit
if test "$LOAD_CMD" = "imxtract"
then
@@ -666,7 +715,7 @@ then
config {
description = "Xen";
kernel = "host_xen";
- fdt = "host_fdt";
+ $fdt_line
loadables = $load_files;
};
};