diff options
-rw-r--r-- | images/CrOS.sh | 2 | ||||
-rw-r--r-- | images/FIT.sh | 2 | ||||
-rw-r--r-- | images/srec.sh | 2 | ||||
-rw-r--r-- | images/uImage.sh | 2 | ||||
-rwxr-xr-x | kbuild.sh | 28 | ||||
-rwxr-xr-x | kflash.sh | 24 |
6 files changed, 42 insertions, 18 deletions
diff --git a/images/CrOS.sh b/images/CrOS.sh index b79e9a4..2f607ef 100644 --- a/images/CrOS.sh +++ b/images/CrOS.sh @@ -45,4 +45,4 @@ make_CrOS_image() { --bootloader $bootloader } -image_file=$output_dir/arch/$arch/boot/vmlinuz.image +_image_file=vmlinuz.image diff --git a/images/FIT.sh b/images/FIT.sh index f42ff2b..e297501 100644 --- a/images/FIT.sh +++ b/images/FIT.sh @@ -90,4 +90,4 @@ EOF PATH="$output_dir/scripts/dtc:$PATH" mkimage -f $kernel_its ${kernel_its/its/itb} } -image_file=$output_dir/arch/$arch/boot/kernel_fdt.itb +_image_file=kernel_fdt.itb diff --git a/images/srec.sh b/images/srec.sh index e0528d3..282567c 100644 --- a/images/srec.sh +++ b/images/srec.sh @@ -15,4 +15,4 @@ make_srec_image() { done } -image_file=$output_dir/arch/$arch/boot/$image_kernel.xz.srec +_image_file=$image_kernel.xz.srec diff --git a/images/uImage.sh b/images/uImage.sh index 45cb581..ca0ec4e 100644 --- a/images/uImage.sh +++ b/images/uImage.sh @@ -6,4 +6,4 @@ make_uImage_image() { $output_dir/arch/$arch/boot/uImage } -image_file=$output_dir/arch/$arch/boot/uImage +_image_file=uImage @@ -204,13 +204,23 @@ version=$(cat $output_dir/include/generated/utsrelease.h | cut -d '"' -f 2) # Create the image # -if [[ -r "$kbuild_root/images/$image.sh" ]] ; then - source "${kbuild_root}/images/$image.sh" || exit 1 - eval make_${image}_image +_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}" + # # Copy the files to their destination directories. # @@ -229,7 +239,7 @@ copy_dtbs() { local dest_dir=$1 local dtb - if [[ $image == FIT || $image == CrOS ]] ; then + if [[ $_image_type == FIT || $_image_type == CrOS ]] ; then return fi @@ -244,12 +254,12 @@ copy_dtbs() { if [[ -d "$target_dir" ]] ; then mkdir -p $target_dir/boot - cp $image_file $target_dir/boot/ + cp ${_image_file} $target_dir/boot/${_image_name} copy_dtbs $target_dir/boot/ fi -if [[ $image != CrOS && -d "$tftp_dir" ]] ; then - cp $image_file $tftp_dir/ +if [[ $_image_type != CrOS && -d "$tftp_dir" ]] ; then + cp ${_image_file} $tftp_dir/${_image_name} copy_dtbs $tftp_dir/ fi @@ -271,7 +281,7 @@ fi # Print status and terminate # -echo "Kernel image available in $image_file" +echo "Kernel image available in ${_image_file}" if [[ x$modules == xmodules ]] ; then echo "Kernel modules installed to $mod_path/lib/modules/$version" fi @@ -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}" |