diff --git a/packages/initramfs/meta b/packages/initramfs/meta index 176f1682df..15408a60fa 100644 --- a/packages/initramfs/meta +++ b/packages/initramfs/meta @@ -34,3 +34,7 @@ PKG_LONGDESC="debug is a Metapackage for installing initramfs" PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +if [ -n "$ISCSI_SUPPORT" ] && [ "$ISCSI_SUPPORT" = yes ]; then + PKG_DEPENDS="$PKG_DEPENDS open-iscsi" +fi \ No newline at end of file diff --git a/packages/initramfs/sysutils/busybox-initramfs/scripts/init b/packages/initramfs/sysutils/busybox-initramfs/scripts/init index e391c6b9c9..db60226f7a 100755 --- a/packages/initramfs/sysutils/busybox-initramfs/scripts/init +++ b/packages/initramfs/sysutils/busybox-initramfs/scripts/init @@ -4,6 +4,7 @@ # This file is part of OpenELEC - http://www.openelec.tv # Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) #      Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) +# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) # # 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 @@ -66,6 +67,36 @@ NBD_DEVS="0" break=*) BREAK="${arg#*=}" ;; + iscsi_auto) + ISCSI_AUTO=yes + ;; + iscsi_initiator=*) + ISCSI_INITIATOR="${arg#iscsi_initiator=}" + ;; + iscsi_target_name=*) + ISCSI_TARGET_NAME="${arg#iscsi_target_name=}" + ;; + iscsi_target_ip=*) + ISCSI_TARGET_IP="${arg#iscsi_target_ip=}" + ;; + iscsi_target_port=*) + ISCSI_TARGET_PORT="${arg#iscsi_target_port=}" + ;; + iscsi_target_group=*) + ISCSI_TARGET_GROUP="${arg#iscsi_target_group=}" + ;; + iscsi_username=*) + ISCSI_USERNAME="${arg#iscsi_username=}" + ;; + iscsi_password=*) + ISCSI_PASSWORD="${arg#iscsi_password=}" + ;; + iscsi_in_username=*) + ISCSI_IN_USERNAME="${arg#iscsi_in_username=}" + ;; + iscsi_in_password=*) + ISCSI_IN_PASSWORD="${arg#iscsi_in_password=}" + ;; esac done @@ -230,6 +261,30 @@ NBD_DEVS="0" error "load_modules" "Failed to load kernel module $module" done } + + do_iscsi_login () + { + + /bin/busybox modprobe iscsi_tcp + + if [ -z $ISCSI_AUTO ]; then + for i in $ISCSI_TARGET_IP; do + /sbin/iscsistart -i $ISCSI_INITIATOR -t $ISCSI_TARGET_NAME \ + -g $ISCSI_TARGET_GROUP -a $i \ + -p $ISCSI_TARGET_PORT \ + ${ISCSI_USERNAME:+-u "$ISCSI_USERNAME"} \ + ${ISCSI_PASSWORD:+-w "$ISCSI_PASSWORD"} \ + ${ISCSI_IN_USERNAME:+-U "$ISCSI_IN_USERNAME"} \ + ${ISCSI_IN_PASSWORD:+-W "$ISCSI_IN_PASSWORD"} + + done + else + echo "Network configuration based on iBFT." + /sbin/iscsistart -N + echo "iSCSI auto connect based on iBFT." + /sbin/iscsistart -b + fi + } check_disks() { progress "Checking disks" @@ -301,6 +356,10 @@ NBD_DEVS="0" [ -f "/sysroot/sbin/init" ] || error "final_check" "Could not find system." } + + if [ -n "$ISCSI_AUTO" -o -n "$ISCSI_TARGET_NAME" ]; then + do_iscsi_login + fi # main boot sequence for BOOT_STEP in \ diff --git a/packages/initramfs/sysutils/open-iscsi/build b/packages/initramfs/sysutils/open-iscsi/build new file mode 100755 index 0000000000..f5eadbac94 --- /dev/null +++ b/packages/initramfs/sysutils/open-iscsi/build @@ -0,0 +1,31 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) +# +# 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, 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. config/options $1 + +cd $PKG_BUILD/utils/open-isns +./configure CFLAGS="$(OPTFLAGS)" --with-security=no \ + --host=$TARGET_NAME \ + --build=$HOST_NAME +cd $PKG_BUILD +make user \ No newline at end of file diff --git a/packages/initramfs/sysutils/open-iscsi/install b/packages/initramfs/sysutils/open-iscsi/install new file mode 100755 index 0000000000..aaf2ce9196 --- /dev/null +++ b/packages/initramfs/sysutils/open-iscsi/install @@ -0,0 +1,31 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) +# +# 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, 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. config/options $1 + +OPEN_ISCSI_DIR="$BUILD/open-iscsi-$PKG_VERSION" + +INSTALL=$ROOT/$BUILD/image/initramfs/root-image + +mkdir -p $INSTALL/sbin + cp -P $OPEN_ISCSI_DIR/usr/iscsistart $INSTALL/sbin \ No newline at end of file diff --git a/packages/initramfs/sysutils/open-iscsi/meta b/packages/initramfs/sysutils/open-iscsi/meta new file mode 100644 index 0000000000..0d213ffb3b --- /dev/null +++ b/packages/initramfs/sysutils/open-iscsi/meta @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) +# +# 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, 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="open-iscsi" +PKG_VERSION="git20120226" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://eesprit.free.fr" +PKG_URL="$PKG_SITE/openelec.tv/bits/$PKG_NAME-$PKG_VERSION.tgz" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="toolchain util-linux" +PKG_PRIORITY="optional" +PKG_SECTION="initramfs/system" +PKG_SHORTDESC="open-iscsi: system utilities for Linux to access iSCSI targets" +PKG_LONGDESC="The open-iscsi package allows you to mount iSCSI targets. This package add support for using iscsi target as root device." +PKG_IS_ADDON="no" + +PKG_AUTORECONF="no" diff --git a/packages/initramfs/sysutils/open-iscsi/patches/open-iscsi-git20120226_dynamic_linked_iscsistart.patch b/packages/initramfs/sysutils/open-iscsi/patches/open-iscsi-git20120226_dynamic_linked_iscsistart.patch new file mode 100644 index 0000000000..27d30311b8 --- /dev/null +++ b/packages/initramfs/sysutils/open-iscsi/patches/open-iscsi-git20120226_dynamic_linked_iscsistart.patch @@ -0,0 +1,11 @@ +--- a/usr/Makefile 2011-08-05 11:54:52.000000000 +0200 ++++ b/usr/Makefile 2011-08-05 11:55:06.000000000 +0200 +@@ -63,7 +63,7 @@ + + iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ + iscsistart.o statics.o +- $(CC) $(CFLAGS) -static $^ -o $@ ++ $(CC) $(CFLAGS) $^ -o $@ + clean: + rm -f *.o $(PROGRAMS) .depend $(LIBSYS) +