[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Booting Debian-live-501 over HTTP



Sorry, forgot to attach the patches in last email.
They are attached here.

On Thu, Sep 3, 2009 at 2:41 PM, Pravin<shindepravin@gmail.com> wrote:
> Hi,
> Thanks for interest :-)
>
>>
>> i would be very, very much interested in patches to live-initramfs to
>> make iscsi booting out-of-the-box possible, and to live-manual to
>> document it.
>>
>
> I have created small patch for live-manual to which will give basic idea
> about how to use httpfs and iscsifs boot options.
> I am appending this patch with this email.
>
> However I had little problem with live-initramfs code.  I could not understand
> how exactly it works, and the interaction between initramfs-tools and
> live-initramfs.
> I could not find any documentation about how I can use live-initramfs
> code to create
> custom initramfs for testing purpose.
>
> The way I work is by fetching the initramfs image from debian live cd,
> and modifying it,
> to support httpfs and iscsi booting.
> I have created a patch on diff between content of original initramfs
> and modified initramfs.
> I am appending that patch also with this email.
> The binary files that I have added/modified to the initramfs can be
> downloaded from following URLs.
> http://rom.etherboot.org/share/pravin/BKO/D/D/DL/httpfs/server/
> http://rom.etherboot.org/share/pravin/BKO/D/D/DL/run-init
> http://rom.etherboot.org/share/pravin/BKO/D/D/DL/modules/
> http://rom.etherboot.org/share/pravin/BKO/D/D/DL/iscsi/tools/
>
> This patch is not yet perfect, and contain some code which was added
> for debugging purpose.
>
> I am trying to learn how live-initramfs creates initramfs.
> Any pointers to documentation and examples of such modification will
> be very helpful to me.
>
> Looking forward for feedback on these patches.
> Also let me know what should I do next to help in getting these
> features in debian live?
>
> Regards,
> -- Pravin
>
> =============================================
> ==============          Patch for live-manual               =========
> =============================================
> diff --git a/xml/chapters/customization/bootup.xml
> b/xml/chapters/customization/bootup.xml
> index 8daca41..202e395 100644
> --- a/xml/chapters/customization/bootup.xml
> +++ b/xml/chapters/customization/bootup.xml
> @@ -39,6 +39,7 @@
>  </para>
>  </sect3>
>
> +
>  <sect3>
>  <title>Booting a Debian Live USB/HDD system from a USB stick with Grub</title>
>  <para>
> @@ -79,6 +80,57 @@ initrd's script in which subdirectory to look for
> the SquashFS image.
>  </sect3>
>  </sect2>
>
> +<sect2 id="netboot">
> +<title>Diskless booting over Network</title>
> +<para>
> +Network booting is specially useful when your system is not having
> harddisk, or hard disk
> +is currupted or you do not want to touch it.  With netbooting option,
> user can boot entire
> +system over network. The only assumption is about network connection
> on user end.
> +</para>
> +
> +<para>
> +User need to have small gpxe image or some other way by which user
> can boot machine over network.
> +This image can be put on floppy or can be burned on NIC card.  This
> script does the initialization
> +of hardware, connect to the boot server (eg. http://boot.kernel.org )
> and fetches the kernel and
> +initramfs images.  The actual booting is done by this downloaded
> kernel with help of initramfs image.
> +</para>
> +
> +<sect3>
> +<title>Booting a Debian Live over HTTP</title>
> +<para>
> +If the boot parameter <command>httpfs=URL-to-image</command>
> +is present then http boot is attempted. The URL provided as boot parameter
> +is used to find out if the image is "iso" or "squashfs".  Depending on the
> +filename extension in the URL.
> +</para>
> +<para>
> +The reason behind providing support for both iso and squashfs is that,
> +even squashfs netbooting is little faster compared to is iso netbooting.
> +But iso http booting allows you to give the URL for iso image of any nearby
> +mirror, resulting much faster booting.
> +</para>
> +</sect3>
> +
> +<sect3>
> +<title>Booting a Debian Live over ISCSI</title>
> +If the boot parameter <command>iscsifs="URL-to-image"</command>
> +is present, then iscsi boot is attempted.  The server port for iscsi can
> +be specifed as part of URL, this allows connections to iscsi servers
> +running on non-standard ports.  ISCSIFS booting also expect one more boot
> +parameter, namely <command>target=target-name</command>.
> +The target name specified here is part of target name, which is used to
> +uniquely identify the target representing debian live iso image when there
> +are multiple disks hosted.  This variable can contain the entire name
> of target,
> +or only part of target name which can uniquely identify the debian
> live iso disk
> +among all other exported disks.
> +<para>
> +</para>
> +</sect3>
> +
> +
> +</sect2>
> +
> +
>  <sect2 id="splash">
>  <title>Splash screens</title>
>  <para>
> =============================================
>
>
> =============================================
> ==============          Patch for initramfs                     =========
> =============================================
> Binary files initrd_orig/bin/fusermount and initrd_new/bin/fusermount differ
> Binary files initrd_orig/bin/httpfs and initrd_new/bin/httpfs differ
> Binary files initrd_orig/bin/run-init and initrd_new/bin/run-init differ
> diff -rupN initrd_orig/etc/iscsi/initiatorname.iscsi
> initrd_new/etc/iscsi/initiatorname.iscsi
> --- initrd_orig/etc/iscsi/initiatorname.iscsi   1970-01-01
> 01:00:00.000000000 +0100
> +++ initrd_new/etc/iscsi/initiatorname.iscsi    2009-09-02 23:37:57.000000000 +0200
> @@ -0,0 +1,6 @@
> +## DO NOT EDIT OR REMOVE THIS FILE!
> +## If you remove this file, the iSCSI daemon will not start.
> +## If you change the InitiatorName, existing access control lists
> +## may reject this initiator.  The InitiatorName must be unique
> +## for each iSCSI initiator.  Do NOT duplicate iSCSI InitiatorNames.
> +InitiatorName=iqn.1993-08.org.debian:01:74e6bd2d995f
> diff -rupN initrd_orig/etc/iscsi/iscsid.conf initrd_new/etc/iscsi/iscsid.conf
> --- initrd_orig/etc/iscsi/iscsid.conf   1970-01-01 01:00:00.000000000 +0100
> +++ initrd_new/etc/iscsi/iscsid.conf    2009-09-02 23:37:57.000000000 +0200
> @@ -0,0 +1,245 @@
> +#
> +# Open-iSCSI default configuration.
> +# Could be located at /etc/iscsi/iscsid.conf or ~/.iscsid.conf
> +#
> +# Note: To set any of these values for a specific node/session run
> +# the iscsiadm --mode node --op command for the value. See the README
> +# and man page for iscsiadm for details on the --op command.
> +#
> +
> +################
> +# iSNS settings
> +################
> +# Address of iSNS server
> +#isns.address = 192.168.0.1
> +#isns.port = 3205
> +
> +#############################
> +# NIC/HBA and driver settings
> +#############################
> +# open-iscsi can create a session and bind it to a NIC/HBA.
> +# To set this up see the example iface config file.
> +
> +#*****************
> +# Startup settings
> +#*****************
> +
> +# To request that the iscsi initd scripts startup a session set to "automatic".
> +node.startup = automatic
> +#
> +# To manually startup the session set to "manual". The default is manual.
> +#node.startup = manual
> +
> +# *************
> +# CHAP Settings
> +# *************
> +
> +# To enable CHAP authentication set node.session.auth.authmethod
> +# to CHAP. The default is None.
> +#node.session.auth.authmethod = CHAP
> +
> +# To set a CHAP username and password for initiator
> +# authentication by the target(s), uncomment the following lines:
> +#node.session.auth.username = username
> +#node.session.auth.password = password
> +
> +# To set a CHAP username and password for target(s)
> +# authentication by the initiator, uncomment the following lines:
> +#node.session.auth.username_in = username_in
> +#node.session.auth.password_in = password_in
> +
> +# To enable CHAP authentication for a discovery session to the target
> +# set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
> +#discovery.sendtargets.auth.authmethod = CHAP
> +
> +# To set a discovery session CHAP username and password for the initiator
> +# authentication by the target(s), uncomment the following lines:
> +#discovery.sendtargets.auth.username = username
> +#discovery.sendtargets.auth.password = password
> +
> +# To set a discovery session CHAP username and password for target(s)
> +# authentication by the initiator, uncomment the following lines:
> +#discovery.sendtargets.auth.username_in = username_in
> +#discovery.sendtargets.auth.password_in = password_in
> +
> +# ********
> +# Timeouts
> +# ********
> +#
> +# See the iSCSI REAME's Advanced Configuration section for tips
> +# on setting timeouts when using multipath or doing root over iSCSI.
> +#
> +# To specify the length of time to wait for session re-establishment
> +# before failing SCSI commands back to the application when running
> +# the Linux SCSI Layer error handler, edit the line.
> +# The value is in seconds and the default is 120 seconds.
> +node.session.timeo.replacement_timeout = 120
> +
> +# To specify the time to wait for login to complete, edit the line.
> +# The value is in seconds and the default is 15 seconds.
> +node.conn[0].timeo.login_timeout = 15
> +
> +# To specify the time to wait for logout to complete, edit the line.
> +# The value is in seconds and the default is 15 seconds.
> +node.conn[0].timeo.logout_timeout = 15
> +
> +# Time interval to wait for on connection before sending a ping.
> +node.conn[0].timeo.noop_out_interval = 5
> +
> +# To specify the time to wait for a Nop-out response before failing
> +# the connection, edit this line. Failing the connection will
> +# cause IO to be failed back to the SCSI layer. If using dm-multipath
> +# this will cause the IO to be failed to the multipath layer.
> +node.conn[0].timeo.noop_out_timeout = 5
> +
> +# To specify the time to wait for abort response before
> +# failing the operation and trying a logical unit reset edit the line.
> +# The value is in seconds and the default is 15 seconds.
> +node.session.err_timeo.abort_timeout = 15
> +
> +# To specify the time to wait for a logical unit response
> +# before failing the operation and trying session re-establishment
> +# edit the line.
> +# The value is in seconds and the default is 30 seconds.
> +node.session.err_timeo.lu_reset_timeout = 20
> +
> +#******
> +# Retry
> +#******
> +
> +# To specify the number of times iscsid should retry a login
> +# if the login attempt fails due to the node.conn[0].timeo.login_timeout
> +# expiring modify the following line. Note that if the login fails
> +# quickly (before node.conn[0].timeo.login_timeout fires) because the network
> +# layer or the target returns an error, iscsid may retry the login more than
> +# node.session.initial_login_retry_max times.
> +#
> +# This retry count along with node.conn[0].timeo.login_timeout
> +# determines the maximum amount of time iscsid will try to
> +# establish the initial login. node.session.initial_login_retry_max is
> +# multiplied by the node.conn[0].timeo.login_timeout to determine the
> +# maximum amount.
> +#
> +# The default node.session.initial_login_retry_max is 8 and
> +# node.conn[0].timeo.login_timeout is 15 so we have:
> +#
> +# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max =
> +#                                                              120 seconds
> +#
> +# Valid values are any integer value. This only
> +# affects the initial login. Setting it to a high value can slow
> +# down the iscsi service startup. Setting it to a low value can
> +# cause a session to not get logged into, if there are distuptions
> +# during startup or if the network is not ready at that time.
> +node.session.initial_login_retry_max = 8
> +
> +################################
> +# session and device queue depth
> +################################
> +
> +# To control how many commands the session will queue set
> +# node.session.cmds_max to an integer between 2 and 2048 that is also
> +# a power of 2. The default is 128.
> +node.session.cmds_max = 128
> +
> +# To control the device's queue depth set node.session.queue_depth
> +# to a value between 1 and 128. The default is 32.
> +node.session.queue_depth = 32
> +
> +#***************
> +# iSCSI settings
> +#***************
> +
> +# To enable R2T flow control (i.e., the initiator must wait for an R2T
> +# command before sending any data), uncomment the following line:
> +#
> +#node.session.iscsi.InitialR2T = Yes
> +#
> +# To disable R2T flow control (i.e., the initiator has an implied
> +# initial R2T of "FirstBurstLength" at offset 0), uncomment the following line:
> +#
> +# The defaults is No.
> +node.session.iscsi.InitialR2T = No
> +
> +#
> +# To disable immediate data (i.e., the initiator does not send
> +# unsolicited data with the iSCSI command PDU), uncomment the following line:
> +#
> +#node.session.iscsi.ImmediateData = No
> +#
> +# To enable immediate data (i.e., the initiator sends unsolicited data
> +# with the iSCSI command packet), uncomment the following line:
> +#
> +# The default is Yes
> +node.session.iscsi.ImmediateData = Yes
> +
> +# To specify the maximum number of unsolicited data bytes the initiator
> +# can send in an iSCSI PDU to a target, edit the following line.
> +#
> +# The value is the number of bytes in the range of 512 to (2^24-1) and
> +# the default is 262144
> +node.session.iscsi.FirstBurstLength = 262144
> +
> +# To specify the maximum SCSI payload that the initiator will negotiate
> +# with the target for, edit the following line.
> +#
> +# The value is the number of bytes in the range of 512 to (2^24-1) and
> +# the defauls it 16776192
> +node.session.iscsi.MaxBurstLength = 16776192
> +
> +# To specify the maximum number of data bytes the initiator can receive
> +# in an iSCSI PDU from a target, edit the following line.
> +#
> +# The value is the number of bytes in the range of 512 to (2^24-1) and
> +# the default is 131072
> +node.conn[0].iscsi.MaxRecvDataSegmentLength = 131072
> +
> +
> +# To specify the maximum number of data bytes the initiator can receive
> +# in an iSCSI PDU from a target during a discovery session, edit the
> +# following line.
> +#
> +# The value is the number of bytes in the range of 512 to (2^24-1) and
> +# the default is 32768
> +#
> +discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
> +
> +# To allow the targets to control the setting of the digest checking,
> +# with the initiator requesting a preference of enabling the
> checking, uncomment# one or both of the following lines:
> +#node.conn[0].iscsi.HeaderDigest = CRC32C,None
> +#node.conn[0].iscsi.DataDigest = CRC32C,None
> +#
> +# To allow the targets to control the setting of the digest checking,
> +# with the initiator requesting a preference of disabling the checking,
> +# uncomment one or both of the following lines:
> +#node.conn[0].iscsi.HeaderDigest = None,CRC32C
> +#node.conn[0].iscsi.DataDigest = None,CRC32C
> +#
> +# To enable CRC32C digest checking for the header and/or data part of
> +# iSCSI PDUs, uncomment one or both of the following lines:
> +#node.conn[0].iscsi.HeaderDigest = CRC32C
> +#node.conn[0].iscsi.DataDigest = CRC32C
> +#
> +# To disable digest checking for the header and/or data part of
> +# iSCSI PDUs, uncomment one or both of the following lines:
> +#node.conn[0].iscsi.HeaderDigest = None
> +#node.conn[0].iscsi.DataDigest = None
> +#
> +# The default is to never use DataDigests or HeaderDigests.
> +#
> +
> +
> +#************
> +# Workarounds
> +#************
> +
> +# Some targets like IET prefer after an initiator has sent a task
> +# management function like an ABORT TASK or LOGICAL UNIT RESET, that
> +# it does not respond to PDUs like R2Ts. To enable this behavior uncomment
> +# the following line (The default behavior is Yes):
> +node.session.iscsi.FastAbort = Yes
> +
> +# Some targets like Equalogic prefer that after an initiator has sent
> +# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that
> +# it continue to respond to R2Ts. To enable this uncomment this line
> +# node.session.iscsi.FastAbort = No
> Binary files initrd_orig/modules/crc32c.ko and
> initrd_new/modules/crc32c.ko differ
> Binary files initrd_orig/modules/libcrc32c.ko and
> initrd_new/modules/libcrc32c.ko differ
> Binary files initrd_orig/modules/loop.ko and initrd_new/modules/loop.ko differ
> Binary files initrd_orig/sbin/fdisk and initrd_new/sbin/fdisk differ
> Binary files initrd_orig/sbin/iscsiadm and initrd_new/sbin/iscsiadm differ
> Binary files initrd_orig/sbin/iscsid and initrd_new/sbin/iscsid differ
> diff -rupN initrd_orig/sbin/iscsi_discovery initrd_new/sbin/iscsi_discovery
> --- initrd_orig/sbin/iscsi_discovery    1970-01-01 01:00:00.000000000 +0100
> +++ initrd_new/sbin/iscsi_discovery     2009-09-02 23:37:58.000000000 +0200
> @@ -0,0 +1,188 @@
> +#!/bin/sh
> +#
> +# Copyright (C) Voltaire Ltd. 2006.  ALL RIGHTS RESERVED.
> +#
> +# This program is free software; you can redistribute it and/or modify it under
> +# the terms of the GNU General Public License as published by the Free Software
> +# Foundation; either version 2 of the License, or (at your option) any later
> +# version.
> +#
> +# This program is distributed in the hope that it will be useful, but WITHOUT
> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
> +# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
> +# details.
> +#
> +# You should have received a copy of the GNU General Public License along with
> +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
> +# Place, Suite 330, Boston, MA 02111-1307 USA
> +#
> +# Author: Dan Bar Dov <danb@voltaire.com>
> +
> +# iscsi_discovery:
> +#    * does a send-targets discovery to the given IP
> +#    * set the transport type to the preferred transport (or tcp is
> -t flag is not used)
> +#    * tries to login
> +#    * if succeeds,
> +#          o logout,
> +#          o mark record autmatic (unless -m flag is used)
> +#    * else
> +#          o reset transport type to TCP
> +#          o try to login
> +#          o if succeeded
> +#                + logout
> +#                + mark record automatic (unless -m flag is used)
> +#
> +
> +usage()
> +{
> +       echo "Usage: $0 <IP> [-p <port>] [-d] [-t <tcp|iser> [-f]] [-m] [-l]"
> +       echo "Options:"
> +       echo  "-p               set the port number (defualt is 3260)."
> +       echo  "-d               print debugging information"
> +       echo  "-t               set trasnpot (default is tcp)."
> +       echo  "-f               force specific transport -disable the fallback to tcp
> (default is fallback enabled)."
> +       echo  "                 force the transport specified by the argument of the -t flag."
> +       echo  "-m               manual startup - will set manual startup (default is
> automatic startup)."
> +       echo  "-l               login to the new discovered nodes (defualt is false)."
> +}
> +
> +dbg()
> +{
> +       $debug && echo $@
> +}
> +
> +initialize()
> +{
> +       trap "exit" 2
> +       debug=false
> +       force="0"
> +       log_out="1"
> +       startup_manual="0"
> +       #set defualt transport to tcp
> +       transport=tcp
> +       #set defualt port to 3260
> +       port=3260;
> +}
> +
> +parse_cmdline()
> +{
> +       if [ $# -lt 1 ]; then
> +               usage
> +               exit 1
> +       fi
> +
> +       # check if the IP address is valid
> +       ip=`echo $1 | awk -F'.' '$1 != "" && $1 <=255 && $2 != "" && $2 <=
> 255 && $3 != "" && $3 <= 255 && $4 != "" && $4 <= 255 {print $0}'`
> +       if [ -z "$ip" ]; then
> +               echo "$1 is not a vaild IP address!"
> +               exit 1
> +       fi
> +       shift
> +       while getopts "dfmlt:p:" options; do
> +        case $options in
> +               d ) debug=true;;
> +               f ) force="1";;
> +               t ) transport=$OPTARG;;
> +               p ) port=$OPTARG;;
> +               m ) startup_manual="1";;
> +               l ) log_out=0;;
> +               \? ) usage
> +                       exit 1;;
> +               * )  usage
> +                       exit 1;;
> +        esac
> +       done
> +}
> +
> +discover()
> +{
> +       # If open-iscsi is already logged in to the portal, exit
> +       if [ $(iscsiadm -m session | grep -c ${ip}:${port}) -ne 0 ]; then
> +               echo "Please logout from all targets on ${ip}:${port} before trying
> to run discovery on that portal"
> +               exit 2
> +       fi
> +
> +       connected=0
> +       discovered=0
> +       df=/tmp/discovered.$$
> +
> +       dbg "starting discovery to $ip"
> +       iscsiadm -m discovery --type sendtargets --portal ${ip}:${port} > ${df}
> +       while read portal target
> +       do
> +               portal=${portal%,*}
> +               select_transport
> +       done < ${df}
> +
> +       discovered=$(cat ${df} | wc -l)
> +       if [ ${discovered} = 0 ]; then
> +               echo "failed to discover targets at ${ip}"
> +               exit 2
> +       else
> +               echo "discovered ${discovered} targets at ${ip}"
> +       fi
> +       /bin/rm -f ${df}
> +}
> +
> +try_login()
> +{
> +       if [ "$startup_manual" != "1" ]; then
> +               iscsiadm -m node --targetname ${target} --portal ${portal} --op
> update -n node.conn[0].startup -v automatic
> +       fi
> +       iscsiadm -m node --targetname ${target} --portal ${portal} --login
>>/dev/null 2>&1
> +       ret=$?
> +       if [ ${ret} = 0 ]; then
> +               echo "Set target ${target} to automatic login over ${transport} to
> portal ${portal}"
> +               connected=$(($connected + 1))
> +               if [ "$log_out" = "1" ]; then
> +                       iscsiadm -m node --targetname ${target} --portal ${portal} --logout
> +               fi
> +       else
> +               echo "Cannot login over ${transport} to portal ${portal}"
> +               iscsiadm -m node --targetname ${target} --portal ${portal} --op
> update -n node.conn[0].startup -v manual
> +       fi
> +       return ${ret}
> +}
> +
> +set_transport()
> +{
> +       transport=$1
> +       if [ "$transport" == "iser" ];then
> +               iscsiadm -m node --targetname ${target} --portal ${portal} \
> +                               --op update -n node.conn[0].iscsi.HeaderDigest -v None
> +               iscsiadm -m node --targetname ${target} --portal ${portal} \
> +                               --op update -n node.conn[0].iscsi.DataDigest -v None
> +       fi
> +       transport_name=`iscsiadm  -m node -p ${portal} -T ${target} |awk
> '/transport_name/ {print $1}'`
> +       iscsiadm -m node --targetname ${target} --portal ${portal} \
> +                       --op update -n ${transport_name} -v ${transport}
> +}
> +
> +select_transport()
> +{
> +       set_transport $transport
> +       dbg "Testing $transport-login to target ${target} portal ${portal}"
> +       try_login;
> +       if [ $? != 0 -a  "$force" = "0" ]; then
> +               set_transport tcp
> +               dbg "starting to test tcp-login to target ${target} portal ${portal}"
> +               try_login;
> +       fi
> +}
> +
> +check_iscsid()
> +{
> +       #check if iscsid is running
> +       pidof iscsid &>/dev/null
> +       ret=$?
> +       if [ $ret -ne 0 ]; then
> +               echo "iscsid is not running"
> +               echo "Exiting..."
> +               exit 1
> +       fi
> +}
> +
> +check_iscsid
> +initialize
> +parse_cmdline "$@"
> +discover
> Binary files initrd_orig/sbin/iscsi-iname and initrd_new/sbin/iscsi-iname differ
> Binary files initrd_orig/sbin/iscsistart and initrd_new/sbin/iscsistart differ
> Binary files initrd_orig/sbin/isosize and initrd_new/sbin/isosize differ
> diff -rupN initrd_orig/scripts/live initrd_new/scripts/live
> --- initrd_orig/scripts/live    2009-09-02 23:38:24.000000000 +0200
> +++ initrd_new/scripts/live     2009-09-02 23:37:57.000000000 +0200
> @@ -19,6 +19,9 @@ USERNAME="user"
>  USERFULLNAME="Live user"
>  HOSTNAME="host"
>
> +export RESCUEBREAK="No"
> +
> +
>  mkdir -p "${mountpoint}"
>
>  # Create /etc/mtab for debug purpose and future syncs
> @@ -84,8 +87,26 @@ Arguments ()
>                        httpfs=*)
>                                HTTPFS="${ARGUMENT#httpfs=}"
>                                export HTTPFS
> +                echo "found argument httpfs here ${HTTPFS}"
> +                               ;;
> +
> +                       iscsifs=*)
> +                               ISCSIFS="${ARGUMENT#iscsifs=}"
> +                               export ISCSIFS
> +                echo "found argument iscsifs here ${ISCSIFS}"
>                                ;;
>
> +            rescuebreak)
> +                export RESCUEBREAK="Yes"
> +                ;;
> +
> +                       target=*)
> +                               TARGET="${ARGUMENT#target=}"
> +                               export TARGET
> +                echo "found argument target here ${TARGET}"
> +                               ;;
> +
> +
>                        hostname=*)
>                                HOSTNAME="${ARGUMENT#hostname=}"
>                                LIVECONF="changed"
> @@ -691,6 +712,9 @@ do_netmount ()
>  {
>        rc=1
>
> +echo "nameserver 4.2.2.2
> +nameserver 128.255.1.3" > /etc/resolv.conf
> +
>        modprobe -q af_packet # For DHCP
>
>        if [ -x /sbin/udevadm ]
> @@ -721,16 +745,31 @@ do_netmount ()
>                panic "No supported network device found, maybe a non-mainline
> driver is required."
>        fi
>
> +
> +
>        if [ "${NFSROOT}" = "auto" ]
>        then
>                NFSROOT=${ROOTSERVER}:${ROOTPATH}
>        fi
> +
> +
> +       if ( [ -n "${ISCSIFS}" ] ) && do_iscsimount
> +       then
> +        echo "do_iscsimount successful"
> +               rc=0
> +               return ${rc}
> +       fi
> +    echo "do_iscsimount failed..."
> +
> +
>
>        if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] )
> && do_httpmount
>        then
> +        echo "do_httpmount successful"
>                rc=0
>                return ${rc}
>        fi
> +    echo "do_httpmount failed..."
>
>        if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
>        then
> @@ -749,10 +788,55 @@ do_netmount ()
>                rc=0
>        fi
>
> +    echo "Giving rescue shell.... type exit when finished"
> +    /bin/bash
>        log_end_msg
>        return ${rc}
>  }
>
> +do_iscsimount ()
> +{
> +       rc=1
> +       dest="${mountpoint}/${LIVE_MEDIA_PATH}"
> +       mount -t ramfs ram "${mountpoint}"
> +       mkdir -p "${dest}"
> +
> +    echo "inside iscsimount"
> +
> +    insmod /modules/libcrc32c.ko
> +    insmod /modules/crc32c.ko
> +    modprobe iscsi_tcp
> +    modprobe ib_iser
> +    mkdir /var/run
> +    /sbin/iscsid
> +    sleep 4
> +    iscsiadm -m discovery -t st -p "${ISCSIFS}"
> +    sleep 4
> +    targetname=`iscsiadm -m node | grep "${TARGET}" | cut -d' ' -f2`
> +    iscsiadm -m node --targetname "${targetname}" --portal "${ISCSIFS}" --login
> +#    dmesg > /messages
> +    sync
> +       i=0
> +#   iscsiadm -m session -P 3 | grep "attached scsi disk"
> +#    export iscsidevice="/dev/disk/by-id/scsi-1494554000000000000000000010000000500c9000000d00f"
> +    export iscsidevice=/dev/disk/by-label/Debian\\x20lenny\\x2020090614-09\:11
> +       while [ "$i" -lt 160 ]
> +       do
> +        ls -l "${iscsidevice}" && break
> +               i="$(($i + 1))"
> +        echo "waiting for iscsi disk to appear $i"
> +               sleep 1
> +        sync
> +       done
> +#   export iscsidevice=`fdisk -l 2> /dev/null | grep "724 MB" | cut
> -d' ' -f2 | cut -d':' -f1`
> +   mount -t iso9660 "${iscsidevice}" "${mountpoint}"
> +    rc=${?}
> +    sync
> +    sleep 2
> +    rc=0
> +    return $rc
> +}
> +
>  do_httpmount ()
>  {
>        rc=1
> @@ -760,11 +844,33 @@ do_httpmount ()
>        mount -t ramfs ram "${mountpoint}"
>        mkdir -p "${dest}"
>
> +    echo "inside httpmount"
>        for webfile in HTTPFS FTPFS FETCH
>        do
>                url="$(eval echo \"\$\{${webfile}\}\")"
>                extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
>
> +        if [ "${extension}" = "iso" ]
> +        then
> +            echo "Mounting iso"
> +                       modprobe fuse
> +            modprobe loop
> +            mknod "${rootmnt}/dev/loop0" b 7 0
> +               mkdir -p "${rootmnt}/iso"
> +            echo "trying httpfs with ${url} and ${mountpoint}"
> +                       httpfs "${url}" "${rootmnt}/iso"
> +               FILEPATH=`ls "${rootmnt}"/iso/*.iso`
> +               echo  "File path is $FILEPATH"
> +               losetup "${rootmnt}/dev/loop0" $FILEPATH
> +               mount -t iso9660 $FILEPATH "${mountpoint}" -o loop -o ro
> +            rc=${?}
> +            return $rc
> +        else
> +            echo "not BKO http mount, proceding in normal way"
> +        fi
> +
> +        echo "webfile is $webfile and url is $url"
> +        echo "webfile is $webfile and url is $url" >> /mylogs
>                if [ -n "$url" ]
>                then
>                        case "${extension}" in
> @@ -793,7 +899,10 @@ do_httpmount ()
>                                                        FUSE_MOUNT="httpfs"
>                                                fi
>                                                modprobe fuse
> +                        echo "trying $FUSE_MOUNT with ${url} and ${dest}"
> +                        sleep 2
>                                                $FUSE_MOUNT "${url}" "${dest}"
> +                        echo "mount done "
>                                        fi
>                                        [ ${?} -eq 0 ] && rc=0
>                                        [ "${extension}" = "tgz" ] && live_dest="ram"
> @@ -1584,6 +1693,13 @@ mountroot ()
>                fi
>        fi
>
> +    if [ "${RESCUEBREAK}" = "Yes" ]; then
> +        echo "#################################################################"
> +        echo "#### giving rescue shell, you can execute any commands
> here #####"
> +        echo "#### When done, type exit, boot process will resume :-)
>    #####"
> +        echo "#################################################################"
> +        /bin/sh
> +    fi
>        if [ -z "${livefs_root}" ]
>        then
>                panic "Unable to find a medium containing a live file system"
>
> =============================================
>



-- 
Pravin
Binary files initrd_orig/bin/fusermount and initrd_new/bin/fusermount differ
Binary files initrd_orig/bin/httpfs and initrd_new/bin/httpfs differ
Binary files initrd_orig/bin/run-init and initrd_new/bin/run-init differ
diff -rupN initrd_orig/etc/iscsi/initiatorname.iscsi initrd_new/etc/iscsi/initiatorname.iscsi
--- initrd_orig/etc/iscsi/initiatorname.iscsi	1970-01-01 01:00:00.000000000 +0100
+++ initrd_new/etc/iscsi/initiatorname.iscsi	2009-09-02 23:37:57.000000000 +0200
@@ -0,0 +1,6 @@
+## DO NOT EDIT OR REMOVE THIS FILE!
+## If you remove this file, the iSCSI daemon will not start.
+## If you change the InitiatorName, existing access control lists
+## may reject this initiator.  The InitiatorName must be unique
+## for each iSCSI initiator.  Do NOT duplicate iSCSI InitiatorNames.
+InitiatorName=iqn.1993-08.org.debian:01:74e6bd2d995f
diff -rupN initrd_orig/etc/iscsi/iscsid.conf initrd_new/etc/iscsi/iscsid.conf
--- initrd_orig/etc/iscsi/iscsid.conf	1970-01-01 01:00:00.000000000 +0100
+++ initrd_new/etc/iscsi/iscsid.conf	2009-09-02 23:37:57.000000000 +0200
@@ -0,0 +1,245 @@
+#
+# Open-iSCSI default configuration.
+# Could be located at /etc/iscsi/iscsid.conf or ~/.iscsid.conf
+#
+# Note: To set any of these values for a specific node/session run
+# the iscsiadm --mode node --op command for the value. See the README
+# and man page for iscsiadm for details on the --op command.
+#
+
+################
+# iSNS settings
+################
+# Address of iSNS server
+#isns.address = 192.168.0.1
+#isns.port = 3205
+
+#############################
+# NIC/HBA and driver settings
+#############################
+# open-iscsi can create a session and bind it to a NIC/HBA.
+# To set this up see the example iface config file.
+
+#*****************
+# Startup settings
+#*****************
+
+# To request that the iscsi initd scripts startup a session set to "automatic".
+node.startup = automatic
+#
+# To manually startup the session set to "manual". The default is manual.
+#node.startup = manual
+
+# *************
+# CHAP Settings
+# *************
+
+# To enable CHAP authentication set node.session.auth.authmethod
+# to CHAP. The default is None.
+#node.session.auth.authmethod = CHAP
+
+# To set a CHAP username and password for initiator
+# authentication by the target(s), uncomment the following lines:
+#node.session.auth.username = username
+#node.session.auth.password = password
+
+# To set a CHAP username and password for target(s)
+# authentication by the initiator, uncomment the following lines:
+#node.session.auth.username_in = username_in
+#node.session.auth.password_in = password_in
+
+# To enable CHAP authentication for a discovery session to the target
+# set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
+#discovery.sendtargets.auth.authmethod = CHAP
+
+# To set a discovery session CHAP username and password for the initiator
+# authentication by the target(s), uncomment the following lines:
+#discovery.sendtargets.auth.username = username
+#discovery.sendtargets.auth.password = password
+
+# To set a discovery session CHAP username and password for target(s)
+# authentication by the initiator, uncomment the following lines:
+#discovery.sendtargets.auth.username_in = username_in
+#discovery.sendtargets.auth.password_in = password_in
+
+# ********
+# Timeouts
+# ********
+#
+# See the iSCSI REAME's Advanced Configuration section for tips
+# on setting timeouts when using multipath or doing root over iSCSI.
+#
+# To specify the length of time to wait for session re-establishment
+# before failing SCSI commands back to the application when running
+# the Linux SCSI Layer error handler, edit the line.
+# The value is in seconds and the default is 120 seconds.
+node.session.timeo.replacement_timeout = 120
+
+# To specify the time to wait for login to complete, edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.conn[0].timeo.login_timeout = 15
+
+# To specify the time to wait for logout to complete, edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.conn[0].timeo.logout_timeout = 15
+
+# Time interval to wait for on connection before sending a ping.
+node.conn[0].timeo.noop_out_interval = 5
+
+# To specify the time to wait for a Nop-out response before failing
+# the connection, edit this line. Failing the connection will
+# cause IO to be failed back to the SCSI layer. If using dm-multipath
+# this will cause the IO to be failed to the multipath layer.
+node.conn[0].timeo.noop_out_timeout = 5
+
+# To specify the time to wait for abort response before
+# failing the operation and trying a logical unit reset edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.session.err_timeo.abort_timeout = 15
+
+# To specify the time to wait for a logical unit response
+# before failing the operation and trying session re-establishment
+# edit the line.
+# The value is in seconds and the default is 30 seconds.
+node.session.err_timeo.lu_reset_timeout = 20
+
+#******
+# Retry
+#******
+
+# To specify the number of times iscsid should retry a login
+# if the login attempt fails due to the node.conn[0].timeo.login_timeout
+# expiring modify the following line. Note that if the login fails
+# quickly (before node.conn[0].timeo.login_timeout fires) because the network
+# layer or the target returns an error, iscsid may retry the login more than
+# node.session.initial_login_retry_max times.
+#
+# This retry count along with node.conn[0].timeo.login_timeout
+# determines the maximum amount of time iscsid will try to
+# establish the initial login. node.session.initial_login_retry_max is
+# multiplied by the node.conn[0].timeo.login_timeout to determine the
+# maximum amount.
+#
+# The default node.session.initial_login_retry_max is 8 and
+# node.conn[0].timeo.login_timeout is 15 so we have:
+#
+# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max =
+#								120 seconds
+#
+# Valid values are any integer value. This only
+# affects the initial login. Setting it to a high value can slow
+# down the iscsi service startup. Setting it to a low value can
+# cause a session to not get logged into, if there are distuptions
+# during startup or if the network is not ready at that time.
+node.session.initial_login_retry_max = 8
+
+################################
+# session and device queue depth
+################################
+
+# To control how many commands the session will queue set
+# node.session.cmds_max to an integer between 2 and 2048 that is also
+# a power of 2. The default is 128.
+node.session.cmds_max = 128
+
+# To control the device's queue depth set node.session.queue_depth
+# to a value between 1 and 128. The default is 32.
+node.session.queue_depth = 32
+
+#***************
+# iSCSI settings
+#***************
+
+# To enable R2T flow control (i.e., the initiator must wait for an R2T
+# command before sending any data), uncomment the following line:
+#
+#node.session.iscsi.InitialR2T = Yes
+#
+# To disable R2T flow control (i.e., the initiator has an implied
+# initial R2T of "FirstBurstLength" at offset 0), uncomment the following line:
+#
+# The defaults is No.
+node.session.iscsi.InitialR2T = No
+
+#
+# To disable immediate data (i.e., the initiator does not send
+# unsolicited data with the iSCSI command PDU), uncomment the following line:
+#
+#node.session.iscsi.ImmediateData = No
+#
+# To enable immediate data (i.e., the initiator sends unsolicited data
+# with the iSCSI command packet), uncomment the following line:
+#
+# The default is Yes
+node.session.iscsi.ImmediateData = Yes
+
+# To specify the maximum number of unsolicited data bytes the initiator
+# can send in an iSCSI PDU to a target, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 262144
+node.session.iscsi.FirstBurstLength = 262144
+
+# To specify the maximum SCSI payload that the initiator will negotiate
+# with the target for, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the defauls it 16776192
+node.session.iscsi.MaxBurstLength = 16776192
+
+# To specify the maximum number of data bytes the initiator can receive
+# in an iSCSI PDU from a target, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 131072
+node.conn[0].iscsi.MaxRecvDataSegmentLength = 131072
+
+
+# To specify the maximum number of data bytes the initiator can receive
+# in an iSCSI PDU from a target during a discovery session, edit the
+# following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 32768
+# 
+discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
+
+# To allow the targets to control the setting of the digest checking,
+# with the initiator requesting a preference of enabling the checking, uncomment# one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = CRC32C,None
+#node.conn[0].iscsi.DataDigest = CRC32C,None
+#
+# To allow the targets to control the setting of the digest checking,
+# with the initiator requesting a preference of disabling the checking,
+# uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = None,CRC32C
+#node.conn[0].iscsi.DataDigest = None,CRC32C
+#
+# To enable CRC32C digest checking for the header and/or data part of
+# iSCSI PDUs, uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = CRC32C
+#node.conn[0].iscsi.DataDigest = CRC32C
+#
+# To disable digest checking for the header and/or data part of
+# iSCSI PDUs, uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = None
+#node.conn[0].iscsi.DataDigest = None
+#
+# The default is to never use DataDigests or HeaderDigests.
+#
+
+
+#************
+# Workarounds
+#************
+
+# Some targets like IET prefer after an initiator has sent a task
+# management function like an ABORT TASK or LOGICAL UNIT RESET, that
+# it does not respond to PDUs like R2Ts. To enable this behavior uncomment
+# the following line (The default behavior is Yes):
+node.session.iscsi.FastAbort = Yes
+
+# Some targets like Equalogic prefer that after an initiator has sent
+# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that
+# it continue to respond to R2Ts. To enable this uncomment this line
+# node.session.iscsi.FastAbort = No
Binary files initrd_orig/modules/crc32c.ko and initrd_new/modules/crc32c.ko differ
Binary files initrd_orig/modules/libcrc32c.ko and initrd_new/modules/libcrc32c.ko differ
Binary files initrd_orig/modules/loop.ko and initrd_new/modules/loop.ko differ
Binary files initrd_orig/sbin/fdisk and initrd_new/sbin/fdisk differ
Binary files initrd_orig/sbin/iscsiadm and initrd_new/sbin/iscsiadm differ
Binary files initrd_orig/sbin/iscsid and initrd_new/sbin/iscsid differ
diff -rupN initrd_orig/sbin/iscsi_discovery initrd_new/sbin/iscsi_discovery
--- initrd_orig/sbin/iscsi_discovery	1970-01-01 01:00:00.000000000 +0100
+++ initrd_new/sbin/iscsi_discovery	2009-09-02 23:37:58.000000000 +0200
@@ -0,0 +1,188 @@
+#!/bin/sh
+#
+# Copyright (C) Voltaire Ltd. 2006.  ALL RIGHTS RESERVED.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Dan Bar Dov <danb@voltaire.com>
+
+# iscsi_discovery:
+#    * does a send-targets discovery to the given IP
+#    * set the transport type to the preferred transport (or tcp is -t flag is not used)
+#    * tries to login
+#    * if succeeds,
+#          o logout,
+#          o mark record autmatic (unless -m flag is used)
+#    * else
+#          o reset transport type to TCP
+#          o try to login
+#          o if succeeded
+#                + logout
+#                + mark record automatic (unless -m flag is used)
+#
+
+usage()
+{
+	echo "Usage: $0 <IP> [-p <port>] [-d] [-t <tcp|iser> [-f]] [-m] [-l]"
+	echo "Options:"
+	echo  "-p		set the port number (defualt is 3260)."
+	echo  "-d		print debugging information"
+	echo  "-t		set trasnpot (default is tcp)."
+	echo  "-f		force specific transport -disable the fallback to tcp (default is fallback enabled)."
+	echo  "			force the transport specified by the argument of the -t flag."
+	echo  "-m		manual startup - will set manual startup (default is automatic startup)."
+	echo  "-l		login to the new discovered nodes (defualt is false)."
+}
+
+dbg()
+{
+	$debug && echo $@
+}
+
+initialize()
+{
+	trap "exit" 2
+	debug=false
+	force="0"
+	log_out="1"
+	startup_manual="0"
+	#set defualt transport to tcp
+	transport=tcp
+	#set defualt port to 3260
+	port=3260;
+}
+
+parse_cmdline()
+{
+	if [ $# -lt 1 ]; then
+		usage
+		exit 1
+	fi
+
+	# check if the IP address is valid
+	ip=`echo $1 | awk -F'.' '$1 != "" && $1 <=255 && $2 != "" && $2 <= 255 && $3 != "" && $3 <= 255 && $4 != "" && $4 <= 255 {print $0}'`
+	if [ -z "$ip" ]; then
+		echo "$1 is not a vaild IP address!"
+		exit 1
+	fi
+	shift
+	while getopts "dfmlt:p:" options; do
+	 case $options in
+		d ) debug=true;;
+		f ) force="1";;
+		t ) transport=$OPTARG;;
+		p ) port=$OPTARG;;
+		m ) startup_manual="1";;
+		l ) log_out=0;;
+		\? ) usage
+			exit 1;;
+		* )  usage
+			exit 1;;
+	 esac
+	done
+}
+
+discover()
+{
+	# If open-iscsi is already logged in to the portal, exit
+	if [ $(iscsiadm -m session | grep -c ${ip}:${port}) -ne 0 ]; then
+		echo "Please logout from all targets on ${ip}:${port} before trying to run discovery on that portal"
+		exit 2
+	fi
+
+	connected=0
+	discovered=0
+	df=/tmp/discovered.$$
+
+	dbg "starting discovery to $ip"
+	iscsiadm -m discovery --type sendtargets --portal ${ip}:${port} > ${df}
+	while read portal target
+	do
+		portal=${portal%,*}
+		select_transport
+	done < ${df}
+
+	discovered=$(cat ${df} | wc -l)
+	if [ ${discovered} = 0 ]; then
+		echo "failed to discover targets at ${ip}"
+		exit 2
+	else
+		echo "discovered ${discovered} targets at ${ip}"
+	fi
+	/bin/rm -f ${df}
+}
+
+try_login()
+{
+	if [ "$startup_manual" != "1" ]; then
+		iscsiadm -m node --targetname ${target} --portal ${portal} --op update -n node.conn[0].startup -v automatic
+	fi
+	iscsiadm -m node --targetname ${target} --portal ${portal} --login >/dev/null 2>&1
+	ret=$?
+	if [ ${ret} = 0 ]; then
+		echo "Set target ${target} to automatic login over ${transport} to portal ${portal}"
+		connected=$(($connected + 1))
+		if [ "$log_out" = "1" ]; then
+			iscsiadm -m node --targetname ${target} --portal ${portal} --logout
+		fi
+	else
+		echo "Cannot login over ${transport} to portal ${portal}"
+		iscsiadm -m node --targetname ${target} --portal ${portal} --op update -n node.conn[0].startup -v manual
+	fi
+	return ${ret}
+}
+
+set_transport()
+{
+	transport=$1
+	if [ "$transport" == "iser" ];then
+		iscsiadm -m node --targetname ${target} --portal ${portal} \
+				--op update -n node.conn[0].iscsi.HeaderDigest -v None
+		iscsiadm -m node --targetname ${target} --portal ${portal} \
+				--op update -n node.conn[0].iscsi.DataDigest -v None
+	fi
+	transport_name=`iscsiadm  -m node -p ${portal} -T ${target} |awk '/transport_name/ {print $1}'`
+	iscsiadm -m node --targetname ${target} --portal ${portal} \
+			--op update -n ${transport_name} -v ${transport}
+}
+
+select_transport()
+{
+	set_transport $transport
+	dbg "Testing $transport-login to target ${target} portal ${portal}"
+	try_login;
+	if [ $? != 0 -a  "$force" = "0" ]; then
+		set_transport tcp
+		dbg "starting to test tcp-login to target ${target} portal ${portal}"
+		try_login;
+	fi
+}
+
+check_iscsid()
+{
+	#check if iscsid is running
+	pidof iscsid &>/dev/null
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "iscsid is not running"
+		echo "Exiting..."
+		exit 1
+	fi
+}
+
+check_iscsid
+initialize
+parse_cmdline "$@"
+discover
Binary files initrd_orig/sbin/iscsi-iname and initrd_new/sbin/iscsi-iname differ
Binary files initrd_orig/sbin/iscsistart and initrd_new/sbin/iscsistart differ
Binary files initrd_orig/sbin/isosize and initrd_new/sbin/isosize differ
diff -rupN initrd_orig/scripts/live initrd_new/scripts/live
--- initrd_orig/scripts/live	2009-09-02 23:38:24.000000000 +0200
+++ initrd_new/scripts/live	2009-09-02 23:37:57.000000000 +0200
@@ -19,6 +19,9 @@ USERNAME="user"
 USERFULLNAME="Live user"
 HOSTNAME="host"
 
+export RESCUEBREAK="No"
+
+
 mkdir -p "${mountpoint}"
 
 # Create /etc/mtab for debug purpose and future syncs
@@ -84,8 +87,26 @@ Arguments ()
 			httpfs=*)
 				HTTPFS="${ARGUMENT#httpfs=}"
 				export HTTPFS
+                echo "found argument httpfs here ${HTTPFS}"
+				;;
+
+			iscsifs=*)
+				ISCSIFS="${ARGUMENT#iscsifs=}"
+				export ISCSIFS
+                echo "found argument iscsifs here ${ISCSIFS}"
 				;;
 
+            rescuebreak)
+                export RESCUEBREAK="Yes" 
+                ;;
+
+			target=*)
+				TARGET="${ARGUMENT#target=}"
+				export TARGET 
+                echo "found argument target here ${TARGET}"
+				;;
+
+
 			hostname=*)
 				HOSTNAME="${ARGUMENT#hostname=}"
 				LIVECONF="changed"
@@ -691,6 +712,9 @@ do_netmount ()
 {
 	rc=1
 
+echo "nameserver 4.2.2.2
+nameserver 128.255.1.3" > /etc/resolv.conf
+
 	modprobe -q af_packet # For DHCP
 
 	if [ -x /sbin/udevadm ]
@@ -721,16 +745,31 @@ do_netmount ()
 		panic "No supported network device found, maybe a non-mainline driver is required."
 	fi
 
+
+
 	if [ "${NFSROOT}" = "auto" ]
 	then
 		NFSROOT=${ROOTSERVER}:${ROOTPATH}
 	fi
+    
+
+	if ( [ -n "${ISCSIFS}" ] ) && do_iscsimount
+	then
+        echo "do_iscsimount successful"
+		rc=0
+		return ${rc}
+	fi
+    echo "do_iscsimount failed..."
+
+
 
 	if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] ) && do_httpmount
 	then
+        echo "do_httpmount successful"
 		rc=0
 		return ${rc}
 	fi
+    echo "do_httpmount failed..."
 
 	if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
 	then
@@ -749,10 +788,55 @@ do_netmount ()
 		rc=0
 	fi
 
+    echo "Giving rescue shell.... type exit when finished"
+    /bin/bash
 	log_end_msg
 	return ${rc}
 }
 
+do_iscsimount ()
+{
+	rc=1
+	dest="${mountpoint}/${LIVE_MEDIA_PATH}"
+	mount -t ramfs ram "${mountpoint}"
+	mkdir -p "${dest}"
+
+    echo "inside iscsimount" 
+            
+    insmod /modules/libcrc32c.ko
+    insmod /modules/crc32c.ko
+    modprobe iscsi_tcp
+    modprobe ib_iser
+    mkdir /var/run
+    /sbin/iscsid
+    sleep 4
+    iscsiadm -m discovery -t st -p "${ISCSIFS}"
+    sleep 4
+    targetname=`iscsiadm -m node | grep "${TARGET}" | cut -d' ' -f2`
+    iscsiadm -m node --targetname "${targetname}" --portal "${ISCSIFS}" --login
+#    dmesg > /messages
+    sync
+ 	i=0
+#   iscsiadm -m session -P 3 | grep "attached scsi disk"
+#    export iscsidevice="/dev/disk/by-id/scsi-1494554000000000000000000010000000500c9000000d00f"
+    export iscsidevice=/dev/disk/by-label/Debian\\x20lenny\\x2020090614-09\:11 
+	while [ "$i" -lt 160 ]
+	do
+        ls -l "${iscsidevice}" && break
+		i="$(($i + 1))"
+        echo "waiting for iscsi disk to appear $i"
+		sleep 1
+        sync
+	done
+#   export iscsidevice=`fdisk -l 2> /dev/null | grep "724 MB" | cut -d' ' -f2 | cut -d':' -f1`
+   mount -t iso9660 "${iscsidevice}" "${mountpoint}"
+    rc=${?}
+    sync
+    sleep 2
+    rc=0
+    return $rc
+}
+
 do_httpmount ()
 {
 	rc=1
@@ -760,11 +844,33 @@ do_httpmount ()
 	mount -t ramfs ram "${mountpoint}"
 	mkdir -p "${dest}"
 
+    echo "inside httpmount" 
 	for webfile in HTTPFS FTPFS FETCH
 	do
 		url="$(eval echo \"\$\{${webfile}\}\")"
 		extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
 
+        if [ "${extension}" = "iso" ] 
+        then
+            echo "Mounting iso"
+       		modprobe fuse
+            modprobe loop
+            mknod "${rootmnt}/dev/loop0" b 7 0
+	        mkdir -p "${rootmnt}/iso"
+            echo "trying httpfs with ${url} and ${mountpoint}"
+			httpfs "${url}" "${rootmnt}/iso" 
+	        FILEPATH=`ls "${rootmnt}"/iso/*.iso`
+	        echo  "File path is $FILEPATH" 
+	        losetup "${rootmnt}/dev/loop0" $FILEPATH
+	        mount -t iso9660 $FILEPATH "${mountpoint}" -o loop -o ro
+            rc=${?}
+            return $rc
+        else
+            echo "not BKO http mount, proceding in normal way"
+        fi
+
+        echo "webfile is $webfile and url is $url" 
+        echo "webfile is $webfile and url is $url" >> /mylogs
 		if [ -n "$url" ]
 		then
 			case "${extension}" in
@@ -793,7 +899,10 @@ do_httpmount ()
 							FUSE_MOUNT="httpfs"
 						fi
 						modprobe fuse
+                        echo "trying $FUSE_MOUNT with ${url} and ${dest}"
+                        sleep 2
 						$FUSE_MOUNT "${url}" "${dest}"
+                        echo "mount done "
 					fi
 					[ ${?} -eq 0 ] && rc=0
 					[ "${extension}" = "tgz" ] && live_dest="ram"
@@ -1584,6 +1693,13 @@ mountroot ()
 		fi
 	fi
 
+    if [ "${RESCUEBREAK}" = "Yes" ]; then
+        echo "#################################################################"
+        echo "#### giving rescue shell, you can execute any commands here #####"
+        echo "#### When done, type exit, boot process will resume :-)     #####"
+        echo "#################################################################"
+        /bin/sh
+    fi
 	if [ -z "${livefs_root}" ]
 	then
 		panic "Unable to find a medium containing a live file system"
Binary files initrd_orig/bin/fusermount and initrd_new/bin/fusermount differ
Binary files initrd_orig/bin/httpfs and initrd_new/bin/httpfs differ
Binary files initrd_orig/bin/run-init and initrd_new/bin/run-init differ
diff -rupN initrd_orig/etc/iscsi/initiatorname.iscsi initrd_new/etc/iscsi/initiatorname.iscsi
--- initrd_orig/etc/iscsi/initiatorname.iscsi	1970-01-01 01:00:00.000000000 +0100
+++ initrd_new/etc/iscsi/initiatorname.iscsi	2009-09-02 23:37:57.000000000 +0200
@@ -0,0 +1,6 @@
+## DO NOT EDIT OR REMOVE THIS FILE!
+## If you remove this file, the iSCSI daemon will not start.
+## If you change the InitiatorName, existing access control lists
+## may reject this initiator.  The InitiatorName must be unique
+## for each iSCSI initiator.  Do NOT duplicate iSCSI InitiatorNames.
+InitiatorName=iqn.1993-08.org.debian:01:74e6bd2d995f
diff -rupN initrd_orig/etc/iscsi/iscsid.conf initrd_new/etc/iscsi/iscsid.conf
--- initrd_orig/etc/iscsi/iscsid.conf	1970-01-01 01:00:00.000000000 +0100
+++ initrd_new/etc/iscsi/iscsid.conf	2009-09-02 23:37:57.000000000 +0200
@@ -0,0 +1,245 @@
+#
+# Open-iSCSI default configuration.
+# Could be located at /etc/iscsi/iscsid.conf or ~/.iscsid.conf
+#
+# Note: To set any of these values for a specific node/session run
+# the iscsiadm --mode node --op command for the value. See the README
+# and man page for iscsiadm for details on the --op command.
+#
+
+################
+# iSNS settings
+################
+# Address of iSNS server
+#isns.address = 192.168.0.1
+#isns.port = 3205
+
+#############################
+# NIC/HBA and driver settings
+#############################
+# open-iscsi can create a session and bind it to a NIC/HBA.
+# To set this up see the example iface config file.
+
+#*****************
+# Startup settings
+#*****************
+
+# To request that the iscsi initd scripts startup a session set to "automatic".
+node.startup = automatic
+#
+# To manually startup the session set to "manual". The default is manual.
+#node.startup = manual
+
+# *************
+# CHAP Settings
+# *************
+
+# To enable CHAP authentication set node.session.auth.authmethod
+# to CHAP. The default is None.
+#node.session.auth.authmethod = CHAP
+
+# To set a CHAP username and password for initiator
+# authentication by the target(s), uncomment the following lines:
+#node.session.auth.username = username
+#node.session.auth.password = password
+
+# To set a CHAP username and password for target(s)
+# authentication by the initiator, uncomment the following lines:
+#node.session.auth.username_in = username_in
+#node.session.auth.password_in = password_in
+
+# To enable CHAP authentication for a discovery session to the target
+# set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
+#discovery.sendtargets.auth.authmethod = CHAP
+
+# To set a discovery session CHAP username and password for the initiator
+# authentication by the target(s), uncomment the following lines:
+#discovery.sendtargets.auth.username = username
+#discovery.sendtargets.auth.password = password
+
+# To set a discovery session CHAP username and password for target(s)
+# authentication by the initiator, uncomment the following lines:
+#discovery.sendtargets.auth.username_in = username_in
+#discovery.sendtargets.auth.password_in = password_in
+
+# ********
+# Timeouts
+# ********
+#
+# See the iSCSI REAME's Advanced Configuration section for tips
+# on setting timeouts when using multipath or doing root over iSCSI.
+#
+# To specify the length of time to wait for session re-establishment
+# before failing SCSI commands back to the application when running
+# the Linux SCSI Layer error handler, edit the line.
+# The value is in seconds and the default is 120 seconds.
+node.session.timeo.replacement_timeout = 120
+
+# To specify the time to wait for login to complete, edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.conn[0].timeo.login_timeout = 15
+
+# To specify the time to wait for logout to complete, edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.conn[0].timeo.logout_timeout = 15
+
+# Time interval to wait for on connection before sending a ping.
+node.conn[0].timeo.noop_out_interval = 5
+
+# To specify the time to wait for a Nop-out response before failing
+# the connection, edit this line. Failing the connection will
+# cause IO to be failed back to the SCSI layer. If using dm-multipath
+# this will cause the IO to be failed to the multipath layer.
+node.conn[0].timeo.noop_out_timeout = 5
+
+# To specify the time to wait for abort response before
+# failing the operation and trying a logical unit reset edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.session.err_timeo.abort_timeout = 15
+
+# To specify the time to wait for a logical unit response
+# before failing the operation and trying session re-establishment
+# edit the line.
+# The value is in seconds and the default is 30 seconds.
+node.session.err_timeo.lu_reset_timeout = 20
+
+#******
+# Retry
+#******
+
+# To specify the number of times iscsid should retry a login
+# if the login attempt fails due to the node.conn[0].timeo.login_timeout
+# expiring modify the following line. Note that if the login fails
+# quickly (before node.conn[0].timeo.login_timeout fires) because the network
+# layer or the target returns an error, iscsid may retry the login more than
+# node.session.initial_login_retry_max times.
+#
+# This retry count along with node.conn[0].timeo.login_timeout
+# determines the maximum amount of time iscsid will try to
+# establish the initial login. node.session.initial_login_retry_max is
+# multiplied by the node.conn[0].timeo.login_timeout to determine the
+# maximum amount.
+#
+# The default node.session.initial_login_retry_max is 8 and
+# node.conn[0].timeo.login_timeout is 15 so we have:
+#
+# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max =
+#								120 seconds
+#
+# Valid values are any integer value. This only
+# affects the initial login. Setting it to a high value can slow
+# down the iscsi service startup. Setting it to a low value can
+# cause a session to not get logged into, if there are distuptions
+# during startup or if the network is not ready at that time.
+node.session.initial_login_retry_max = 8
+
+################################
+# session and device queue depth
+################################
+
+# To control how many commands the session will queue set
+# node.session.cmds_max to an integer between 2 and 2048 that is also
+# a power of 2. The default is 128.
+node.session.cmds_max = 128
+
+# To control the device's queue depth set node.session.queue_depth
+# to a value between 1 and 128. The default is 32.
+node.session.queue_depth = 32
+
+#***************
+# iSCSI settings
+#***************
+
+# To enable R2T flow control (i.e., the initiator must wait for an R2T
+# command before sending any data), uncomment the following line:
+#
+#node.session.iscsi.InitialR2T = Yes
+#
+# To disable R2T flow control (i.e., the initiator has an implied
+# initial R2T of "FirstBurstLength" at offset 0), uncomment the following line:
+#
+# The defaults is No.
+node.session.iscsi.InitialR2T = No
+
+#
+# To disable immediate data (i.e., the initiator does not send
+# unsolicited data with the iSCSI command PDU), uncomment the following line:
+#
+#node.session.iscsi.ImmediateData = No
+#
+# To enable immediate data (i.e., the initiator sends unsolicited data
+# with the iSCSI command packet), uncomment the following line:
+#
+# The default is Yes
+node.session.iscsi.ImmediateData = Yes
+
+# To specify the maximum number of unsolicited data bytes the initiator
+# can send in an iSCSI PDU to a target, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 262144
+node.session.iscsi.FirstBurstLength = 262144
+
+# To specify the maximum SCSI payload that the initiator will negotiate
+# with the target for, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the defauls it 16776192
+node.session.iscsi.MaxBurstLength = 16776192
+
+# To specify the maximum number of data bytes the initiator can receive
+# in an iSCSI PDU from a target, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 131072
+node.conn[0].iscsi.MaxRecvDataSegmentLength = 131072
+
+
+# To specify the maximum number of data bytes the initiator can receive
+# in an iSCSI PDU from a target during a discovery session, edit the
+# following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 32768
+# 
+discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
+
+# To allow the targets to control the setting of the digest checking,
+# with the initiator requesting a preference of enabling the checking, uncomment# one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = CRC32C,None
+#node.conn[0].iscsi.DataDigest = CRC32C,None
+#
+# To allow the targets to control the setting of the digest checking,
+# with the initiator requesting a preference of disabling the checking,
+# uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = None,CRC32C
+#node.conn[0].iscsi.DataDigest = None,CRC32C
+#
+# To enable CRC32C digest checking for the header and/or data part of
+# iSCSI PDUs, uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = CRC32C
+#node.conn[0].iscsi.DataDigest = CRC32C
+#
+# To disable digest checking for the header and/or data part of
+# iSCSI PDUs, uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = None
+#node.conn[0].iscsi.DataDigest = None
+#
+# The default is to never use DataDigests or HeaderDigests.
+#
+
+
+#************
+# Workarounds
+#************
+
+# Some targets like IET prefer after an initiator has sent a task
+# management function like an ABORT TASK or LOGICAL UNIT RESET, that
+# it does not respond to PDUs like R2Ts. To enable this behavior uncomment
+# the following line (The default behavior is Yes):
+node.session.iscsi.FastAbort = Yes
+
+# Some targets like Equalogic prefer that after an initiator has sent
+# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that
+# it continue to respond to R2Ts. To enable this uncomment this line
+# node.session.iscsi.FastAbort = No
Binary files initrd_orig/modules/crc32c.ko and initrd_new/modules/crc32c.ko differ
Binary files initrd_orig/modules/libcrc32c.ko and initrd_new/modules/libcrc32c.ko differ
Binary files initrd_orig/modules/loop.ko and initrd_new/modules/loop.ko differ
Binary files initrd_orig/sbin/fdisk and initrd_new/sbin/fdisk differ
Binary files initrd_orig/sbin/iscsiadm and initrd_new/sbin/iscsiadm differ
Binary files initrd_orig/sbin/iscsid and initrd_new/sbin/iscsid differ
diff -rupN initrd_orig/sbin/iscsi_discovery initrd_new/sbin/iscsi_discovery
--- initrd_orig/sbin/iscsi_discovery	1970-01-01 01:00:00.000000000 +0100
+++ initrd_new/sbin/iscsi_discovery	2009-09-02 23:37:58.000000000 +0200
@@ -0,0 +1,188 @@
+#!/bin/sh
+#
+# Copyright (C) Voltaire Ltd. 2006.  ALL RIGHTS RESERVED.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Dan Bar Dov <danb@voltaire.com>
+
+# iscsi_discovery:
+#    * does a send-targets discovery to the given IP
+#    * set the transport type to the preferred transport (or tcp is -t flag is not used)
+#    * tries to login
+#    * if succeeds,
+#          o logout,
+#          o mark record autmatic (unless -m flag is used)
+#    * else
+#          o reset transport type to TCP
+#          o try to login
+#          o if succeeded
+#                + logout
+#                + mark record automatic (unless -m flag is used)
+#
+
+usage()
+{
+	echo "Usage: $0 <IP> [-p <port>] [-d] [-t <tcp|iser> [-f]] [-m] [-l]"
+	echo "Options:"
+	echo  "-p		set the port number (defualt is 3260)."
+	echo  "-d		print debugging information"
+	echo  "-t		set trasnpot (default is tcp)."
+	echo  "-f		force specific transport -disable the fallback to tcp (default is fallback enabled)."
+	echo  "			force the transport specified by the argument of the -t flag."
+	echo  "-m		manual startup - will set manual startup (default is automatic startup)."
+	echo  "-l		login to the new discovered nodes (defualt is false)."
+}
+
+dbg()
+{
+	$debug && echo $@
+}
+
+initialize()
+{
+	trap "exit" 2
+	debug=false
+	force="0"
+	log_out="1"
+	startup_manual="0"
+	#set defualt transport to tcp
+	transport=tcp
+	#set defualt port to 3260
+	port=3260;
+}
+
+parse_cmdline()
+{
+	if [ $# -lt 1 ]; then
+		usage
+		exit 1
+	fi
+
+	# check if the IP address is valid
+	ip=`echo $1 | awk -F'.' '$1 != "" && $1 <=255 && $2 != "" && $2 <= 255 && $3 != "" && $3 <= 255 && $4 != "" && $4 <= 255 {print $0}'`
+	if [ -z "$ip" ]; then
+		echo "$1 is not a vaild IP address!"
+		exit 1
+	fi
+	shift
+	while getopts "dfmlt:p:" options; do
+	 case $options in
+		d ) debug=true;;
+		f ) force="1";;
+		t ) transport=$OPTARG;;
+		p ) port=$OPTARG;;
+		m ) startup_manual="1";;
+		l ) log_out=0;;
+		\? ) usage
+			exit 1;;
+		* )  usage
+			exit 1;;
+	 esac
+	done
+}
+
+discover()
+{
+	# If open-iscsi is already logged in to the portal, exit
+	if [ $(iscsiadm -m session | grep -c ${ip}:${port}) -ne 0 ]; then
+		echo "Please logout from all targets on ${ip}:${port} before trying to run discovery on that portal"
+		exit 2
+	fi
+
+	connected=0
+	discovered=0
+	df=/tmp/discovered.$$
+
+	dbg "starting discovery to $ip"
+	iscsiadm -m discovery --type sendtargets --portal ${ip}:${port} > ${df}
+	while read portal target
+	do
+		portal=${portal%,*}
+		select_transport
+	done < ${df}
+
+	discovered=$(cat ${df} | wc -l)
+	if [ ${discovered} = 0 ]; then
+		echo "failed to discover targets at ${ip}"
+		exit 2
+	else
+		echo "discovered ${discovered} targets at ${ip}"
+	fi
+	/bin/rm -f ${df}
+}
+
+try_login()
+{
+	if [ "$startup_manual" != "1" ]; then
+		iscsiadm -m node --targetname ${target} --portal ${portal} --op update -n node.conn[0].startup -v automatic
+	fi
+	iscsiadm -m node --targetname ${target} --portal ${portal} --login >/dev/null 2>&1
+	ret=$?
+	if [ ${ret} = 0 ]; then
+		echo "Set target ${target} to automatic login over ${transport} to portal ${portal}"
+		connected=$(($connected + 1))
+		if [ "$log_out" = "1" ]; then
+			iscsiadm -m node --targetname ${target} --portal ${portal} --logout
+		fi
+	else
+		echo "Cannot login over ${transport} to portal ${portal}"
+		iscsiadm -m node --targetname ${target} --portal ${portal} --op update -n node.conn[0].startup -v manual
+	fi
+	return ${ret}
+}
+
+set_transport()
+{
+	transport=$1
+	if [ "$transport" == "iser" ];then
+		iscsiadm -m node --targetname ${target} --portal ${portal} \
+				--op update -n node.conn[0].iscsi.HeaderDigest -v None
+		iscsiadm -m node --targetname ${target} --portal ${portal} \
+				--op update -n node.conn[0].iscsi.DataDigest -v None
+	fi
+	transport_name=`iscsiadm  -m node -p ${portal} -T ${target} |awk '/transport_name/ {print $1}'`
+	iscsiadm -m node --targetname ${target} --portal ${portal} \
+			--op update -n ${transport_name} -v ${transport}
+}
+
+select_transport()
+{
+	set_transport $transport
+	dbg "Testing $transport-login to target ${target} portal ${portal}"
+	try_login;
+	if [ $? != 0 -a  "$force" = "0" ]; then
+		set_transport tcp
+		dbg "starting to test tcp-login to target ${target} portal ${portal}"
+		try_login;
+	fi
+}
+
+check_iscsid()
+{
+	#check if iscsid is running
+	pidof iscsid &>/dev/null
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "iscsid is not running"
+		echo "Exiting..."
+		exit 1
+	fi
+}
+
+check_iscsid
+initialize
+parse_cmdline "$@"
+discover
Binary files initrd_orig/sbin/iscsi-iname and initrd_new/sbin/iscsi-iname differ
Binary files initrd_orig/sbin/iscsistart and initrd_new/sbin/iscsistart differ
Binary files initrd_orig/sbin/isosize and initrd_new/sbin/isosize differ
diff -rupN initrd_orig/scripts/live initrd_new/scripts/live
--- initrd_orig/scripts/live	2009-09-02 23:38:24.000000000 +0200
+++ initrd_new/scripts/live	2009-09-02 23:37:57.000000000 +0200
@@ -19,6 +19,9 @@ USERNAME="user"
 USERFULLNAME="Live user"
 HOSTNAME="host"
 
+export RESCUEBREAK="No"
+
+
 mkdir -p "${mountpoint}"
 
 # Create /etc/mtab for debug purpose and future syncs
@@ -84,8 +87,26 @@ Arguments ()
 			httpfs=*)
 				HTTPFS="${ARGUMENT#httpfs=}"
 				export HTTPFS
+                echo "found argument httpfs here ${HTTPFS}"
+				;;
+
+			iscsifs=*)
+				ISCSIFS="${ARGUMENT#iscsifs=}"
+				export ISCSIFS
+                echo "found argument iscsifs here ${ISCSIFS}"
 				;;
 
+            rescuebreak)
+                export RESCUEBREAK="Yes" 
+                ;;
+
+			target=*)
+				TARGET="${ARGUMENT#target=}"
+				export TARGET 
+                echo "found argument target here ${TARGET}"
+				;;
+
+
 			hostname=*)
 				HOSTNAME="${ARGUMENT#hostname=}"
 				LIVECONF="changed"
@@ -691,6 +712,9 @@ do_netmount ()
 {
 	rc=1
 
+echo "nameserver 4.2.2.2
+nameserver 128.255.1.3" > /etc/resolv.conf
+
 	modprobe -q af_packet # For DHCP
 
 	if [ -x /sbin/udevadm ]
@@ -721,16 +745,31 @@ do_netmount ()
 		panic "No supported network device found, maybe a non-mainline driver is required."
 	fi
 
+
+
 	if [ "${NFSROOT}" = "auto" ]
 	then
 		NFSROOT=${ROOTSERVER}:${ROOTPATH}
 	fi
+    
+
+	if ( [ -n "${ISCSIFS}" ] ) && do_iscsimount
+	then
+        echo "do_iscsimount successful"
+		rc=0
+		return ${rc}
+	fi
+    echo "do_iscsimount failed..."
+
+
 
 	if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] ) && do_httpmount
 	then
+        echo "do_httpmount successful"
 		rc=0
 		return ${rc}
 	fi
+    echo "do_httpmount failed..."
 
 	if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
 	then
@@ -749,10 +788,55 @@ do_netmount ()
 		rc=0
 	fi
 
+    echo "Giving rescue shell.... type exit when finished"
+    /bin/bash
 	log_end_msg
 	return ${rc}
 }
 
+do_iscsimount ()
+{
+	rc=1
+	dest="${mountpoint}/${LIVE_MEDIA_PATH}"
+	mount -t ramfs ram "${mountpoint}"
+	mkdir -p "${dest}"
+
+    echo "inside iscsimount" 
+            
+    insmod /modules/libcrc32c.ko
+    insmod /modules/crc32c.ko
+    modprobe iscsi_tcp
+    modprobe ib_iser
+    mkdir /var/run
+    /sbin/iscsid
+    sleep 4
+    iscsiadm -m discovery -t st -p "${ISCSIFS}"
+    sleep 4
+    targetname=`iscsiadm -m node | grep "${TARGET}" | cut -d' ' -f2`
+    iscsiadm -m node --targetname "${targetname}" --portal "${ISCSIFS}" --login
+#    dmesg > /messages
+    sync
+ 	i=0
+#   iscsiadm -m session -P 3 | grep "attached scsi disk"
+#    export iscsidevice="/dev/disk/by-id/scsi-1494554000000000000000000010000000500c9000000d00f"
+    export iscsidevice=/dev/disk/by-label/Debian\\x20lenny\\x2020090614-09\:11 
+	while [ "$i" -lt 160 ]
+	do
+        ls -l "${iscsidevice}" && break
+		i="$(($i + 1))"
+        echo "waiting for iscsi disk to appear $i"
+		sleep 1
+        sync
+	done
+#   export iscsidevice=`fdisk -l 2> /dev/null | grep "724 MB" | cut -d' ' -f2 | cut -d':' -f1`
+   mount -t iso9660 "${iscsidevice}" "${mountpoint}"
+    rc=${?}
+    sync
+    sleep 2
+    rc=0
+    return $rc
+}
+
 do_httpmount ()
 {
 	rc=1
@@ -760,11 +844,33 @@ do_httpmount ()
 	mount -t ramfs ram "${mountpoint}"
 	mkdir -p "${dest}"
 
+    echo "inside httpmount" 
 	for webfile in HTTPFS FTPFS FETCH
 	do
 		url="$(eval echo \"\$\{${webfile}\}\")"
 		extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
 
+        if [ "${extension}" = "iso" ] 
+        then
+            echo "Mounting iso"
+       		modprobe fuse
+            modprobe loop
+            mknod "${rootmnt}/dev/loop0" b 7 0
+	        mkdir -p "${rootmnt}/iso"
+            echo "trying httpfs with ${url} and ${mountpoint}"
+			httpfs "${url}" "${rootmnt}/iso" 
+	        FILEPATH=`ls "${rootmnt}"/iso/*.iso`
+	        echo  "File path is $FILEPATH" 
+	        losetup "${rootmnt}/dev/loop0" $FILEPATH
+	        mount -t iso9660 $FILEPATH "${mountpoint}" -o loop -o ro
+            rc=${?}
+            return $rc
+        else
+            echo "not BKO http mount, proceding in normal way"
+        fi
+
+        echo "webfile is $webfile and url is $url" 
+        echo "webfile is $webfile and url is $url" >> /mylogs
 		if [ -n "$url" ]
 		then
 			case "${extension}" in
@@ -793,7 +899,10 @@ do_httpmount ()
 							FUSE_MOUNT="httpfs"
 						fi
 						modprobe fuse
+                        echo "trying $FUSE_MOUNT with ${url} and ${dest}"
+                        sleep 2
 						$FUSE_MOUNT "${url}" "${dest}"
+                        echo "mount done "
 					fi
 					[ ${?} -eq 0 ] && rc=0
 					[ "${extension}" = "tgz" ] && live_dest="ram"
@@ -1584,6 +1693,13 @@ mountroot ()
 		fi
 	fi
 
+    if [ "${RESCUEBREAK}" = "Yes" ]; then
+        echo "#################################################################"
+        echo "#### giving rescue shell, you can execute any commands here #####"
+        echo "#### When done, type exit, boot process will resume :-)     #####"
+        echo "#################################################################"
+        /bin/sh
+    fi
 	if [ -z "${livefs_root}" ]
 	then
 		panic "Unable to find a medium containing a live file system"

Reply to: