ソースからカーネルをコンパイルするときに致命的なエラーが発生しました。 '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宣言には3つのパラメータが必要ですが、ファイルでは2drivers/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

おすすめ記事