If the QEMU version is found to be >= 1.6, then automatically
enable flash (using the QEMU pflash command line parameter).

QEMU supports flash since 1.2, but only if KVM is disabled.
As of QEMU 1.6, flash support should also be enabled when
KVM is used. Therefore it is safest to only enable flash for
QEMU 1.6 and newer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
---
 OvmfPkg/build.sh |   25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
index 7758246..f3eb97c 100755
--- a/OvmfPkg/build.sh
+++ b/OvmfPkg/build.sh
@@ -179,16 +179,25 @@ if [ -z "$PLATFORMFILE" ]; then
   PLATFORMFILE=$WORKSPACE/OvmfPkg/OvmfPkg$Processor.dsc
 fi
 
-ADD_QEMU_HDA=yes
-for arg in "$@"
-do
-  case $arg in
-    -hd[a-d]|-fd[ab]|-cdrom)
-      ADD_QEMU_HDA=no
-      break
+if [[ "$RUN_QEMU" == "yes" ]]; then
+  qemu_version=$($QEMU_COMMAND -version 2>&1 | tail -1 | awk '{print $4}')
+  case $qemu_version in
+    1.[6-9].*|1.[1-9][0-9].*|2.*.*)
+      ENABLE_FLASH=yes
       ;;
   esac
-done
+
+  ADD_QEMU_HDA=yes
+  for arg in "$@"
+  do
+    case $arg in
+      -hd[a-d]|-fd[ab]|-cdrom)
+        ADD_QEMU_HDA=no
+        break
+        ;;
+    esac
+  done
+fi
 
 #
 # Uncomment this block for parameter parsing debug
-- 
1.7.10.4


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to