tcm_fc自动加载 linux,[Fibre Channle 实战之四]centos7中如何添加tcm_qla2xxx支持

  • Post author:
  • Post category:linux


centos7中自带的有qla2xxx驱动,但是没有tcm_qla2xxx驱动,这会创建一些HBA卡的target的时候失败。为此,需要保证tcm_qla2xxx.ko驱动能生成并自动执行。那么该如何解决这个问题呢?

1.选择tcm_qla2xxx模块

首先,进入和当前centos内核版本和配置选项一致的源代码的build目录:

cd/lib/modules/3.10.0-229.el7.x86_64/build

make

menuconfig

加上对tcm_qla2xxx的支持:

8fa7c12615e954bafe2538df66e42a48.png

d4a4d421689b7ca73768e81bd42add7a.png

2.编译tcm_qla2xxx驱动

保存上面的选择,然后退出。接着cd

/home/qbaq/qla2xxx:

make

-C /lib/modules/3.10.0-229.el7.x86_64/build M=`pwd` modules

会看到下面的提示:

Building

modules, stage 2.

MODPOST

2 modules

WARNING:

“btree_init” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko] undefined!

WARNING:

“btree_insert” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko]

undefined!

WARNING:

“btree_update” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko]

undefined!

WARNING:

“btree_lookup” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko]

undefined!

WARNING:

“btree_destroy” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko]

undefined!

WARNING:

“btree_get_prev” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko]

undefined!

WARNING:

“btree_remove” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko]

undefined!

WARNING:

“btree_last” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko] undefined!

WARNING:

“btree_geo32” [/home/qbaq/qla2xxx/tcm_qla2xxx.ko]

undefined!

CC

/home/qbaq/qla2xxx/qla2xxx.mod.o

LD

[M]  /home/qbaq/qla2xxx/qla2xxx.ko

CC

/home/qbaq/qla2xxx/tcm_qla2xxx.mod.o

LD

[M]  /home/qbaq/qla2xxx/tcm_qla2xxx.ko

make:

Leaving directory `/usr/src/kernels/3.10.0-229.el7.x86_64′

[root@localhost

qla2xxx]# insmod ./tcm_qla2xxx.ko

insmod:

ERROR: could not insert module ./tcm_qla2xxx.ko: Unknown symbol in

module

[root@localhost

qla2xxx]# dmesg | tail -n 10

[

3907.642678] tcm_qla2xxx: Unknown symbol btree_get_prev (err 0)

[

3935.279739] tcm_qla2xxx: Unknown symbol btree_last (err 0)

[

3935.279763] tcm_qla2xxx: Unknown symbol btree_insert (err 0)

[

3935.279884] tcm_qla2xxx: Unknown symbol btree_remove (err 0)

[

3935.279911] tcm_qla2xxx: Unknown symbol btree_geo32 (err 0)

[

3935.279946] tcm_qla2xxx: Unknown symbol btree_lookup (err 0)

[

3935.279960] tcm_qla2xxx: Unknown symbol btree_init (err 0)

[

3935.280066] tcm_qla2xxx: Unknown symbol btree_destroy (err 0)

[

3935.280080] tcm_qla2xxx: Unknown symbol btree_update (err 0)

[

3935.280142] tcm_qla2xxx: Unknown symbol btree_get_prev (err 0)

可以看大上面tcm_qla2xxx的一些符合依赖于btree这个模块。为此,需要继续解决对btree的依赖。尝试和上面同样的方法,重新进入build/:

make

menuconfig

不过这次,在本地编译就会产生问题:

[root@localhost

lib]# make -C /lib/modules/3.10.0-229.el7.x86_64/build M=`pwd`

modules

make:

Entering directory `/usr/src/kernels/3.10.0-229.el7.x86_64′

CC

[M]  /home/qbaq/lib/crc-ccitt.o

CC

[M]  /home/qbaq/lib/crc-t10dif.o

CC

[M]  /home/qbaq/lib/crc-itu-t.o

CC

[M]  /home/qbaq/lib/libcrc32c.o

CC

[M]  /home/qbaq/lib/crc8.o

CC

[M]  /home/qbaq/lib/ts_kmp.o

CC

[M]  /home/qbaq/lib/ts_bm.o

CC

[M]  /home/qbaq/lib/ts_fsm.o

CC

[M]  /home/qbaq/lib/cordic.o

CC

[M]  /home/qbaq/lib/raid6/algos.o

CC

[M]  /home/qbaq/lib/raid6/recov.o

HOSTCC

/home/qbaq/lib/raid6/mktables

TABLE

/home/qbaq/lib/raid6/tables.c

CC

[M]  /home/qbaq/lib/raid6/tables.o

UNROLL

/home/qbaq/lib/raid6/int1.c

awk:

fatal: can’t open source file

`/usr/src/kernels/3.10.0-229.el7.x86_64//home/qbaq/lib/raid6/unroll.awk’

for reading (No such file or directory)

make[2]:

*** [/home/qbaq/lib/raid6/int1.c] Error 1

make[1]:

*** [/home/qbaq/lib/raid6] Error 2

make:

*** [_module_/home/qbaq/lib] Error 2

3.解决tcm_qla2xxx对btree模块的依赖

究其原因,btree模块在tcm_qla2xxx选上之后,默认必须应该变成build

in的,因为它可能依赖其他的内容。我们看这个文件包含的头文件也可以看出来:

所以,还需要重新编译内核。为了尽量保证和发行版的配置文件一致,我们把经过上面操作之后/lib/module/3.10.0-229.el7.x86_64

/build下最新的.confg拷贝过来:

然后make

-j 32

make

bzImage

make

modules_install

make

install

这样就能保证生成的内核里已经包含了btree模块,同时由于它会在启动时候加载,后续加载tcm_qla2xxx驱动就不会有问题了。