centos6.5编译内核key.h: No such file or directory

crypto/signature/ksign-publickey.c:2:17: error: key.h: No such file or directory
crypto/signature/ksign-publickey.c: In function ‘ksign_init’:
crypto/signature/ksign-publickey.c:10: error: ‘ksign_def_public_key’ undeclared (first use in this function)
crypto/signature/ksign-publickey.c:10: error: (Each undeclared identifier is reported only once
crypto/signature/ksign-publickey.c:10: error: for each function it appears in.)
crypto/signature/ksign-publickey.c:11: error: ‘ksign_def_public_key_size’ undeclared (first use in this function)
make[2]: *** [crypto/signature/ksign-publickey.o] Error 1
make[1]: *** [crypto/signature] Error 2
make: *** [crypto] Error 2

解决方案:

Documentation/module-signing.txt

1.产生更过的随机数据:rngd -r /dev/urandom
2.生成genkey文件,展示了生成key的规则

%pubring kernel.pub
%secring kernel.sec
Key-Type: DSA
Key-Length: 1024
Name-Real: Red Hat, Inc.
Name-Comment: Kernel Module GPG key
%commit

3.生成bin2c程序,将二进制程序转化成c头文件表示

scripts/bin2c //gcc不识别 -m elf_x86_64,手动编译:gcc scripts/bin2c.c   -o scripts/bin2c
gcc   -m elf_x86_64  scripts/bin2c.c   -o scripts/bin2c
cc1: error: unrecognized command line option "-m"

4.生成key.h

gpg --homedir . --batch --gen-key genkey
gpg --homedir . --export --keyring kernel.pub keyname |scripts/bin2c ksign_def_public_key __initdata >crypto/signature/key.h
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页