gpt4 book ai didi

编译内核模块 - 需要什么包

转载 作者:太空宇宙 更新时间:2023-11-04 06:54:19 25 4
gpt4 key购买 nike

直到现在,当我编译内核模块时,我安装了:kernel-devel、kernel-headers。
后来,我不得不包括内核源代码。
所以现在我为了编译我的内核模块而安装的包是:kernel-devel、kernel-headers 和 kernel.src.rpm(内核源代码)。
我正在创建一个“构建机器”,它将检查可用的最新内核、下载必要的包并为该内核编译内核模块。
我不想安装这个包,只是想下载它,然后将文件复制到它们的位置(下载 kernel.src.rpm、rpm2cpio、cpio,然后复制到/lib/modules/kernel-X-Y/)我注意到如果安装了内核 src,则不需要内核头文件。

kernel-devel is needed ??,我不确定是否需要,当尝试在没有 kernel-devel 的情况下安装时,我得到以下异常:

make[2]: Entering directory `/usr/src/kernels/3.10.0-693.el7.x86_64'

ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.

我错过了什么?如果我安装 kernel-devel,那么我不会得到这个异常,我不想安装 kernel-devel。

最佳答案

在运行 make 编译内核之前,您需要运行 make oldconfig 或将 .config 文件复制到构建树中。 make oldconfig 将使用 .config 并将其更新到较新的内核。

您还有其他选择:

一个简单的make help | grep -i config 在内核源码目录下显示:

Configuration targets:
config - Update current config utilising a line-oriented program
nconfig - Update current config utilising a ncurses menu based
menuconfig - Update current config utilising a menu based program
xconfig - Update current config utilising a Qt based front-end
gconfig - Update current config utilising a GTK+ based front-end
oldconfig - Update current config utilising a provided .config as base
localmodconfig - Update current config disabling modules not loaded
localyesconfig - Update current config converting local mods to core
silentoldconfig - Same as oldconfig, but quietly, additionally update deps
defconfig - New config with default from ARCH supplied defconfig
savedefconfig - Save current config as ./defconfig (minimal config)
allnoconfig - New config where all options are answered with no
allyesconfig - New config where all options are accepted with yes
allmodconfig - New config selecting modules when possible
alldefconfig - New config with all symbols set to default
randconfig - New config with random answer to all options
listnewconfig - List new options
olddefconfig - Same as silentoldconfig but sets new symbols to their
kvmconfig - Enable additional options for kvm guest kernel support
xenconfig - Enable additional options for xen dom0 and guest kernel support
tinyconfig - Configure the tiniest possible kernel
kselftest-merge - Merge all the config dependencies of kselftest to existing
.config.
configuration. This is e.g. useful to build with nit-picking config.
i386_defconfig - Build for i386
x86_64_defconfig - Build for x86_64
make O=dir [targets] Locate all output files in "dir", including .config

关于编译内核模块 - 需要什么包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47051402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com