2012-09-25 16:02:24 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2013-01-25 18:53:02 +00:00
|
|
|
# The modules_sign target checks for corresponding .o files for every .ko that
|
|
|
|
# is signed. This doesn't work for package builds which re-use the same build
|
|
|
|
# directory for every flavour, and the .config may change between flavours.
|
|
|
|
# So instead of using this script to just sign lib/modules/$KernelVer/extra,
|
|
|
|
# sign all .ko in the buildroot.
|
2012-09-25 16:02:24 +00:00
|
|
|
|
|
|
|
# This essentially duplicates the 'modules_sign' Kbuild target and runs the
|
|
|
|
# same commands for those modules.
|
|
|
|
|
|
|
|
moddir=$1
|
|
|
|
|
|
|
|
modules=`find $moddir -name *.ko`
|
|
|
|
|
|
|
|
MODSECKEY="./signing_key.priv"
|
|
|
|
MODPUBKEY="./signing_key.x509"
|
|
|
|
|
|
|
|
for mod in $modules
|
|
|
|
do
|
|
|
|
dir=`dirname $mod`
|
|
|
|
file=`basename $mod`
|
|
|
|
|
2013-02-26 13:40:33 +00:00
|
|
|
./scripts/sign-file sha256 ${MODSECKEY} ${MODPUBKEY} ${dir}/${file} \
|
2012-09-25 16:02:24 +00:00
|
|
|
${dir}/${file}.signed
|
|
|
|
mv ${dir}/${file}.signed ${dir}/${file}
|
|
|
|
rm -f ${dir}/${file}.{sig,dig}
|
|
|
|
done
|
2013-03-24 14:44:30 +00:00
|
|
|
|
|
|
|
RANDOMMOD=$(find $moddir -type f -name '*.ko' | sort -R | head -n 1)
|
|
|
|
if [ "~Module signature appended~" != "$(tail -c 28 $RANDOMMOD)" ]; then
|
|
|
|
echo "*****************************"
|
|
|
|
echo "*** Modules are unsigned! ***"
|
|
|
|
echo "*****************************"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|