From 549612d07a18add36e665ff48f094076c9653eaf Mon Sep 17 00:00:00 2001 From: Andrei Cherechesu Date: Thu, 30 Jun 2022 17:00:26 +0300 Subject: scripts: Add support for prepending path to file names Added support for prepending path to file names in the final generated u-boot script, for the use-case where we have the files in a separate folder that can be accessed with a given $LOAD_CMD. For example, we can have "fatload mmc 0:2" as LOAD_CMD but the files would need to be loaded from the /boot folder within the 2nd partition, not from the root ("/"). By specifying the "-p " parameter when running the script, paths like "/boot" can be automatically prepended to the generated u-boot commands used to load the files in board's memory. Also added the support to disk_image script, to enable generating a FAT partition with the binaries deployed in a custom folder within it, if the "-p" parameter is specified. Signed-off-by: Andrei Cherechesu Reviewed-by: Stefano Stabellini --- scripts/uboot-script-gen | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'scripts/uboot-script-gen') diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index 085e29f..8f08cd6 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -316,7 +316,7 @@ function load_file() then echo "imxtract \$fit_addr $fit_scr_name $memaddr" >> $UBOOT_SOURCE else - echo "$LOAD_CMD $memaddr $relative_path" >> $UBOOT_SOURCE + echo "$LOAD_CMD $memaddr ${prepend_path:+$prepend_path/}$relative_path" >> $UBOOT_SOURCE fi add_size $filename } @@ -891,7 +891,7 @@ function print_help { script=`basename "$0"` echo "usage:" - echo " $script -c CONFIG_FILE -d DIRECTORY [-t LOAD_CMD] [-o FILE] [-k KEY_DIR/HINT [-u U-BOOT_DTB]] [-e] [-f]" + echo " $script -c CONFIG_FILE -d DIRECTORY [-t LOAD_CMD] [-o FILE] [-k KEY_DIR/HINT [-u U-BOOT_DTB]] [-e] [-f] [-p PREPEND_PATH]" echo " $script -h" echo "where:" echo " CONFIG_FILE - configuration file" @@ -907,6 +907,7 @@ function print_help echo " HINT - the file name of the crt and key file minus the suffix (ex, hint.crt and hint.key)" echo " U-BOOT_DTB - u-boot control dtb so that the public key gets added to it" echo " -f - enable generating a FIT image" + echo " PREPEND_PATH - path to be appended before file names to match deploy location within rootfs" echo " -h - prints out the help message and exits " echo "Defaults:" echo " CONFIG_FILE=$cfg_file, UBOOT_TYPE=\"LOAD_CMD\" env var, DIRECTORY=$uboot_dir" @@ -914,7 +915,7 @@ function print_help echo " $script -c ../config -d ./build42 -t \"scsi load 1:1\"" } -while getopts ":c:t:d:ho:k:u:f" opt; do +while getopts ":c:t:d:ho:k:u:fp:" opt; do case ${opt} in t ) case $OPTARG in @@ -953,6 +954,9 @@ while getopts ":c:t:d:ho:k:u:f" opt; do f ) fit_opt=y ;; + p ) + prepend_path="$OPTARG" + ;; h ) print_help exit 0 @@ -1179,5 +1183,5 @@ then echo "$LOAD_CMD $fit_addr $FIT; source $fit_addr:boot_scr" else echo "Generated uboot script $UBOOT_SCRIPT, to be loaded at address $uboot_addr:" - echo "$LOAD_CMD $uboot_addr $UBOOT_SCRIPT; source $uboot_addr" + echo "$LOAD_CMD $uboot_addr ${prepend_path:+$prepend_path/}$UBOOT_SCRIPT; source $uboot_addr" fi -- cgit v1.2.3