a5bd9f6
From 8a02952132bdc58a643b468f28e38594d9caecfa Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Sun, 14 Apr 2013 17:10:55 +0200
a5bd9f6
Subject: [PATCH 303/364] 	Support mkrescue on sparc64.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                              |  4 ++
a5bd9f6
 INSTALL                                |  2 +-
a5bd9f6
 Makefile.util.def                      |  1 +
a5bd9f6
 grub-core/Makefile.core.def            |  9 ++++
a5bd9f6
 grub-core/boot/sparc64/ieee1275/boot.S | 24 ++++++++-
a5bd9f6
 util/grub-mkimage.c                    | 21 +++++++-
a5bd9f6
 util/grub-mkrescue.in                  | 89 +++++++++++++++++++++++++---------
a5bd9f6
 7 files changed, 123 insertions(+), 27 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index df9e300..4c1e28d 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,9 @@
a5bd9f6
 2013-04-14  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	Support mkrescue on sparc64.
a5bd9f6
+
a5bd9f6
+2013-04-14  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	Allow IEEE1275 ports on path even if it wasn't detected automatically.
a5bd9f6
 	Needed on OpenBIOS due to incomplete device tree.
a5bd9f6
 
a5bd9f6
diff --git a/INSTALL b/INSTALL
a5bd9f6
index 128bf47..3333686 100644
a5bd9f6
--- a/INSTALL
a5bd9f6
+++ b/INSTALL
a5bd9f6
@@ -45,7 +45,7 @@ need the following.
a5bd9f6
 Prerequisites for make-check:
a5bd9f6
 
a5bd9f6
 * qemu, specifically the binary 'qemu-system-i386'
a5bd9f6
-* xorriso, for grub-mkrescue and grub-shell
a5bd9f6
+* xorriso 1.2.9 or later, for grub-mkrescue and grub-shell
a5bd9f6
 
a5bd9f6
 Configuring the GRUB
a5bd9f6
 ====================
a5bd9f6
diff --git a/Makefile.util.def b/Makefile.util.def
a5bd9f6
index ef3c4ea..ed7b412 100644
a5bd9f6
--- a/Makefile.util.def
a5bd9f6
+++ b/Makefile.util.def
a5bd9f6
@@ -475,6 +475,7 @@ script = {
a5bd9f6
   enable = mips_loongson;
a5bd9f6
   enable = ia64_efi;
a5bd9f6
   enable = powerpc_ieee1275;
a5bd9f6
+  enable = sparc64_ieee1275;
a5bd9f6
 };
a5bd9f6
 
