aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/target/tcm_mod_builder.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/target/tcm_mod_builder.txt')
-rw-r--r--Documentation/target/tcm_mod_builder.txt145
1 files changed, 145 insertions, 0 deletions
diff --git a/Documentation/target/tcm_mod_builder.txt b/Documentation/target/tcm_mod_builder.txt
new file mode 100644
index 000000000000..84533d8e747f
--- /dev/null
+++ b/Documentation/target/tcm_mod_builder.txt
@@ -0,0 +1,145 @@
1>>>>>>>>>> The TCM v4 fabric module script generator <<<<<<<<<<
2
3Greetings all,
4
5This document is intended to be a mini-HOWTO for using the tcm_mod_builder.py
6script to generate a brand new functional TCM v4 fabric .ko module of your very own,
7that once built can be immediately be loaded to start access the new TCM/ConfigFS
8fabric skeleton, by simply using:
9
10 modprobe $TCM_NEW_MOD
11 mkdir -p /sys/kernel/config/target/$TCM_NEW_MOD
12
13This script will create a new drivers/target/$TCM_NEW_MOD/, and will do the following
14
15 *) Generate new API callers for drivers/target/target_core_fabric_configs.c logic
16 ->make_nodeacl(), ->drop_nodeacl(), ->make_tpg(), ->drop_tpg()
17 ->make_wwn(), ->drop_wwn(). These are created into $TCM_NEW_MOD/$TCM_NEW_MOD_configfs.c
18 *) Generate basic infrastructure for loading/unloading LKMs and TCM/ConfigFS fabric module
19 using a skeleton struct target_core_fabric_ops API template.
20 *) Based on user defined T10 Proto_Ident for the new fabric module being built,
21 the TransportID / Initiator and Target WWPN related handlers for
22 SPC-3 persistent reservation are automatically generated in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
23 using drivers/target/target_core_fabric_lib.c logic.
24 *) NOP API calls for all other Data I/O path and fabric dependent attribute logic
25 in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
26
27tcm_mod_builder.py depends upon the mandatory '-p $PROTO_IDENT' and '-m
28$FABRIC_MOD_name' parameters, and actually running the script looks like:
29
30target:/mnt/sdb/lio-core-2.6.git/Documentation/target# python tcm_mod_builder.py -p iSCSI -m tcm_nab5000
31tcm_dir: /mnt/sdb/lio-core-2.6.git/Documentation/target/../../
32Set fabric_mod_name: tcm_nab5000
33Set fabric_mod_dir:
34/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
35Using proto_ident: iSCSI
36Creating fabric_mod_dir:
37/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
38Writing file:
39/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_base.h
40Using tcm_mod_scan_fabric_ops:
41/mnt/sdb/lio-core-2.6.git/Documentation/target/../../include/target/target_core_fabric_ops.h
42Writing file:
43/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.c
44Writing file:
45/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.h
46Writing file:
47/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_configfs.c
48Writing file:
49/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kbuild
50Writing file:
51/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kconfig
52Would you like to add tcm_nab5000to drivers/target/Kbuild..? [yes,no]: yes
53Would you like to add tcm_nab5000to drivers/target/Kconfig..? [yes,no]: yes
54
55At the end of tcm_mod_builder.py. the script will ask to add the following
56line to drivers/target/Kbuild:
57
58 obj-$(CONFIG_TCM_NAB5000) += tcm_nab5000/
59
60and the same for drivers/target/Kconfig:
61
62 source "drivers/target/tcm_nab5000/Kconfig"
63
64*) Run 'make menuconfig' and select the new CONFIG_TCM_NAB5000 item:
65
66 <M> TCM_NAB5000 fabric module
67
68*) Build using 'make modules', once completed you will have:
69
70target:/mnt/sdb/lio-core-2.6.git# ls -la drivers/target/tcm_nab5000/
71total 1348
72drwxr-xr-x 2 root root 4096 2010-10-05 03:23 .
73drwxr-xr-x 9 root root 4096 2010-10-05 03:22 ..
74-rw-r--r-- 1 root root 282 2010-10-05 03:22 Kbuild
75-rw-r--r-- 1 root root 171 2010-10-05 03:22 Kconfig
76-rw-r--r-- 1 root root 49 2010-10-05 03:23 modules.order
77-rw-r--r-- 1 root root 738 2010-10-05 03:22 tcm_nab5000_base.h
78-rw-r--r-- 1 root root 9096 2010-10-05 03:22 tcm_nab5000_configfs.c
79-rw-r--r-- 1 root root 191200 2010-10-05 03:23 tcm_nab5000_configfs.o
80-rw-r--r-- 1 root root 40504 2010-10-05 03:23 .tcm_nab5000_configfs.o.cmd
81-rw-r--r-- 1 root root 5414 2010-10-05 03:22 tcm_nab5000_fabric.c
82-rw-r--r-- 1 root root 2016 2010-10-05 03:22 tcm_nab5000_fabric.h
83-rw-r--r-- 1 root root 190932 2010-10-05 03:23 tcm_nab5000_fabric.o
84-rw-r--r-- 1 root root 40713 2010-10-05 03:23 .tcm_nab5000_fabric.o.cmd
85-rw-r--r-- 1 root root 401861 2010-10-05 03:23 tcm_nab5000.ko
86-rw-r--r-- 1 root root 265 2010-10-05 03:23 .tcm_nab5000.ko.cmd
87-rw-r--r-- 1 root root 459 2010-10-05 03:23 tcm_nab5000.mod.c
88-rw-r--r-- 1 root root 23896 2010-10-05 03:23 tcm_nab5000.mod.o
89-rw-r--r-- 1 root root 22655 2010-10-05 03:23 .tcm_nab5000.mod.o.cmd
90-rw-r--r-- 1 root root 379022 2010-10-05 03:23 tcm_nab5000.o
91-rw-r--r-- 1 root root 211 2010-10-05 03:23 .tcm_nab5000.o.cmd
92
93*) Load the new module, create a lun_0 configfs group, and add new TCM Core
94 IBLOCK backstore symlink to port:
95
96target:/mnt/sdb/lio-core-2.6.git# insmod drivers/target/tcm_nab5000.ko
97target:/mnt/sdb/lio-core-2.6.git# mkdir -p /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0
98target:/mnt/sdb/lio-core-2.6.git# cd /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0/
99target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# ln -s /sys/kernel/config/target/core/iblock_0/lvm_test0 nab5000_port
100
101target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# cd -
102target:/mnt/sdb/lio-core-2.6.git# tree /sys/kernel/config/target/nab5000/
103/sys/kernel/config/target/nab5000/
104|-- discovery_auth
105|-- iqn.foo
106| `-- tpgt_1
107| |-- acls
108| |-- attrib
109| |-- lun
110| | `-- lun_0
111| | |-- alua_tg_pt_gp
112| | |-- alua_tg_pt_offline
113| | |-- alua_tg_pt_status
114| | |-- alua_tg_pt_write_md
115| | `-- nab5000_port -> ../../../../../../target/core/iblock_0/lvm_test0
116| |-- np
117| `-- param
118`-- version
119
120target:/mnt/sdb/lio-core-2.6.git# lsmod
121Module Size Used by
122tcm_nab5000 3935 4
123iscsi_target_mod 193211 0
124target_core_stgt 8090 0
125target_core_pscsi 11122 1
126target_core_file 9172 2
127target_core_iblock 9280 1
128target_core_mod 228575 31
129tcm_nab5000,iscsi_target_mod,target_core_stgt,target_core_pscsi,target_core_file,target_core_iblock
130libfc 73681 0
131scsi_debug 56265 0
132scsi_tgt 8666 1 target_core_stgt
133configfs 20644 2 target_core_mod
134
135----------------------------------------------------------------------
136
137Future TODO items:
138
139 *) Add more T10 proto_idents
140 *) Make tcm_mod_dump_fabric_ops() smarter and generate function pointer
141 defs directly from include/target/target_core_fabric_ops.h:struct target_core_fabric_ops
142 structure members.
143
144October 5th, 2010
145Nicholas A. Bellinger <nab@linux-iscsi.org>