summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu575
1 files changed, 0 insertions, 575 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
deleted file mode 100755
index b6c9b54..0000000
--- a/scripts/runqemu
+++ /dev/null
@@ -1,575 +0,0 @@
1#!/bin/bash
2#
3# Handle running OE images standalone with QEMU
4#
5# Copyright (C) 2006-2011 Linux Foundation
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20usage() {
21 MYNAME=`basename $0`
22cat <<_EOF
23
24Usage: you can run this script with any valid combination
25of the following environment variables (in any order):
26 KERNEL - the kernel image file to use
27 ROOTFS - the rootfs image file or nfsroot directory to use
28 MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
29 Simplified QEMU command-line options can be passed with:
30 nographic - disables video console
31 serial - enables a serial console on /dev/ttyS0
32 kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)
33 kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required)
34 publicvnc - enable a VNC server open to all hosts
35 qemuparams="xyz" - specify custom parameters to QEMU
36 bootparams="xyz" - specify custom kernel parameters during boot
37
38Examples:
39 $MYNAME qemuarm
40 $MYNAME qemux86-64 core-image-sato ext4
41 $MYNAME qemux86-64 wic-image-minimal wic
42 $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial
43 $MYNAME qemux86 iso/hddimg/vmdk/qcow2/vdi/ramfs/cpio.gz...
44 $MYNAME qemux86 qemuparams="-m 256"
45 $MYNAME qemux86 bootparams="psplash=false"
46 $MYNAME path/to/<image>-<machine>.vmdk
47 $MYNAME path/to/<image>-<machine>.wic
48_EOF
49 exit 1
50}
51
52if [ "x$1" = "x" ]; then
53 usage
54fi
55
56error() {
57 echo "Error: "$*
58 usage
59}
60
61MACHINE=${MACHINE:=""}
62KERNEL=${KERNEL:=""}
63ROOTFS=${ROOTFS:=""}
64FSTYPE=${FSTYPE:=""}
65LAZY_ROOTFS=""
66SCRIPT_QEMU_OPT=""
67SCRIPT_QEMU_EXTRA_OPT=""
68SCRIPT_KERNEL_OPT=""
69SERIALSTDIO=""
70TCPSERIAL_PORTNUM=""
71KVM_ENABLED="no"
72KVM_ACTIVE="no"
73VHOST_ENABLED="no"
74VHOST_ACTIVE="no"
75IS_VM="false"
76
77# Determine whether the file is a kernel or QEMU image, and set the
78# appropriate variables
79process_filename() {
80 filename=$1
81
82 # Extract the filename extension
83 EXT=`echo $filename | awk -F . '{ print \$NF }'`
84 case /$EXT/ in
85 /bin/)
86 # A file ending in .bin is a kernel
87 [ -z "$KERNEL" ] && KERNEL=$filename || \
88 error "conflicting KERNEL args [$KERNEL] and [$filename]"
89 ;;
90 /ext[234]/|/jffs2/|/btrfs/)
91 # A file ending in a supportted fs type is a rootfs image
92 if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
93 FSTYPE=$EXT
94 ROOTFS=$filename
95 else
96 error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
97 fi
98 ;;
99 /hddimg/|/hdddirect/|/vmdk/|/wic/|/qcow2/|/vdi/|/otaimg/)
100 FSTYPE=$EXT
101 VM=$filename
102 ROOTFS=$filename
103 IS_VM="true"
104 ;;
105 *)
106 error "unknown file arg [$filename]"
107 ;;
108 esac
109}
110
111check_fstype_conflicts() {
112 if [ -z "$FSTYPE" -o "$FSTYPE" = "$1" ]; then
113 FSTYPE=$1
114 else
115 error "conflicting FSTYPE types [$FSTYPE] and [$1]"
116 fi
117}
118# Parse command line args without requiring specific ordering. It's a
119# bit more complex, but offers a great user experience.
120while true; do
121 arg=${1}
122 case "$arg" in
123 "qemux86" | "qemux86-64" | "qemuarm" | "qemuarm64" | "qemumips" | "qemumipsel" | \
124 "qemumips64" | "qemush4" | "qemuppc" | "qemumicroblaze" | "qemuzynq" | "qemuzynqmp")
125 [ -z "$MACHINE" -o "$MACHINE" = "$arg" ] && MACHINE=$arg || \
126 error "conflicting MACHINE types [$MACHINE] and [$arg]"
127 ;;
128 "ext"[234] | "jffs2" | "nfs" | "btrfs")
129 check_fstype_conflicts $arg
130 ;;
131 "hddimg" | "hdddirect" | "wic" | "vmdk" | "qcow2" | "vdi" | "iso" | "otaimg")
132 check_fstype_conflicts $arg
133 IS_VM="true"
134 ;;
135 "ramfs" | "cpio.gz")
136 FSTYPE=cpio.gz
137 ;;
138 "nographic")
139 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
140 SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
141 ;;
142 "serial")
143 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
144 SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
145 SERIALSTDIO="1"
146 ;;
147 "tcpserial="*)
148 TCPSERIAL_PORTNUM=${arg##tcpserial=}
149 ;;
150 "biosdir="*)
151 CUSTOMBIOSDIR="${arg##biosdir=}"
152 ;;
153 "biosfilename="*)
154 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${arg##biosfilename=}"
155 ;;
156 "qemuparams="*)
157 SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
158
159 # Warn user if they try to specify serial or kvm options
160 # to use simplified options instead
161 serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
162 kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
163 vga_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-vga\)'`
164 [ ! -z "$serial_option" -o ! -z "$kvm_option" ] && \
165 echo "Please use simplified serial or kvm options instead"
166 ;;
167 "bootparams="*)
168 SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
169 ;;
170 "audio")
171 if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then
172 echo "Enabling audio in qemu."
173 echo "Please install snd_intel8x0 or snd_ens1370 driver in linux guest."
174 QEMU_AUDIO_DRV="alsa"
175 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
176 fi
177 ;;
178 "kvm")
179 KVM_ENABLED="yes"
180 KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
181 ;;
182 "kvm-vhost")
183 KVM_ENABLED="yes"
184 KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
185 VHOST_ENABLED="yes"
186 ;;
187 "slirp")
188 SLIRP_ENABLED="yes"
189 ;;
190 "publicvnc")
191 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -vnc :0"
192 ;;
193 *-image*)
194 [ -z "$ROOTFS" ] || \
195 error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
196 if [ -f "$arg" ]; then
197 process_filename $arg
198 elif [ -d "$arg" ]; then
199 # Handle the case where the nfsroot dir has -image-
200 # in the pathname
201 echo "Assuming $arg is an nfs rootfs"
202 FSTYPE=nfs
203 ROOTFS=$arg
204 else
205 ROOTFS=$arg
206 LAZY_ROOTFS="true"
207 fi
208 ;;
209 "") break ;;
210 *)
211 # A directory name is an nfs rootfs
212 if [ -d "$arg" ]; then
213 echo "Assuming $arg is an nfs rootfs"
214 if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then
215 FSTYPE=nfs
216 else
217 error "conflicting FSTYPE types [$arg] and nfs"
218 fi
219
220 if [ -z "$ROOTFS" ]; then
221 ROOTFS=$arg
222 else
223 error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
224 fi
225 elif [ -f "$arg" ]; then
226 process_filename $arg
227 else
228 error "unable to classify arg [$arg]"
229 fi
230 ;;
231 esac
232 shift
233done
234
235if [ ! -c /dev/net/tun ] ; then
236 echo "TUN control device /dev/net/tun is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)"
237 exit 1
238elif [ ! -w /dev/net/tun ] ; then
239 echo "TUN control device /dev/net/tun is not writable, please fix (e.g. sudo chmod 666 /dev/net/tun)"
240 exit 1
241fi
242
243# Report errors for missing combinations of options
244if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" -a "$FSTYPE" != "wic" ]; then
245 error "you must specify at least a MACHINE or KERNEL argument"
246fi
247if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
248 error "NFS booting without an explicit ROOTFS path is not yet supported"
249fi
250
251if [ -z "$MACHINE" ]; then
252 if [ "$IS_VM" = "true" ]; then
253 [ "x$FSTYPE" = "xwic" ] && filename=$ROOTFS || filename=$VM
254 MACHINE=`basename $filename | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
255 if [ -z "$MACHINE" ]; then
256 error "Unable to set MACHINE from image filename [$VM]"
257 fi
258 echo "Set MACHINE to [$MACHINE] based on image [$VM]"
259 else
260 MACHINE=`basename $KERNEL | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
261 if [ -z "$MACHINE" ]; then
262 error "Unable to set MACHINE from kernel filename [$KERNEL]"
263 fi
264 echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
265 fi
266fi
267
268YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
269YOCTO_PARAVIRT_KVM_WIKI="https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM"
270# Detect KVM configuration
271if [ "x$KVM_ENABLED" = "xyes" ]; then
272 if [ -z "$KVM_CAPABLE" ]; then
273 echo "You are trying to enable KVM on a cpu without VT support."
274 echo "Remove kvm from the command-line, or refer"
275 echo "$YOCTO_KVM_WIKI";
276 exit 1;
277 fi
278 if [ "x$MACHINE" != "xqemux86" -a "x$MACHINE" != "xqemux86-64" ]; then
279 echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
280 exit 1;
281 fi
282 if [ ! -e /dev/kvm ]; then
283 echo "Missing KVM device. Have you inserted kvm modules?"
284 echo "For further help see:"
285 echo "$YOCTO_KVM_WIKI";
286 exit 1;
287 fi
288 if [ -w /dev/kvm -a -r /dev/kvm ]; then
289 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
290 KVM_ACTIVE="yes"
291 else
292 echo "You have no rights on /dev/kvm."
293 echo "Please change the ownership of this file as described at:"
294 echo "$YOCTO_KVM_WIKI";
295 exit 1;
296 fi
297 if [ "x$VHOST_ENABLED" = "xyes" ]; then
298 if [ ! -e /dev/vhost-net ]; then
299 echo "Missing virtio net device. Have you inserted vhost-net module?"
300 echo "For further help see:"
301 echo "$YOCTO_PARAVIRT_KVM_WIKI";
302 exit 1;
303 fi
304
305 if [ -w /dev/vhost-net -a -r /dev/vhost-net ]; then
306 VHOST_ACTIVE="yes"
307 else
308 echo "You have no rights on /dev/vhost-net."
309 echo "Please change the ownership of this file as described at:"
310 echo "$YOCTO_KVM_WIKI";
311 exit 1;
312 fi
313 fi
314fi
315
316machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'`
317# MACHINE is now set for all cases
318
319# Defaults used when these vars need to be inferred
320QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin
321QEMUX86_DEFAULT_FSTYPE=ext4
322
323QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
324QEMUX86_64_DEFAULT_FSTYPE=ext4
325
326QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
327QEMUARM_DEFAULT_FSTYPE=ext4
328
329QEMUARM64_DEFAULT_KERNEL=Image-qemuarm64.bin
330QEMUARM64_DEFAULT_FSTYPE=ext4
331
332QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
333QEMUMIPS_DEFAULT_FSTYPE=ext4
334
335QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin
336QEMUMIPSEL_DEFAULT_FSTYPE=ext4
337
338QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin
339QEMUMIPS64_DEFAULT_FSTYPE=ext4
340
341QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin
342QEMUSH4_DEFAULT_FSTYPE=ext4
343
344QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin
345QEMUPPC_DEFAULT_FSTYPE=ext4
346
347QEMUMICROBLAZE_DEFAULT_KERNEL=linux.bin.ub
348QEMUMICROBLAZE_DEFAULT_FSTYPE=cpio
349
350QEMUZYNQ_DEFAULT_KERNEL=uImage
351QEMUZYNQ_DEFAULT_FSTYPE=cpio
352
353QEMUZYNQMP_DEFAULT_KERNEL=Image
354QEMUZYNQMP_DEFAULT_FSTYPE=cpio
355
356setup_path_vars() {
357 if [ -z "$OE_TMPDIR" ] ; then
358 PATHS_REQUIRED=true
359 elif [ "$1" = "1" -a -z "$DEPLOY_DIR_IMAGE" ] ; then
360 PATHS_REQUIRED=true
361 else
362 PATHS_REQUIRED=false
363 fi
364
365 if [ "$PATHS_REQUIRED" = "true" ]; then
366 # Try to get the variable values from bitbake
367 type -P bitbake &>/dev/null || {
368 echo "In order for this script to dynamically infer paths";
369 echo "to kernels or filesystem images, you either need";
370 echo "bitbake in your PATH or to source oe-init-build-env";
371 echo "before running this script" >&2;
372 exit 1; }
373
374 # We have bitbake in PATH, get the variable values from bitbake
375 BITBAKE_ENV_TMPFILE=`mktemp --tmpdir runqemu.XXXXXXXXXX`
376 if [ "$?" != "0" ] ; then
377 echo "Error: mktemp failed for bitbake environment output"
378 exit 1
379 fi
380
381 MACHINE=$MACHINE bitbake -e > $BITBAKE_ENV_TMPFILE
382 if [ -z "$OE_TMPDIR" ] ; then
383 OE_TMPDIR=`sed -n 's/^TMPDIR=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
384 fi
385 if [ -z "$DEPLOY_DIR_IMAGE" ] ; then
386 DEPLOY_DIR_IMAGE=`sed -n 's/^DEPLOY_DIR_IMAGE=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
387 fi
388 if [ -z "$QEMU_DTB" ] ; then
389 QEMU_DTB=`sed -n 's/^QEMU_DTB=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
390 fi
391 if [ -z "$OE_TMPDIR" ]; then
392 # Check for errors from bitbake that the user needs to know about
393 BITBAKE_OUTPUT=`cat $BITBAKE_ENV_TMPFILE | wc -l`
394 if [ "$BITBAKE_OUTPUT" -eq "0" ]; then
395 echo "Error: this script needs to be run from your build directory, or you need"
396 echo "to explicitly set OE_TMPDIR and DEPLOY_DIR_IMAGE in your environment"
397 else
398 echo "There was an error running bitbake to determine TMPDIR"
399 echo "Here is the output from 'bitbake -e':"
400 cat $BITBAKE_ENV_TMPFILE
401 fi
402 rm $BITBAKE_ENV_TMPFILE
403 exit 1
404 fi
405 rm $BITBAKE_ENV_TMPFILE
406 fi
407}
408
409setup_sysroot() {
410 # Toolchain installs set up $OECORE_NATIVE_SYSROOT in their
411 # environment script. If that variable isn't set, we're
412 # either in an in-tree build scenario or the environment
413 # script wasn't source'd.
414 if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
415 setup_path_vars
416 BUILD_ARCH=`uname -m`
417 BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
418 BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
419
420 OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
421 fi
422
423 # Some recipes store the BIOS under $OE_TMPDIR/sysroots/$MACHINE,
424 # now defined as OECORE_MACHINE_SYSROOT. The latter is used when searching
425 # BIOS, VGA BIOS and keymaps.
426 if [ -z "$OECORE_MACHINE_SYSROOT" ]; then
427 OECORE_MACHINE_SYSROOT=$OE_TMPDIR/sysroots/$MACHINE
428 fi
429}
430
431# Locate a rootfs image to boot which matches our expected
432# machine and fstype.
433findimage() {
434 where=$1
435 machine=$2
436 extension=$3
437
438 # Sort rootfs candidates by modification time - the most
439 # recently created one is the one we most likely want to boot.
440 filename=`ls -t1 $where/*-image*$machine.$extension 2>/dev/null | head -n1`
441 if [ "x$filename" != "x" ]; then
442 ROOTFS=$filename
443 return
444 fi
445
446 echo "Couldn't find a $machine rootfs image in $where."
447 exit 1
448}
449
450# Bios is necessary when using otaimg, look for it
451if [ "$FSTYPE" = "otaimg" ]; then
452 setup_path_vars 1
453 bios_option=`expr "$SCRIPT_QEMU_OPT" : '.*\(-bios\)'`
454 echo "bios_option: $bios_option"
455 if [ -z $bios_option ]; then
456 echo "LOOK FOR BIOS at ${DEPLOY_DIR_IMAGE}"
457 # if -bios wasn't specified explicitly, try to look at the default location
458 if [ -e "${DEPLOY_DIR_IMAGE}/u-boot.rom" ]; then
459 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${DEPLOY_DIR_IMAGE}/u-boot.rom"
460 else
461 error "OTA image requires specifying u-boot as BIOS"
462 fi
463 fi
464fi
465
466
467# Kernel command line is stored in compressed format as u-boot environment
468# which breaks determining drive interface with grep in runqemu-internal
469if [ "$FSTYPE" = "otaimg" ]; then
470 FORCE_DRIVE_IF="ide"
471fi
472
473if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
474 # Extract the filename extension
475 EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
476 if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
477 "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" -o \
478 "x$EXT" = "xext4" ]; then
479 FSTYPE=$EXT
480 else
481 echo "Note: Unable to determine filesystem extension for $ROOTFS"
482 echo "We will use the default FSTYPE for $MACHINE"
483 # ...which is done further below...
484 fi
485fi
486
487if [ -z "$KERNEL" -a "$IS_VM" = "false" ]; then \
488 setup_path_vars 1
489 eval kernel_file=\$${machine2}_DEFAULT_KERNEL
490 KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file
491
492 if [ -z "$KERNEL" ]; then
493 error "Unable to determine default kernel for MACHINE [$MACHINE]"
494 fi
495fi
496# KERNEL is now set for all cases
497
498if [ -z "$FSTYPE" ]; then
499 eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
500
501 if [ -z "$FSTYPE" ]; then
502 error "Unable to determine default fstype for MACHINE [$MACHINE]"
503 fi
504fi
505
506# FSTYPE is now set for all cases
507
508# Handle cases where a ROOTFS type is given instead of a filename, e.g.
509# core-image-sato
510if [ "$LAZY_ROOTFS" = "true" ]; then
511 setup_path_vars 1
512 echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE"
513 if [ "$IS_VM" = "true" ]; then
514 VM=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
515 else
516 ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
517 fi
518fi
519
520if [ -z "$ROOTFS" ]; then
521 setup_path_vars 1
522 T=$DEPLOY_DIR_IMAGE
523 eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
524 findimage $T $MACHINE $FSTYPE
525
526 if [ -z "$ROOTFS" ]; then
527 error "Unable to determine default rootfs for MACHINE [$MACHINE]"
528 elif [ "$IS_VM" = "true" ]; then
529 VM=$ROOTFS
530 fi
531fi
532# ROOTFS is now set for all cases, now expand it to be an absolute path, it should exist at this point
533
534ROOTFS=`readlink -f $ROOTFS`
535
536echo ""
537echo "Continuing with the following parameters:"
538if [ "$IS_VM" = "false" ]; then
539 echo "KERNEL: [$KERNEL]"
540 echo "ROOTFS: [$ROOTFS]"
541else
542 echo "VM: [$VM]"
543fi
544echo "FSTYPE: [$FSTYPE]"
545
546setup_sysroot
547# OECORE_NATIVE_SYSROOT and OECORE_MACHINE_SYSROOT are now set for all cases
548
549INTERNAL_SCRIPT="$0-internal"
550if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
551INTERNAL_SCRIPT=`which runqemu-internal`
552fi
553
554# Specify directory for BIOS, VGA BIOS and keymaps
555if [ ! -z "$CUSTOMBIOSDIR" ]; then
556 if [ -d "$OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" ]; then
557 echo "Assuming biosdir is $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
558 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
559 elif [ -d "$OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR" ]; then
560 echo "Assuming biosdir is $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
561 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
562 else
563 if [ ! -d "$CUSTOMBIOSDIR" ]; then
564 echo "Custom BIOS directory not found. Tried: $CUSTOMBIOSDIR"
565 echo "and $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
566 echo "and $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
567 exit 1;
568 fi
569 echo "Assuming biosdir is $CUSTOMBIOSDIR"
570 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $CUSTOMBIOSDIR"
571 fi
572fi
573
574. $INTERNAL_SCRIPT
575exit $?