diff options
| author | Scott Garman <scott.a.garman@intel.com> | 2010-09-28 16:23:54 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-07 19:51:36 +0100 |
| commit | fcbd67c047f02052cc87f2d0dcbfde83a23921bd (patch) | |
| tree | 6ab238d5ff5e4a23ab585afb8cd89c5c0466e971 /scripts/runqemu-nfs | |
| parent | c8a181e847660bb9d7faedad0bed7d05afbe8103 (diff) | |
| download | poky-fcbd67c047f02052cc87f2d0dcbfde83a23921bd.tar.gz | |
poky-qemu: integrate userspace nfsroot support
This is the first phase of some refactoring the poky-qemu control
scripts are getting. This integrates userspace nfsroot support into
poky-qemu, making runqemu-nfs obsolete.
This fixes [BUGID #295]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'scripts/runqemu-nfs')
| -rwxr-xr-x | scripts/runqemu-nfs | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/scripts/runqemu-nfs b/scripts/runqemu-nfs deleted file mode 100755 index 19943a7648..0000000000 --- a/scripts/runqemu-nfs +++ /dev/null | |||
| @@ -1,103 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # Copyright (c) 2010 Intel Corp. | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License version 2 as | ||
| 7 | # published by the Free Software Foundation. | ||
| 8 | # | ||
| 9 | # This program is distributed in the hope that it will be useful, | ||
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 12 | # See the GNU General Public License for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License | ||
| 15 | # along with this program; if not, write to the Free Software | ||
| 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 17 | |||
| 18 | function usage() { | ||
| 19 | echo "Usage: $0 {machine-type} <kernel> <rootfs-dir>" | ||
| 20 | echo "Where <rootfs-dir> is a rootfs directory that was created using the poky-extract-sdk utility" | ||
| 21 | echo "machine-type is optional if the kernel file is named according to Poky conventions" | ||
| 22 | } | ||
| 23 | |||
| 24 | if [[ $# -lt 2 || $# -gt 3 ]]; then | ||
| 25 | usage | ||
| 26 | exit 1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | if [ $# -eq 3 ]; then | ||
| 30 | QEMUARCH=$1 | ||
| 31 | ZIMAGE=$2 | ||
| 32 | SDK_ROOTFS_DIR=$(cd "$3" && pwd) | ||
| 33 | else | ||
| 34 | ZIMAGE=$1 | ||
| 35 | SDK_ROOTFS_DIR=$(cd "$2" && pwd) | ||
| 36 | |||
| 37 | QEMUARCH=`basename $ZIMAGE | sed -r -e 's#.*-([a-z]+[0-9]*)-?[0-9]*..*#\1#'` | ||
| 38 | if [ -z "$QEMUARCH" ]; then | ||
| 39 | echo "Error: Unable to determine machinetype from filename '$ZIMAGE'" | ||
| 40 | usage | ||
| 41 | exit 1 | ||
| 42 | fi | ||
| 43 | fi | ||
| 44 | |||
| 45 | if [ ! -e "$ZIMAGE" ]; then | ||
| 46 | echo "Error: kernel file '$ZIMAGE' does not exist" | ||
| 47 | usage | ||
| 48 | exit 1 | ||
| 49 | fi | ||
| 50 | |||
| 51 | QEMU_INTERNAL_SCRIPT=`which poky-qemu-internal` | ||
| 52 | if [ -z "$QEMU_INTERNAL_SCRIPT" ]; then | ||
| 53 | echo "Error: Unable to find the poky-qemu-internal script" | ||
| 54 | exit 1 | ||
| 55 | fi | ||
| 56 | |||
| 57 | SYSROOT_SETUP_SCRIPT=`which poky-find-native-sysroot` | ||
| 58 | if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then | ||
| 59 | echo "Error: Unable to find the poky-find-native-sysroot script" | ||
| 60 | echo "Did you forget to source your Poky environment script?" | ||
| 61 | exit 1 | ||
| 62 | fi | ||
| 63 | . $SYSROOT_SETUP_SCRIPT | ||
| 64 | |||
| 65 | PSEUDO_LOCALSTATEDIR=~/.poky-sdk/pseudo | ||
| 66 | export PSEUDO_LOCALSTATEDIR | ||
| 67 | |||
| 68 | RPC=`which rpcbind` | ||
| 69 | if [ "x$RPC" = "x" ]; then | ||
| 70 | RPC=`which portmap` | ||
| 71 | if [ "x$RPC" = "x" ]; then | ||
| 72 | echo "You need rpcbind or portmap installed and running to run the" | ||
| 73 | echo "userspace NFS server." | ||
| 74 | exit 1 | ||
| 75 | fi | ||
| 76 | fi | ||
| 77 | |||
| 78 | rpcbind_running=`ps ax | grep rpcbind | wc -l` | ||
| 79 | portmap_running=`ps ax | grep portbind | wc -l` | ||
| 80 | if [ rpcbind_running == 1 -a portmap_running == 1 ]; then | ||
| 81 | echo "You need to be running either rpcbind or portmap to continue" | ||
| 82 | exit 1 | ||
| 83 | fi | ||
| 84 | |||
| 85 | # Start the userspace NFS server | ||
| 86 | echo "poky-export-rootfs restart $SDK_ROOTFS_DIR" | ||
| 87 | poky-export-rootfs restart $SDK_ROOTFS_DIR | ||
| 88 | if [ $? != 0 ]; then | ||
| 89 | exit 1 | ||
| 90 | fi | ||
| 91 | |||
| 92 | # Run QEMU | ||
| 93 | MACHINE=$QEMUARCH | ||
| 94 | TYPE="nfs" | ||
| 95 | HDIMAGE=$SDK_ROOTFS_DIR | ||
| 96 | CROSSPATH=$POKY_NATIVE_SYSROOT/usr/bin | ||
| 97 | . $QEMU_INTERNAL_SCRIPT | ||
| 98 | |||
| 99 | # Cleanup | ||
| 100 | echo "poky-export-rootfs stop $SDK_ROOTFS_DIR" | ||
| 101 | poky-export-rootfs stop $SDK_ROOTFS_DIR | ||
| 102 | |||
| 103 | exit 0 | ||
