]> code.ossystems Code Review - openembedded-core.git/commitdiff
poky-qemu-internal: Support NFS boots better
authorJeff Dike <jdike@x86_64.user-mode-linux.org>
Thu, 5 Aug 2010 18:50:14 +0000 (14:50 -0400)
committerRichard Purdie <rpurdie@linux.intel.com>
Fri, 20 Aug 2010 15:20:10 +0000 (16:20 +0100)
The image specification can now be in the form nfs-server:directory.
This makes it possible to nfs-boot from servers other than the host.
poky-qemu-internal will properly construct the kernel command line
given such a specification.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
scripts/poky-qemu-internal
scripts/tunctl-src/Makefile [new file with mode: 0644]

index 8ff3add5115fc0175bde0792efc7e9a9aa78d4ed..acb6ff50ffe63c671c1fd9d00235e5329c31f8c4 100755 (executable)
@@ -92,6 +92,16 @@ if [ "$TYPE" != "nfs" -a ! -f "$HDIMAGE" ]; then
     return
 fi
 
+if [ "$TYPE" = "nfs" ]; then
+    NFS_SERVER=`echo $HDIMAGE | sed 's/^\([^:]*\):.*/\1/'`
+    NFS_DIR=`echo $HDIMAGE | sed 's/^[^:]*:\(.*\)/\1/'`
+fi
+
+if [ "$NFS_SERVER" = "" ]; then
+    NFS_SERVER="192.168.7.1"
+    NFS_DIR=$HDIMAGE
+fi
+
 if [ ! -f "$ZIMAGE" ]; then
     echo "Error: Kernel image file $ZIMAGE doesn't exist"
     return
@@ -107,14 +117,11 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -hda $HDIMAGE -no-reboot $QEMU_UI_OPTIONS"
     fi
     if [ "$TYPE" = "nfs" ]; then
-        if [ "x$HDIMAGE" = "x" ]; then
-            HDIMAGE=/srv/nfs/qemuarm
-        fi
-        if [ ! -d "$HDIMAGE" ]; then
+        if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
             echo "Error: NFS mount point $HDIMAGE doesn't exist"
             return
         fi
-        KERNCMDLINE="root=/dev/nfs nfsroot=192.168.7.1:$HDIMAGE rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+        KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS"
     fi
        if [ "$MACHINE" = "qemuarmv6" ]; then
@@ -133,14 +140,11 @@ if [ "$MACHINE" = "qemux86" ]; then
         QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $HDIMAGE $QEMU_UI_OPTIONS"
     fi
     if [ "$TYPE" = "nfs" ]; then
-        if [ "x$HDIMAGE" = "x" ]; then
-            HDIMAGE=/srv/nfs/qemux86
-        fi
-        if [ ! -d "$HDIMAGE" ]; then
+        if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
             echo "Error: NFS mount point $HDIMAGE doesn't exist."
             return
         fi
-        KERNCMDLINE="root=/dev/nfs nfsroot=192.168.7.1:$HDIMAGE rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+        KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
     fi
 fi
diff --git a/scripts/tunctl-src/Makefile b/scripts/tunctl-src/Makefile
new file mode 100644 (file)
index 0000000..81cab8a
--- /dev/null
@@ -0,0 +1,17 @@
+OBJS = tunctl.o
+BIN = tunctl
+CFLAGS ?= -g -Wall
+
+BIN_DIR ?= /usr/bin
+
+all : $(BIN)
+
+$(BIN) : $(OBJS)
+       $(CC) $(CFLAGS) -o $(BIN) $(OBJS)
+
+clean : 
+       rm -f $(BIN) $(OBJS) *~
+
+install : $(BIN)
+       install -d $(DESTDIR)$(BIN_DIR)
+       install -s $(BIN) $(DESTDIR)$(BIN_DIR)