summaryrefslogtreecommitdiff
path: root/kflash.sh
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-09-02 05:11:10 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-09-02 16:38:12 +0300
commitdb1fa470e1af84145ae22411cc35b7a7cccbe965 (patch)
tree519920d6c00efe1ade8c5413539256a9d00f58fe /kflash.sh
parent0f562883509ddaf1cd66d89f36361262b3bd3f83 (diff)
Support overriding the image file name
Add support for overriding the image file name, using the same mechanism as for DTB files. The 'image' parameter can specify both the image make target and image destination file name, separated by a ':'. If no ':' is found, the image make target is used as the image destination file name. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'kflash.sh')
-rwxr-xr-xkflash.sh24
1 files changed, 19 insertions, 5 deletions
diff --git a/kflash.sh b/kflash.sh
index 448006f..a83e84c 100755
--- a/kflash.sh
+++ b/kflash.sh
@@ -106,13 +106,27 @@ esac
target_dir=${target_dir:-${target_root[$arch]}}
tftp_dir=${tftp_dir:-$tftp_root/$platform}
-if [[ -r "$kbuild_root/images/$image.sh" ]] ; then
- source "${kbuild_root}/images/$image.sh" || exit 1
- eval make_${image}_image
+#
+# Determine the image source and destination file names
+#
+
+_image_type=${image/:*/}
+
+if [[ -r "$kbuild_root/images/${_image_type}.sh" ]] ; then
+ source "${kbuild_root}/images/${_image_type}.sh" || exit 1
+ eval make_${_image_type}_image
else
- image_file=$output_dir/arch/$arch/boot/$image
+ _image_file=${_image_type}
fi
+if echo "${image}" | grep -q ':' ; then
+ _image_name=${image/*:/}
+else
+ _image_name=${_image_file}
+fi
+
+_image_file="$output_dir/arch/$arch/boot/${_image_file}"
+
#
# Validate the partition names and paths
#
@@ -316,7 +330,7 @@ for part_name in ${partitions[@]} ; do
$flash_cmd "${dev}${part_idx}" "${part_path}/${_dtb_dst}" "${_dtb_src}"
;;
kernel)
- $flash_cmd "${dev}${part_idx}" "${part_path}/" "${image_file}"
+ $flash_cmd "${dev}${part_idx}" "${part_path}/${_image_name}" "${_image_file}"
;;
modules)
$flash_cmd "${dev}${part_idx}" "${part_path}/" "${mod_path}"