# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
# Only sections that are in by default or those that
# are not module groups need to be defined here...
HWOPTS='keymap cache modules pata sata scsi usb firewire waitscan slowusb evms lvm dmraid mdadm fs net'
-MY_HWOPTS='modules pata sata scsi usb firewire waitscan dmraid mdadm fs net'
+MY_HWOPTS='modules pata sata scsi usb firewire waitscan dmraid mdadm fs net iscsi'
fi
}
+startiscsi() {
+
+ if [ -n "${ISCSI_I}" ] && [ -n "${ISCSI_T}" ] && [ -n "${ISCSI_A}" ]
+ then
+ good_msg "Activating ISCSI"
+ iscsistart -i "${ISCSI_I}" -t "${ISCSI_T}" -g 1 -a ${ISCSI_A}
+ fi
+
+}
+
+
# Open a LUKS device
# It is either the root or a swap, other devices are supported in the scripts provided with sys-fs/cryptsetup-luks
# $1 - root/swap
nfsroot\=*)
NFSROOT=`parse_opt "${x}"`
;;
+ # ISCSI
+ iscsi_i\=*)
+ ISCSI_I=`parse_opt "${x}"`
+ ;;
+ iscsi_t\=*)
+ ISCSI_T=`parse_opt "${x}"`
+ ;;
+ iscsi_a\=*)
+ ISCSI_A=`parse_opt "${x}"`
+ ;;
+ # Crypto
crypt_root\=*)
CRYPT_ROOT=`parse_opt "${x}"`
;;
# Scan volumes
startVolumes
+# Start ISCSI
+startiscsi
+
setup_keymap
# Initialize LUKS root device except for livecd's
# Hardware (Network)
MODULES_NET="e1000 tg3"
+# iSCSI support
+MODULES_ISCSI="scsi_transport_iscsi libiscsi iscsi_tcp"
+
# Hardware (Pluggable)
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide-cs firmware_class"
echo " --mdadm Copy /etc/mdadm.conf to initramfs"
echo " --dmraid Include DMRAID support"
echo " --multipath Include Multipath support"
+ echo " --iscsi Include ISCSI support"
echo " --slowusb Enables extra pauses for slow USB CD boots"
echo " --bootloader=grub Add new kernel to GRUB configuration"
echo " --linuxrc=<file> Specifies a user created linuxrc"
--bootloader=*)
CMD_BOOTLOADER=`parse_opt "$*"`
print_info 2 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}"
+ --iscsi)
+ CMD_ISCSI=1
+ print_info 2 "CMD_ISCSI: ${CMD_ISCSI}"
;;
--loglevel=*)
CMD_LOGLEVEL=`parse_opt "$*"`
rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null
fi
}
+
+compile_iscsi() {
+ if [ ! -f "${ISCSI_BINCACHE}" ]
+ then
+ [ ! -f "${ISCSI_SRCTAR}" ] &&
+ gen_die "Could not find ISCSI source tarball: ${ISCSI_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${ISCSI_DIR}"
+ tar -zxpf "${ISCSI_SRCTAR}"
+ [ ! -d "${ISCSI_DIR}" ] &&
+ gen_die "ISCSI directory ${ISCSI_DIR} invalid"
+ print_info 1 'ISCSI: >> Compiling...'
+ cd "${TEMP}/${ISCSI_DIR}/utils/fwparam_ibft"
+ MAKE=${UTILS_MAKE} compile_generic "" ""
+ cd "${TEMP}/${ISCSI_DIR}/usr"
+ MAKE=${UTILS_MAKE} compile_generic "" ""
+ cd "${TEMP}/${ISCSI_DIR}/kernel"
+
+ # Find out target kernel Version, make modules for that version
+ RELEASE=$(head -n 4 ${CMD_KERNEL_DIR}/Makefile | sed -r -e 's/^VERSION = (.*)/\1./g' -e 's/PATCHLEVEL = (.*)/\1./g' -e 's/SUBLEVEL = (.*)/\1/g' -e 's/EXTRAVERSION = (.*)/\1/g' | tr -d '\n')
+ KERNELRELEASE=${RELEASE} MAKE=${UTILS_MAKE} compile_generic "" ""
+
+ # copy kernel modules to initramfs
+ mkdir -p "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
+ cp *.ko "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
+
+ cd "${TEMP}/initramfs-iscsi-temp/"
+ print_info 1 'iscsistart: >> Copying to cache...'
+ [ -f "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ] ||
+ gen_die 'iscsistart executable does not exist!'
+ strip "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
+ gen_die 'Could not strip iscsistart binary!'
+ bzip2 "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
+ gen_die 'bzip2 compression of iscsistart failed!'
+ mv "${TEMP}/${ISCSI_DIR}/usr/iscsistart.bz2" "${ISCSI_BINCACHE}" ||
+ gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?'
+
+ cd "${TEMP}"
+ rm -rf "${ISCSI_DIR}" > /dev/null
+ fi
+}
+
sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
fi
+ # Make sure the iscsi modules are off if --iscsi
+ # CONFIG_SCSI_ISCSI_ATTRS
+ # CONFIG_ISCSI_TCP
+ if isTrue ${CMD_ISCSI}
+ then
+ sed -i ${KERNEL_DIR}/.config -e 's/^CONFIG_SCSI_ISCSI_ATTRS=\(.*\)/\# CONFIG_SCSI_ISCSI_ATTRS is not set/g'
+ sed -i ${KERNEL_DIR}/.config -e 's/^CONFIG_ISCSI_TCP=\(.*\)/\# CONFIG_ISCSI_TCP is not set/g'
+ fi
+
if isTrue ${SPLASH}
then
sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'
set_config_with_override 1 LVM CMD_LVM
set_config_with_override 1 EVMS CMD_EVMS
set_config_with_override 1 DMRAID CMD_DMRAID
+ set_config_with_override 1 ISCSI CMD_ISCSI
set_config_with_override 1 BUSYBOX CMD_BUSYBOX "yes"
set_config_with_override 1 UNIONFS CMD_UNIONFS
set_config_with_override 1 NETBOOT CMD_NETBOOT
DEVICE_MAPPER_BINCACHE=`cache_replace "${DEVICE_MAPPER_BINCACHE}"`
LVM_BINCACHE=`cache_replace "${LVM_BINCACHE}"`
DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
+ ISCSI_BINCACHE=`cache_replace "${ISCSI_BINCACHE}"`
BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
DEVICE_MAPPER_BINCACHE=`arch_replace "${DEVICE_MAPPER_BINCACHE}"`
LVM_BINCACHE=`arch_replace "${LVM_BINCACHE}"`
DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
+ ISCSI_BINCACHE=`arch_replace "${ISCSI_BINCACHE}"`
BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
FUSE_BINCACHE=`arch_replace "${FUSE_BINCACHE}"`
UNIONFS_FUSE_BINCACHE=`arch_replace "${UNIONFS_FUSE_BINCACHE}"`
}
check_distfiles() {
- for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $MULTIPATH_SRCTAR $LVM_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR
+ for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $MULTIPATH_SRCTAR $LVM_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR $ISCSI_SRCTAR
do
if [ ! -f "${i}" ]
then
rm -r "${TEMP}/initramfs-dmraid-temp/"
}
+append_iscsi(){
+ if [ -d "${TEMP}/initramfs-iscsi-temp" ]
+ then
+ rm -r "${TEMP}/initramfs-iscsi-temp/"
+ fi
+ print_info 1 'ISCSI: Adding support (compiling binaries)...'
+ compile_iscsi
+ cd ${TEMP}
+ mkdir -p "${TEMP}/initramfs-iscsi-temp/bin/"
+ /bin/bzip2 -dc "${ISCSI_BINCACHE}" > "${TEMP}/initramfs-iscsi-temp/bin/iscsistart" ||
+ gen_die "Could not extract iscsi binary cache!"
+ chmod a+x "${TEMP}/initramfs-iscsi-temp/bin/iscsistart"
+ cd "${TEMP}/initramfs-iscsi-temp/"
+ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
+ rm -rf "${TEMP}/initramfs-iscsi-temp" > /dev/null
+}
+
append_lvm(){
if [ -d "${TEMP}/initramfs-lvm-temp" ]
then
append_data 'busybox' "${BUSYBOX}"
append_data 'lvm' "${LVM}"
append_data 'dmraid' "${DMRAID}"
+ append_data 'iscsi' "${ISCSI}"
append_data 'evms' "${EVMS}"
append_data 'mdadm' "${MDADM}"
append_data 'luks' "${LUKS}"
[ "${EVMS}" -eq '1' ] && print_info 1 'add "doevms" for evms support'
[ "${DMRAID}" -eq '1' ] && print_info 1 'add "dodmraid" for dmraid support'
[ "${DMRAID}" -eq '1' ] && print_info 1 ' or "dodmraid=<additional options>"'
+ [ "${ISCSI}" -eq '1' ] && print_info 1 'add "iscsi_i=<initiator name> iscsi_t=<target name> iscsi_a=<target ip>" for iscsi support'
fi
[ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR}
DMRAID_SRCTAR="${DISTDIR}/dmraid-${DMRAID_VER}.tar.bz2"
DMRAID_BINCACHE="%%CACHE%%/dmraid-${DMRAID_VER}-%%ARCH%%.tar.bz2"
+ISCSI_VER="VERSION_ISCSI"
+ISCSI_DIR="open-iscsi-${ISCSI_VER}"
+ISCSI_SRCTAR="${DISTDIR}/open-iscsi-${ISCSI_VER}.tar.gz"
+ISCSI_BINCACHE="%%CACHE%%/iscsi-${ISCSI_VER}-%%ARCH%%.bz2"
+
E2FSPROGS_VER="VERSION_E2FSPROGS"
E2FSPROGS_DIR="e2fsprogs-${E2FSPROGS_VER}"
E2FSPROGS_SRCTAR="${DISTDIR}/e2fsprogs-${E2FSPROGS_VER}.tar.gz"