diff options
author | Matthias Hentges <oe@hentges.net> | 2006-04-16 17:21:08 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-04-16 17:21:08 +0000 |
commit | dda0f8c7a259a59db463e18f4465bca8054032d0 (patch) | |
tree | f91df7037647650e23c32dc258806d09502dd996 /packages/altboot/files | |
parent | eadb3d4295eacea15d745f7f88d181652ff1253d (diff) |
altboot: Allow usage of USB network (g_ether) for NFS booting
Diffstat (limited to 'packages/altboot/files')
-rw-r--r-- | packages/altboot/files/akita/altboot-2.6.cfg | 3 | ||||
-rw-r--r-- | packages/altboot/files/altboot-menu/Advanced/40-bootNFS | 61 | ||||
-rw-r--r-- | packages/altboot/files/altboot.func | 147 | ||||
-rw-r--r-- | packages/altboot/files/c7x0/altboot-2.6.cfg | 4 | ||||
-rw-r--r-- | packages/altboot/files/spitz/altboot-2.6.cfg | 4 |
5 files changed, 153 insertions, 66 deletions
diff --git a/packages/altboot/files/akita/altboot-2.6.cfg b/packages/altboot/files/akita/altboot-2.6.cfg index 6da57be958..2254a35552 100644 --- a/packages/altboot/files/akita/altboot-2.6.cfg +++ b/packages/altboot/files/akita/altboot-2.6.cfg @@ -20,7 +20,8 @@ USB_STORAGE_PARTITION="/dev/sda1" USB_STORAGE_WAIT="4" USB_NETWORKING_AVAILABLE="yes" -USB_NW_MODULES="g_ether" +USB_NW_MODULES="usbcore pxa27x_udc ohci-hcd g_ether" +USB_NW_DEVICE="usb0" KEXEC_KERNEL_DIR="/boot" KEXEC_BIN="/usr/sbin/kexec" diff --git a/packages/altboot/files/altboot-menu/Advanced/40-bootNFS b/packages/altboot/files/altboot-menu/Advanced/40-bootNFS index f18c27b044..352b29ed07 100644 --- a/packages/altboot/files/altboot-menu/Advanced/40-bootNFS +++ b/packages/altboot/files/altboot-menu/Advanced/40-bootNFS @@ -21,34 +21,14 @@ run_module() { # Mount /proc, etc init_rootfs - - # Needed for NFS - /etc/init.d/portmap start >/dev/null 2>&1 || die "/etc/init.d/portmap start failed!" - - # For some reason NFS mounts hang if /e/i/networking is not run. - # For the time beeing I'm too lazy to investigate ;) - /etc/init.d/networking start >/dev/null 2>&1 || die "/etc/init.d/networking start failed!" - - sleep 2 - - # After the PCMCIA service is started, an inserted WLAN card should automatically - # activate itself. - - if test -x /etc/init.d/pcmcia - then - /etc/init.d/pcmcia start >/dev/null 2>&1 || die "/etc/init.d/pcmcia start failed!" - else - # With kernel 2.6.16+ udev is used - /etc/init.d/udev start >/dev/null 2>&1 || die "/etc/init.d/udev start failed!" - - /etc/init.d/udev stop - fi - + nfs_host="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $1}'|sed -n "s/\(.*\)\:\(.*\)/\1/p" `" nfs_mounts="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $1}'`" nfs_mountpoints="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $2}'`" WLAN_NIC="`iwconfig 2>/dev/null | grep ESSID | awk '{print $1}'`" + + start_networking "$nfs_host" if test -z "$nfs_host" then @@ -56,41 +36,6 @@ run_module() { fi - # WLAN with DHCP needs some time to get a lease, set up the routing, etc. - echo -n "Waiting for WLAN" - cnt=0 - while true - do - if (ping -c 1 $nfs_host) >/dev/null 2>&1 - then - echo " found" - break - else - if test "$cnt" = 30 -o "$cnt" = 60 - then - echo "" - echo "WARNING: WLAN didn't activate in $cnt seconds!" - - if test "$cnt" = 30 - then - let cnt=$cnt+1 - echo "Restarting udhcpc for [$WLAN_NIC]" - killall udhcpc - - udhcpc -i "$WLAN_NIC" -H `cat /etc/hostname` >/dev/tty1 2>&1 - - - else - mdie "Failed to activate WLAN!" - break - fi - else - echo -n "." - let cnt=$cnt+1 - fi - fi - sleep 1 - done if test "` echo "$nfs_mountpoints" |wc -l | tr -d " "`" -gt 1 then diff --git a/packages/altboot/files/altboot.func b/packages/altboot/files/altboot.func index 94794fa8ff..3c6d165851 100644 --- a/packages/altboot/files/altboot.func +++ b/packages/altboot/files/altboot.func @@ -424,18 +424,17 @@ check_fs() { # Make the initial rootfs a bit more usable init_rootfs(){ - echo -n "Mounting rootfs rw..." - mount -o remount,rw / && echo ok || die "mount -o remount,rw / failed" +# echo -n "Mounting rootfs rw..." + mount -o remount,rw / || die "mount -o remount,rw / failed" - mount | grep -q "/proc " >/dev/null 2>&1 && echo "Note: /proc is already mounted" || mount proc -t proc /proc >/dev/tty0 2>&1 + mount | grep -q "/proc " >/dev/null 2>&1 || mount proc -t proc /proc >/dev/tty0 2>&1 if ( uname -r | grep -q "2.6." ) then - mount | grep -q "/sys " >/dev/null 2>&1 && echo "Note: /sys is already mounted" || mount sys -t sysfs /sys >/dev/tty0 2>&1 + mount | grep -q "/sys " >/dev/null 2>&1 || mount sys -t sysfs /sys >/dev/tty0 2>&1 fi - - echo -n "Generating device files..." - /etc/init.d/devices start && echo ok || die "FAILED" + + /etc/init.d/devices start || die "FAILED" } mount_sd(){ @@ -526,3 +525,137 @@ mount_home(){ fi fi } + +start_networking() { + + if test "$USB_NETWORKING_AVAILABLE" = "yes" + then + echo "" + echo "Select the type of your network connection:" + echo "" + echo -e "\t[1] LAN or WLAN NIC" + echo -e "\t[2] USB Connection" + echo "" + + if test "$AUTOBOOT" != "yes" -o ! -e /etc/.altboot-lanselect.last + then + while true + do + echo -n "Connection Type: " + read junk + + test "$junk" = 1 -o "$junk" = 2 && break + done + else + junk="`cat /etc/.altboot-lanselect.last`" + test -z "$junk" && junk=1 + + echo -n "Connection Type: $junk (autoboot)" + fi + + case "$junk" in + 1) NW_TYPE="NIC" + ;; + 2) NW_TYPE="USB" + ;; + esac + + echo "$junk" > /etc/.altboot-lanselect.last + else + NW_TYPE=NIC + fi + + + + # Needed for NFS + /etc/init.d/portmap start >/dev/null 2>&1 || die "/etc/init.d/portmap start failed!" + + # For some reason NFS mounts hang if /e/i/networking is not run. + # For the time beeing I'm too lazy to investigate ;) + /etc/init.d/networking start >/dev/null 2>&1 || die "/etc/init.d/networking start failed!" + + sleep 2 + + if test "$NW_TYPE" = "NIC" + then + # After the PCMCIA service is started, an inserted WLAN card should automatically + # activate itself. + + if test -x /etc/init.d/pcmcia + then + /etc/init.d/pcmcia start >/dev/null 2>&1 || die "/etc/init.d/pcmcia start failed!" + else + # With kernel 2.6.16+ udev is used + /etc/init.d/udev start >/dev/null 2>&1 || die "/etc/init.d/udev start failed!" + + /etc/init.d/udev stop + fi + fi + + if test "$NW_TYPE" = "USB" + then + echo "" + for module in $USB_NW_MODULES + do + echo "modprobing [$module]" + modprobe $module || die "modprobe $module FAILED" + done + + ifdown "$USB_NW_DEVICE" >/dev/null 2>&1 + + + echo -e "\nPlease make sure that usb0 is up on your PC and hit <ENTER>." + read junk + + ifup "$USB_NW_DEVICE" + fi + + # WLAN with DHCP needs some time to get a lease, set up the routing, etc. + echo -n "Waiting for Network." + cnt=0 + while true + do + if (ping -c 1 $1) >/dev/null 2>&1 + then + echo " found" + break + else + if test "$cnt" = 30 -o "$cnt" = 60 + then + echo "" + echo "WARNING: $NW_TYPE didn't activate in $cnt seconds!" + + if test "$cnt" = 30 + then + let cnt=$cnt+1 + + if test "$NW_TYPE" = "NIC" + then + echo "Restarting udhcpc for [$WLAN_NIC]" + killall udhcpc + + udhcpc -i "$WLAN_NIC" -H `cat /etc/hostname` >/dev/tty1 2>&1 + fi + + if test "$NW_TYPE" = "USB" + then + echo "ifdown/up $USB_NW_DEVICE..." + ifdown "$USB_NW_DEVICE" + sleep 1 + ifup "$USB_NW_DEVICE" + fi + + else + mdie "Failed to activate $NW_TYPE!" + break + fi + else + echo -n "." + let cnt=$cnt+1 + fi + fi + sleep 1 + done + + +} diff --git a/packages/altboot/files/c7x0/altboot-2.6.cfg b/packages/altboot/files/c7x0/altboot-2.6.cfg index ad15f7169e..71dd5099c2 100644 --- a/packages/altboot/files/c7x0/altboot-2.6.cfg +++ b/packages/altboot/files/c7x0/altboot-2.6.cfg @@ -17,6 +17,10 @@ USB_STORAGE_MODULES="usb_ohci_pxa27x usb-storage" USB_STORAGE_PARTITION="/dev/sda1" USB_STORAGE_WAIT="4" +USB_NETWORKING_AVAILABLE="yes" +USB_NW_MODULES="usbcore pxa27x_udc ohci-hcd g_ether" +USB_NW_DEVICE="usb0" + INIT_RUNLEVEL="5" NO_GUI_RL="2" MASTER_PASSWORD="" diff --git a/packages/altboot/files/spitz/altboot-2.6.cfg b/packages/altboot/files/spitz/altboot-2.6.cfg index c9a030b348..2254a35552 100644 --- a/packages/altboot/files/spitz/altboot-2.6.cfg +++ b/packages/altboot/files/spitz/altboot-2.6.cfg @@ -19,6 +19,10 @@ USB_STORAGE_MODULES="usb_ohci_pxa27x usb-storage" USB_STORAGE_PARTITION="/dev/sda1" USB_STORAGE_WAIT="4" +USB_NETWORKING_AVAILABLE="yes" +USB_NW_MODULES="usbcore pxa27x_udc ohci-hcd g_ether" +USB_NW_DEVICE="usb0" + KEXEC_KERNEL_DIR="/boot" KEXEC_BIN="/usr/sbin/kexec" |