From b081d2a92eca9b7180eea0d357b867999b76de76 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Thu, 31 May 2007 22:29:30 +0000 Subject: Stuff for WLAN boot (all testing). git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1125 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/etc/functions | 23 +++++++++++++++++++---- initramfs/initrd-stuff/etc/messages | 3 +++ initramfs/initrd-stuff/init | 29 ++++++++++++++++++----------- 3 files changed, 40 insertions(+), 15 deletions(-) (limited to 'initramfs') diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index d645adc9..23f2a6c3 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -153,7 +153,7 @@ local netdev="eth${vifnum}" local pdev="p${netdev}" local vdev="veth${vifnum}" local vif0="vif0.${vifnum}" -# fixme: that is the mac address of eth0 device +# fixme: that is the mac address of main ethernet device local mac=$macaddr brctl addbr ${bridge} @@ -180,6 +180,21 @@ else fi } ############################################################################# +# definition of wlan interface name and wireless connect +wlanlinksetup () { +if=$(iwconfig 2>/dev/null|sed -n "/ESSID:/p"|sed "s/ .*//") +if [ -n "$if" ] ; then + ip link set dev $if up + if iwconfig $if mode managed essid "${essid}"; then + nwif=$if + else + error "$init_nowlan" + fi +else + error "$init_nowlan" +fi +} +############################################################################# # nfs mounter for root filesystem and other sources nfsmnt () { @@ -281,7 +296,7 @@ else # ensure the interface is up - might produce conflicts - nbd could # fail!! [ -n "$noipyet" ] && \ - ip link set dev eth0 up + ip link set dev $nwif up [ -f /lib/modules/@@@KERNVER@@@/kernel/net/packet/af_packet.ko ] && \ modprobe ${MODPRV} af_packet echo "Starting $dhcp for configuration" @@ -293,14 +308,14 @@ case $dhcp in mkdhclconf $vci ln -s /bin/dhcpmkconfig /bin/dhclient-script dhclient -cf /etc/dhclient.conf -lf /var/lib/dhcp/dhclient.leases \ - -q eth0 >/dev/null 2>&1 || error "$error_dhclient" + -q $nwif >/dev/null 2>&1 || error "$error_dhclient" ;; # udhcpc is a busybox applet udhcpc) [ -n $vci ] && vci="-V $vci" testmkd /usr/share/udhcpc ln -s /bin/dhcpmkconfig /usr/share/udhcpc/default.script - udhcpc -b -q $vci -s /usr/share/udhcpc/default.script -i eth0 2>/dev/null + udhcpc -b -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null ;; esac echo "dhcp finished at $(sysup)" > /tmp/dhcp-done diff --git a/initramfs/initrd-stuff/etc/messages b/initramfs/initrd-stuff/etc/messages index 7cf31c1a..5569704d 100644 --- a/initramfs/initrd-stuff/etc/messages +++ b/initramfs/initrd-stuff/etc/messages @@ -35,6 +35,9 @@ with dhcp!" init_errnwad=" Failed to load the network \ adaptor modules defined via mkdxsinitrd\n run. Please rerun and list the \ appropriate modules (without .ko)." +init_nowlan=" No wireless LAN capable interface found. Did you provide the \ +proper kernel\n modules?" +init_wlanf=" Unable to configure the WLAN interface." init_errdhcp=" Did not get complete IP \ configuration via DHCP. You may want to add\n a vendor code identifier \ via kernel commandline (vci=VCI)." diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index f8905d35..252eb4c0 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -52,6 +52,7 @@ mkdir -p ${devdir}/pts ${devdir}/shm ${devdir}/.udevdb ${devdir}/.udev export PATH=/bin:/sbin:/usr/bin/:/usr/sbin export date="${slxconf_date}" +export nwif="eth0" export DEBUGLEVEL=0 export KERNEL="${slxconf_kernver}" @@ -124,7 +125,7 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup # essid for WLAN boot (experimental, might be moved to a module component # in later versions essid=*) - essid==${opts#essid=} + essid=${opts#essid=} ;; # if configuration should not be gathered by dhcp client nodhcp) @@ -305,6 +306,7 @@ fi # load network adaptor modules hwautocfg nwmod if [ -n "${essid}" ] ; then + wlanlinksetup echo "Starting shell for testing of WLAN setup procedure" /bin/ash fi @@ -313,8 +315,8 @@ fi [ $DEBUGLEVEL -eq 20 ] && echo "** starting ip config at $(sysup)" ip link set dev lo up ip addr add 127.0.0.1/8 dev lo -ip link set dev eth0 up || error "$init_noeth" -macaddr=$(ip link show dev eth0|sed -n "/ether [0-9e-f]\{2\}:.*/p" \ +ip link set dev $nwif up || error "$init_noeth" +macaddr=$(ip link show dev $nwif|sed -n "/ether [0-9e-f]\{2\}:.*/p" \ |sed -e "s/.*ether //;s/ .*//") # XEN bridge config @@ -337,7 +339,7 @@ if [ -n "$ipinfo" ] ; then subnet_mask=$subnet_mask\ngateway=$gateway\nserverip=$serverip" \ >>/etc/machine-setup # set static ip address - ip addr add $clientip/$(nm2pref $subnet_mask) dev eth0 + ip addr add $clientip/$(nm2pref $subnet_mask) dev $nwif ip route add default via $gateway else noipyet="yes" @@ -352,7 +354,7 @@ if [ -n "$noipyet" ] ; then [ -z "$clientip" -o -z "$subnet_mask" -o -z "$gateway" \ -o -z "$broadcast_address" ] && error "$init_errdhcp" ip addr add $clientip/$(nm2pref $subnet_mask) broadcast $broadcast_address \ - dev eth0 + dev $nwif fi # check if serverip is set as variable @@@serverip@@@ sed "s,@@@serverip@@@,$serverip," -i /etc/machine-setup @@ -386,6 +388,7 @@ if [ -n "${nbdmod}" ] ; then usleep 100 done usleep 100 + echo noop > /sys/block/nbd0/queue/scheduler # switch off unneeded block read ahead echo "0" > /sys/block/nbd0/queue/read_ahead_kb ;; @@ -412,6 +415,7 @@ if [ -n "${nbdmod}" ] ; then # dnbd by Thorsten Zitterell dnbd) # quickhack + RDEV=/dev/dnbd0 if [ -z $nodnbdcache ] ; then # variable not really used yet mkdir /dnbd mount -n -o 'size=10%' -t tmpfs tmpfs /dnbd @@ -420,13 +424,16 @@ if [ -n "${nbdmod}" ] ; then waitfor /tmp/cache 10000 fi [ $(echo $nbdhost|sed "s,\..*,,") -ge 224 ] && \ - ip route add 224.0.0.0/4 dev eth0 + ip route add 224.0.0.0/4 dev $nwif waitfor /dev/dnbd0 10000 || error "$init_nbddev" - while ! dnbd-client -b $nbdhost -d /dev/dnbd0 $clientopt ; do - usleep 100 - done - echo "0" > /sys/block/dnbd0/queue/read_ahead_kb - RDEV=/dev/dnbd0 + echo "dnbd-client -b $nbdhost -d $RDEV $clientopt" + /bin/ash + #while ! dnbd-client -b $nbdhost -d $RDEV $clientopt ; do + # sleep 1 + #done + # problem with squashfs and cfq scheduler + echo noop > /sys/block/dnbd0/queue/scheduler + echo 0 > /sys/block/dnbd0/queue/read_ahead_kb ;; esac RWRO="ro" -- cgit v1.2.3-55-g7522