ソースからカーネルをコンパイルすると致命的なエラーが発生しました: 関数 '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_stats3 つのパラメータが必要であると宣言されていますが、ファイルではdrivers/md/bcache/request.c、関数に渡されるパラメータは 2 つだけですpart_round_stats

この問題について Google で検索してみましたが、何も見つかりません。

それで、ここでどのような問題が発生したのでしょうか? これは 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

関連情報