diff options
author | 2017-07-03 13:18:27 +0200 | |
---|---|---|
committer | 2017-07-03 13:18:27 +0200 | |
commit | 3f146116ccbff725996f32d839a28f6079bcb7c5 (patch) | |
tree | aeb7649592c4829296eec08d5cf28df48330c9be /INSTALL | |
parent | 60e7878695d9c72a6e3cfc52f880aa32530a2de7 (diff) |
tools/scripts_yocto: fix mksdcard for newer archive format
The patch [9813](https://gerrit.automotivelinux.org/gerrit/#/c/9813/) enforces the same
IMAGE_FSTYPES for all boards on AGL. As a consequence, the script mksdcard needs some
adjustments to handle the newest tarball format.
Bug-AGL: SPEC-492
Change-Id: Ifc63f5cd689d033ae702e79343819bf2620c229c
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'INSTALL')
-rwxr-xr-x | INSTALL/tools/scripts_yocto/mksdcard | 17 |
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) |