Recompiling Kernel with NBD module

General support questions
Post Reply
blopeur
Posts: 2
Joined: 2017/04/26 12:26:40

Recompiling Kernel with NBD module

Post by blopeur » 2017/04/26 12:29:50

I downloaded latest src rpm kernel ( 3.10.0.514.10.2.el7) and tried rebuilding it with some modified config options.

With the stock config settings, it builds okay.

With mpt3sas builtin instead of modular I get:
......In file included from include/linux/thread_info.h:11:0,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/scsi/mpt3sas/mpt3sas_base.c:47:
include/linux/moduleparam.h:13:29: error: expected ')' before 'KBUILD_MODNAME'
#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."


If I try to build the nbd driver I get the following:

drivers/block/nbd.c: In function '__nbd_ioctl':
drivers/block/nbd.c:619:19: error: 'REQ_TYPE_SPECIAL' undeclared (first use in this function)
sreq.cmd_type = REQ_TYPE_SPECIAL;
^
drivers/block/nbd.c:619:19: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [drivers/block/nbd.o] Error 1

This appears to be related to __GENKSYMS__ somehow, this kernel seems to have been modified to define REQ_TYPE_SPECIAL only if __GENKSYMS__ is defined.


Is there anyway to build the nbd module as part of the kernel RPM ?

blopeur
Posts: 2
Joined: 2017/04/26 12:26:40

Re: Recompiling Kernel with NBD module

Post by blopeur » 2017/04/27 12:53:18

Or at least , is there a way to compile the NBD module separately ?
When trying the recommended way I hit the same bug.

pcns
Posts: 1
Joined: 2017/10/04 23:40:37

Re: Recompiling Kernel with NBD module

Post by pcns » 2017/10/04 23:49:36

Below is the patch that I applied to complete the build. (Based on the contents of include/linux/blkdev.h)

Code: Select all

--- nbd.c-orig	2017-10-04 19:36:27.625383152 -0400
+++ nbd.c	2017-10-04 19:34:57.773647599 -0400
@@ -617,7 +617,11 @@
 		mutex_lock(&nbd->tx_lock);
 		blk_rq_init(NULL, &sreq);
 
+#ifdef __GENKSYMS__
                 sreq.cmd_type = REQ_TYPE_SPECIAL ;
+#else
+                sreq.cmd_type = REQ_TYPE_DRV_PRIV ;
+#endif
 		nbd_cmd(&sreq) = NBD_CMD_DISC;
 
 		/* Check again after getting mutex back.  */
Otherwise, I followed the steps in http://www.misterx.org/2013/03/05/getti ... entos-6-x/

Post Reply