summaryrefslogtreecommitdiff
path: root/scripts/runqemu-export-rootfs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu-export-rootfs')
-rwxr-xr-xscripts/runqemu-export-rootfs127
1 files changed, 48 insertions, 79 deletions
diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index f8213ba4ef..c7992d8223 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -40,19 +40,19 @@ NFS_EXPORT_DIR=$(cd "$2" && pwd)
SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
- echo "Error: Unable to find the oe-find-native-sysroot script"
- echo "Did you forget to source your build environment setup script?"
- exit 1
+ echo "Error: Unable to find the oe-find-native-sysroot script"
+ echo "Did you forget to source your build environment setup script?"
+ exit 1
fi
-. $SYSROOT_SETUP_SCRIPT
+. $SYSROOT_SETUP_SCRIPT meta-ide-support
-if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd" ]; then
- echo "Error: Unable to find rpc.mountd binary in $OECORE_NATIVE_SYSROOT/usr/sbin/"
+if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/unfsd" ]; then
+ echo "Error: Unable to find unfsd binary in $OECORE_NATIVE_SYSROOT/usr/bin/"
if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then
- echo "Have you run 'bitbake meta-ide-support'?"
+ echo "Have you run 'bitbake meta-ide-support'?"
else
- echo "This shouldn't happen - something is missing from your toolchain installation"
+ echo "This shouldn't happen - something is missing from your toolchain installation"
fi
exit 1
fi
@@ -68,7 +68,7 @@ NFSPID=~/.runqemu-sdk/nfs$NFS_INSTANCE.pid
MOUNTPID=~/.runqemu-sdk/mount$NFS_INSTANCE.pid
PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
-PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo"
+PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/../$(basename $NFS_EXPORT_DIR).pseudo_state"
export PSEUDO_LOCALSTATEDIR
if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
@@ -78,109 +78,78 @@ if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
fi
# rpc.mountd RPC port
-NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ]
+MOUNTD_RPCPORT=${MOUNTD_RPCPORT:=$[ 21111 + $NFS_INSTANCE ]}
# rpc.nfsd RPC port
-NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ]
-# NFS port number
-NFS_PORT=$[ 3049 + $NFS_INSTANCE ]
+NFSD_RPCPORT=${NFSD_RPCPORT:=$[ 11111 + $NFS_INSTANCE ]}
+# NFS server port number
+NFSD_PORT=${NFSD_PORT:=$[ 3049 + 2 * $NFS_INSTANCE ]}
# mountd port number
-MOUNT_PORT=$[ 3048 + $NFS_INSTANCE ]
+MOUNTD_PORT=${MOUNTD_PORT:=$[ 3048 + 2 * $NFS_INSTANCE ]}
## For debugging you would additionally add
## --debug all
-MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r -P $MOUNT_PORT"
-NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r"
-
-# Setup the exports file
-if [ "$1" = "start" ]; then
- echo "Creating exports file..."
- echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS
-fi
+UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFSD_RPCPORT -n $NFSD_PORT -y $MOUNTD_RPCPORT -m $MOUNTD_PORT"
# See how we were called.
case "$1" in
start)
- echo "Starting User Mode rpc.mountd"
- echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS"
- $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS
- if [ ! $? = 0 ]; then
- echo "====================="
- echo "Error starting MOUNTD"
- echo "====================="
- ps -ef | grep -v grep | grep rpcbind 2>&1 > /dev/null
- if [ $? = 0 ] ; then
- echo " If you see an error above that says:"
- echo " RPC: Authentication error; why = Client credential too weak"
- echo " You need to change the startup of rpcbind"
- echo " on your host by doing the following as root:"
- echo "==============================================="
- echo " According to /etc/sysconfig/rpcbind, then "
- echo " echo RPCBIND_ARGS=-i >> /etc/sysconfig/rpcbind"
- echo " or"
- echo " echo RPCBIND_OPTIONS=-i >> /etc/sysconfig/rpcbind"
- echo " /etc/init.d/rpcbind restart"
- echo "==============================================="
- echo "For Ubuntu 11.10 hosts"
- echo "Add OPTIONS=\"-i -w\" to /etc/default/rpcbind"
- echo "sudo service portmap restart"
- fi
- exit 1
+ PORTMAP_RUNNING=`ps -ef | grep portmap | grep -v grep`
+ RPCBIND_RUNNING=`ps -ef | grep rpcbind | grep -v grep`
+ if [[ "x$PORTMAP_RUNNING" = "x" && "x$RPCBIND_RUNNING" = "x" ]]; then
+ echo "======================================================="
+ echo "Error: neither rpcbind nor portmap appear to be running"
+ echo "Please install and start one of these services first"
+ echo "======================================================="
+ echo "Tip: for recent Ubuntu hosts, run:"
+ echo " sudo apt-get install rpcbind"
+ echo "Then add OPTIONS=\"-i -w\" to /etc/default/rpcbind and run"
+ echo " sudo service portmap restart"
+
+ exit 1
fi
+
+ echo "Creating exports file..."
+ echo "$NFS_EXPORT_DIR (rw,no_root_squash,no_all_squash,insecure)" > $EXPORTS
+
echo "Starting User Mode nfsd"
- echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS"
- $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS
+ echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS"
+ $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS
if [ ! $? = 0 ]; then
- echo "Error starting nfsd"
- exit 1
+ echo "Error starting nfsd"
+ exit 1
fi
# Check to make sure everything started ok.
- if [ ! -f $MOUNTPID ]; then
- echo "rpc.mountd did not start correctly"
- exit 1
- fi
if [ ! -f $NFSPID ]; then
- echo "rpc.nfsd did not start correctly"
- exit 1
- fi
- ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null
- if [ ! $? = 0 ]; then
- echo "rpc.mountd did not start correctly"
- exit 1
+ echo "rpc.nfsd did not start correctly"
+ exit 1
fi
ps -fp `cat $NFSPID` > /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
- echo "rpc.nfsd did not start correctly"
- exit 1
+ echo "rpc.nfsd did not start correctly"
+ exit 1
fi
echo " "
echo "On your target please remember to add the following options for NFS"
- echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp"
+ echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT"
;;
stop)
- if [ -f "$MOUNTPID" ]; then
- echo "Stopping rpc.mountd"
- kill `cat $MOUNTPID`
- rm -f $MOUNTPID
- else
- echo "No PID file, not stopping rpc.mountd"
- fi
if [ -f "$NFSPID" ]; then
- echo "Stopping rpc.nfsd"
- kill `cat $NFSPID`
- rm -f $NFSPID
+ echo "Stopping rpc.nfsd"
+ kill `cat $NFSPID`
+ rm -f $NFSPID
else
- echo "No PID file, not stopping rpc.nfsd"
+ echo "No PID file, not stopping rpc.nfsd"
fi
if [ -f "$EXPORTS" ]; then
- echo "Removing exports file"
- rm -f $EXPORTS
+ echo "Removing exports file"
+ rm -f $EXPORTS
fi
;;
restart)
$0 stop $NFS_EXPORT_DIR
$0 start $NFS_EXPORT_DIR
if [ ! $? = 0 ]; then
- exit 1
+ exit 1
fi
;;
*)