[grub2/f17] Support PowerMac partitioning.

Peter Jones pjones at fedoraproject.org
Thu Apr 26 14:31:11 UTC 2012


commit a5b8b6f459e45b1f69959b17a135d3fc490b0fad
Author: Peter Jones <pjones at redhat.com>
Date:   Thu Apr 26 10:19:48 2012 -0400

    Support PowerMac partitioning.

 ...4-add-support-for-PowerMac-HFS-partitions.patch |   94 ++++++++++++++++++++
 grub2.spec                                         |    1 +
 2 files changed, 95 insertions(+), 0 deletions(-)
---
diff --git a/grub-2.00~beta4-add-support-for-PowerMac-HFS-partitions.patch b/grub-2.00~beta4-add-support-for-PowerMac-HFS-partitions.patch
new file mode 100644
index 0000000..9ad7dde
--- /dev/null
+++ b/grub-2.00~beta4-add-support-for-PowerMac-HFS-partitions.patch
@@ -0,0 +1,94 @@
+From f2dc76d4d82ac9bbe5ccb4e8ccc49c14e8574c20 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <pjones at fedoraproject.org>
+Date: Wed, 25 Apr 2012 13:09:15 +0200
+Subject: [PATCH 2/2] add support for PowerMac HFS partitions
+
+Signed-off-by: Fedora PPC secondary arch maintainer <karsten at fedoraproject.org>
+---
+ util/grub-install.in |   67 ++++++++++++++++++++++++++++++++------------------
+ 1 files changed, 43 insertions(+), 24 deletions(-)
+
+diff --git a/util/grub-install.in b/util/grub-install.in
+index 26be9d9..f1f9bae 100644
+--- a/util/grub-install.in
++++ b/util/grub-install.in
+@@ -757,33 +757,52 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
+ 
+         # If a install device is defined, copy the core.elf to PReP partition.
+ 	else
+-            if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" != "41" ]; then
+-		gettext "The chosen partition is not a PReP partition." 1>&2
+-		echo 1>&2
+-		exit 1
+-            fi
+-
++        if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" = "41" ]; then
+             if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" != ELF ] && ( cmp -s -n $(blockdev --getsize64 ${install_device}) /dev/zero "${install_device}" &>/dev/null ); then
+-            # Change boot device to the harddisk root
+-		boot_device="$ofpath"
+-		dd if="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" of="${install_device}" status=noxfer || {
+-		    gettext "Failed to copy Grub to the PReP partition." 1>&2
+-		    echo 1>&2
+-		    exit 1
+-		}
++                 # Change boot device to the harddisk root
++                 boot_device="$ofpath"
++                 dd if="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" of="${install_device}" status=noxfer || {
++                     gettext "Failed to copy Grub to the PReP partition." 1>&2
++                     echo 1>&2
++                     exit 1
++                }
+             else
+-		gettext "The PReP partition is not empty. If you are sure you want to use it, run dd to clear it:" 1>&2
+-		echo 1>&2
+-		echo "  dd if=/dev/zero of=${install_device}"
+-		exit 1
++                gettext "The PReP partition is not empty. If you are sure you want to use it, run dd to clear it:" 1>&2
++                echo 1>&2
++                echo "  dd if=/dev/zero of=${install_device}"
++                exit 1
+             fi
+-	    dev="`echo "${install_device}" | sed -e 's/\/dev\///' -e 's/[0-9]\+//'`"
+-	    boot_device="`$ofpathname "$dev"`" || {
+-	    # TRANSLATORS: "device tree path" is the name of the device
+-            # for IEEE1275
+-		gettext_printf "Couldn't find IEEE1275 device tree path for %s.\nYou will have to set \`boot-device' variable manually.\n" "$dev" 1>&2
+-		exit 1
+-	    }
++            dev="`echo "${install_device}" | sed -e 's/\/dev\///' -e 's/[0-9]\+//'`"
++            boot_device="`$ofpathname "$dev"`" || {
++                # TRANSLATORS: "device tree path" is the name of the device
++                # for IEEE1275
++                gettext_printf "Couldn't find IEEE1275 device tree path for %s.\nYou will have to set \`boot-device' variable manually.\n" "$dev" 1>&2
++                exit 1
++            }
++        else
++            hmount ${install_device} >/dev/null 2>&1
++            if [ $? -eq 0 ]; then
++                humount "${install_device}"
++                # Change boot device to the harddisk root
++                boot_device="$ofpath"
++                hmount "${install_device}"
++                hcopy "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" ":" || {
++                    gettext "Failed to copy Grub to the HFS partition." 1>&2
++                    gettext "Maybe the HFS partition is not empty. If you are sure you want to use it, run hformat to clear it:" 1>&2
++                    echo 1>&2
++                    echo "  hformat ${install_device}"
++                    exit 1
++                }
++                humount "${install_device}"
++                # We're on PowerMac, it's either /dev/sdaX or /dev/hdaX:
++                dev="`echo "${install_device}" | sed -e 's/\/dev\/.da//'`"
++                boot_device="hd:${dev},core.${imgext}"
++            else
++                gettext "The chosen partition is neither a PReP nor a HFS partition." 1>&2
++                echo 1>&2
++                exit 1
++            fi
++        fi
+ 	fi
+ 
+ 	"$nvsetenv" boot-device "$boot_device" || {
+-- 
+1.7.6.5
+
diff --git a/grub2.spec b/grub2.spec
index 416e892..0d3517c 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -41,6 +41,7 @@ Patch3:		grub2-handle-initramfs-on-xen.patch
 Patch4:		grub-1.99-Fix-tests-of-zeroed-partition.patch
 Patch5:		grub-1.99-ppc-terminfo.patch
 Patch6:		grub-2.00-beta4-wronly.patch
+Patch7:		grub-2.00~beta4-add-support-for-PowerMac-HFS-partitions.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 


More information about the scm-commits mailing list