a5bd9f6
 script = {
a5bd9f6
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
a5bd9f6
index 6aead4c..f1f1012 100644
a5bd9f6
--- a/grub-core/Makefile.core.def
a5bd9f6
+++ b/grub-core/Makefile.core.def
a5bd9f6
@@ -283,10 +283,19 @@ image = {
a5bd9f6
 
a5bd9f6
 image = {
a5bd9f6
   name = cdboot;
a5bd9f6
+
a5bd9f6
   i386_pc = boot/i386/pc/cdboot.S;
a5bd9f6
   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
a5bd9f6
   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
a5bd9f6
+
a5bd9f6
+  sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
a5bd9f6
+  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
a5bd9f6
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
a5bd9f6
+  sparc64_ieee1275_cppflags = '-DCDBOOT=1';
a5bd9f6
+
a5bd9f6
   objcopyflags = '-O binary';
a5bd9f6
+
a5bd9f6
+  enable = sparc64_ieee1275;
a5bd9f6
   enable = i386_pc;
a5bd9f6
 };
a5bd9f6
 
a5bd9f6
diff --git a/grub-core/boot/sparc64/ieee1275/boot.S b/grub-core/boot/sparc64/ieee1275/boot.S
a5bd9f6
index f796995..0ab9a4a 100644
a5bd9f6
--- a/grub-core/boot/sparc64/ieee1275/boot.S
a5bd9f6
+++ b/grub-core/boot/sparc64/ieee1275/boot.S
a5bd9f6
@@ -28,6 +28,7 @@ pic_base:
a5bd9f6
 	call	boot_continue
a5bd9f6
 	 mov	%o4, CIF_REG
a5bd9f6
 
a5bd9f6
+#ifndef CDBOOT
a5bd9f6
 	/* The offsets to these locations are defined by the
a5bd9f6
 	 * GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
a5bd9f6
 	 * and grub-setup uses this to patch these next three values as needed.
a5bd9f6
@@ -43,9 +44,19 @@ pic_base:
a5bd9f6
 	. = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH
a5bd9f6
 boot_path:
a5bd9f6
 	. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
a5bd9f6
-boot_path_end:
a5bd9f6
 kernel_byte:		.xword (2 << 9)
a5bd9f6
+boot_path_end:
a5bd9f6
 kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
a5bd9f6
+#else
a5bd9f6
+#define boot_path (_start + 512)
a5bd9f6
+#define boot_path_end (_start + 1024)
a5bd9f6
+#include <grub/offsets.h>
a5bd9f6
+
a5bd9f6
+	. = _start + 8
a5bd9f6
+kernel_byte:		.xword (2 << 9)
a5bd9f6
+kernel_size:	        .word  512
a5bd9f6
+kernel_address:		.word  GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
a5bd9f6
+#endif
a5bd9f6
 
a5bd9f6
 prom_finddev_name:	.asciz "finddevice"
a5bd9f6
 prom_chosen_path:	.asciz "/chosen"
a5bd9f6
@@ -158,8 +169,10 @@ boot_continue:
a5bd9f6
 	 mov	GRUB_NAME_LEN, %o3
a5bd9f6
 
a5bd9f6
 	GET_ABS(boot_path, %o3)
a5bd9f6
+#ifndef CDBOOT
a5bd9f6
 	ldub	[%o3], %o1
a5bd9f6
 	brnz,pn	%o1, bootpath_known
a5bd9f6
+#endif
a5bd9f6
 
a5bd9f6
 	/* getprop(chosen_node, "bootpath", &buffer, buffer_size) */
a5bd9f6
 	 GET_ABS(prom_bootpath_name, %o2)
a5bd9f6
@@ -194,12 +207,19 @@ bootpath_known:
a5bd9f6
 	GET_ABS(prom_read_name, %o0)
a5bd9f6
 	LDUW_ABS(kernel_address, 0x00, %o2)
a5bd9f6
 	call	prom_call_3_1_o1
a5bd9f6
+#ifdef CDBOOT
a5bd9f6
+	 LDUW_ABS(kernel_size, 0x00, %o3)
a5bd9f6
+#else
a5bd9f6
 	 mov	512, %o3
a5bd9f6
+#endif
a5bd9f6
 
a5bd9f6
 	LDUW_ABS(kernel_address, 0x00, %o2)
a5bd9f6
 	jmpl	%o2, %o7
a5bd9f6
+#ifdef CDBOOT
a5bd9f6
+	 mov	CIF_REG, %o4
a5bd9f6
+#else
a5bd9f6
 	 nop
a5bd9f6
-
a5bd9f6
+#endif
a5bd9f6
 	. = _start + GRUB_BOOT_MACHINE_CODE_END
a5bd9f6
 
a5bd9f6
 /* the last 4 bytes in the sector 0 contain the signature */
a5bd9f6
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
a5bd9f6
index 80e7d81..96279a4 100644
a5bd9f6
--- a/util/grub-mkimage.c
a5bd9f6
+++ b/util/grub-mkimage.c
a5bd9f6
@@ -67,7 +67,8 @@ struct image_target_desc
a5bd9f6
   int bigendian;
a5bd9f6
   enum {
a5bd9f6
     IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
a5bd9f6
-    IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
a5bd9f6
+    IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_SPARC64_CDCORE,
a5bd9f6
+    IMAGE_I386_IEEE1275,
a5bd9f6
     IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
a5bd9f6
     IMAGE_FULOONG2F_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC,
a5bd9f6
     IMAGE_QEMU_MIPS_FLASH
a5bd9f6
@@ -336,6 +337,21 @@ struct image_target_desc image_targets[] =
a5bd9f6
     },
a5bd9f6
     {
a5bd9f6
       .dirname = "sparc64-ieee1275",
a5bd9f6
+      .names = { "sparc64-ieee1275-cdcore", NULL },
a5bd9f6
+      .voidp_sizeof = 8,
a5bd9f6
+      .bigendian = 1, 
a5bd9f6
+      .id = IMAGE_SPARC64_CDCORE,
a5bd9f6
+      .flags = PLATFORM_FLAGS_NONE,
a5bd9f6
+      .total_module_size = GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE,
a5bd9f6
+      .decompressor_compressed_size = TARGET_NO_FIELD,
a5bd9f6
+      .decompressor_uncompressed_size = TARGET_NO_FIELD,
a5bd9f6
+      .decompressor_uncompressed_addr = TARGET_NO_FIELD,
a5bd9f6
+      .section_align = 1,
a5bd9f6
+      .vaddr_offset = 0,
a5bd9f6
+      .link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
a5bd9f6
+    },
a5bd9f6
+    {
a5bd9f6
+      .dirname = "sparc64-ieee1275",
a5bd9f6
       .names = { "sparc64-ieee1275-aout", NULL },
a5bd9f6
       .voidp_sizeof = 8,
a5bd9f6
       .bigendian = 1,
a5bd9f6
@@ -1021,6 +1037,7 @@ generate_image (const char *dir, const char *prefix,
a5bd9f6
       break;
a5bd9f6
     case IMAGE_SPARC64_AOUT:
a5bd9f6
     case IMAGE_SPARC64_RAW:
a5bd9f6
+    case IMAGE_SPARC64_CDCORE:
a5bd9f6
     case IMAGE_I386_IEEE1275:
a5bd9f6
     case IMAGE_PPC:
a5bd9f6
       break;
a5bd9f6
@@ -1360,6 +1377,8 @@ generate_image (const char *dir, const char *prefix,
a5bd9f6
 	free (boot_path);
a5bd9f6
       }
a5bd9f6
       break;
a5bd9f6
+    case IMAGE_SPARC64_CDCORE:
a5bd9f6
+      break;
a5bd9f6
     case IMAGE_YEELOONG_FLASH:
a5bd9f6
     case IMAGE_FULOONG2F_FLASH:
a5bd9f6
     {
a5bd9f6
diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in
a5bd9f6
index a244b2a..c74c8ca 100644
a5bd9f6
--- a/util/grub-mkrescue.in
a5bd9f6
+++ b/util/grub-mkrescue.in
a5bd9f6
@@ -44,6 +44,7 @@ i386_ieee1275_dir="${libdir}/@PACKAGE@/i386-ieee1275"
a5bd9f6
 efi32_dir="${libdir}/@PACKAGE@/i386-efi"
a5bd9f6
 efi64_dir="${libdir}/@PACKAGE@/x86_64-efi"
a5bd9f6
 ia64_dir="${libdir}/@PACKAGE@/ia64-efi"
a5bd9f6
+sparc64_dir="${libdir}/@PACKAGE@/sparc64-ieee1275"
a5bd9f6
 ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275"
a5bd9f6
 rom_directory=
a5bd9f6
 override_dir=
a5bd9f6
@@ -90,6 +91,7 @@ usage () {
a5bd9f6
     print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")"
a5bd9f6
     print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")"
a5bd9f6
     print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")"
a5bd9f6
+    print_option_help "--sparc-boot" "$(gettext "enable sparc boot. Disables HFS+, APM and boot as disk image for i386-pc")"
a5bd9f6
     echo
a5bd9f6
     gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt
a5bd9f6
     echo
a5bd9f6
@@ -99,6 +101,8 @@ usage () {
a5bd9f6
     gettext "Mail xorriso support requests to <bug-xorriso@gnu.org>."; echo
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
+system_area=auto
a5bd9f6
+
a5bd9f6
 # Check the arguments.
a5bd9f6
 while test $# -gt 0
a5bd9f6
 do
a5bd9f6
@@ -147,6 +151,9 @@ do
a5bd9f6
 	export PATH
a5bd9f6
 	;;
a5bd9f6
 
a5bd9f6
+    --sparc-boot)
a5bd9f6
+        system_area=sparc64 ;;
a5bd9f6
+
a5bd9f6
     --product-name)
a5bd9f6
         product_name=`argument $option "$@"`; shift ;;
a5bd9f6
     --product-name=*)
a5bd9f6
@@ -230,9 +237,7 @@ make_image ()
a5bd9f6
 
a5bd9f6
     gettext_printf "Enabling %s support ...\n" "$2"
a5bd9f6
 
a5bd9f6
-    memdisk_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
a5bd9f6
-    memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
a5bd9f6
-    mkdir -p "${memdisk_dir}/boot/grub"
a5bd9f6
+    load_cfg="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`"
a5bd9f6
 
a5bd9f6
     (cat << EOF
a5bd9f6
 search --fs-uuid --set=root ${iso_uuid}
a5bd9f6
@@ -240,18 +245,36 @@ set prefix=(\${root})/boot/grub
a5bd9f6
 EOF
a5bd9f6
     for i in $(cat "${source_directory}/partmap.lst") ${modules} ; do
a5bd9f6
         echo "insmod $i"
a5bd9f6
-    done ; \
a5bd9f6
-    echo "source \$prefix/grub.cfg") \
a5bd9f6
-    > "${memdisk_dir}/boot/grub/grub.cfg"
a5bd9f6
-
a5bd9f6
-    (cd "${memdisk_dir}"; tar -cf - boot) > "${memdisk_img}"
a5bd9f6
-    rm -rf "${memdisk_dir}"
a5bd9f6
-    "$grub_mkimage" -O ${platform} -d "${source_directory}" -m "${memdisk_img}" -o "$3" --prefix='(memdisk)/boot/grub' \
a5bd9f6
-        search iso9660 configfile normal memdisk tar $4
a5bd9f6
-    rm -rf "${memdisk_img}"
a5bd9f6
+    done ; ) > "${load_cfg}"
a5bd9f6
+
a5bd9f6
+    "$grub_mkimage" -O ${platform} -d "${source_directory}" -c "${load_cfg}" -o "$3" \
a5bd9f6
+        search iso9660 $4
a5bd9f6
+    rm -rf "${load_cfg}"
a5bd9f6
+}
a5bd9f6
+
a5bd9f6
+make_image_fwdisk ()
a5bd9f6
+{
a5bd9f6
+    source_directory="$1"
a5bd9f6
+    platform=$2
a5bd9f6
+    if ! test -e "${source_directory}"; then
a5bd9f6
+	return;
a5bd9f6
+    fi
a5bd9f6
+
a5bd9f6
+    gettext_printf "Enabling %s support ...\n" "$2"
a5bd9f6
+
a5bd9f6
+    "$grub_mkimage" -O ${platform} -d "${source_directory}" -p '()/boot/grub' -o "$3" \
a5bd9f6
+        iso9660 $4
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
 if [ "${override_dir}" = "" ] ; then
a5bd9f6
+    if [ "$system_area" = auto ]; then
a5bd9f6
+	if test -e "${pc_dir}" || test -e "${ppc_dir}" \
a5bd9f6
+	    || test -e "${efi32_dir}" || test -e "${efi64_dir}"; then 
a5bd9f6
+	    system_area=common;
a5bd9f6
+	elif test -e "${sparc64_dir}" ; then
a5bd9f6
+	    system_area=sparc64;
a5bd9f6
+	fi
a5bd9f6
+    fi
a5bd9f6
     if test -e "${multiboot_dir}" ; then
a5bd9f6
         process_input_dir "${multiboot_dir}" i386-multiboot
a5bd9f6
     fi
a5bd9f6
@@ -288,6 +311,9 @@ if [ "${override_dir}" = "" ] ; then
a5bd9f6
     if test -e "${ppc_dir}" ; then
a5bd9f6
         process_input_dir "${ppc_dir}" powerpc-ieee1275
a5bd9f6
     fi
a5bd9f6
+    if test -e "${sparc64_dir}" ; then
a5bd9f6
+        process_input_dir "${sparc64_dir}" sparc64-ieee1275
a5bd9f6
+    fi
a5bd9f6
 else
a5bd9f6
     . "${override_dir}"/modinfo.sh
a5bd9f6
     process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
a5bd9f6
@@ -303,18 +329,20 @@ else
a5bd9f6
     loongson_dir=
a5bd9f6
     ppc_dir=
a5bd9f6
     i386_ieee1275_dir=
a5bd9f6
+    sparc64_dir=
a5bd9f6
     case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
a5bd9f6
         i386-multiboot) multiboot_dir="${override_dir}" ;;
a5bd9f6
         i386-coreboot) coreboot_dir="${override_dir}" ;;
a5bd9f6
         i386-qemu) qemu_dir="${override_dir}" ;;
