代码拉取完成,页面将自动刷新
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Default key-sign
#
# Just a wrapper for sign-file
#
# We depend on CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
# for the built-in keys.
KERNEL_UNAMER=$1
BUILD_DIR=$2
BASE_DIR=$3
KCONFIG_FILE=$BUILD_DIR/.config
MODULE_DIR=$BASE_DIR/lib/modules/$KERNEL_UNAMER
error() {
echo "module-signer: error: $*" >&2
}
if ! [[ -f $KCONFIG_FILE ]]; then
error "can't find a valid kernel config."
exit 1
fi
if ! grep -q '^CONFIG_MODULES=y' "$KCONFIG_FILE"; then
echo "CONFIG_MODULES=y is not defined in .config, skipping signing."
exit 0
fi
if ! grep -q '^CONFIG_MODULE_SIG=y' "$KCONFIG_FILE"; then
echo "CONFIG_MODULE_SIG=y is not defined in .config, skipping signing."
exit 0
fi
if ! [[ -x $BUILD_DIR/scripts/sign-file ]]; then
error "$BUILD_DIR/scripts/sign-file is not an executable file."
exit 1
fi
if ! grep -q '^CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"' "$KCONFIG_FILE"; then
error "CONFIG_MODULE_SIG_KEY is not defined in .config, can't gen keys."
exit 1
fi
echo "module-signer: Signing $KERNEL_UNAMER modules with builtin keys..."
PRIKEY="$BUILD_DIR/certs/signing_key.pem"
PUBKEY="$BUILD_DIR/certs/signing_key.x509"
if ! [[ -s $PRIKEY ]]; then
error "private key file doesn't exist: $PRIKEY"
exit 1
fi
if ! [[ -s $PUBKEY ]]; then
error "public key file doesn't exist: $PUBKEY"
exit 1
fi
JOB=$(nproc)
JOB=${JOB:-2}
export BUILD_DIR
export PRIKEY
export PUBKEY
# shellcheck disable=2016
find "$MODULE_DIR" -type f -name '*.ko' -print0 | xargs -0r -n 1 -P "$JOB" sh -c '
$BUILD_DIR/scripts/sign-file sha256 "$PRIKEY" "$PUBKEY" "$1"
rm -f $1.sig $1.dig
if [ "~Module signature appended~" != "$(tail -c 28 "$1")" ]; then
echo "module-signer: error: failed to sign $1."
exit 1
fi
' _ || exit $?
echo "module-signer: Signing $KERNEL_UNAMER done."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。