從原始碼編譯內核出現致命錯誤:函數「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

相關內容