[SCM] live-boot branch, debian-next, updated. debian/2.0_a6-1-1-g24abdcc
Daniel Baumann
daniel at debian.org
Tue Jun 8 13:01:33 UTC 2010
The following commit has been merged in the debian-next branch:
commit 24abdcc2b16a9b9d877de74cdba06f898975d78b
Author: Michal Suchanek <hramrach at centrum.cz>
Date: Fri Jun 4 17:47:36 2010 +0200
Adding initial iSCSI boot support, still requires patched iscsid though.
diff --git a/docs/parameters.txt b/docs/parameters.txt
index a9ef77c..1887608 100644
--- a/docs/parameters.txt
+++ b/docs/parameters.txt
@@ -16,6 +16,7 @@ live userfullname=USERFULLNAME
live integrity-check
live ip=[CLIENT_IP]:[SERVER_IP]:[GATEWAY_IP]:[NETMASK]:[HOSTNAME]:[DEVICE]:[AUTOCONF] [,[CLIENT_IP]:[SERVER_IP]:[GATEWAY_IP]:[NETMASK]:[HOSTNAME]:[DEVICE]:[AUTOCONF]]*
live ip[=frommedia]
+live iscsi=target-ip[,target-port];target-name
live {keyb|kbd-chooser/method}=KEYBOARD
live {klayout|console-setup/layoutcode}=LAYOUT
live {kvariant|console-setup/variantcode}=VARIANT
diff --git a/hooks/live b/hooks/live
index adadab3..cba7120 100755
--- a/hooks/live
+++ b/hooks/live
@@ -204,3 +204,12 @@ if [ -x /usr/bin/curlftpfs ]
then
copy_exec /usr/bin/curlftpfs /bin
fi
+
+# iSCSI
+if [ -x /usr/sbin/iscsistart ]
+then
+ copy_exec /usr/sbin/iscsistart /bin
+ #manual_add_modules ib_iser
+ manual_add_modules iscsi_tcp
+ manual_add_modules crc32c
+fi
diff --git a/scripts/live b/scripts/live
index 7ee3e7f..2e40b45 100755
--- a/scripts/live
+++ b/scripts/live
@@ -122,6 +122,19 @@ Arguments ()
httpfs=*)
HTTPFS="${ARGUMENT#httpfs=}"
export HTTPFS
+ ;;
+
+ iscsi=*)
+ ISCSI="${ARGUMENT#iscsi=}"
+ #ip:port - separated by ;
+ ISCSI_PORTAL="${ISCSI%;*}"
+ if echo "${ISCSI_PORTAL}" | grep -q , ; then
+ ISCSI_SERVER="${ISCSI_PORTAL%,*}"
+ ISCSI_PORT="${ISCSI_PORTAL#*,}"
+ fi
+ #target name
+ ISCSI_TARGET="${ISCSI#*;}"
+ export ISCSI ISCSI_PORTAL ISCSI_TARGET ISCSI_SERVER ISCSI_PORT
;;
isofrom=*|fromiso=*)
@@ -589,7 +602,7 @@ copy_live_to ()
return 0
}
-do_netmount ()
+do_netsetup ()
{
modprobe -q af_packet # For DHCP
@@ -653,6 +666,11 @@ do_netmount ()
[ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
export HOSTNAME
+ if [ -n "${DEVICE}" ]
+ then
+ HWADDR="$(cat /sys/class/net/${DEVICE}/address)"
+ fi
+
# Check if we have a network device at all
if ! ls /sys/class/net/"$DEVICE" > /dev/null 2>&1 && \
! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
@@ -662,6 +680,11 @@ do_netmount ()
then
panic "No supported network device found, maybe a non-mainline driver is required."
fi
+}
+
+do_netmount()
+{
+ do_netsetup
if [ "${NFSROOT}" = "auto" ]
then
@@ -697,6 +720,54 @@ do_netmount ()
return ${rc}
}
+do_iscsi()
+{
+ do_netsetup
+ #modprobe ib_iser
+ modprobe iscsi_tcp
+ local debugopt=""
+ [ "${DEBUG}" == "Yes" ] && debugopt="-d 8"
+ #FIXME this name is supposed to be unique - some date + ifconfig hash?
+ ISCSI_INITIATORNAME="iqn.1993-08.org.debian.live:01:$(echo "${HWADDR}" | sed -e s/://g)"
+ export ISCSI_INITIATORNAME
+ if [ -n "${ISCSI_SERVER}" ] ; then
+ iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_SERVER}" -p "${ISCSI_PORT}"
+ else
+ iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_PORTAL}" -p 3260
+ fi
+ if [ $? != 0 ]
+ then
+ panic "Failed to log into iscsi target"
+ fi
+ local host="$(ls -d /sys/class/scsi_host/host*/device/iscsi_host:host* \
+ /sys/class/scsi_host/host*/device/iscsi_host/host* | sed -e 's:/device.*::' -e 's:.*host::')"
+ if [ -n "${host}" ]
+ then
+ local devices=""
+ local i=0
+ while [ -z "${devices}" -a $i -lt 60 ]
+ do
+ sleep 1
+ devices="$(ls -d /sys/class/scsi_device/${host}*/device/block:* \
+ /sys/class/scsi_device/${host}*/device/block/* | sed -e 's!.*[:/]!!')"
+ i=$(expr $i + 1)
+ echo -ne $i\\r
+ done
+ for dev in $devices
+ do
+ if check_dev "null" "/dev/$dev"
+ then
+ return 0;
+ fi
+ done
+ panic "Failed to locate a live device on iSCSI devices (tried: $devices)."
+ else
+ panic "Failed to locate iSCSI host in /sys"
+ fi
+ NETBOOT="iscsi"
+ export NETBOOT
+}
+
do_httpmount ()
{
rc=1
@@ -1653,7 +1724,10 @@ mountroot ()
panic "Unable to find a live file system on the network"
fi
else
- if [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
+ if [ -n "${ISCSI_PORTAL}" ]
+ then
+ do_iscsi && livefs_root="${mountpoint}"
+ elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
then
# Do a local boot from hd
livefs_root=${ROOT}
--
live-boot
More information about the debian-live-changes
mailing list