uname -r #-> 3.10.0-123.el7.x86_64 yum install kernel-devel kernel-headers cd /tmp wget http://vault.centos.org/7.0.1406/os/Source/SPackages/kernel-3.10.0-123.el7.src.rpm rpm -ihv kernel-3.10.0-123.el7.src.rpm (这时会在/root/rpmbuild/SOURCES下生成tar.xz包) cd ~/rpmbuild/SOURCES tar Jxvf linux-3.10.0-123.el7.tar.xz -C /usr/src/kernels/ cd /usr/src/kernels/ mv $(uname -r) $(uname -r)-old mv linux-3.10.0-123.el7 $(uname -r) cd $(uname -r) make mrproper cp ../$(uname -r)-old/Module.symvers ./ cp /boot/config-$(uname -r) ./.config make oldconfig make prepare make scripts make CONFIG_BLK_DEV_NBD=m M=drivers/block cp drivers/block/nbd.ko /lib/modules/$(uname -r)/kernel/drivers/block/ depmod -a
modprobe nbd 启用nbd模块
时间: 2024-12-28 18:17:56