Blob Blame Raw
From 6a2668284e0bf240c50cdff8540573a9150106d1 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Fri, 12 Apr 2013 01:29:45 +0200
Subject: [PATCH 282/364] 	Support i386-ieee1275 grub-mkrescue and make
 check on it.

---
 ChangeLog                                | 4 ++++
 Makefile.util.def                        | 1 +
 grub-core/tests/boot/qemu-shutdown-x86.S | 9 +++++++++
 tests/grub_script_expansion.in           | 2 +-
 tests/partmap_test.in                    | 8 +++++++-
 tests/util/grub-shell.in                 | 7 ++++---
 util/grub-mkrescue.in                    | 8 ++++++++
 7 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0d62509..c137b5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-04-11  Vladimir Serbinenko  <phcoder@gmail.com>
 
+	Support i386-ieee1275 grub-mkrescue and make check on it.
+
+2013-04-11  Vladimir Serbinenko  <phcoder@gmail.com>
+
 	Merge powerpc grub-mkrescue flavour with common. Use xorriso HFS+
 	feature for it.
 
diff --git a/Makefile.util.def b/Makefile.util.def
index bd286fc..373c25b 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -470,6 +470,7 @@ script = {
   enable = i386_qemu;
   enable = i386_multiboot;
   enable = i386_coreboot;
+  enable = i386_ieee1275;
   enable = mips_qemu_mips;
   enable = mips_loongson;
   enable = ia64_efi;
diff --git a/grub-core/tests/boot/qemu-shutdown-x86.S b/grub-core/tests/boot/qemu-shutdown-x86.S
index 8f794fc..9f8bc40 100644
--- a/grub-core/tests/boot/qemu-shutdown-x86.S
+++ b/grub-core/tests/boot/qemu-shutdown-x86.S
@@ -1,3 +1,12 @@
+	movl $0x80000b80, %eax
+	movw $0xcf8, %dx
+	outl  %eax, %dx
+	movl $0x1001, %eax
+	movw $0xcfc, %dx
+	inb  %al, %dx
+	orb  $1, %al
+	outb  %al, %dx
+
 	movl $0x80000b40, %eax
 	movw $0xcf8, %dx
 	outl  %eax, %dx
diff --git a/tests/grub_script_expansion.in b/tests/grub_script_expansion.in
index c476390..03dc510 100644
--- a/tests/grub_script_expansion.in
+++ b/tests/grub_script_expansion.in
@@ -35,7 +35,7 @@ done
 
 other=`echo insmod regexp\; echo '(*)' | @builddir@/grub-shell`
 for d in $disks; do
-    if ! echo "$other" | grep "$d" >/dev/null; then
+    if ! echo "$other" | grep -F "$d" >/dev/null; then
 	echo "$d missing from (*) expansion" >&2
 	exit 1
     fi
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 1507220..a0beb2a 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -49,7 +49,7 @@ list_parts () {
     outfile="$1"
     shift
 
-    echo ls | "${grubshell}" --qemu-opts="-hda ${imgfile}" \
+    echo ls | "${grubshell}" --qemu-opts="-$qemudisk ${imgfile}" \
 	--modules=$mod | tr -d "\n\r" > "${outfile}"
     cat "${outfile}"
     echo
@@ -58,12 +58,18 @@ list_parts () {
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson)
 	disk=ata0
+	qemudisk=hda
 	;;
     powerpc-ieee1275)
 	disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0
+	qemudisk=hda
 	# QEMU firmware has bugs which prevent it from accessing hard disk.
 	exit 0
 	;;
+    i386-ieee1275)
+	disk=ieee1275/d
+	qemudisk=hdb
+	;;
     *)
 	disk=hd0
 	;;
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 04e64da..c6d1cd7 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -100,10 +100,11 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	console=vga_text;;
 
     i386-ieee1275)
-	boot=cd
+	boot=hd
 	qemu=qemu-system-i386
-	console=console;;
-
+	console=console
+	trim=1
+	;;
     i386-qemu)
 	boot=qemu
 	qemu=qemu-system-i386
diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in
index a6e4de6..510d95f 100644
--- a/util/grub-mkrescue.in
+++ b/util/grub-mkrescue.in
@@ -40,6 +40,7 @@ mipsel_qemu_dir="${libdir}/@PACKAGE@/mipsel-qemu_mips"
 loongson_dir="${libdir}/@PACKAGE@/mipsel-loongson"
 mips_qemu_dir="${libdir}/@PACKAGE@/mips-qemu_mips"
 pc_dir="${libdir}/@PACKAGE@/i386-pc"
+i386_ieee1275_dir="${libdir}/@PACKAGE@/i386-ieee1275"
 efi32_dir="${libdir}/@PACKAGE@/i386-efi"
 efi64_dir="${libdir}/@PACKAGE@/x86_64-efi"
 ia64_dir="${libdir}/@PACKAGE@/ia64-efi"
@@ -256,6 +257,9 @@ if [ "${override_dir}" = "" ] ; then
     if test -e "${pc_dir}" ; then
         process_input_dir "${pc_dir}" i386-pc
     fi
+    if test -e "${i386_ieee1275_dir}" ; then
+	process_input_dir "${i386_ieee1275_dir}" i386-ieee1275
+    fi
     if test -e "${efi32_dir}" ; then
         process_input_dir "${efi32_dir}" i386-efi
     fi
@@ -291,6 +295,7 @@ else
     mips_qemu_dir=
     loongson_dir=
     ppc_dir=
+    i386_ieee1275_dir=
     case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
         i386-multiboot) multiboot_dir="${override_dir}" ;;
         i386-coreboot) coreboot_dir="${override_dir}" ;;
@@ -303,6 +308,7 @@ else
 	mipsel-loongson) loongson_dir="${override_dir}" ;;
 	mips-qemu_mips) mips_qemu_dir="${override_dir}" ;;
 	powerpc-ieee1275) ppc_dir="${override_dir}" ;;
+	i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;;
     esac
 fi
 
@@ -336,6 +342,8 @@ fi
 # build multiboot core.img
 make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "pata ahci at_keyboard"
 
+make_image "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" ""
+
 if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then
     efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
     mkdir -p "${efi_dir}/efi/boot"
-- 
1.8.1.4