mkits: support definition of DTB loadaddr
authorDavid Bauer <mail@david-bauer.net>
Sun, 6 Nov 2022 23:42:40 +0000 (00:42 +0100)
committerDavid Bauer <mail@david-bauer.net>
Tue, 8 Nov 2022 11:16:36 +0000 (12:16 +0100)
Support defining a per-device loadaddress for the DTB. This is required
for devices which to not align the DTB from the bootloader correctly.

Signed-off-by: David Bauer <mail@david-bauer.net>
include/image-commands.mk
include/image.mk
scripts/mkits.sh

index 492e6933f1928767854c73b661ee9b8613fa7452..1f6ba1c15a47e983692a0a100721e4420476818a 100644 (file)
@@ -296,6 +296,7 @@ define Build/fit
                -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
                $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
                $(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \
+               $(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \
                $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \
                -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
                -A $(LINUX_KARCH) -v $(LINUX_VERSION)
index b3dfc9019aedbe4acebcbdff21f0ff237223f824..e9dc53f82ead22adf11425de2c016b1a8a4ea88d 100644 (file)
@@ -388,6 +388,7 @@ define Device/Init
   DEVICE_DTS_CONFIG :=
   DEVICE_DTS_DELIMITER :=
   DEVICE_DTS_DIR :=
+  DEVICE_DTS_LOADADDR :=
   DEVICE_DTS_OVERLAY :=
   DEVICE_FDT_NUM :=
   SOC :=
@@ -413,6 +414,7 @@ DEFAULT_DEVICE_VARS := \
   CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
   VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
   DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \
+  DEVICE_DTS_LOADADDR \
   DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
   SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
   UBOOT_PATH IMAGE_SIZE \
index 7bf5681addf097c40e60a93131e6836fdd37a193..58c879cd62da2d2133b10b6d7abf112ade97f8bb 100755 (executable)
@@ -35,6 +35,7 @@ usage() {
        printf "\n\t-l ==> legacy mode character (@ etc otherwise -)"
        printf "\n\t-o ==> create output file 'its_file'"
        printf "\n\t-O ==> create config with dt overlay 'name:dtb'"
+       printf "\n\t-s ==> set FDT load address to 'addr' (hex)"
        printf "\n\t\t(can be specified more than once)\n"
        exit 1
 }
@@ -48,7 +49,7 @@ LOADABLES=
 DTOVERLAY=
 DTADDR=
 
-while getopts ":A:a:c:C:D:d:e:f:i:k:l:n:o:O:v:r:H:" OPTION
+while getopts ":A:a:c:C:D:d:e:f:i:k:l:n:o:O:v:r:s:H:" OPTION
 do
        case $OPTION in
                A ) ARCH=$OPTARG;;
@@ -66,6 +67,7 @@ do
                o ) OUTPUT=$OPTARG;;
                O ) DTOVERLAY="$DTOVERLAY ${OPTARG}";;
                r ) ROOTFS=$OPTARG;;
+               s ) FDTADDR=$OPTARG;;
                H ) HASH=$OPTARG;;
                v ) VERSION=$OPTARG;;
                * ) echo "Invalid option passed to '$0' (options:$*)"
@@ -91,6 +93,10 @@ fi
        DTADDR=$(printf "0x%08x" $(($LOAD_ADDR - $dtbsize)) )
 }
 
+[ "$FDTADDR" ] && {
+       DTADDR="$FDTADDR"
+}
+
 # Conditionally create fdt information
 if [ -n "${DTB}" ]; then
        FDT_NODE="