
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개의 매개변수가 필요하다고 함수가 선언되어 있는 반면, 파일에서는 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