Centos

從原始碼編譯核心出現致命錯誤:函式“part_round_stats”的參數太少

  • September 3, 2020

我正在嘗試從系統 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

我試圖用Google搜尋這個問題,但我一無所獲。

那麼我在這裡遇到了什麼樣的問題?這是來自linux原始碼的錯誤嗎?(我不這麼認為……),或者這是版本的某種問題?或者下載的原始碼不支持模組 BCACHE 並且核心開發人員留下了致命錯誤?

試試這個:

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

引用自:https://unix.stackexchange.com/questions/604070