diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index 20c21911d6..3ea148145f 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -28,8 +28,9 @@ if [ $# -lt 2 ]; then exit 1 fi -BOOT_DESC_FILE="${1}/boot.desc" -IMAGE="${1}/${2}" +IMAGE_DIR="$(readlink -f "${1}")" +BOOT_DESC_FILE="${IMAGE_DIR}/boot.desc" +IMAGE="${IMAGE_DIR}/${2}" shift shift FLAG_OVERRIDES="${@}" @@ -233,6 +234,16 @@ make_image_bootable() { -s "${FLAGS_statefulfs_mountpoint}" } +# Use default of current image location if the output dir doesn't exist. +if [ ! -d ${FLAGS_output_dir} ]; then + warn "Output dir not found, using ${IMAGE_DIR}." + FLAGS_output_dir="${IMAGE_DIR}" + FLAGS_rootfs_hash="${IMAGE_DIR}/rootfs.hash" + FLAGS_rootfs_mountpoint="${IMAGE_DIR}/rootfs_dir" + FLAGS_statefulfs_mountpoint="${IMAGE_DIR}/stateful_dir" + FLAGS_espfs_mountpoint="${IMAGE_DIR}/esp" +fi + # Create the directories if they don't exist. mkdir -p ${FLAGS_rootfs_mountpoint} mkdir -p ${FLAGS_statefulfs_mountpoint}