/ lib / modules / * / build指向非现有文件

时间:2016-04-17 10:59:48

标签: linux

我有一个CentOS Linux版本7.2.1511(核心版)。

我想为当前运行的内核构建一些内核代码。

我的uname -r说class NameBuilder def build_name # builds name... end end class A def create_server options = { name: NameBuilder.new.build_name } do_some_operations(options) end def do_some_operations(options) # does some operations end end RSpec.describe A do let(:a) { described_class.new } describe '#create_server' do let(:name_builder) { instance_double(NameBuilder) } before do allow(NameBuilder).to receive(:new).and_return(name_builder) end it 'does operations' do # the first expectation isn't really part of what you seem # to want to test, but it shows that this way of testing can work expect(name_builder).to receive(:build_name) expect(a).to receive(:do_some_operations) a.create_server end end end ,但是ls -l / usr / src / kernels / 仅显示3.10.0-327.10.1.el7.x86_64。为什么我的文件系统上有非当前内核的源代码(vanilla fresh provisioned Digitalocean box)?

为什么yum install kernel-devel不会为当前运行的内核安装头文件?

1 个答案:

答案 0 :(得分:1)

uname是对内核的系统调用以获取信息。它告诉你那台机器上正在运行什么。硬盘上实际存在的内容可以是任何人安装的任何内容。有人可能下载了错误的软件包,或者您可能安装了多个内核等。但是,正在运行的那个是uname告诉您的。