mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-18 10:46:44 +00:00
sbin/insmod wrapper: Add TRACE and DEBUG traces
This commit is contained in:
parent
52947e2767
commit
51b1ad39c3
@ -4,10 +4,9 @@
|
|||||||
# The default PCR to be extended is 5, but can be
|
# The default PCR to be extended is 5, but can be
|
||||||
# overridden with the MODULE_PCR environment variable
|
# overridden with the MODULE_PCR environment variable
|
||||||
|
|
||||||
die() {
|
. /etc/functions
|
||||||
echo >&2 "$@"
|
|
||||||
exit 1
|
TRACE "Under insmod.sh"
|
||||||
}
|
|
||||||
|
|
||||||
MODULE="$1"; shift
|
MODULE="$1"; shift
|
||||||
|
|
||||||
@ -31,18 +30,22 @@ if [ ! -r /sys/class/tpm/tpm0/pcrs -o ! -x /bin/tpm ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$tpm_missing" ]; then
|
if [ -z "$tpm_missing" ]; then
|
||||||
|
DEBUG "Extending PCR $MODULE_PCR with $MODULE"
|
||||||
tpmr extend -ix "$MODULE_PCR" -if "$MODULE" \
|
tpmr extend -ix "$MODULE_PCR" -if "$MODULE" \
|
||||||
|| die "$MODULE: tpm extend failed"
|
|| die "$MODULE: tpm extend failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$*" -a -z "$tpm_missing" ]; then
|
if [ ! -z "$*" -a -z "$tpm_missing" ]; then
|
||||||
|
DEBUG "Extending PCR $MODULE_PCR with $*"
|
||||||
TMPFILE=/tmp/insmod.$$
|
TMPFILE=/tmp/insmod.$$
|
||||||
echo "$@" > $TMPFILE
|
echo "$@" > $TMPFILE
|
||||||
|
DEBUG "Extending PCR $MODULE_PCR with $TMPFILE"
|
||||||
tpmr extend -ix "$MODULE_PCR" -if $TMPFILE \
|
tpmr extend -ix "$MODULE_PCR" -if $TMPFILE \
|
||||||
|| die "$MODULE: tpm extend on arguments failed"
|
|| die "$MODULE: tpm extend on arguments failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Since we have replaced the real insmod, we must invoke
|
# Since we have replaced the real insmod, we must invoke
|
||||||
# the busybox insmod via the original executable
|
# the busybox insmod via the original executable
|
||||||
|
DEBUG "Loading $MODULE with busybox insmod"
|
||||||
busybox insmod "$MODULE" "$@" \
|
busybox insmod "$MODULE" "$@" \
|
||||||
|| die "$MODULE: insmod failed"
|
|| die "$MODULE: insmod failed"
|
||||||
|
Loading…
Reference in New Issue
Block a user