Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 编译内核模块-需要哪些包_C_Makefile_Linux Kernel_Kernel Module - Fatal编程技术网

C 编译内核模块-需要哪些包

C 编译内核模块-需要哪些包,c,makefile,linux-kernel,kernel-module,C,Makefile,Linux Kernel,Kernel Module,直到现在,当我编译内核模块时,我安装了:kernel-devel,kernel-headers。 后来,我不得不加入内核源代码。 因此,现在我为编译内核模块而安装的软件包有:kernel-devel、kernel-header和kernel.src.rpm(内核源代码)。 我正在创建一个“构建机器”,它将检查可用的最新内核,下载必要的软件包并编译该内核的内核模块。 我不想安装这个包,只想下载它,然后将文件复制到它们的位置(下载kernel.src.rpm、rpm2cpio、cpio,然后复制到/

直到现在,当我编译内核模块时,我安装了:kernel-devel,kernel-headers。
后来,我不得不加入内核源代码。
因此,现在我为编译内核模块而安装的软件包有:kernel-devel、kernel-header和kernel.src.rpm(内核源代码)。

我正在创建一个“构建机器”,它将检查可用的最新内核,下载必要的软件包并编译该内核的内核模块。
我不想安装这个包,只想下载它,然后将文件复制到它们的位置(下载kernel.src.rpm、rpm2cpio、cpio,然后复制到/lib/modules/kernel-X-Y/) 我注意到,如果安装了内核src,就不需要内核头

需要kernel-devel???,我不确定是否需要,当尝试在没有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文件复制到构建树中
makeoldconfig
然后将使用.config并将其更新到较新的内核

您还有其他选择:

内核源目录中的一个简单的
makehelp | 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

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

您还有其他选择:

内核源目录中的一个简单的
makehelp | 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

“我正在创建一个“构建机器”,它将检查可用的最新内核,下载必要的包并编译该内核的内核模块。”--你不是下载源代码,只是做一个make吗?我的意思是应该配置构建树当使用yum安装kernel或kernel-devel时,它是否编译构建树?您是否确实阅读了错误消息??它会告诉你出了什么问题。@AhmedMasud,错误信息并不总是正确的。例如,这两个文件对我来说都存在。@Russue如果您有确切的错误消息,但它不起作用,则表示您的生成已中断。。。从
make mrproperty
开始,然后重试“Im正在创建一个“构建机器”,该机器将检查可用的最新内核,下载必要的包,并编译该内核的内核模块。”--您不是下载源代码,只是做一个make吗?我的意思是应该配置构建树当使用yum安装kernel或kernel-devel时,它是否编译构建树?您是否确实阅读了错误消息??它会告诉你出了什么问题。@AhmedMasud,错误信息并不总是正确的。例如,这两个文件对我来说都存在。@Russue如果您有确切的错误消息,但它不起作用,则表示您的生成已中断。。。从
使mr正确开始
,然后重试