a5bd9f6
-        i386-pc) pc_dir="${override_dir}" ;;
a5bd9f6
-	i386-efi) efi32_dir="${override_dir}" ;;
a5bd9f6
-	x86_64-efi) efi64_dir="${override_dir}" ;;
a5bd9f6
+        i386-pc) pc_dir="${override_dir}"; system_area=common;;
a5bd9f6
+	i386-efi) efi32_dir="${override_dir}"; system_area=common ;;
a5bd9f6
+	x86_64-efi) efi64_dir="${override_dir}"; system_area=common ;;
a5bd9f6
 	ia64-efi) ia64_dir="${override_dir}" ;;
a5bd9f6
 	mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;;
a5bd9f6
 	mipsel-loongson) loongson_dir="${override_dir}" ;;
a5bd9f6
 	mips-qemu_mips) mips_qemu_dir="${override_dir}" ;;
a5bd9f6
-	powerpc-ieee1275) ppc_dir="${override_dir}" ;;
a5bd9f6
+	powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;;
a5bd9f6
+	sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;;
a5bd9f6
 	i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;;
a5bd9f6
     esac
a5bd9f6
 fi
a5bd9f6
@@ -342,14 +370,16 @@ if test -e "${pc_dir}" ; then
a5bd9f6
 
a5bd9f6
     rm -f "${core_img}"
