Skip to contentSkip to conversation

locate the qemu binary in the grub-shell test

PATCH In review Dustin Kirkland 3 participants 3 messages Feb 20, 2010 – Feb 25, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locate the qemu binary in the grub-shell test

The grub-shell test assumes that qemu-system-i386 will be the binary used, and that it's available on the system. Actually, on amd64/x86_64 systems, the appropriate binary is qemu-system-x86_64. Furthermore, an appropriate error should be thrown if neither executable is found.

2010-02-20 Dustin Kirkland <[email protected]>

* tests/util/grub-shell.in: locate the appropriate qemu system binary, and exit non-zero, with an error message, if none are found

tests/util/grub-shell.in +13 -2
diff -Nur -x '*.orig' -x '*~' lucid/tests/util/grub-shell.in lucid.new/tests/util/grub-shell.in
@@ -92,6 +92,18 @@
     esac
 done
 
+qemu=
+for i in qemu-system-i386 qemu-system-x86_64; do
+    if which ${i} >/dev/null; then
+	qemu=${i}
+	break
+    fi
+done
+if [ "x${qemu}" = x ]; then
+    echo "qemu is not installed" 1>&2
+    exit 1
+fi
+
 if [ "x${source}" = x ] ; then
     tmpfile=`mktemp`
     while read; do
@@ -135,8 +147,7 @@
 cp ${isofile} ${fdafile}
 
 outfile=`mktemp`
-qemu-system-i386 ${qemuopts} -nographic -serial stdio -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r" >${outfile}
-
+${qemu} ${qemuopts} -nographic -serial stdio -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r" >${outfile}
 cat $outfile
 
 rm -f ${tmpfile} ${outfile} ${cfgfile} ${isofile} ${hdafile} ${fdafile}
#1 lore raw
Quoted 3 lines · Dustin Kirkland

The grub-shell test assumes that qemu-system-i386 will be the binary used, and that it's available on the system. Actually, on amd64/x86_64 systems, the appropriate binary is qemu-system-x86_64.

Currently grub-shell supports only i386-pc target and the right qemu architecture to test it with is system-i386. qemu-system-x86_64 is appropriate only for amd64-specific tests (you can have a look at my bootchecks branch). Architecture of build has nothing to do with architecture of target: you can very well cross-compile for i386-pc from mips. It's not any different than cross-compiling to i386-pc from x86_64 (the only difference is that you use biarch compiler)

Quoted 50 lines

Furthermore, an
appropriate error should be thrown if neither executable is found.

2010-02-20 Dustin Kirkland <[email protected]>

* tests/util/grub-shell.in: locate the appropriate qemu system binary, and exit non-zero, with an error message, if none are found

diff -Nur -x '*.orig' -x '*~' lucid/tests/util/grub-shell.in lucid.new/tests/util/grub-shell.in

tests/util/grub-shell.in +13 -3
@@ -92,6 +92,18 @@
     esac
 done
 
+qemu=
+for i in qemu-system-i386 qemu-system-x86_64; do
+    if which ${i} >/dev/null; then
+	qemu=${i}
+	break
+    fi
+done
+if [ "x${qemu}" = x ]; then
+    echo "qemu is not installed" 1>&2
+    exit 1
+fi
+
 if [ "x${source}" = x ] ; then
     tmpfile=`mktemp`
     while read; do
@@ -135,8 +147,7 @@
 cp ${isofile} ${fdafile}
 
 outfile=`mktemp`
-qemu-system-i386 ${qemuopts} -nographic -serial stdio -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r" >${outfile}
-
+${qemu} ${qemuopts} -nographic -serial stdio -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r" >${outfile}
 cat $outfile
 
 rm -f ${tmpfile} ${outfile} ${cfgfile} ${isofile} ${hdafile} ${fdafile}
 
 
------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw
Quoted 11 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 3 lines · Dustin Kirkland

The grub-shell test assumes that qemu-system-i386 will be the binary used, and that it's available on the system. Actually, on amd64/x86_64 systems, the appropriate binary is qemu-system-x86_64.

Currently grub-shell supports only i386-pc target and the right qemu architecture to test it with is system-i386. qemu-system-x86_64 is appropriate only for amd64-specific tests (you can have a look at my bootchecks branch). Architecture of build has nothing to do with architecture of target: you can very well cross-compile for i386-pc from mips. It's not any different than cross-compiling to i386-pc from x86_64 (the only difference is that you use biarch compiler)

Actually, there is no qemu-system-i386 (it's just qemu). But 'qemu-system-x86_64 -cpu qemu32' is absolutely identical to 'qemu' as far as the guest is concerned.

The proper thing to do would be to try 'qemu qemu-system-i386 qemu-system-x86_64' and for the last one, append a -cpu qemu32.

Regards,

Anthony Liguori

Quoted 58 lines
Quoted 45 lines

Furthermore, an
appropriate error should be thrown if neither executable is found.

2010-02-20 Dustin Kirkland<[email protected]>

* tests/util/grub-shell.in: locate the appropriate qemu system binary, and exit non-zero, with an error message, if none are found

diff -Nur -x '*.orig' -x '*~' lucid/tests/util/grub-shell.in lucid.new/tests/util/grub-shell.in

tests/util/grub-shell.in +13 -3
@@ -92,6 +92,18 @@
      esac
  done
 
+qemu=
+for i in qemu-system-i386 qemu-system-x86_64; do
+    if which ${i}>/dev/null; then
+	qemu=${i}
+	break
+    fi
+done
+if [ "x${qemu}" = x ]; then
+    echo "qemu is not installed" 1>&2
+    exit 1
+fi
+
  if [ "x${source}" = x ] ; then
      tmpfile=`mktemp`
      while read; do
@@ -135,8 +147,7 @@
  cp ${isofile} ${fdafile}
 
  outfile=`mktemp`
-qemu-system-i386 ${qemuopts} -nographic -serial stdio -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r">${outfile}
-
+${qemu} ${qemuopts} -nographic -serial stdio -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r">${outfile}
  cat $outfile
 
  rm -f ${tmpfile} ${outfile} ${cfgfile} ${isofile} ${hdafile} ${fdafile}
 
 
------------------------------------------------------------------------
Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel