aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL/tools/scripts_yocto/mksdcard
diff options
context:
space:
mode:
Diffstat (limited to 'INSTALL/tools/scripts_yocto/mksdcard')
-rwxr-xr-xINSTALL/tools/scripts_yocto/mksdcard17
1 files changed, 12 insertions, 5 deletions
diff --git a/INSTALL/tools/scripts_yocto/mksdcard b/INSTALL/tools/scripts_yocto/mksdcard
index 306ec87..c895f3d 100755
--- a/INSTALL/tools/scripts_yocto/mksdcard
+++ b/INSTALL/tools/scripts_yocto/mksdcard
@@ -19,22 +19,29 @@
set -e
usage() {
- echo "Usage: $0 <image .rootfs.tar.bz2> <output image file or dir> [size in GB]" >&2
+ echo "Usage: $0 <image.rootfs.tar.*> [output_file_or_dir [size_in_GB]]" >&2
echo "<image tarball> is usually located in \$builddir/tmp/deploy/images" >&2
exit 1
}
IMGTAR=$1
-[[ ! -f $IMGTAR ]] && { echo "Invalid image archive" >&2; usage; }
+[[ ! -f $IMGTAR ]] && { echo "Image file not found." >&2; usage; }
-OUTPUT=$2
+if [[ $IMGTAR =~ ^.*\.(rootfs.tar\..*)$ ]]; then
+ ext=${BASH_REMATCH[1]}
+ IMGBASE=$(basename $IMGTAR .$ext)
+else
+ echo "Invalid image archive (not a tarball?)" >&2; usage;
+fi
+
+OUTPUT=${2:-.}
if [[ -z $OUTPUT ]]; then
echo "Invalid output file/dir." >&2
usage
elif [[ -d $OUTPUT ]]; then
# output is a dir, use input file for name
- OUTPUT=$OUTPUT/$(basename $IMGTAR .rootfs.tar.bz2).raw
+ OUTPUT=$OUTPUT/$IMGBASE.raw
fi
@@ -76,7 +83,7 @@ make_image() {
sudo mkdir $tmpd
sudo mount $loop $tmpd
echo "Extracting image tarball..."
- sudo tar pjxf $imgtar -C $tmpd --xattrs-include='*'
+ sudo tar pxf $imgtar -C $tmpd --xattrs-include='*'
echo "Detected machine $machine"
case $machine in
porter)