summaryrefslogtreecommitdiffstats
path: root/mod-extra-sign.sh
blob: a4b2c8cf702997d1e2c1fcaafb20cd301a0f4cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /bin/bash

# We need to sign modules we've moved from <path>/kernel/ to <path>/extra/
# during mod-extra processing by hand.  The 'modules_sign' Kbuild target can
# "handle" out-of-tree modules, but it does that by not signing them.  Plus,
# the modules we've moved aren't actually out-of-tree.  We've just shifted
# them to a different location behind Kbuild's back because we are mean.

# 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`

    sh ./scripts/sign-file ${MODSECKEY} ${MODPUBKEY} ${dir}/${file} \
       ${dir}/${file}.signed
    mv ${dir}/${file}.signed ${dir}/${file}
    rm -f ${dir}/${file}.{sig,dig}
done