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 | |
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')
-rwxr-xr-x | scripts/poky-qemu | 44 | ||||
-rwxr-xr-x | scripts/poky-qemu-internal | 253 | ||||
-rwxr-xr-x | scripts/runqemu-nfs | 103 |
3 files changed, 140 insertions, 260 deletions
diff --git a/scripts/poky-qemu b/scripts/poky-qemu index 6fe6f5e99b..111aa15b70 100755 --- a/scripts/poky-qemu +++ b/scripts/poky-qemu | |||
@@ -20,40 +20,42 @@ | |||
20 | 20 | ||
21 | if [ "x$1" = "x" ]; then | 21 | if [ "x$1" = "x" ]; then |
22 | MYNAME=`basename $0` | 22 | MYNAME=`basename $0` |
23 | echo "Run as MACHINE=xyz $MYNAME ZIMAGE IMAGEFILE [OPTIONS]" | 23 | echo "Run as MACHINE=xyz $MYNAME KERNEL ROOTFS [OPTIONS]" |
24 | echo "where:" | 24 | echo "where:" |
25 | echo " ZIMAGE - the kernel image file to use" | 25 | echo " KERNEL - the kernel image file to use" |
26 | echo " IMAGEFILE - the image file/location to use" | 26 | echo " ROOTFS - the rootfs image file or nfsroot directory to use" |
27 | echo " (NFS booting assumed if IMAGEFILE not specified)" | 27 | # echo " (NFS booting assumed if ROOTFS not specified)" |
28 | echo " MACHINE=xyz - the machine name (optional, autodetected from ZIMAGE if unspecified)" | 28 | echo " MACHINE=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)" |
29 | echo " OPTIONS - extra options to pass to QEMU" | 29 | echo " OPTIONS - extra options to pass to QEMU" |
30 | exit 1 | 30 | exit 1 |
31 | else | 31 | else |
32 | ZIMAGE=$1 | 32 | KERNEL=$1 |
33 | shift | 33 | shift |
34 | fi | 34 | fi |
35 | 35 | ||
36 | if [ "x$MACHINE" = "x" ]; then | 36 | if [ "x$MACHINE" = "x" ]; then |
37 | MACHINE=`basename $ZIMAGE | sed -r -e 's#.*-([a-z]+[0-9]*)-?[0-9]*..*#\1#'` | 37 | MACHINE=`basename $KERNEL | sed -r -e 's#.*-([a-z]+[0-9\-]*)-?[0-9]*..*#\1#'` |
38 | fi | 38 | fi |
39 | 39 | ||
40 | if [ "x$1" = "x" ]; then | 40 | if [ "x$1" = "x" ]; then |
41 | TYPE="nfs" | 41 | FSTYPE="nfs" |
42 | echo "Error: NFS booting without an explicit ROOTFS path is not yet supported" | ||
43 | exit 1 | ||
42 | else | 44 | else |
43 | TYPE="ext3" | 45 | ROOTFS=$1 |
44 | if [ "$MACHINE" = "akita" ]; then | 46 | |
45 | TYPE="jffs2" | 47 | if [ -d "$1" ]; then |
46 | fi | 48 | echo "$ROOTFS is a directory, assuming nfsroot" |
47 | if [ "$MACHINE" = "spitz" ]; then | 49 | FSTYPE="nfs" |
48 | TYPE="ext3" | 50 | else |
49 | fi | 51 | FSTYPE="ext3" |
50 | if [ "$MACHINE" = "nokia800" ]; then | 52 | EXT=${ROOTFS##.*} |
51 | TYPE="jffs2" | 53 | if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || |
52 | fi | 54 | "x$EXT" == "xjffs2" ]]; then |
53 | if [ "$MACHINE" = "nokia800-maemo" ]; then | 55 | FSTYPE=$EXT |
54 | TYPE="jffs2" | 56 | fi |
57 | echo "Using $FSTYPE as filesytem type for $ROOTFS" | ||
55 | fi | 58 | fi |
56 | HDIMAGE=$1 | ||
57 | shift | 59 | shift |
58 | fi | 60 | fi |
59 | 61 | ||
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal index 30e90df0b6..c65e0f1de2 100755 --- a/scripts/poky-qemu-internal +++ b/scripts/poky-qemu-internal | |||
@@ -17,7 +17,6 @@ | |||
17 | # with this program; if not, write to the Free Software Foundation, Inc., | 17 | # with this program; if not, write to the Free Software Foundation, Inc., |
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 | 19 | ||
20 | |||
21 | # Call setting: | 20 | # Call setting: |
22 | # QEMU_MEMORY (optional) - set the amount of memory in the emualted system. | 21 | # QEMU_MEMORY (optional) - set the amount of memory in the emualted system. |
23 | # SERIAL_LOGFILE (optional) - log the serial port output to a file | 22 | # SERIAL_LOGFILE (optional) - log the serial port output to a file |
@@ -25,35 +24,37 @@ | |||
25 | # | 24 | # |
26 | # Image options: | 25 | # Image options: |
27 | # MACHINE - the machine to run | 26 | # MACHINE - the machine to run |
28 | # TYPE - the image type to run | 27 | # FSTYPE - the image type to run |
29 | # ZIMAGE - the kernel image file to use | 28 | # KERNEL - the kernel image file to use |
30 | # HDIMAGE - the disk image file to use | 29 | # ROOTFS - the disk image file to use |
31 | # | 30 | # |
32 | 31 | ||
33 | if [ -z "$QEMU_MEMORY" ]; then | 32 | if [ -z "$QEMU_MEMORY" ]; then |
34 | case "$MACHINE" in | 33 | case "$MACHINE" in |
35 | "qemux86") | 34 | "qemux86") |
36 | QEMU_MEMORY="128M" | 35 | QEMU_MEMORY="128M" |
37 | ;; | 36 | ;; |
38 | "qemux86-64") | 37 | "qemux86-64") |
39 | QEMU_MEMORY="128M" | 38 | QEMU_MEMORY="128M" |
40 | ;; | 39 | ;; |
41 | "qemumips") | 40 | "qemumips") |
42 | QEMU_MEMORY="128M" | 41 | QEMU_MEMORY="128M" |
43 | ;; | 42 | ;; |
44 | "qemuppc") | 43 | "qemuppc") |
45 | QEMU_MEMORY="128M" | 44 | QEMU_MEMORY="128M" |
46 | ;; | 45 | ;; |
47 | *) | 46 | *) |
48 | QEMU_MEMORY="64M" | 47 | QEMU_MEMORY="64M" |
49 | ;; | 48 | ;; |
50 | esac | 49 | esac |
51 | 50 | ||
52 | fi | 51 | fi |
53 | 52 | ||
54 | QEMUIFUP=`which poky-qemu-ifup` | 53 | QEMUIFUP=`which poky-qemu-ifup` |
55 | QEMUIFDOWN=`which poky-qemu-ifdown` | 54 | QEMUIFDOWN=`which poky-qemu-ifdown` |
56 | 55 | ||
56 | NFSRUNNING="false" | ||
57 | |||
57 | LOCKDIR="/tmp/qemu-tap-locks" | 58 | LOCKDIR="/tmp/qemu-tap-locks" |
58 | [ ! -d "$LOCKDIR" ] && mkdir $LOCKDIR | 59 | [ ! -d "$LOCKDIR" ] && mkdir $LOCKDIR |
59 | 60 | ||
@@ -63,8 +64,8 @@ LOCKFILE="" | |||
63 | for tap in $POSSIBLE; do | 64 | for tap in $POSSIBLE; do |
64 | LOCKFILE="$LOCKDIR/$tap" | 65 | LOCKFILE="$LOCKDIR/$tap" |
65 | if lockfile -2 -r 1 $LOCKFILE; then | 66 | if lockfile -2 -r 1 $LOCKFILE; then |
66 | TAP=$tap | 67 | TAP=$tap |
67 | break; | 68 | break; |
68 | fi | 69 | fi |
69 | done | 70 | done |
70 | 71 | ||
@@ -79,8 +80,7 @@ if [ "$TAP" = "" ]; then | |||
79 | fi | 80 | fi |
80 | LOCKFILE="$LOCKDIR/$tap" | 81 | LOCKFILE="$LOCKDIR/$tap" |
81 | if lockfile $LOCKFILE; then | 82 | if lockfile $LOCKFILE; then |
82 | TAP=$tap | 83 | TAP=$tap |
83 | break; | ||
84 | fi | 84 | fi |
85 | else | 85 | else |
86 | echo "Using preconfigured tap device '$TAP'" | 86 | echo "Using preconfigured tap device '$TAP'" |
@@ -93,6 +93,12 @@ release_lock() { | |||
93 | echo "Releasing lockfile of preconfigured tap device '$TAP'" | 93 | echo "Releasing lockfile of preconfigured tap device '$TAP'" |
94 | rm -f $LOCKFILE | 94 | rm -f $LOCKFILE |
95 | fi | 95 | fi |
96 | |||
97 | if [ "$NFSRUNNING" = "true" ]; then | ||
98 | echo "Shutting down the userspace NFS server:" | ||
99 | echo "poky-export-rootfs stop $ROOTFS" | ||
100 | poky-export-rootfs stop $ROOTFS | ||
101 | fi | ||
96 | } | 102 | } |
97 | 103 | ||
98 | n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | 104 | n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] |
@@ -110,44 +116,62 @@ if [ "x$SERIAL_LOGFILE" != "x" ]; then | |||
110 | fi | 116 | fi |
111 | 117 | ||
112 | case "$MACHINE" in | 118 | case "$MACHINE" in |
113 | "qemuarm") ;; | 119 | "qemuarm") ;; |
114 | "qemumips") ;; | 120 | "qemumips") ;; |
115 | "qemuppc") ;; | 121 | "qemuppc") ;; |
116 | "qemuarmv6") ;; | 122 | "qemuarmv6") ;; |
117 | "qemuarmv7") ;; | 123 | "qemuarmv7") ;; |
118 | "qemux86") ;; | 124 | "qemux86") ;; |
119 | "qemux86-64") ;; | 125 | "qemux86-64") ;; |
120 | "akita") ;; | 126 | "akita") ;; |
121 | "spitz") ;; | 127 | "spitz") ;; |
122 | "nokia800") ;; | 128 | *) |
123 | "nokia800-maemo") ;; | 129 | echo "Error: Unsupported machine type $MACHINE" |
124 | *) | 130 | return |
125 | echo "Error: Unsupported machine type $MACHINE" | 131 | ;; |
126 | return | ||
127 | ;; | ||
128 | esac | 132 | esac |
129 | 133 | ||
130 | if [ "$TYPE" != "nfs" -a ! -f "$HDIMAGE" ]; then | 134 | if [ ! -f "$KERNEL" ]; then |
131 | echo "Error: Image file $HDIMAGE doesn't exist" | 135 | echo "Error: Kernel image file $KERNEL doesn't exist" |
132 | release_lock | 136 | release_lock |
133 | return | 137 | return |
134 | fi | 138 | fi |
135 | 139 | ||
136 | if [ "$TYPE" = "nfs" ]; then | 140 | if [ "$FSTYPE" != "nfs" -a ! -f "$ROOTFS" ]; then |
141 | echo "Error: Image file $ROOTFS doesn't exist" | ||
142 | release_lock | ||
143 | return | ||
144 | fi | ||
145 | |||
146 | if [ "$FSTYPE" = "nfs" ]; then | ||
137 | NFS_SERVER="192.168.7.1" | 147 | NFS_SERVER="192.168.7.1" |
138 | NFS_DIR=`echo $HDIMAGE | sed 's/^[^:]*:\(.*\)/\1/'` | 148 | NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'` |
139 | UNFS_OPTS="nfsvers=2,mountprog=21111,nfsprog=11111,udp" | 149 | UNFS_OPTS="nfsvers=2,mountprog=21111,nfsprog=11111,udp" |
150 | |||
151 | PSEUDO_LOCALSTATEDIR=~/.poky-sdk/pseudo | ||
152 | export PSEUDO_LOCALSTATEDIR | ||
153 | |||
154 | rpcbind_running=`ps ax | grep rpcbind | grep -v grep | wc -l` | ||
155 | portmap_running=`ps ax | grep portmap | grep -v grep | wc -l` | ||
156 | if [[ $rpcbind_running == 0 && $portmap_running == 0 ]]; then | ||
157 | echo "You need to be running either rpcbind or portmap to continue" | ||
158 | release_lock | ||
159 | return | ||
160 | fi | ||
161 | |||
162 | # Start the userspace NFS server | ||
163 | echo "poky-export-rootfs restart $ROOTFS" | ||
164 | poky-export-rootfs restart $ROOTFS | ||
165 | if [ $? != 0 ]; then | ||
166 | release_lock | ||
167 | return | ||
168 | fi | ||
169 | NFSRUNNING="true" | ||
140 | fi | 170 | fi |
141 | 171 | ||
142 | if [ "$NFS_SERVER" = "" ]; then | 172 | if [ "$NFS_SERVER" = "" ]; then |
143 | NFS_SERVER="192.168.7.1" | 173 | NFS_SERVER="192.168.7.1" |
144 | NFS_DIR=$HDIMAGE | 174 | NFS_DIR=$ROOTFS |
145 | fi | ||
146 | |||
147 | if [ ! -f "$ZIMAGE" ]; then | ||
148 | echo "Error: Kernel image file $ZIMAGE doesn't exist" | ||
149 | release_lock | ||
150 | return | ||
151 | fi | 175 | fi |
152 | 176 | ||
153 | if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then | 177 | if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then |
@@ -162,37 +186,37 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm | |||
162 | MACHINE_SUBTYPE=versatilepb | 186 | MACHINE_SUBTYPE=versatilepb |
163 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" | 187 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" |
164 | # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer" | 188 | # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer" |
165 | if [ "$TYPE" = "ext3" ]; then | 189 | if [ "$FSTYPE" = "ext3" ]; then |
166 | KERNCMDLINE="root=/dev/sda console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off" | 190 | KERNCMDLINE="root=/dev/sda console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off" |
167 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -hda $HDIMAGE -no-reboot $QEMU_UI_OPTIONS" | 191 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" |
168 | fi | 192 | fi |
169 | if [ "$TYPE" = "nfs" ]; then | 193 | if [ "$FSTYPE" = "nfs" ]; then |
170 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 194 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
171 | echo "Error: NFS mount point $HDIMAGE doesn't exist" | 195 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
172 | release_lock | 196 | release_lock |
173 | return | 197 | return |
174 | fi | 198 | fi |
175 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 199 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
176 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS" | 200 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS" |
177 | fi | 201 | fi |
178 | if [ "$MACHINE" = "qemuarmv6" ]; then | 202 | if [ "$MACHINE" = "qemuarmv6" ]; then |
179 | QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136" | 203 | QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136" |
180 | fi | 204 | fi |
181 | if [ "$MACHINE" = "qemuarmv7" ]; then | 205 | if [ "$MACHINE" = "qemuarmv7" ]; then |
182 | QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8" | 206 | QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8" |
183 | fi | 207 | fi |
184 | fi | 208 | fi |
185 | 209 | ||
186 | if [ "$MACHINE" = "qemux86" ]; then | 210 | if [ "$MACHINE" = "qemux86" ]; then |
187 | QEMU=qemu | 211 | QEMU=qemu |
188 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl" | 212 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl" |
189 | if [ "$TYPE" = "ext3" ]; then | 213 | if [ "$FSTYPE" = "ext3" ]; then |
190 | KERNCMDLINE="vga=0 root=/dev/hda mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" | 214 | KERNCMDLINE="vga=0 root=/dev/hda mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" |
191 | QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $HDIMAGE $QEMU_UI_OPTIONS" | 215 | QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $QEMU_UI_OPTIONS" |
192 | fi | 216 | fi |
193 | if [ "$TYPE" = "nfs" ]; then | 217 | if [ "$FSTYPE" = "nfs" ]; then |
194 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 218 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
195 | echo "Error: NFS mount point $HDIMAGE doesn't exist." | 219 | echo "Error: NFS mount point $ROOTFS doesn't exist." |
196 | release_lock | 220 | release_lock |
197 | return | 221 | return |
198 | fi | 222 | fi |
@@ -204,16 +228,16 @@ fi | |||
204 | if [ "$MACHINE" = "qemux86-64" ]; then | 228 | if [ "$MACHINE" = "qemux86-64" ]; then |
205 | QEMU=qemu-system-x86_64 | 229 | QEMU=qemu-system-x86_64 |
206 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl" | 230 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl" |
207 | if [ "$TYPE" = "ext3" ]; then | 231 | if [ "$FSTYPE" = "ext3" ]; then |
208 | KERNCMDLINE="vga=0 root=/dev/hda mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" | 232 | KERNCMDLINE="vga=0 root=/dev/hda mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" |
209 | QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $HDIMAGE $QEMU_UI_OPTIONS" | 233 | QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $QEMU_UI_OPTIONS" |
210 | fi | 234 | fi |
211 | if [ "$TYPE" = "nfs" ]; then | 235 | if [ "$FSTYPE" = "nfs" ]; then |
212 | if [ "x$HDIMAGE" = "x" ]; then | 236 | if [ "x$ROOTFS" = "x" ]; then |
213 | HDIMAGE=/srv/nfs/qemux86-64 | 237 | ROOTFS=/srv/nfs/qemux86-64 |
214 | fi | 238 | fi |
215 | if [ ! -d "$HDIMAGE" ]; then | 239 | if [ ! -d "$ROOTFS" ]; then |
216 | echo "Error: NFS mount point $HDIMAGE doesn't exist." | 240 | echo "Error: NFS mount point $ROOTFS doesn't exist." |
217 | release_lock | 241 | release_lock |
218 | return | 242 | return |
219 | fi | 243 | fi |
@@ -224,15 +248,15 @@ fi | |||
224 | 248 | ||
225 | if [ "$MACHINE" = "spitz" ]; then | 249 | if [ "$MACHINE" = "spitz" ]; then |
226 | QEMU=qemu-system-arm | 250 | QEMU=qemu-system-arm |
227 | if [ "$TYPE" = "ext3" ]; then | 251 | if [ "$FSTYPE" = "ext3" ]; then |
228 | echo $HDIMAGE | 252 | echo $ROOTFS |
229 | HDIMAGE=`readlink -f $HDIMAGE` | 253 | ROOTFS=`readlink -f $ROOTFS` |
230 | echo $HDIMAGE | 254 | echo $ROOTFS |
231 | if [ ! -e "$HDIMAGE.qemudisk" ]; then | 255 | if [ ! -e "$ROOTFS.qemudisk" ]; then |
232 | echo "Adding a partition table to the ext3 image for use by QEMU, please wait..." | 256 | echo "Adding a partition table to the ext3 image for use by QEMU, please wait..." |
233 | poky-addptable2image $HDIMAGE $HDIMAGE.qemudisk | 257 | poky-addptable2image $ROOTFS $ROOTFS.qemudisk |
234 | fi | 258 | fi |
235 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $HDIMAGE.qemudisk -portrait" | 259 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait" |
236 | fi | 260 | fi |
237 | fi | 261 | fi |
238 | 262 | ||
@@ -243,11 +267,11 @@ if [ "$MACHINE" = "qemumips" ]; then | |||
243 | if [ "$TYPE" = "ext3" ]; then | 267 | if [ "$TYPE" = "ext3" ]; then |
244 | #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 268 | #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
245 | KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 269 | KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
246 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $HDIMAGE -no-reboot $QEMU_UI_OPTIONS" | 270 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" |
247 | fi | 271 | fi |
248 | if [ "$TYPE" = "nfs" ]; then | 272 | if [ "$FSTYPE" = "nfs" ]; then |
249 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 273 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
250 | echo "Error: NFS mount point $HDIMAGE doesn't exist" | 274 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
251 | release_lock | 275 | release_lock |
252 | return | 276 | return |
253 | fi | 277 | fi |
@@ -262,13 +286,13 @@ if [ "$MACHINE" = "qemuppc" ]; then | |||
262 | CPU_SUBTYPE=603e | 286 | CPU_SUBTYPE=603e |
263 | BIOS=powerpc_rom.bin | 287 | BIOS=powerpc_rom.bin |
264 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -nographic" | 288 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -nographic" |
265 | if [ "$TYPE" = "ext3" ]; then | 289 | if [ "$FSTYPE" = "ext3" ]; then |
266 | KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 290 | KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
267 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -bios $BIOS -hda $HDIMAGE -no-reboot $QEMU_UI_OPTIONS" | 291 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -bios $BIOS -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" |
268 | fi | 292 | fi |
269 | if [ "$TYPE" = "nfs" ]; then | 293 | if [ "$FSTYPE" = "nfs" ]; then |
270 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 294 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
271 | echo "Error: NFS mount point $HDIMAGE doesn't exist" | 295 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
272 | release_lock | 296 | release_lock |
273 | return | 297 | return |
274 | fi | 298 | fi |
@@ -279,56 +303,13 @@ fi | |||
279 | 303 | ||
280 | if [ "$MACHINE" = "akita" ]; then | 304 | if [ "$MACHINE" = "akita" ]; then |
281 | QEMU=qemu-system-arm | 305 | QEMU=qemu-system-arm |
282 | if [ "$TYPE" = "jffs2" ]; then | 306 | if [ "$FSTYPE" = "jffs2" ]; then |
283 | HDIMAGE=`readlink -f $HDIMAGE` | 307 | ROOTFS=`readlink -f $ROOTFS` |
284 | if [ ! -e "$HDIMAGE.qemuflash" ]; then | 308 | if [ ! -e "$ROOTFS.qemuflash" ]; then |
285 | echo "Converting raw image into flash image format for use by QEMU, please wait..." | 309 | echo "Converting raw image into flash image format for use by QEMU, please wait..." |
286 | raw2flash.akita < $HDIMAGE > $HDIMAGE.qemuflash | 310 | raw2flash.akita < $ROOTFS > $ROOTFS.qemuflash |
287 | fi | ||
288 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -mtdblock $HDIMAGE.qemuflash -portrait" | ||
289 | fi | ||
290 | fi | ||
291 | |||
292 | if [ "$MACHINE" = "nokia800" ]; then | ||
293 | QEMU=qemu-system-arm | ||
294 | if [ "$TYPE" = "jffs2" ]; then | ||
295 | HDIMAGE=`readlink -f $HDIMAGE` | ||
296 | if [ ! -e "$HDIMAGE.qemuflash" ]; then | ||
297 | echo "'Flashing' rootfs, please wait..." | ||
298 | poky-nokia800-flashutil $HDIMAGE $HDIMAGE.qemuflash | ||
299 | fi | ||
300 | KERNCMDLINE="root=/dev/mtdblock4 rootfstype=jffs2" | ||
301 | QEMU_NETWORK_CMD="-net nic,model=usb,vlan=0 $QEMU_TAP_CMD" | ||
302 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M n800 -mtdblock $HDIMAGE.qemuflash -serial vc -m 130 -serial vc -serial vc -serial vc -usb -usbdevice net:0" | ||
303 | fi | ||
304 | fi | ||
305 | |||
306 | if [ "$MACHINE" = "nokia800-maemo" ]; then | ||
307 | QEMU=qemu-system-arm | ||
308 | if [ "$TYPE" = "jffs2" ]; then | ||
309 | HDIMAGE=`readlink -f $HDIMAGE` | ||
310 | if [ ! -e "$HDIMAGE.qemuflash" ]; then | ||
311 | if [ ! -e "$HDIMAGE.initfs" ]; then | ||
312 | echo "Error, $HDIMAGE.initfs must exist!" | ||
313 | release_lock | ||
314 | return | ||
315 | fi | ||
316 | if [ ! -e "$HDIMAGE.config" ]; then | ||
317 | echo "Error, $HDIMAGE.config must exist!" | ||
318 | echo "To generate it, take an n800 and cat /dev/mtdblock1 > $HDIMAGE.config" | ||
319 | release_lock | ||
320 | return | ||
321 | fi | ||
322 | echo "'Flashing' config partition, please wait..." | ||
323 | poky-nokia800-flashutil $HDIMAGE.config $HDIMAGE.qemuflash config | ||
324 | echo "'Flashing' initfs, please wait..." | ||
325 | poky-nokia800-flashutil $HDIMAGE.initfs $HDIMAGE.qemuflash initfs | ||
326 | echo "'Flashing' rootfs, please wait..." | ||
327 | poky-nokia800-flashutil $HDIMAGE $HDIMAGE.qemuflash | ||
328 | fi | 311 | fi |
329 | KERNCMDLINE="" | 312 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -mtdblock $ROOTFS.qemuflash -portrait" |
330 | QEMU_NETWORK_CMD="-net nic,model=usb,vlan=0 $QEMU_TAP_CMD" | ||
331 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M n800 -mtdblock $HDIMAGE.qemuflash -serial vc -m 130 -serial vc -serial vc -serial vc -usb -usbdevice net:0 -show-cursor" | ||
332 | fi | 313 | fi |
333 | fi | 314 | fi |
334 | 315 | ||
@@ -384,8 +365,8 @@ else | |||
384 | fi | 365 | fi |
385 | 366 | ||
386 | echo "Running $QEMU..." | 367 | echo "Running $QEMU..." |
387 | echo $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append '"'$KERNCMDLINE'"' | 368 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS $* --append '"'$KERNCMDLINE'"' |
388 | $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" || /bin/true | 369 | $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" || /bin/true |
389 | 370 | ||
390 | release_lock | 371 | release_lock |
391 | 372 | ||
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 | ||