a5bd9f6
 
a5bd9f6
-    grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-info-table \
a5bd9f6
-		--embedded-boot ${embed_img}"
a5bd9f6
+    grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table"
a5bd9f6
+    if [ "$system_area" = common ]; then
a5bd9f6
+	grub_mkisofs_arguments="--embedded-boot ${embed_img}"
a5bd9f6
+    fi
a5bd9f6
 fi
a5bd9f6
 
a5bd9f6
 # build multiboot core.img
a5bd9f6
 make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "pata ahci at_keyboard"
a5bd9f6
 
a5bd9f6
-make_image "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" ""
a5bd9f6
+make_image_fwdisk "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" ""
a5bd9f6
 
a5bd9f6
 if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then
a5bd9f6
     efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
a5bd9f6
@@ -384,7 +414,7 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th
a5bd9f6
     grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img"
a5bd9f6
 fi
a5bd9f6
 
a5bd9f6
-make_image "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" ""
a5bd9f6
+make_image_fwdisk "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" ""
a5bd9f6
 if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/powerpc.elf" ]; then
a5bd9f6
     mkdir -p "${iso9660_dir}"/System/Library/CoreServices
a5bd9f6
     touch "${iso9660_dir}/mach_kernel"
a5bd9f6
@@ -402,20 +432,32 @@ if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso96
a5bd9f6
 EOF
