scripts: checkpatch: Add fw version check

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8dc4527cdf4a465a88f384453857257945333ee8
This commit is contained in:
Joseph Chen
2023-09-14 10:29:50 +00:00
parent 8350c61125
commit 6143b15b05

View File

@@ -408,6 +408,32 @@ function check_mode()
fi fi
} }
function check_version()
{
echo "Checking fwver..."
git whatchanged -1 --name-only | sed -n '/bin\//p' | sed -n '/ddr/p; /tpl/p; /spl/p; /bl31/p; /bl32/p; /tee/p;' | while read FILE; do
if ! test -f ${FILE}; then
continue
fi
NAME_VER=`echo ${FILE} | grep -o 'v[0-9].[0-9][0-9]'`
# ignore version < v1.00
if [[ "${NAME_VER}" == *v0.* ]]; then
continue
fi
if ! strings ${FILE} | grep -q 'fwver: ' ; then
echo "ERROR: ${FILE}: No \"fwver: \" string found in binary"
exit 1
fi
FW_VER=`strings ${FILE} | grep -o 'fwver: v[1-9].[0-9][0-9]' | awk '{ print $2 }'`
if [ "${NAME_VER}" != "${FW_VER}" ] ; then
echo "ERROR: ${FILE}: file version is ${NAME_VER}, but fw version is ${FW_VER}."
exit 1
fi
done
}
function finish() function finish()
{ {
echo "OK, everything is nice." echo "OK, everything is nice."
@@ -415,6 +441,7 @@ function finish()
} }
check_mode check_mode
check_version
check_docs check_docs
check_dirty check_dirty
check_stripped check_stripped