mirror of
https://github.com/linuxboot/heads.git
synced 2025-03-01 11:41:36 +00:00
This is a step towards unifying the server and laptop config (issue #139) and also makes it possible to later remove the USB modules from the normal boot path.
30 lines
622 B
Bash
Executable File
30 lines
622 B
Bash
Executable File
#!/bin/sh
|
|
# extend a TPM PCR with a module and then load it
|
|
# any arguments will also be measured
|
|
|
|
die() {
|
|
echo >&2 "$@"
|
|
exit 1
|
|
}
|
|
|
|
INDEX="$1"; shift
|
|
MODULE="$1"; shift
|
|
|
|
if [ -z "$INDEX" -o -z "$MODULE" ]; then
|
|
die "Usage: $0 pcr-index module [args...]"
|
|
fi
|
|
|
|
if [ ! -r "$MODULE" ]; then
|
|
die "$MODULE: not found?"
|
|
fi
|
|
|
|
tpm extend -ix "$INDEX" -if "$MODULE" || die "$MODULE: tpm extend failed"
|
|
|
|
if [ ! -z "$@" ]; then
|
|
TMPFILE=/tmp/insmod.$$
|
|
echo "$@" > $TMPFILE
|
|
tpm extend -ix "$INDEX" -if $TMPFILE || die "$MODULE: tpm extend on arguments failed"
|
|
fi
|
|
|
|
insmod "$MODULE" "$@" || die "$MODULE: insmod failed"
|