These instructions are for SCST trunk as of 5/25/2015 and Ubuntu server 15.04 with 3.19.0-18-generic amd64 kernel. adjust paths as needed
commands all relative to the build dir of your choice and mostly dependent on the command above it
get latest SCST:
svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst
make kernel patch:
cd scst scripts/generate-kernel-patch 3.19 > ../scst.patch cd ..
get kernel source and tools:
apt-get source linux-image-$(uname -r) apt-get build-dep linux-image-$(uname -r) apt-get install libncurses5-dev
apply scst patch to kernel and prepare it for building (note: -Np1 is a One(1) not a lower case L (l) ):
cd linux-3.19.0/ patch -Np1 -i ../scst.patch chmod a+x debian/scripts/* chmod a+x debian/scripts/misc/*
create a custom flavor for scst based on the generic flavor:
cp debian.master/config/amd64/config.flavour.generic debian.master/config/amd64/config.flavour.scst cp debian.master/abi/3.19.0-17.17/amd64/generic debian.master/abi/3.19.0-17.17/amd64/scst cp debian.master/abi/3.19.0-17.17/amd64/generic.modules debian.master/abi/3.19.0-17.17/amd64/scst.modules cp debian.master/control.d/vars.generic debian.master/control.d/vars.scst
edit debian.master/control.d/vars.scst
to reflect SCST instead of Generic
edit debian.master/etc/getabis
and add scst to the getall amd64...
line
edit debian.master/rules.d/amd64.mk
and add scst to the flavours = ...
line
Update configs for our new flavor. Take default answer on any prompts:
fakeroot debian/rules clean debian/rules updateconfigs
Edit the configs to enable scst modules, only edit amd64/config.flavour.scst, say "n" to all the others:
debian/rules editconfigs
In the GUI select Networking Support
, then Networking options
, under TCP/IP networking
press spacebar on TCP/IP zero-copy transfer completion notification
to enable it. Select Exit
twice and select Device Drivers
, then SCSI Target (SCST) Support
, then press spacebar on the option to make it <M>
, leave what shows up as defaults.
Select Exit until you get a Save prompt, choose Yes. You will get many config-check failures, they are all ARM and PPC related and do not affect us.
Compile the kernel:
fakeroot debian/rules clean fakeroot debian/rules binary-headers binary-scst cd .. ls -l
you should now have several .deb files. Copy them to the target system and install the needed ones:
dpkg -i linux-image-* linux-headers*
Reboot into the new kernel and cd back into your build dir to compile and install scst, iscsi, and scstadmin
cd scst make scst scst_install iscsi iscsi_install scstadm scstadm_install cd ..
To enable boot-time startup:
systemctl enable scst.service
Create /etc/scst.conf
and add our devices and iscsi config. filename
can be any storage block device, including MD, LVM, and mapper aliases, or a filename such as created with dd if=/dev/zero of=disk01 bs=1M count=1024
. the TARGET name needs to be unique on your LAN, the part after the : is what you change (tgt in the example). You must also always have a LUN 0, in case you might want to remove any LUN, make a small file to be LUN 0 that will always exist.
HANDLER vdisk_fileio { DEVICE disk01 { filename /media/data/disk01 nv_cache 1 } } TARGET_DRIVER iscsi { enabled 1 TARGET iqn.2015-05.iscsi.lan:tgt { LUN 0 disk01 enabled 1 } }
Start the service:
service scst start
iSCSI Initiators should now see your LUNs.
If the SCST is running on a desktop, which gets frequent kernel upgrades, it may be necessary to compile the kernel again after an update. When I tried to do this, I kept get failures of "abi checks" at the end of my kernel compilation (long-running) final step. I researched abi checks but must confess I still don't entirely understand what is causing the build to fail abi checks. It's also kind of interesting that the first time you build SCST this error doesn't usually occur, but if you try to build the kernel again after an Ubuntu kernel update on the same desktop, then the abi error hits on the kernel compile.
However, there seems to be a well-known workaround or approach to this problem, which is to run the kernel compile with an additional switch. This switch worked for me (i.e the kernel compiled successfully with no more "abi check" errors). The exact error that would hit right at the end of the long-running compile was:
debian/rules.d/4-checks.mk:3: recipe for target 'abi-check-scst' failed
and the way to make the error "go away" was to run the compile with the additional switch "skipabi=true" i.e. run the compile command:
sudo skipabi=true fakeroot debian/rules -j8 binary-headers binary-scst
The only thing that worries me a bit is that frankly I don't understand what the error means in the first place, so I'm not sure if the workaround is producing a stable reliable kernel build. Hopefully it is. I searched for a good "debian abi for dummies" so to speak, but could not find a good explanation online that really made clear how to understand why the build was failing abi check.
(Note: the "-j8" is just added to supposedly speed up the compile and has nothing to do with the workaround for the abi check failure).
Thanks
Gilbert