使用makefile文件直接进行编译。
make -C /usr/src/kernels/2.6.32-431.3.1.el6.x86_64/ M=$PWD modules
[root@ceph01 linux-3.13.8]# make -C /lib/modules/3.13.8-11.el6xen.x86_64/build M=$(pwd) CONFIG_CEPH_LIB=m modules make: Entering directory `/usr/src/kernels/3.13.8-11.el6xen.x86_64' CC kernel/bounds.s GEN /root/rpmbuild/SOURCES/linux-3.13.8/include/generated/bounds.h CC arch/x86/kernel/asm-offsets.s GEN /root/rpmbuild/SOURCES/linux-3.13.8/include/generated/asm-offsets.h make[1]: *** No rule to make target `/root/rpmbuild/SOURCES/linux-3.13.8/missing-syscalls', needed by `__build'. Stop. make: *** [_module_/root/rpmbuild/SOURCES/linux-3.13.8] Error 2 make: Leaving directory `/usr/src/kernels/3.13.8-11.el6xen.x86_64'
出现以上编译错误,采取措施为:
在kernel.spec文件中添加如下:
188 #add qfong 189 if [ -d arch/%{asmarch}/syscalls ]; then 190 %{__cp} -a --parents arch/%{asmarch}/syscalls $RPM_BUILD_ROOT/lib/modules/%{KRELEASE}/buil d/ 191 fi 192 #end add
然后编译
make -C /lib/modules/3.13.8-12.el6xen.x86_64/build M=$(pwd) CONFIG_CEPH_LIB=m modules
使用命令加载模块
rmmod rbd rmmod libceph insmod libceph.ko modprobe rbd