a5bd9f6
     "$grub_render_label" -f "$label_font" -b "$label_bgcolor" -c "$label_color" -t "${product_name} ${product_version}" -o "${iso9660_dir}/System/Library/CoreServices/.disk_label"
a5bd9f6
     echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails"
a5bd9f6
-    grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label"
a5bd9f6
+    if [ "$system_area" = common ]; then
a5bd9f6
+	grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label"
a5bd9f6
+    fi
a5bd9f6
 fi
a5bd9f6
 
a5bd9f6
 if [ -e "${iso9660_dir}/boot/powerpc.elf" ] ; then
a5bd9f6
     cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX
a5bd9f6
     cp "${iso9660_dir}/boot/powerpc.elf" "${iso9660_dir}"/System/Library/CoreServices/grub.elf
a5bd9f6
     # FIXME: add PreP
a5bd9f6
-    grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices -sysid PPC"
a5bd9f6
+    if [ "$system_area" = common ]; then
a5bd9f6
+	grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices"
a5bd9f6
+    fi
a5bd9f6
+    grub_mkisofs_arguments="${grub_mkisofs_arguments} -sysid PPC"
a5bd9f6
 fi
a5bd9f6
 
a5bd9f6
-if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ]; then
a5bd9f6
+if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] && [ "$system_area" = common ]; then
a5bd9f6
     grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfs-bless-by i /System/Library/CoreServices/boot.efi"
a5bd9f6
 fi
a5bd9f6
 
a5bd9f6
+make_image_fwdisk "${sparc64_dir}" sparc64-ieee1275-cdcore "${iso9660_dir}/boot/grub/sparc64-ieee1275/core.img" ""
a5bd9f6
+if [ -e "${iso9660_dir}"/boot/grub/sparc64-ieee1275/core.img ] && [ "$system_area" = sparc64 ]; then
a5bd9f6
+   sysarea_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
a5bd9f6
+   dd if=/dev/zero count=1 bs=512 | cat - "${sparc64_dir}"/cdboot.img > "$sysarea_img"
a5bd9f6
+   grub_mkisofs_arguments="${grub_mkisofs_arguments} -G $sysarea_img -B , --grub2-sparc-core /boot/grub/sparc64-ieee1275/core.img"
a5bd9f6
+fi
a5bd9f6
+
a5bd9f6
 make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata"
a5bd9f6
 if [ -e "${iso9660_dir}/boot/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then
a5bd9f6
     cp "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf"
a5bd9f6
@@ -452,6 +494,7 @@ fi
a5bd9f6
 "${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o "${output_image}" -r "${iso9660_dir}" --sort-weight 0 / --sort-weight 1 /boot ${source}
a5bd9f6
 rm -rf "${iso9660_dir}"
a5bd9f6
 
a5bd9f6
+rm -f "${sysarea_img}"
a5bd9f6
 rm -f "${embed_img}"
a5bd9f6
 
a5bd9f6
 exit 0
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6