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/poky-qemu-internal | |
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/poky-qemu-internal')
-rwxr-xr-x | scripts/poky-qemu-internal | 253 |
1 files changed, 117 insertions, 136 deletions
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 | ||