The quick and dirty way:
- Download SRC rpm for kernel you want to build module for
- Run `rpmbuild -bp kernel.spec`. While the magic is happening here go `make pbnj` or read the latest copy of 2600…oh wait thats not printed any more..crap.
- Next go to your your kernel build directory `cd /root/rpmbuild/BUILD/kernel-$(uname -r | sed ‘s/.x86_64//’)/linux-$(uname -r)`
- type `make menuconfig`
- Go to “Device Drivers | Block devices” and set “M” on “Network block device support” exit saving new kernel config.
- Next type `make prepare && make modules_prepare && make` (make is needed otherwise you are missing symbols that the nbd.ko needs)
- If your system is older, now is the time to take your significant other to dinner, catch up on some online gaming, or play with your kids.
- Next we build just the block device modules by typing`make M=drivers/block`
- We now check the module ` modinfo drivers/block/nbd.ko` if all looks good we copy it to the running kernels extra folder in /lib/modules/$(uname -r)/extra.
- We can finally now load the module via `depmod -a && modprobe nbd`.
I will be doing some testing on NBD vs GlusterFS in a coming post. The one kicker is that the NBD and GlusterFS servers will be running on a RazPi’s with a 2G USB thumbdrive for the exported block device (thanks to the vendors at conferences!) .