runqemu 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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. usage() {
  20. MYNAME=`basename $0`
  21. echo ""
  22. echo "Usage: you can run this script with any valid combination"
  23. echo "of the following environment variables (in any order):"
  24. echo " QEMUARCH - the qemu machine architecture to use"
  25. echo " KERNEL - the kernel image file to use"
  26. echo " ROOTFS - the rootfs image file or nfsroot directory to use"
  27. echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)"
  28. echo " RAMFS - boot a ramfs-based image"
  29. echo " ISO - boot an ISO image"
  30. echo " VM - boot a vmdk image"
  31. echo " Simplified QEMU command-line options can be passed with:"
  32. echo " nographic - disables video console"
  33. echo " serial - enables a serial console on /dev/ttyS0"
  34. echo " kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)"
  35. echo " publicvnc - enable a VNC server open to all hosts"
  36. echo " qemuparams=\"xyz\" - specify custom parameters to QEMU"
  37. echo " bootparams=\"xyz\" - specify custom kernel parameters during boot"
  38. echo ""
  39. echo "Examples:"
  40. echo " $MYNAME qemuarm"
  41. echo " $MYNAME qemux86-64 core-image-sato ext4"
  42. echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
  43. echo " $MYNAME qemux86 ramfs"
  44. echo " $MYNAME qemux86 iso"
  45. echo " $MYNAME qemux86 qemuparams=\"-m 256\""
  46. echo " $MYNAME qemux86 bootparams=\"psplash=false\""
  47. echo " $MYNAME path/to/<image>-<machine>.vmdk"
  48. exit 1
  49. }
  50. if [ "x$1" = "x" ]; then
  51. usage
  52. fi
  53. error() {
  54. echo "Error: "$*
  55. usage
  56. }
  57. MACHINE=${MACHINE:=""}
  58. KERNEL=${KERNEL:=""}
  59. ROOTFS=${ROOTFS:=""}
  60. VM=${VM:=""}
  61. FSTYPE=${FSTYPE:=""}
  62. LAZY_ROOTFS=""
  63. SCRIPT_QEMU_OPT=""
  64. SCRIPT_QEMU_EXTRA_OPT=""
  65. SCRIPT_KERNEL_OPT=""
  66. SERIALSTDIO=""
  67. KVM_ENABLED="no"
  68. KVM_ACTIVE="no"
  69. # Determine whether the file is a kernel or QEMU image, and set the
  70. # appropriate variables
  71. process_filename() {
  72. filename=$1
  73. # Extract the filename extension
  74. EXT=`echo $filename | awk -F . '{ print \$NF }'`
  75. case /$EXT/ in
  76. /bin/)
  77. # A file ending in .bin is a kernel
  78. [ -z "$KERNEL" ] && KERNEL=$filename || \
  79. error "conflicting KERNEL args [$KERNEL] and [$filename]"
  80. ;;
  81. /ext[234]/|/jffs2/|/btrfs/)
  82. # A file ending in a supportted fs type is a rootfs image
  83. if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
  84. FSTYPE=$EXT
  85. ROOTFS=$filename
  86. else
  87. error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
  88. fi
  89. ;;
  90. /vmdk/)
  91. FSTYPE=$EXT
  92. VM=$filename
  93. ;;
  94. *)
  95. error "unknown file arg [$filename]"
  96. ;;
  97. esac
  98. }
  99. # Parse command line args without requiring specific ordering. It's a
  100. # bit more complex, but offers a great user experience.
  101. while true; do
  102. arg=${1}
  103. case "$arg" in
  104. "qemux86" | "qemux86-64" | "qemuarm" | "qemuarm64" | "qemumips" | "qemumipsel" | \
  105. "qemumips64" | "qemush4" | "qemuppc" | "qemumicroblaze" | "qemuzynq")
  106. [ -z "$MACHINE" ] && MACHINE=$arg || \
  107. error "conflicting MACHINE types [$MACHINE] and [$arg]"
  108. ;;
  109. "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs")
  110. [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \
  111. error "conflicting FSTYPE types [$FSTYPE] and [$arg]"
  112. ;;
  113. *-image*)
  114. [ -z "$ROOTFS" ] || \
  115. error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
  116. if [ -f "$arg" ]; then
  117. process_filename $arg
  118. elif [ -d "$arg" ]; then
  119. # Handle the case where the nfsroot dir has -image-
  120. # in the pathname
  121. echo "Assuming $arg is an nfs rootfs"
  122. FSTYPE=nfs
  123. ROOTFS=$arg
  124. else
  125. ROOTFS=$arg
  126. LAZY_ROOTFS="true"
  127. fi
  128. ;;
  129. "ramfs")
  130. FSTYPE=cpio.gz
  131. RAMFS=true
  132. ;;
  133. "iso")
  134. FSTYPE=iso
  135. ISOFS=true
  136. ;;
  137. "nographic")
  138. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
  139. SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
  140. ;;
  141. "serial")
  142. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
  143. SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
  144. SERIALSTDIO="1"
  145. ;;
  146. "biosdir="*)
  147. CUSTOMBIOSDIR="${arg##biosdir=}"
  148. ;;
  149. "biosfilename="*)
  150. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${arg##biosfilename=}"
  151. ;;
  152. "qemuparams="*)
  153. SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
  154. # Warn user if they try to specify serial or kvm options
  155. # to use simplified options instead
  156. serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
  157. kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
  158. vga_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-vga\)'`
  159. [ ! -z "$serial_option" -o ! -z "$kvm_option" ] && \
  160. echo "Please use simplified serial or kvm options instead"
  161. ;;
  162. "bootparams="*)
  163. SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
  164. ;;
  165. "audio")
  166. if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then
  167. echo "Enabling audio in qemu."
  168. echo "Please install snd_intel8x0 or snd_ens1370 driver in linux guest."
  169. QEMU_AUDIO_DRV="alsa"
  170. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
  171. fi
  172. ;;
  173. "kvm")
  174. KVM_ENABLED="yes"
  175. KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
  176. ;;
  177. "slirp")
  178. SLIRP_ENABLED="yes"
  179. ;;
  180. "publicvnc")
  181. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -vnc 0.0.0.0:0"
  182. ;;
  183. "") break ;;
  184. *)
  185. # A directory name is an nfs rootfs
  186. if [ -d "$arg" ]; then
  187. echo "Assuming $arg is an nfs rootfs"
  188. if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then
  189. FSTYPE=nfs
  190. else
  191. error "conflicting FSTYPE types [$arg] and nfs"
  192. fi
  193. if [ -z "$ROOTFS" ]; then
  194. ROOTFS=$arg
  195. else
  196. error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
  197. fi
  198. elif [ -f "$arg" ]; then
  199. process_filename $arg
  200. else
  201. error "unable to classify arg [$arg]"
  202. fi
  203. ;;
  204. esac
  205. shift
  206. done
  207. if [ ! -c /dev/net/tun ] ; then
  208. echo "TUN control device /dev/net/tun is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)"
  209. exit 1
  210. elif [ ! -w /dev/net/tun ] ; then
  211. echo "TUN control device /dev/net/tun is not writable, please fix (e.g. sudo chmod 666 /dev/net/tun)"
  212. exit 1
  213. fi
  214. # Report errors for missing combinations of options
  215. if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" ]; then
  216. error "you must specify at least a MACHINE, VM, or KERNEL argument"
  217. fi
  218. if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
  219. error "NFS booting without an explicit ROOTFS path is not yet supported"
  220. fi
  221. if [ -z "$MACHINE" ]; then
  222. if [ "x$FSTYPE" = "xvmdk" ]; then
  223. MACHINE=`basename $VM | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
  224. if [ -z "$MACHINE" ]; then
  225. error "Unable to set MACHINE from vmdk filename [$VM]"
  226. fi
  227. echo "Set MACHINE to [$MACHINE] based on vmdk [$VM]"
  228. else
  229. MACHINE=`basename $KERNEL | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
  230. if [ -z "$MACHINE" ]; then
  231. error "Unable to set MACHINE from kernel filename [$KERNEL]"
  232. fi
  233. echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
  234. fi
  235. fi
  236. YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
  237. YOCTO_PARAVIRT_KVM_WIKI="https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM"
  238. # Detect KVM configuration
  239. if [ "x$KVM_ENABLED" = "xyes" ]; then
  240. if [ -z "$KVM_CAPABLE" ]; then
  241. echo "You are trying to enable KVM on a cpu without VT support."
  242. echo "Remove kvm from the command-line, or refer"
  243. echo "$YOCTO_KVM_WIKI";
  244. exit 1;
  245. fi
  246. if [ "x$MACHINE" != "xqemux86" -a "x$MACHINE" != "xqemux86-64" ]; then
  247. echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
  248. exit 1;
  249. fi
  250. if [ ! -e /dev/kvm ]; then
  251. echo "Missing KVM device. Have you inserted kvm modules?"
  252. echo "For further help see:"
  253. echo "$YOCTO_KVM_WIKI";
  254. exit 1;
  255. fi
  256. if [ ! -e /dev/vhost-net ]; then
  257. echo "Missing virtio net device. Have you inserted vhost-net module?"
  258. echo "For further help see:"
  259. echo "$YOCTO_PARAVIRT_KVM_WIKI";
  260. exit 1;
  261. fi
  262. if [ -w /dev/kvm -a -r /dev/kvm ]; then
  263. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
  264. KVM_ACTIVE="yes"
  265. else
  266. echo "You have no rights on /dev/kvm."
  267. echo "Please change the ownership of this file as described at:"
  268. echo "$YOCTO_KVM_WIKI";
  269. exit 1;
  270. fi
  271. if [ ! -w /dev/vhost-net -o ! -r /dev/vhost-net ]; then
  272. if [ "$SLIRP_ENABLED" != "yes" ] ; then
  273. echo "You have no rights on /dev/vhost-net."
  274. echo "Please change the ownership of this file as described at:"
  275. echo "$YOCTO_PARAVIRT_KVM_WIKI";
  276. exit 1;
  277. fi
  278. fi
  279. fi
  280. machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'`
  281. # MACHINE is now set for all cases
  282. # Defaults used when these vars need to be inferred
  283. QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin
  284. QEMUX86_DEFAULT_FSTYPE=ext4
  285. QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
  286. QEMUX86_64_DEFAULT_FSTYPE=ext4
  287. QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
  288. QEMUARM_DEFAULT_FSTYPE=ext4
  289. QEMUARM64_DEFAULT_KERNEL=Image-qemuarm64.bin
  290. QEMUARM64_DEFAULT_FSTYPE=ext4
  291. QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
  292. QEMUMIPS_DEFAULT_FSTYPE=ext4
  293. QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin
  294. QEMUMIPSEL_DEFAULT_FSTYPE=ext4
  295. QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin
  296. QEMUMIPS64_DEFAULT_FSTYPE=ext4
  297. QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin
  298. QEMUSH4_DEFAULT_FSTYPE=ext4
  299. QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin
  300. QEMUPPC_DEFAULT_FSTYPE=ext4
  301. QEMUMICROBLAZE_DEFAULT_KERNEL=linux.bin.ub
  302. QEMUMICROBLAZE_DEFAULT_FSTYPE=cpio
  303. QEMUZYNQ_DEFAULT_KERNEL=uImage
  304. QEMUZYNQ_DEFAULT_FSTYPE=cpio
  305. AKITA_DEFAULT_KERNEL=zImage-akita.bin
  306. AKITA_DEFAULT_FSTYPE=jffs2
  307. SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
  308. SPITZ_DEFAULT_FSTYPE=ext3
  309. setup_path_vars() {
  310. if [ -z "$OE_TMPDIR" ] ; then
  311. PATHS_REQUIRED=true
  312. elif [ "$1" = "1" -a -z "$DEPLOY_DIR_IMAGE" ] ; then
  313. PATHS_REQUIRED=true
  314. else
  315. PATHS_REQUIRED=false
  316. fi
  317. if [ "$PATHS_REQUIRED" = "true" ]; then
  318. # Try to get the variable values from bitbake
  319. type -P bitbake &>/dev/null || {
  320. echo "In order for this script to dynamically infer paths";
  321. echo "to kernels or filesystem images, you either need";
  322. echo "bitbake in your PATH or to source oe-init-build-env";
  323. echo "before running this script" >&2;
  324. exit 1; }
  325. # We have bitbake in PATH, get the variable values from bitbake
  326. BITBAKE_ENV_TMPFILE=`mktemp --tmpdir runqemu.XXXXXXXXXX`
  327. if [ "$?" != "0" ] ; then
  328. echo "Error: mktemp failed for bitbake environment output"
  329. exit 1
  330. fi
  331. MACHINE=$MACHINE bitbake -e > $BITBAKE_ENV_TMPFILE
  332. if [ -z "$OE_TMPDIR" ] ; then
  333. OE_TMPDIR=`sed -n 's/^TMPDIR=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
  334. fi
  335. if [ -z "$DEPLOY_DIR_IMAGE" ] ; then
  336. DEPLOY_DIR_IMAGE=`sed -n 's/^DEPLOY_DIR_IMAGE=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
  337. fi
  338. if [ -z "$OE_TMPDIR" ]; then
  339. # Check for errors from bitbake that the user needs to know about
  340. BITBAKE_OUTPUT=`cat $BITBAKE_ENV_TMPFILE | wc -l`
  341. if [ "$BITBAKE_OUTPUT" -eq "0" ]; then
  342. echo "Error: this script needs to be run from your build directory, or you need"
  343. echo "to explicitly set OE_TMPDIR and DEPLOY_DIR_IMAGE in your environment"
  344. else
  345. echo "There was an error running bitbake to determine TMPDIR"
  346. echo "Here is the output from 'bitbake -e':"
  347. cat $BITBAKE_ENV_TMPFILE
  348. fi
  349. rm $BITBAKE_ENV_TMPFILE
  350. exit 1
  351. fi
  352. rm $BITBAKE_ENV_TMPFILE
  353. fi
  354. }
  355. setup_sysroot() {
  356. # Toolchain installs set up $OECORE_NATIVE_SYSROOT in their
  357. # environment script. If that variable isn't set, we're
  358. # either in an in-tree build scenario or the environment
  359. # script wasn't source'd.
  360. if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
  361. setup_path_vars
  362. BUILD_ARCH=`uname -m`
  363. BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
  364. BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
  365. OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
  366. fi
  367. }
  368. # Locate a rootfs image to boot which matches our expected
  369. # machine and fstype.
  370. findimage() {
  371. where=$1
  372. machine=$2
  373. extension=$3
  374. # Sort rootfs candidates by modification time - the most
  375. # recently created one is the one we most likely want to boot.
  376. filename=`ls -t1 $where/*-image*$machine.$extension 2>/dev/null | head -n1`
  377. if [ "x$filename" != "x" ]; then
  378. ROOTFS=$filename
  379. return
  380. fi
  381. echo "Couldn't find a $machine rootfs image in $where."
  382. exit 1
  383. }
  384. if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
  385. # Extract the filename extension
  386. EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
  387. if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
  388. "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" -o \
  389. "x$EXT" = "xext4" ]; then
  390. FSTYPE=$EXT
  391. else
  392. echo "Note: Unable to determine filesystem extension for $ROOTFS"
  393. echo "We will use the default FSTYPE for $MACHINE"
  394. # ...which is done further below...
  395. fi
  396. fi
  397. if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then
  398. setup_path_vars 1
  399. eval kernel_file=\$${machine2}_DEFAULT_KERNEL
  400. KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file
  401. if [ -z "$KERNEL" ]; then
  402. error "Unable to determine default kernel for MACHINE [$MACHINE]"
  403. fi
  404. fi
  405. # KERNEL is now set for all cases
  406. if [ -z "$FSTYPE" ]; then
  407. eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
  408. if [ -z "$FSTYPE" ]; then
  409. error "Unable to determine default fstype for MACHINE [$MACHINE]"
  410. fi
  411. fi
  412. # FSTYPE is now set for all cases
  413. # Handle cases where a ROOTFS type is given instead of a filename, e.g.
  414. # core-image-sato
  415. if [ "$LAZY_ROOTFS" = "true" ]; then
  416. setup_path_vars 1
  417. echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE"
  418. ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
  419. fi
  420. if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then
  421. setup_path_vars 1
  422. T=$DEPLOY_DIR_IMAGE
  423. eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
  424. findimage $T $MACHINE $FSTYPE
  425. if [ -z "$ROOTFS" ]; then
  426. error "Unable to determine default rootfs for MACHINE [$MACHINE]"
  427. fi
  428. fi
  429. # ROOTFS is now set for all cases, now expand it to be an absolute path, it should exist at this point
  430. ROOTFS=`readlink -f $ROOTFS`
  431. echo ""
  432. echo "Continuing with the following parameters:"
  433. if [ "x$FSTYPE" != "xvmdk" ]; then
  434. echo "KERNEL: [$KERNEL]"
  435. echo "ROOTFS: [$ROOTFS]"
  436. else
  437. echo "VMDK: [$VM]"
  438. fi
  439. echo "FSTYPE: [$FSTYPE]"
  440. setup_sysroot
  441. # OECORE_NATIVE_SYSROOT is now set for all cases
  442. INTERNAL_SCRIPT="$0-internal"
  443. if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
  444. INTERNAL_SCRIPT=`which runqemu-internal`
  445. fi
  446. # Specify directory for BIOS, VGA BIOS and keymaps
  447. if [ ! -z "$CUSTOMBIOSDIR" ]; then
  448. if [ -d "$OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" ]; then
  449. echo "Assuming biosdir is $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
  450. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
  451. else
  452. if [ ! -d "$CUSTOMBIOSDIR" ]; then
  453. echo "Custom BIOS directory not found. Tried: $CUSTOMBIOSDIR"
  454. echo "and $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
  455. exit 1;
  456. fi
  457. echo "Assuming biosdir is $CUSTOMBIOSDIR"
  458. SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $CUSTOMBIOSDIR"
  459. fi
  460. fi
  461. . $INTERNAL_SCRIPT
  462. exit $?