从源代码编译内核出现致命错误:函数“part_round_stats”的参数太少

从源代码编译内核出现致命错误:函数“part_round_stats”的参数太少

我正在尝试在 CentOS 7 系统上从源代码编译内核。

的输出uname -a是:

Linux dbn03 3.10.0-957.el7.x86_64 #1 SMP Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

以下是我下载源代码并编译它的方法:

wget "http://vault.centos.org/7.6.1810/os/Source/SPackages/kernel-3.10.0-957.el7.src.rpm"  
rpm2cpio ./kernel-3.10.0-957.el7.src.rpm | cpio -idmv
make menuconfig
     Device Drivers 
         ->Multiple devices driver support (RAID and LVM)
             -><*> Block device as cache
make bzImage
make modules

如您所见,我只是尝试使用 BCACHE 模块编译内核。但是,当我执行上面的命令时,出现如下错误:

drivers/md/bcache/request.c:675:3: warning: passing argument 2 of ‘part_round_stats’ makes integer from pointer without a cast [enabled by default]
   part_round_stats(cpu, &s->d->disk->part0);
   ^
In file included from include/linux/blkdev.h:9:0,
                 from include/linux/blktrace_api.h:4,
                 from drivers/md/bcache/bcache.h:181,
                 from drivers/md/bcache/request.c:9:
include/linux/genhd.h:408:13: note: expected ‘int’ but argument is of type ‘struct hd_struct *’
 extern void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part);
             ^
drivers/md/bcache/request.c:675:3: error: too few arguments to function ‘part_round_stats’
   part_round_stats(cpu, &s->d->disk->part0);
   ^
In file included from include/linux/blkdev.h:9:0,
                 from include/linux/blktrace_api.h:4,
                 from drivers/md/bcache/bcache.h:181,
                 from drivers/md/bcache/request.c:9:
include/linux/genhd.h:408:13: note: declared here
 extern void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part);

看来我收到了警告和错误。

我想我可以忽略这个警告,但这个错误是致命的。在标头中,函数part_round_stats声明需要三个参数,而在文件中drivers/md/bcache/request.c,仅将两个参数传递给函数part_round_stats

我尝试用谷歌搜索这个问题,但一无所获。

那么我在这里遇到了什么样的问题呢?这是来自linux源代码的错误吗? (我不这么认为......),或者这是版本的某种问题?或者下载的源代码不支持BCACHE模块并且内核开发者留下了致命错误?

答案1

试试这个:

rpm -ivh kernel-3.10.0-957.el7.src.rpm
cd ~/rpmbuild/SOURCES
rpmbuild -bp kernel.spec
cd ~/rpmbuild/BUILD/kernel-3.10.0-957.el7/linux-3.10.0-957.fc32.x86_64
make menuconfig
make bzImage
make modules

相关内容