summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/wlanboot
diff options
context:
space:
mode:
Diffstat (limited to 'src/os-plugins/plugins/wlanboot')
-rw-r--r--src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm154
-rw-r--r--src/os-plugins/plugins/wlanboot/XX_wlanboot.sh27
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwconfigbin0 -> 17596 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iweventbin0 -> 13496 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwgetidbin0 -> 9300 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwlistbin0 -> 25840 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwprivbin0 -> 9340 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwspybin0 -> 9328 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/bin/iwtest1
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/README8
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucodebin0 -> 149652 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucodebin0 -> 149816 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucodebin0 -> 187608 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucodebin0 -> 187764 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucodebin0 -> 345008 bytes
l---------src/os-plugins/plugins/wlanboot/files/lib/libiw.so1
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/lib/libiw.so.29bin0 -> 25892 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh75
18 files changed, 266 insertions, 0 deletions
diff --git a/src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm b/src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm
new file mode 100644
index 00000000..ab1c614e
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm
@@ -0,0 +1,154 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# wlanboot.pm
+# - an wlanboot extension to the stage3 system
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::wlanboot;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Path;
+
+use Data::Dumper;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'wlanboot',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ wlanboot is an extension for stage 3
+ End-of-Here
+ precedence => 50,
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'wlanboot::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'wlanboot'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'wlanboot::activenics' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ kernel modules to load ..
+ End-of-Here
+ content_regex => '',
+ content_descr => 'space seperated list of kernel modules (without .ko)',
+ default => 'iwl3945 arc4 ecb',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ my $attrs = $info->{'plugin-attrs'};
+
+ my $filesDir = "$openslxBasePath/lib/plugins/wlanboot/files";
+ slxsystem("cp -r $filesDir $pluginRepoPath/");
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+
+ return;
+}
+
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $attrs = $info->{'attrs'};
+
+ my @suggestedKernelModules;
+
+ print Dumper(split(/ /, $attrs->{'wlanboot::activenics'}));
+ push(@suggestedKernelModules, split(/ /, $attrs->{'wlanboot::activenics'} ));
+
+ return @suggestedKernelModules;
+}
+
+sub copyRequiredFilesIntoInitramfs
+{
+ my $self = shift;
+ my $targetPath = shift;
+ my $attrs = shift;
+ my $makeInitRamFSEngine = shift;
+ my $pluginRepoPath = "$openslxConfig{'base-path'}/lib/plugins/wlanboot";
+
+ $makeInitRamFSEngine->addCMD(
+ "cp -p $pluginRepoPath/files/bin/* $targetPath/bin/"
+ );
+ $makeInitRamFSEngine->addCMD(
+ "cp -a $pluginRepoPath/files/firmware $targetPath/lib"
+ );
+ $makeInitRamFSEngine->addCMD(
+ "cp -a $pluginRepoPath/files/lib $targetPath/"
+ );
+ vlog(1, _tr("wlanboot-plugin: ..."));
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/wlanboot/XX_wlanboot.sh b/src/os-plugins/plugins/wlanboot/XX_wlanboot.sh
new file mode 100644
index 00000000..c33c1e19
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/XX_wlanboot.sh
@@ -0,0 +1,27 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'wlanboot' plugin - the runlevel script
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+if [ -e /initramfs/plugin-conf/wlanboot.conf ]; then
+ . /initramfs/plugin-conf/wlanboot.conf
+ if [ $wlanboot_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'wlanboot' os-plugin ...";
+ #iwconfig wlan0 essid "wlanboottest"
+ #ip link set wlan0 up
+ #udhcpc -i wlan0
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'wlanboot' os-plugin ...";
+
+ fi
+fi
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwconfig b/src/os-plugins/plugins/wlanboot/files/bin/iwconfig
new file mode 100755
index 00000000..42c18ca1
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwconfig
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwevent b/src/os-plugins/plugins/wlanboot/files/bin/iwevent
new file mode 100755
index 00000000..bf9b921b
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwevent
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwgetid b/src/os-plugins/plugins/wlanboot/files/bin/iwgetid
new file mode 100755
index 00000000..a310ee85
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwgetid
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwlist b/src/os-plugins/plugins/wlanboot/files/bin/iwlist
new file mode 100755
index 00000000..9597d4d4
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwlist
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwpriv b/src/os-plugins/plugins/wlanboot/files/bin/iwpriv
new file mode 100755
index 00000000..a9fd399e
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwpriv
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwspy b/src/os-plugins/plugins/wlanboot/files/bin/iwspy
new file mode 100755
index 00000000..2bded1e1
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwspy
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwtest b/src/os-plugins/plugins/wlanboot/files/bin/iwtest
new file mode 100644
index 00000000..c6846702
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwtest
@@ -0,0 +1 @@
+test file for plugin wlanboot.
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/README b/src/os-plugins/plugins/wlanboot/files/firmware/README
new file mode 100644
index 00000000..0845746d
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/README
@@ -0,0 +1,8 @@
+Put all the required firmwares of WLAN adapters you would like to use in
+your setup here into this subdirectory. They are copied into the InitRamFS
+to be present for device configuration via modprobe/mdev in stage3.
+
+For more information on the "wlanboot" plugin have a look at the project
+page!
+
+The OpenSLX Team
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucode
new file mode 100644
index 00000000..14dc7aac
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucode
new file mode 100644
index 00000000..c1ea0aab
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucode
new file mode 100644
index 00000000..6d67a882
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucode
new file mode 100644
index 00000000..8cf429d3
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucode
new file mode 100644
index 00000000..5519149b
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/lib/libiw.so b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so
new file mode 120000
index 00000000..ee7675c6
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so
@@ -0,0 +1 @@
+libiw.so.29 \ No newline at end of file
diff --git a/src/os-plugins/plugins/wlanboot/files/lib/libiw.so.29 b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so.29
new file mode 100755
index 00000000..1fde3844
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so.29
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh b/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh
new file mode 100755
index 00000000..fee893d4
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh
@@ -0,0 +1,75 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 init-hook 10 of 'wlanboot' plugin - firing up the wlan connection
+
+#setting udhcpc up
+mkdir -p /usr/share/udhcpc
+echo -e "#!/bin/ash\nunset infomsg HOME IFS mask lease interface DEBUGLEVEL \
+BOOT_IMAGE\nset >/tmp/ipstuff" >/usr/share/udhcpc/default.script
+chmod u+x /usr/share/udhcpc/default.script
+
+echo "! shutting down watchdog for debugging";
+killall watchdog;
+
+essid=$(sed -n 's/.*essid=\([^[:blank:]]*\) .*/\1/p' /proc/cmdline);
+[ $DEBUGLEVEL -gt 0 ] && echo "set essid to ${essid}";
+#value of essid unchecked yet
+
+
+# load network adaptor modules
+#modprobe iwl3945
+cd /lib/modules/$(ls /lib/modules/)/kernel/drivers/net/wireless
+for mod in $(find . | grep .ko | sed 's,.*/\([^/]*\).ko,\1',); do
+ echo "Mod:";
+ echo $mod;
+ modprobe $mod || echo "module $mod did not load for some reason"
+ usleep 10000
+done
+cd /
+
+wlanif=$(iwconfig 2>/dev/null|sed -n "/ESSID:/p"|sed "s/ .*//")
+[ $DEBUGLEVEL -gt 0 ] && echo "wlancard recognized as ${wlanif}";
+
+if [ -n "$wlanif" ] ; then
+ ip link set dev ${wlanif} up
+ if iwconfig ${wlanif} mode managed essid "${essid}"; then
+ nwif=${wlanif}
+ else
+ error " Unable to configure the WLAN interface."
+ fi
+
+
+ ( sleep 6 ; killall udhcpc >/dev/null 2>&1 ) &
+ udhcpc -f -n -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null
+ if grep "ip=" /tmp/ipstuff >/dev/null 2>&1 ; then
+ . /tmp/ipstuff
+ for i in $dns ; do
+ echo "nameserver $i" >>/etc/resolv.conf
+ done
+ # simply add a single dns server for passing via kernel cmdline to stage3
+ # (quickhack, just the last, list of dns might be better ...)
+ echo "dnssrv=$i" >>/tmp/ipstuff
+ return
+ else
+ if [ $i -eq 1 ] ; then
+ sleep 1
+ else
+ echo "Did not get any proper IP configuration"; /bin/ash
+ fi
+ fi
+
+ ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $nwif
+ ip route add default via $router
+ [ $DEBUGLEVEL -gt 0 ] && echo "IP-Configuration: $ip on interface $wlanif."
+else
+ error " No wireless LAN capable interface found. Did you provide the \
+proper kernel\n modules and firmware?"
+fi \ No newline at end of file