scripts: fit: validate image type of source file

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id04a4ef397fe19ffac3f09daeea6c5ebc9294dcd
This commit is contained in:
Joseph Chen 2020-12-31 18:13:41 +08:00
parent 993c3b78b3
commit e156df4354
4 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,9 @@ function args_process()
if [ ! -f ${IMG} ]; then if [ ! -f ${IMG} ]; then
echo "ERROR: No ${IMG}" echo "ERROR: No ${IMG}"
exit 1 exit 1
elif ! file ${IMG} | grep 'Device Tree Blob' ; then
echo "ERROR: ${IMG} is not FIT image"
exit 1
fi fi
} }

View File

@ -48,6 +48,9 @@ function fit_repack()
if [ ! -f ${IMAGE} ]; then if [ ! -f ${IMAGE} ]; then
echo "ERROR: No ${IMAGE}" echo "ERROR: No ${IMAGE}"
exit 1 exit 1
elif ! file ${IMAGE} | grep 'Device Tree Blob' ; then
echo "ERROR: ${IMAGE} is not FIT image"
exit 1
elif [ ! -d ${DATA} ]; then elif [ ! -d ${DATA} ]; then
echo "ERROR: No input directory ${DATA}" echo "ERROR: No input directory ${DATA}"
exit 1 exit 1

View File

@ -51,6 +51,9 @@ function fit_resign()
if [ ! -f ${ITB} ]; then if [ ! -f ${ITB} ]; then
echo "ERROR: No ${ITB}" echo "ERROR: No ${ITB}"
exit 1 exit 1
elif ! file ${ITB} | grep 'Device Tree Blob' ; then
echo "ERROR: ${ITB} is not FIT image"
exit 1
elif [ ! -f ${SIG} ]; then elif [ ! -f ${SIG} ]; then
echo "ERROR: No ${SIG}" echo "ERROR: No ${SIG}"
exit 1 exit 1

View File

@ -41,6 +41,9 @@ function args_process()
if [ ! -f ${ITB} ]; then if [ ! -f ${ITB} ]; then
echo "ERROR: No ${ITB}" echo "ERROR: No ${ITB}"
exit 1 exit 1
elif ! file ${ITB} | grep 'Device Tree Blob' ; then
echo "ERROR: ${ITB} is not FIT image"
exit 1
fi fi
if [ -z ${OUT} ]; then if [ -z ${OUT} ]; then