diff options
author | Scott Garman <scott.a.garman@intel.com> | 2010-10-03 21:16:24 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-07 19:55:50 +0100 |
commit | e70c8981f250ead9e025ecd27aef94b67d784fc6 (patch) | |
tree | 0644d5cfb98596f71e5cce7ff8f1e23508c4a4a2 /scripts/poky-export-rootfs | |
parent | 8532405c1d6b2184ca88922506b725110a1f7627 (diff) | |
download | poky-e70c8981f250ead9e025ecd27aef94b67d784fc6.tar.gz |
Allow running of multiple QEMU nfs instances
These changes allow multiple instances of the userspace NFS server
to run, when brought up by consecutive instances of the poky-qemu
control script.
This fixes [BUGID #393]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'scripts/poky-export-rootfs')
-rwxr-xr-x | scripts/poky-export-rootfs | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/scripts/poky-export-rootfs b/scripts/poky-export-rootfs index ef527dc058..f3552516ad 100755 --- a/scripts/poky-export-rootfs +++ b/scripts/poky-export-rootfs | |||
@@ -61,11 +61,11 @@ if [ ! -d ~/.poky-sdk ]; then | |||
61 | mkdir -p ~/.poky-sdk | 61 | mkdir -p ~/.poky-sdk |
62 | fi | 62 | fi |
63 | 63 | ||
64 | TARGET_VIRT_INSTANCE=${TARGET_VIRT_INSTANCE:=0} | 64 | NFS_INSTANCE=${NFS_INSTANCE:=0} |
65 | EXPORTS=~/.poky-sdk/exports$TARGET_VIRT_INSTANCE | 65 | EXPORTS=~/.poky-sdk/exports$NFS_INSTANCE |
66 | RMTAB=~/.poky-sdk/rmtab$TARGET_VIRT_INSTANCE | 66 | RMTAB=~/.poky-sdk/rmtab$NFS_INSTANCE |
67 | NFSPID=~/.poky-sdk/nfs$TARGET_VIRT_INSTANCE.pid | 67 | NFSPID=~/.poky-sdk/nfs$NFS_INSTANCE.pid |
68 | MOUNTPID=~/.poky-sdk/mount$TARGET_VIRT_INSTANCE.pid | 68 | MOUNTPID=~/.poky-sdk/mount$NFS_INSTANCE.pid |
69 | 69 | ||
70 | PSEUDO_OPTS="-P $POKY_NATIVE_SYSROOT/usr" | 70 | PSEUDO_OPTS="-P $POKY_NATIVE_SYSROOT/usr" |
71 | PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo" | 71 | PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo" |
@@ -78,15 +78,14 @@ if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then | |||
78 | fi | 78 | fi |
79 | 79 | ||
80 | # rpc.mountd RPC port | 80 | # rpc.mountd RPC port |
81 | NFS_MOUNTPROG="21111" | 81 | NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ] |
82 | # rpc.nfsd RPC port | 82 | # rpc.nfsd RPC port |
83 | NFS_NFSPROG="11111" | 83 | NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ] |
84 | # NFS port number | 84 | # NFS port number |
85 | NFS_PORT="3049" | 85 | NFS_PORT=$[ 3049 + $NFS_INSTANCE ] |
86 | 86 | ||
87 | ## For debugging you would additionally add | 87 | ## For debugging you would additionally add |
88 | ## --debug all | 88 | ## --debug all |
89 | |||
90 | MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r" | 89 | MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r" |
91 | NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r" | 90 | NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r" |
92 | 91 | ||
@@ -102,7 +101,7 @@ case "$1" in | |||
102 | echo "Starting User Mode rpc.mountd" | 101 | echo "Starting User Mode rpc.mountd" |
103 | echo " $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS" | 102 | echo " $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS" |
104 | $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS | 103 | $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS |
105 | if [ ! $? = 0 ] ; then | 104 | if [ ! $? = 0 ]; then |
106 | echo "=====================" | 105 | echo "=====================" |
107 | echo "Error starting MOUNTD" | 106 | echo "Error starting MOUNTD" |
108 | echo "=====================" | 107 | echo "=====================" |
@@ -125,26 +124,26 @@ case "$1" in | |||
125 | echo "Starting User Mode nfsd" | 124 | echo "Starting User Mode nfsd" |
126 | echo " $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS" | 125 | echo " $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS" |
127 | $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS | 126 | $PSEUDO $PSEUDO_OPTS $POKY_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS |
128 | if [ ! $? = 0 ] ; then | 127 | if [ ! $? = 0 ]; then |
129 | echo "Error starting nfsd" | 128 | echo "Error starting nfsd" |
130 | exit 1 | 129 | exit 1 |
131 | fi | 130 | fi |
132 | # Check to make sure everything started ok. | 131 | # Check to make sure everything started ok. |
133 | if [ ! -f $MOUNTPID ] ; then | 132 | if [ ! -f $MOUNTPID ]; then |
134 | echo "rpc.mountd did not start correctly" | 133 | echo "rpc.mountd did not start correctly" |
135 | exit 1 | 134 | exit 1 |
136 | fi | 135 | fi |
137 | if [ ! -f $NFSPID ] ; then | 136 | if [ ! -f $NFSPID ]; then |
138 | echo "rpc.nfsd did not start correctly" | 137 | echo "rpc.nfsd did not start correctly" |
139 | exit 1 | 138 | exit 1 |
140 | fi | 139 | fi |
141 | ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null | 140 | ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null |
142 | if [ ! $? = 0 ] ; then | 141 | if [ ! $? = 0 ]; then |
143 | echo "rpc.mountd did not start correctly" | 142 | echo "rpc.mountd did not start correctly" |
144 | exit 1 | 143 | exit 1 |
145 | fi | 144 | fi |
146 | ps -fp `cat $NFSPID` > /dev/null 2> /dev/null | 145 | ps -fp `cat $NFSPID` > /dev/null 2> /dev/null |
147 | if [ ! $? = 0 ] ; then | 146 | if [ ! $? = 0 ]; then |
148 | echo "rpc.nfsd did not start correctly" | 147 | echo "rpc.nfsd did not start correctly" |
149 | exit 1 | 148 | exit 1 |
150 | fi | 149 | fi |
@@ -153,25 +152,29 @@ case "$1" in | |||
153 | echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp" | 152 | echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp" |
154 | ;; | 153 | ;; |
155 | stop) | 154 | stop) |
156 | if [ -f "$MOUNTPID" ] ; then | 155 | if [ -f "$MOUNTPID" ]; then |
157 | echo "Stopping rpc.mountd" | 156 | echo "Stopping rpc.mountd" |
158 | kill `cat $MOUNTPID` | 157 | kill `cat $MOUNTPID` |
159 | rm -f $MOUNTPID | 158 | rm -f $MOUNTPID |
160 | else | 159 | else |
161 | echo "No PID file, not stopping rpc.mountd" | 160 | echo "No PID file, not stopping rpc.mountd" |
162 | fi | 161 | fi |
163 | if [ -f "$NFSPID" ] ; then | 162 | if [ -f "$NFSPID" ]; then |
164 | echo "Stopping rpc.nfsd" | 163 | echo "Stopping rpc.nfsd" |
165 | kill `cat $NFSPID` | 164 | kill `cat $NFSPID` |
166 | rm -f $NFSPID | 165 | rm -f $NFSPID |
167 | else | 166 | else |
168 | echo "No PID file, not stopping rpc.nfsd" | 167 | echo "No PID file, not stopping rpc.nfsd" |
169 | fi | 168 | fi |
169 | if [ -f "$EXPORTS" ]; then | ||
170 | echo "Removing exports file" | ||
171 | rm -f $EXPORTS | ||
172 | fi | ||
170 | ;; | 173 | ;; |
171 | restart) | 174 | restart) |
172 | $0 stop $NFS_EXPORT_DIR | 175 | $0 stop $NFS_EXPORT_DIR |
173 | $0 start $NFS_EXPORT_DIR | 176 | $0 start $NFS_EXPORT_DIR |
174 | if [ ! $? = 0 ] ; then | 177 | if [ ! $? = 0 ]; then |
175 | exit 1 | 178 | exit 1 |
176 | fi | 179 | fi |
177 | ;; | 180 | ;; |