Various fixes from Mads Kiilerich

This commit is contained in:
Peter Jones 2012-04-26 11:09:57 -04:00
parent 2b1c010ce0
commit 0e6e69f9b5
5 changed files with 144 additions and 6 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
grub-*.tar.?z grub-*.tar.?z
/unifont-5.1.20080820.pcf.gz

View File

@ -0,0 +1,29 @@
From 8e4aea82c6aba6b8b5ca68d74abafa3fe9486c36 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 19 Apr 2012 14:17:38 -0400
Subject: [PATCH] Open device O_WRONLY in grub_util_biosdisk_write.
revision 4225 introduced an error wherein the device we intend
to write to from e.g. grub2-bios-setup is opened read-only. The
immediate following write(2) call then fails with -EBADF.
---
grub-core/kern/emu/hostdisk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c
index ea7eb3d..19748df 100644
--- a/grub-core/kern/emu/hostdisk.c
+++ b/grub-core/kern/emu/hostdisk.c
@@ -1081,7 +1081,7 @@ grub_util_biosdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
{
int fd;
grub_disk_addr_t max = ~0ULL;
- fd = open_device (disk, sector, O_RDONLY, &max);
+ fd = open_device (disk, sector, O_WRONLY, &max);
if (fd < 0)
return grub_errno;
--
1.7.10

View File

@ -0,0 +1,94 @@
From f2dc76d4d82ac9bbe5ccb4e8ccc49c14e8574c20 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <pjones@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@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

View File

@ -16,13 +16,13 @@
%endif %endif
%global tarversion 2.00~beta2 %global tarversion 2.00~beta4
%undefine _missing_build_ids_terminate_build %undefine _missing_build_ids_terminate_build
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.0 Version: 2.0
Release: 0.22%{?dist} Release: 0.24%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base Group: System Environment/Base
@ -32,13 +32,15 @@ Obsoletes: grub < 1:0.98
Source0: ftp://alpha.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz Source0: ftp://alpha.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz
Source2: grub.default Source2: grub.default
Source3: README.Fedora Source3: README.Fedora
Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz
Patch0: grub-1.99-handle-fwrite-return.patch Patch0: grub-1.99-handle-fwrite-return.patch
Patch1: grub-1.99-grub_test_assert_printf.patch Patch1: grub-1.99-grub_test_assert_printf.patch
Patch2: grub-1.99-just-say-linux.patch Patch2: grub-1.99-just-say-linux.patch
Patch3: grub2-handle-initramfs-on-xen.patch Patch3: grub2-handle-initramfs-on-xen.patch
Patch9: grub-1.99-gcc-4.7.0.patch Patch4: grub-1.99-Fix-tests-of-zeroed-partition.patch
Patch10: grub-1.99-Fix-tests-of-zeroed-partition.patch Patch5: grub-1.99-ppc-terminfo.patch
Patch11: 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) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -86,6 +88,8 @@ echo foo
echo bar echo bar
cd grub-%{tarversion} cd grub-%{tarversion}
cp %{SOURCE3} . cp %{SOURCE3} .
# place unifont in the '.' from which configure is run
cp %{SOURCE4} unifont.pcf.gz
git init git init
git config user.email "pjones@fedoraproject.org" git config user.email "pjones@fedoraproject.org"
git config user.name "Fedora Ninjas" git config user.name "Fedora Ninjas"
@ -98,6 +102,8 @@ mv grub-%{tarversion} grub-efi-%{tarversion}
%setup -D -q -T -a 0 -n grub-%{tarversion} %setup -D -q -T -a 0 -n grub-%{tarversion}
cd grub-%{tarversion} cd grub-%{tarversion}
cp %{SOURCE3} . cp %{SOURCE3} .
# place unifont in the '.' from which configure is run
cp %{SOURCE4} unifont.pcf.gz
git init git init
git config user.email "pjones@fedoraproject.org" git config user.email "pjones@fedoraproject.org"
git config user.name "Fedora Ninjas" git config user.name "Fedora Ninjas"
@ -177,7 +183,6 @@ rm -fr $RPM_BUILD_ROOT
cd grub-efi-%{tarversion} cd grub-efi-%{tarversion}
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
mv $RPM_BUILD_ROOT/etc/bash_completion.d/grub $RPM_BUILD_ROOT/etc/bash_completion.d/grub-efi mv $RPM_BUILD_ROOT/etc/bash_completion.d/grub $RPM_BUILD_ROOT/etc/bash_completion.d/grub-efi
sed s,grub/grub-mkconfig_lib,grub-efi/grub-mkconfig_lib, -i $RPM_BUILD_ROOT%{_sbindir}/grub2-efi-mkconfig
# Ghost config file # Ghost config file
install -m 755 -d $RPM_BUILD_ROOT/boot/efi/EFI/redhat/ install -m 755 -d $RPM_BUILD_ROOT/boot/efi/EFI/redhat/
@ -376,6 +381,13 @@ fi
%endif %endif
%changelog %changelog
* Thu Apr 26 2012 Peter Jones <pjones@redhat.com> - 2.0-0.24
- Various fixes from Mads Kiilerich
* Thu Apr 19 2012 Peter Jones <pjones@redhat.com> - 2.0-0.23
- Update to 2.00~beta4
- Make fonts work so we can do graphics reasonably
* Thu Mar 29 2012 David Aquilina <dwa@redhat.com> - 2.0-0.22 * Thu Mar 29 2012 David Aquilina <dwa@redhat.com> - 2.0-0.22
- Fix ieee1275 platform define for ppc - Fix ieee1275 platform define for ppc

View File

@ -1 +1,3 @@
4509839183c4593ab49a2c6044c03f18 grub-2.00~beta2.tar.xz 4509839183c4593ab49a2c6044c03f18 grub-2.00~beta2.tar.xz
8c28087c5fcb3188f1244b390efffdbe unifont-5.1.20080820.pcf.gz
6902a2b408038b8d3263a86536ac4652 grub-2.00~beta4.tar.xz