加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
module-keygen.sh 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
nilusyi 提交于 2022-10-25 14:34 . init repo
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Default keygen
#
# We do nothing here, just check if CONFIG_MODULE_SIG_KEY is set to
# "certs/signing_key.pem", this is a special value for kernel config,
# Kbuild will automatically generate keys when this value is set.
KERNEL_UNAMER=$1
BUILD_DIR=$2
KCONFIG_FILE=$BUILD_DIR/.config
error() {
echo "module-keygen: error: $*" >&2
exit 1
}
if ! [[ -f $KCONFIG_FILE ]]; then
error "can't find a valid kernel config: $KCONFIG_FILE"
fi
if ! grep -q '^CONFIG_MODULES=y' "$KCONFIG_FILE"; then
echo "CONFIG_MODULES not enabled, quit. "
exit 0
fi
if ! grep -q '^CONFIG_MODULE_SIG=y' "$KCONFIG_FILE"; then
echo "CONFIG_MODULE_SIG not enabled, quit. "
exit 0
fi
if ! grep -q '^CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"' "$KCONFIG_FILE"; then
error "CONFIG_MODULE_SIG_KEY=\"certs/signing_key.pem\" is not defined, can't gen keys."
fi
# Don't use Kbuild's signing, use %%{_module_signer} instead, be compatible with debuginfo and compression
echo "module-keygen: Disabling CONFIG_MODULE_SIG_FORCE, siginig within temporary builtin key."
sed -i -e "s/^CONFIG_MODULE_SIG_FORCE.*/# CONFIG_MODULE_SIG_FORCE is not set/" "$KCONFIG_FILE"
echo "module-keygen: $KERNEL_UNAMER is using builtin keys."
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化