Backports HOWTO
From Linux-iSCSI
The Backports HOWTO describes how to build the "out-of-tree" LIO backport versions.
Contents |
Introduction
The backports tree (lio-core-backports.git) contains the backported kernel code from the upstream kernel.org lio-core-*.git source. It tracks the LIO&nsp;3.1 codebase (Target and iSCSI). It does not yet contain support for tcm_loop and tcm_fc, or other LIO 4 fabric modules. This will change at some point for those fabric modules that are standalone and do not require upstream kernel modificiations.
Currently the source tree contains the following kernel code:
- Target (kernel/drivers/target/): target mode infrastructure v3.1.x and Linux storage subsystem plugins.
- iSCSI (kernel/drivers/lio-core/): iSCSI fabric module v3.1.x.
- ConfigFS (kernel/fs/configfs/): filesystem module backport required for pre v2.6.27 kernels.
The kernel code has been built and run on a number of different architectures and environments going back to v2.6.18 and up to the recent stable v2.6.3[1,2] versions that are now shipping with RHEL6, OpenSuse 11.2, Fedora 1[1,2] and Ubuntu Lucid Lynx. So far this tree has been successfully run on i386, x86_64, and ia-64, ppc, armv5tejl and alpha environments, but the kernel code will run on any supported architecture
Getting the sources
First, the git package is required in order to access the lio-core-backports source tree. Make sure git is available on the shell where the builds will be done. It is available as the git-core package on pretty much all general purpose distributions.
Second, either pick and downloads#download a specific LIO 3 version, or clone the latest LIO 3 tree to a local repository (in lio-core-backports.git):
git clone git://risingtidesystems.com/lio-core-backports.git lio-core-backports.git
Note the source tree is also available via gitweb from RisingTide Systems at lio-core-backports.git.
Building
Local ".ko" objects
Building the kernel module packages requires that the running kernel has a matching set of header or source available in order to generate the necessary .ko object files. The name of the actual header or source package will vary, so please refer to the Linux distribution documentation on how to do this.
Once the package required to build out of tree kernel modules has been successfully installed, the symlinks for build and/or source will be setup in /lib/modules/$KERNEL_REV/. These are the paths that lio-core-backports.git/autoconfig uses with kbuild.
Then run:
make
to first call ./autoconfig --write-to-file in order to generate a local ./.make_autoconfig. This file is used by the lio-core-backports.git Makefiles to determine the local environment variables required in order for the build to commence. The resulting ./.make_autoconfig looks like:
ARCH?=x86_64 AUTO_CFLAGS?= -DHAS_UTS_RELEASE -DUSE_MSLEEP -Dscsi_execute_async_address -DPYX_ISCSI_VENDOR='"Linux-iSCSI.org"' -DIQN_PREFIX='"iqn.2003-01.org.linux-iscsi"' -DLINUX -DLINUX_SCATTERLIST_HAS_PAGE -DSVN_VSN=\"3.1.4\" BASENAME?=RedHat-R6-Gold.x86_64 CONFIGFS_BACKPORT?=0 DISTRO?=REDHAT KERNEL?=26 KERNEL_DIR?=/lib/modules/2.6.32-19.el6.x86_64/build KERNEL_INCLUDE_DIR?=/lib/modules/2.6.32-19.el6.x86_64/build/include KERNEL_SOURCE_DIR?=/lib/modules/2.6.32-19.el6.x86_64/build KERNEL_VERSION_INFO?=LINUX_KERNEL_26 LIBL?=x86_64 LIO_REV?=1ce986f1 LIO_UTILS_REV?= LIO_UTILS_VERSION?=3.1.4 LIO_VERSION?=3.1.4 OSTYPE?=LINUX RELEASE?=2.6.32-19.el6.x86_64 RELEASES?=ARRAY(0x2261f20) RPM_DIR?=/root/rpmbuild SNMP?=0 SYSTEM?=RedHat-R6-Gold
Once the build environment variables has been successfully determined, run a make, which first builds kernel/fs/configfs (if kernel < v2.6.27 for $RELEASE), then kernel/drivers/target, and finally kernel/drivers/lio-core.
When the build has successfully completed, run:
make install
to copy the .ko objects into /lib/modules/$RELEASE/extra/, and run depmod -ae so that the .ko objects are available on the local install.
RPM packages
First, make sure that the kernel header and/or source packages mentioned above are installed for the build environment. Second, make sure that the rpmbuild program is available to the local shell. This package is available on all modern RPM based distributions, but also varys depending the Linux distribution and/or environment. Please refer to the local distribution documentation on how to install rpmbuild. From there, run:
make kernel_rpms
to generate the kernel binary packages in $RPM_DIR/packages/$ARCH from the ./.make_autoconfig environment variables.
You can install these packages with:
rpm -i $PACKAGE.RPM
and upgrade them later with:
rpm -iUf --force $PACKAGENAME
DEB packages
First, make sure that the kernel header and/or source packages mentioned above are installed for the build environment. Second, make sure that the debhelper and module-assistant packages are installed.
From there, run make kernel_source-debs-nosign: to generate the kernel source debs that can be installed with dpkg -i $PACKAGE.deb. Using module-assistant to build the new packages is done with:
m-a -t a-i $PACKAGE_NAME
where $PACKAGE_NAME is be configfs-backport (for < v2.6.27 kernels), target_core_mod and iscsi_target_mod.
This will generate the kernel version specific binary packages in /usr/src/, which can then be installed using:
dpkg -i $PACKAGE