You need to download and install the Generic SCSI Target Subsystem for Linux (SCST) from http://scst.sourceforge.net/downloads.html. Building and installing this software is outside the scope of this document.
To add a disk image file as an SRP target, you need to add the following four lines to /etc/scst.conf:
[HANDLER vdisk] DEVICE srpboot,/path/to/image/file.img,,512 [ASSIGNMENT Default] DEVICE srpboot,0
where /path/to/image/file.img is the path to your disk image file.
Reload the SCST configuration:
/etc/init.d/scst reload
and check that the SRP target is visible:
ibsrpdm && ibsrpdm -c
You should see something like
IO Unit Info:
port LID: 0001
port GID: fe800000000000000002c9030001c65b
change ID: 0100
max controllers: 0x10
controller[ 1]
GUID: 0002c9030001c65a
vendor ID: 000002
device ID: 006732
IO class : 0100
ID: SCST SRP target
service entries: 1
service[ 0]: 0002c9030001c65a / SRP.T10:0002c9030001c65a
id_ext=0002c9030001c65a,ioc_guid=0002c9030001c65a,
dgid=fe800000000000000002c9030001c65b,
pkey=ffff,service_id=0002c9030001c65a
Make a note of the SRP target parameters id_ext, ioc_guid, dgid and service_id. You are now ready to