summaryrefslogtreecommitdiffstats
path: root/scripts/poky-export-rootfs
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-04-20 23:24:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-04-21 00:29:31 +0100
commit2c2e61743c8d6620a04aa5cb534af78f51b2845e (patch)
tree769b7139eb86f49d9d78153c8e673ed8f04d9bde /scripts/poky-export-rootfs
parent0b70e298fbb2cf0a9aa1bab193a66a7edfe99e10 (diff)
downloadpoky-2c2e61743c8d6620a04aa5cb534af78f51b2845e.tar.gz
Rename the remaining poky-* scripts to oe-* or runqemu-*
(From OE-Core rev: 877b3d84597fcfc3abf5aa332019d412f2717896) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/poky-export-rootfs')
-rwxr-xr-xscripts/poky-export-rootfs186
1 files changed, 0 insertions, 186 deletions
diff --git a/scripts/poky-export-rootfs b/scripts/poky-export-rootfs
deleted file mode 100755
index 764d19a823..0000000000
--- a/scripts/poky-export-rootfs
+++ /dev/null
@@ -1,186 +0,0 @@
1#!/bin/bash
2#
3# Copyright (c) 2005-2009 Wind River Systems, Inc.
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
18usage() {
19 echo "Usage: $0 {start|stop|restart} <nfs-export-dir>"
20}
21
22if [ $# != 2 ]; then
23 usage
24 exit 1
25fi
26
27if [[ "$1" != "start" && "$1" != "stop" && "$1" != "restart" ]]; then
28 echo "Unknown command '$1'"
29 usage
30 exit 1
31fi
32
33if [ ! -d "$2" ]; then
34 echo "Error: '$2' does not exist"
35 usage
36 exit 1
37fi
38# Ensure the nfs-export-dir is an absolute path
39NFS_EXPORT_DIR=$(cd "$2" && pwd)
40
41SYSROOT_SETUP_SCRIPT=`which poky-find-native-sysroot`
42if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
43 echo "Error: Unable to find the poky-find-native-sysroot script"
44 echo "Did you forget to source your Poky environment script?"
45 exit 1
46fi
47. $SYSROOT_SETUP_SCRIPT
48
49if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd" ]; then
50 echo "Error: Unable to find rpc.mountd binary in $OECORE_NATIVE_SYSROOT/usr/sbin/"
51
52 if [ "x$POKY_DISTRO_VERSION" = "x" ]; then
53 echo "Have you run 'bitbake meta-ide-support'?"
54 else
55 echo "This shouldn't happen - something is missing from your toolchain installation"
56 fi
57 exit 1
58fi
59
60if [ ! -d ~/.poky-sdk ]; then
61 mkdir -p ~/.poky-sdk
62fi
63
64NFS_INSTANCE=${NFS_INSTANCE:=0}
65EXPORTS=~/.poky-sdk/exports$NFS_INSTANCE
66RMTAB=~/.poky-sdk/rmtab$NFS_INSTANCE
67NFSPID=~/.poky-sdk/nfs$NFS_INSTANCE.pid
68MOUNTPID=~/.poky-sdk/mount$NFS_INSTANCE.pid
69
70PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
71PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo"
72export PSEUDO_LOCALSTATEDIR
73
74if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
75 echo "Error: $PSEUDO_LOCALSTATEDIR does not exist."
76 echo "Did you create the export directory using poky-extract-sdk?"
77 exit 1
78fi
79
80# rpc.mountd RPC port
81NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ]
82# rpc.nfsd RPC port
83NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ]
84# NFS port number
85NFS_PORT=$[ 3049 + $NFS_INSTANCE ]
86
87## For debugging you would additionally add
88## --debug all
89MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r"
90NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r"
91
92# Setup the exports file
93if [ "$1" = "start" ]; then
94 echo "Creating exports file..."
95 echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS
96fi
97
98# See how we were called.
99case "$1" in
100 start)
101 echo "Starting User Mode rpc.mountd"
102 echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS"
103 $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS
104 if [ ! $? = 0 ]; then
105 echo "====================="
106 echo "Error starting MOUNTD"
107 echo "====================="
108 ps -ef | grep -v grep | grep rpcbind 2>&1 > /dev/null
109 if [ $? = 0 ] ; then
110 echo " If you see an error above that says:"
111 echo " RPC: Authentication error; why = Client credential too weak"
112 echo " You need to change the startup of rpcbind"
113 echo " on your host by doing the following as root:"
114 echo "==============================================="
115 echo " According to /etc/sysconfig/rpcbind, then "
116 echo " echo RPCBIND_ARGS=-i >> /etc/sysconfig/rpcbind"
117 echo " or"
118 echo " echo RPCBIND_OPTIONS=-i >> /etc/sysconfig/rpcbind"
119 echo " /etc/init.d/rpcbind restart"
120 echo "==============================================="
121 fi
122 exit 1
123 fi
124 echo "Starting User Mode nfsd"
125 echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS"
126 $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS
127 if [ ! $? = 0 ]; then
128 echo "Error starting nfsd"
129 exit 1
130 fi
131 # Check to make sure everything started ok.
132 if [ ! -f $MOUNTPID ]; then
133 echo "rpc.mountd did not start correctly"
134 exit 1
135 fi
136 if [ ! -f $NFSPID ]; then
137 echo "rpc.nfsd did not start correctly"
138 exit 1
139 fi
140 ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null
141 if [ ! $? = 0 ]; then
142 echo "rpc.mountd did not start correctly"
143 exit 1
144 fi
145 ps -fp `cat $NFSPID` > /dev/null 2> /dev/null
146 if [ ! $? = 0 ]; then
147 echo "rpc.nfsd did not start correctly"
148 exit 1
149 fi
150 echo " "
151 echo "On your target please remember to add the following options for NFS"
152 echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp"
153 ;;
154 stop)
155 if [ -f "$MOUNTPID" ]; then
156 echo "Stopping rpc.mountd"
157 kill `cat $MOUNTPID`
158 rm -f $MOUNTPID
159 else
160 echo "No PID file, not stopping rpc.mountd"
161 fi
162 if [ -f "$NFSPID" ]; then
163 echo "Stopping rpc.nfsd"
164 kill `cat $NFSPID`
165 rm -f $NFSPID
166 else
167 echo "No PID file, not stopping rpc.nfsd"
168 fi
169 if [ -f "$EXPORTS" ]; then
170 echo "Removing exports file"
171 rm -f $EXPORTS
172 fi
173 ;;
174 restart)
175 $0 stop $NFS_EXPORT_DIR
176 $0 start $NFS_EXPORT_DIR
177 if [ ! $? = 0 ]; then
178 exit 1
179 fi
180 ;;
181 *)
182 echo "$0 {start|stop|restart} <nfs-export-dir>"
183 ;;
184esac
185
186exit 0