initramfs-nfsboot: Add parsing of kernel commandline params, bump version to 0.2
authorPaul Sokolovsky <pmiscml@gmail.com>
Tue, 17 Jul 2007 23:39:10 +0000 (23:39 +0000)
committerPaul Sokolovsky <pmiscml@gmail.com>
Tue, 17 Jul 2007 23:39:10 +0000 (23:39 +0000)
* Untested.

packages/initrdscripts/files/nfsboot.sh
packages/initrdscripts/initramfs-nfsboot_0.2.bb [moved from packages/initrdscripts/initramfs-nfsboot_0.1.bb with 100% similarity]

index bb689fa..b536c40 100644 (file)
@@ -3,8 +3,48 @@
 echo "Starting initramfs boot..."
 mkdir /proc
 mount -t proc proc /proc
-ifconfig eth0 192.168.20.230
+
+for arg in `cat /proc/cmdline`; do
+    echo $arg
+    optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+    echo $optarg
+    case $arg in
+        root=*)
+            root=$optarg ;;
+        nfsroot=*)
+            nfsroot=$optarg ;;
+        ip=*)
+            ip=$optarg ;;
+    esac
+done
+
+echo $ip | (IFS=: read client_ip server_ip gw_ip netmask hostname device autoconf; \
+echo client_ip=$client_ip;
+echo server_ip=$server_ip;
+echo gw_ip=$gw_ip;
+echo netmask=$netmask;
+echo hostname=$hostname;
+echo device=$device;
+echo autoconf=$autoconf;
+
+case "x$device" in
+    usb*)
+       echo "USB"
+       modprobe g_ether
+       ;;
+esac
+
+ifconfig $device $client_ip
+)
+
 mkdir /mnt
-mount -t nfs 192.168.20.210:/home/nfs/Angstrom-opie-image-test-h4000 /mnt
+if [ "x$root" = "x/dev/nfs" ]; then
+    echo "booting from NFS: $nfsroot"
+    mount -t nfs $nfsroot /mnt
+else
+    echo "booting from: $root"
+    mount $root /mnt
+fi
+
 cd /mnt
 exec switch_root -c /dev/console /mnt /sbin/init