Merge remote-tracking branch 'kiilerix/f17'

Conflicts:
	grub2.spec
This commit is contained in:
Peter Jones 2012-06-04 11:47:16 -04:00
commit f6b642dfbe
17 changed files with 230 additions and 638 deletions

View file

@ -38,9 +38,14 @@ GRUB 2 in Fedora
----------------
The Fedora installer (anaconda) will make sure grub2 is installed for new and
updated systems. It will write /etc/default/grub and run grub2-mkconfig to
create /boot/grub2/grub.cfg, and it will run grub2-install to install the boot
loader in the MBR and in /boot/grub2/ .
updated systems. It will run grub2-install to install the boot loader in the
MBR and in /boot/grub2/, and it will write /etc/default/grub and run
grub2-mkconfig to create /boot/grub2/grub.cfg.
The active boot loader will not be changed when the GRUB 2 package is updated.
A new boot loader can be installed with something like:
grub2-install /dev/sda
grubby will patch grub.cfg (through /etc/grub2.cfg) when new kernels are
installed. The GRUB 2 configuration system in /etc/default/grub and /etc/grub.d/
@ -49,26 +54,17 @@ grub.cfg with:
grub2-mkconfig -o /boot/grub2/grub.cfg
The active boot loader will not be changed when the GRUB 2 package is updated.
A new boot loader can be installed with something like:
grub2-install /dev/sda
Documentation
-------------
The GRUB 2 manual can be found on http://www.gnu.org/software/grub/manual/ .
The GRUB 2 manual can be found in grub.html or on
http://www.gnu.org/software/grub/manual/ .
Support channels
----------------
If you find a bug in this package, report them to the Red Hat Bugzilla [2].
For talk about using grub2, use IRC channel #grub on freenode Network [3].
You can meet this package maintainer there (nick lkundrak).
[2] http://bugzilla.redhat.com/
[3] http://freenode.net/
--
Lubomir Rintel <lkundrak@v3.sk>
Fedora Project

View file

@ -1,25 +0,0 @@
From c8f67c2ee40815c075f1d6e5b3d6b504fbe204f5 Mon Sep 17 00:00:00 2001
From: Mark Hamzy <hamzy@us.ibm.com>
Date: Sun, 25 Mar 2012 09:22:34 -0500
Subject: [PATCH] Fix tests of zeroed partition
---
util/grub-install.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/util/grub-install.in b/util/grub-install.in
index 9c1d133..e8638af 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -750,7 +750,7 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
exit 1
fi
- if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ $(cmp /dev/zero "${install_device}" &>/dev/null) ]; then
+ if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || (cmp -s -n $(blockdev --getsize64 ${install_device}) /dev/zero "${install_device}"); 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 || {
--
1.7.7.2

View file

@ -1,167 +0,0 @@
From e51968bcd089db5efd5e33043e6e23592f696371 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 2 Mar 2011 13:13:44 -0500
Subject: [PATCH] Make get_test_assert() correctly format its output.
The old code gives arguments to a printf function which can't work
correctly, and the compiler complains.
---
grub-core/tests/example_functional_test.c | 2 +-
grub-core/tests/lib/test.c | 88 +++++++++++++++++++++++++++--
include/grub/test.h | 10 ++-
3 files changed, 90 insertions(+), 10 deletions(-)
diff --git a/grub-core/tests/example_functional_test.c b/grub-core/tests/example_functional_test.c
index 5259881..0c69749 100644
--- a/grub-core/tests/example_functional_test.c
+++ b/grub-core/tests/example_functional_test.c
@@ -24,7 +24,7 @@ static void
example_test (void)
{
/* Check if 1st argument is true and report with default error message. */
- grub_test_assert (1 == 1);
+ grub_test_assert (1 == 1, "1 equal 1 expected");
/* Check if 1st argument is true and report with custom error message. */
grub_test_assert (2 == 2, "2 equal 2 expected");
diff --git a/grub-core/tests/lib/test.c b/grub-core/tests/lib/test.c
index 06d78b7..8453d5b 100644
--- a/grub-core/tests/lib/test.c
+++ b/grub-core/tests/lib/test.c
@@ -42,22 +42,75 @@ typedef struct grub_test_failure *grub_test_failure_t;
grub_test_t grub_test_list;
static grub_test_failure_t failure_list;
-static void
-add_failure (const char *file,
- const char *funp,
- grub_uint32_t line, const char *fmt, va_list args)
+static grub_test_failure_t
+failure_start(const char *file, const char *funp, grub_uint32_t line);
+static grub_test_failure_t
+failure_start(const char *file, const char *funp, grub_uint32_t line)
{
grub_test_failure_t failure;
failure = (grub_test_failure_t) grub_malloc (sizeof (*failure));
if (!failure)
- return;
+ return NULL;
failure->file = grub_strdup (file ? : "<unknown_file>");
+ if (!failure->file)
+ {
+ grub_free(failure);
+ return NULL;
+ }
+
failure->funp = grub_strdup (funp ? : "<unknown_function>");
+ if (!failure->funp)
+ {
+ grub_free(failure->file);
+ grub_free(failure);
+ return NULL;
+ }
+
failure->line = line;
- failure->message = grub_xvasprintf (fmt, args);
+ failure->message = NULL;
+
+ return failure;
+}
+
+static void
+failure_append_vtext(grub_test_failure_t failure, const char *fmt, va_list args);
+static void
+failure_append_vtext(grub_test_failure_t failure, const char *fmt, va_list args)
+{
+ char *msg = grub_xvasprintf(fmt, args);
+ if (failure->message)
+ {
+ char *oldmsg = failure->message;
+
+ failure->message = grub_xasprintf("%s%s", oldmsg, msg);
+ grub_free(oldmsg);
+ }
+ else
+ {
+ failure->message = msg;
+ }
+}
+
+static void
+failure_append_text(grub_test_failure_t failure, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ failure_append_vtext(failure, fmt, args);
+ va_end(args);
+}
+
+static void
+add_failure (const char *file,
+ const char *funp,
+ grub_uint32_t line, const char *fmt, va_list args)
+{
+ grub_test_failure_t failure = failure_start(file, funp, line);
+ failure_append_text(failure, fmt, args);
grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure));
}
@@ -100,6 +153,29 @@ grub_test_nonzero (int cond,
}
void
+grub_test_assert_helper (int cond, const char *file, const char *funp,
+ grub_uint32_t line, const char *condstr,
+ const char *fmt, ...)
+{
+ va_list ap;
+ grub_test_failure_t failure;
+
+ if (cond)
+ return;
+
+ failure = failure_start(file, funp, line);
+ failure_append_text(failure, "assert failed: %s ", condstr);
+
+ va_start(ap, fmt);
+
+ failure_append_vtext(failure, fmt, ap);
+
+ va_end(ap);
+
+ grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure));
+}
+
+void
grub_test_register (const char *name, void (*test_main) (void))
{
grub_test_t test;
diff --git a/include/grub/test.h b/include/grub/test.h
index 5d1ba75..d876f57 100644
--- a/include/grub/test.h
+++ b/include/grub/test.h
@@ -54,10 +54,14 @@ void grub_test_nonzero (int cond, const char *file,
__attribute__ ((format (printf, 5, 6)));
/* Macro to fill in location details and an optional error message. */
+void grub_test_assert_helper (int cond, const char *file,
+ const char *func, grub_uint32_t line,
+ const char *condstr, const char *fmt, ...)
+ __attribute__ ((format (printf, 6, 7)));
+
#define grub_test_assert(cond, ...) \
- grub_test_nonzero(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
- ## __VA_ARGS__, \
- "assert failed: %s", #cond)
+ grub_test_assert_helper(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
+ #cond, ## __VA_ARGS__);
void grub_unit_test_init (void);
void grub_unit_test_fini (void);
--
1.7.3.1

View file

@ -1,59 +0,0 @@
From de1c35857ee803653d3ffd94eb5d3f3b45ab000e Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 2 Mar 2011 11:29:28 -0500
Subject: [PATCH] Don't ignore fwrite's return since we build with -Wno-unused.
---
util/grub-mklayout.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c
index 04501cb..beea3eb 100644
--- a/util/grub-mklayout.c
+++ b/util/grub-mklayout.c
@@ -324,6 +324,7 @@ write_file (FILE *out, struct grub_keyboard_layout *layout)
{
grub_uint32_t version;
unsigned i;
+ int rc;
version = grub_cpu_to_le32 (GRUB_KEYBOARD_LAYOUTS_VERSION);
@@ -342,10 +343,10 @@ write_file (FILE *out, struct grub_keyboard_layout *layout)
layout->keyboard_map_shift_l3[i]
= grub_cpu_to_le32(layout->keyboard_map_shift_l3[i]);
- fwrite (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC, 1,
+ rc = fwrite (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC, 1,
GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE, out);
- fwrite (&version, sizeof (version), 1, out);
- fwrite (layout, 1, sizeof (*layout), out);
+ rc = fwrite (&version, sizeof (version), 1, out);
+ rc = fwrite (layout, 1, sizeof (*layout), out);
}
static void
--
1.7.3.1
diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c
index 513af47..308f8e9 100644
--- a/util/grub-menulst2cfg.c
+++ b/util/grub-menulst2cfg.c
@@ -34,6 +34,7 @@ main (int argc, char **argv)
size_t bufsize = 0;
char *suffix = xstrdup ("");
int suffixlen = 0;
+ int rc;
if (argc >= 2 && argv[1][0] == '-')
{
@@ -111,7 +112,7 @@ main (int argc, char **argv)
if (entryname)
fprintf (out, "}\n\n");
- fwrite (suffix, 1, suffixlen, out);
+ rc = fwrite (suffix, 1, suffixlen, out);
free (buf);
free (suffix);

View file

@ -29,9 +29,9 @@ index ce52576..29ebcbd 100644
+ * include/grub/efi/api.h: add define for OsIndications variable
+ * include/grub/efi/efi.h: export grub_efi_set_variable
+
2012-04-18 Vladimir Serbinenko <phcoder@gmail.com>
2012-05-31 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Bump to beta5.
* configure.ac: Bump to beta6.
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 000cf0d..d0c06d5 100644
--- a/grub-core/Makefile.core.def

View file

@ -14,7 +14,7 @@ index 293b756..2503aa0 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -818,14 +818,16 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
fi
}
fi
- "$nvsetenv" boot-device "$boot_device" || {
@ -25,16 +25,16 @@ index 293b756..2503aa0 100644
- echo " setenv boot-device $boot_device" 1>&2
- exit 1
- }
+ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]; then
+ "$nvsetenv" boot-device "$boot_device" || {
+ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]; then
+ "$nvsetenv" boot-device "$boot_device" || {
+ # TRANSLATORS: The %s will be replaced by an external program name.
+ gettext_printf "\`%s' failed.\n" "$nvsetenv" 1>&2
+ gettext "You will have to set \`boot-device' variable manually. At the IEEE1275 prompt, type:" 1>&2
+ echo 1>&2
+ echo " setenv boot-device $boot_device" 1>&2
+ exit 1
+ }
+ fi
+ gettext_printf "\`%s' failed.\n" "$nvsetenv" 1>&2
+ gettext "You will have to set \`boot-device' variable manually. At the IEEE1275 prompt, type:" 1>&2
+ echo 1>&2
+ echo " setenv boot-device $boot_device" 1>&2
+ exit 1
+ }
+ fi
fi
elif [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xmips-arc ]; then
dvhtool -d "${install_device}" --unix-to-vh "{grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" grub

View file

@ -1,120 +0,0 @@
Return-Path: benh@au1.ibm.com
Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
zmail14.collab.prod.int.phx2.redhat.com with LMTP; Sun, 13 May 2012
23:43:23 -0400 (EDT)
Received: from localhost (localhost.localdomain [127.0.0.1])
by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A92D5F0BC1
for <pjones@redhat.com>; Sun, 13 May 2012 23:43:23 -0400 (EDT)
Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id KDt5yD-zSoXe for <pjones@redhat.com>;
Sun, 13 May 2012 23:43:23 -0400 (EDT)
Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 951A2F0843
for <pjones@mail.corp.redhat.com>; Sun, 13 May 2012 23:43:23 -0400 (EDT)
Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17])
by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4E3hNWo019302
for <pjones@redhat.com>; Sun, 13 May 2012 23:43:23 -0400
Received: from bastion.fedoraproject.org (bastion02.phx2.fedoraproject.org [10.5.126.11])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4E3hLtl006033
for <pjones@redhat.com>; Sun, 13 May 2012 23:43:21 -0400
Received: by bastion02.phx2.fedoraproject.org (Postfix)
id 1B8B34040D; Mon, 14 May 2012 03:43:21 +0000 (UTC)
Delivered-To: pjones@fedoraproject.org
Received: from mx2.redhat.com (ext-mx01.rdu.redhat.com [10.11.45.6])
by bastion02.phx2.fedoraproject.org (Postfix) with ESMTP id AF73B402BC
for <pjones@fedoraproject.org>; Mon, 14 May 2012 03:43:20 +0000 (UTC)
Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148])
by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4E3h5JZ014320
for <pjones@fedoraproject.org>; Sun, 13 May 2012 23:43:11 -0400
Received: from /spool/local
by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted
for <pjones@fedoraproject.org> from <benh@au1.ibm.com>;
Mon, 14 May 2012 03:37:12 +1000
Received: from d23relay03.au.ibm.com (202.81.31.245)
by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted;
Mon, 14 May 2012 03:37:09 +1000
Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139])
by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q4E3gcbg60358704
for <pjones@fedoraproject.org>; Mon, 14 May 2012 13:42:38 +1000
Received: from d23av04.au.ibm.com (loopback [127.0.0.1])
by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q4E3gb1m003356
for <pjones@fedoraproject.org>; Mon, 14 May 2012 13:42:37 +1000
Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12])
by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q4E3gbsI003349;
Mon, 14 May 2012 13:42:37 +1000
Received: from [10.61.2.137] (haven.au.ibm.com [9.190.164.82])
(using SSLv3 with cipher AES256-SHA (256/256 bits))
(Client did not present a certificate)
by ozlabs.au.ibm.com (Postfix) with ESMTPSA id B60A073A09;
Mon, 14 May 2012 13:42:37 +1000 (EST)
Message-ID: <1336966957.6727.15.camel@pasglop>
Subject: [PATCH] grub: Fix module trampoline for powerpc
From: Benjamin Herrenschmidt <benh@au1.ibm.com>
To: Brent Baude <baude@us.ibm.com>, pjones@fedoraproject.org
Cc: hamzy@us.ibm.com, Josh Boyer <jwboyer@gmail.com>
Date: Mon, 14 May 2012 13:42:37 +1000
Organization: IBM Australia
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
x-cbid: 12051317-7014-0000-0000-0000011BC8AA
X-RedHat-Spam-Score: -5.01 (RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD)
X-RedHat-Spam-Score: -5.011 (RCVD_IN_DNSWL_HI,SPF_PASS,T_RP_MATCHES_RCVD)
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17
X-Scanned-By: MIMEDefang 2.67 on 10.11.45.6
[ --- snip --- ]
Not sure who to send that to, I picked Peter as he's in
the rpm log as author of the of the powerpc patches,
feel free to do whatever with that one, it should ultimately
go to upstream grub I suppose ...
Without this, grub doesn't work for me at all with fc17 beta
[ --- snip --- ]
The trampoline generated by grub powerpc's dl.c to call from
modules into the main grub code uses r0 as a scratch register.
However, nowadays, gcc can (and will) generate function calls
to spill registers to the stack (well, it's even stupid enough
to do it when there's only one register to save ! go figure....)
Those calls happen during the function prolog, before the
return address has been saved on the stack, typically it's held
in r0 at this stage. Since those calls will hit the trampoline
in grub, which clobbers r0, this will clobber the return address
and cause a crash.
This patch changes the trampolines to use r12 instead which
is safe to use in our case.
Note: It might be better to actually link those low level gcc
support functions statically into the modules but that's beyond
the level of grub hacking I'm prepared to do today.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
diff --git a/grub-core/kern/powerpc/dl.c b/grub-core/kern/powerpc/dl.c
index b8a2b50..0a8ec85 100644
--- a/grub-core/kern/powerpc/dl.c
+++ b/grub-core/kern/powerpc/dl.c
@@ -89,9 +89,9 @@ struct trampoline
static const struct trampoline trampoline_template =
{
- 0x3c000000,
- 0x60000000,
- 0x7c0903a6,
+ 0x3d800000,
+ 0x618c0000,
+ 0x7d8903a6,
0x4e800420,
};

View file

@ -1,29 +0,0 @@
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

16
grub-2.00-ieee1276.patch Normal file
View file

@ -0,0 +1,16 @@
From: Valdimir Serbinenko <phcoder@gmail.com>
Subject: Check for ieee1275 and not ieee1276.
upstream rev 4404
--- a/util/grub-install.in 2012-05-31 11:38:21 +0000
+++ b/util/grub-install.in 2012-06-01 20:43:10 +0000
@@ -738,7 +738,7 @@
elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "powerpc-ieee1275" ]; then
# If a install device is defined, copy the core.elf to PReP partition.
- if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "powerpc-ieee1276" ] && [ -n "${install_device}" ]; then
+ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "powerpc-ieee1275" ] && [ -n "${install_device}" ]; then
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

82
grub-2.00-linux-mbr.patch Normal file
View file

@ -0,0 +1,82 @@
From: Valdimir Serbinenko <phcoder@gmail.com>
Subject: Fix MBR remapping workaround.
upstream rev 4405
--- a/grub-core/kern/emu/hostdisk.c 2012-05-27 11:19:09 +0000
+++ b/grub-core/kern/emu/hostdisk.c 2012-06-02 11:48:44 +0000
@@ -1067,27 +1067,18 @@
if (fd < 0)
return grub_errno;
+#ifdef __linux__
+ if (sector == 0)
+ /* Work around a bug in Linux ez remapping. Linux remaps all
+ sectors that are read together with the MBR in one read. It
+ should only remap the MBR, so we split the read in two
+ parts. -jochen */
+ max = 1;
+#endif /* __linux__ */
+
if (max > size)
max = size;
-#ifdef __linux__
- if (sector == 0 && max > 1)
- {
- /* Work around a bug in Linux ez remapping. Linux remaps all
- sectors that are read together with the MBR in one read. It
- should only remap the MBR, so we split the read in two
- parts. -jochen */
- if (grub_util_fd_read (fd, buf, (1 << disk->log_sector_size))
- != (1 << disk->log_sector_size))
- return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
- map[disk->id].device, strerror (errno));
-
- buf += (1 << disk->log_sector_size);
- size--;
- max--;
- }
-#endif /* __linux__ */
-
if (grub_util_fd_read (fd, buf, max << disk->log_sector_size)
!= (ssize_t) (max << disk->log_sector_size))
return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
@@ -1111,28 +1102,18 @@
if (fd < 0)
return grub_errno;
+#ifdef __linux__
+ if (sector == 0)
+ /* Work around a bug in Linux ez remapping. Linux remaps all
+ sectors that are write together with the MBR in one write. It
+ should only remap the MBR, so we split the write in two
+ parts. -jochen */
+ max = 1;
+#endif /* __linux__ */
+
if (max > size)
max = size;
-#ifdef __linux__
- if (sector == 0 && max > 1)
- {
- /* Work around a bug in Linux ez remapping. Linux remaps all
- sectors that are write together with the MBR in one write. It
- should only remap the MBR, so we split the write in two
- parts. -jochen */
- if (grub_util_fd_write (fd, buf, (1 << disk->log_sector_size))
- != (1 << disk->log_sector_size))
- return grub_error (GRUB_ERR_WRITE_ERROR,
- N_("cannot write to `%s': %s"),
- map[disk->id].device, strerror (errno));
-
- buf += (1 << disk->log_sector_size);
- size--;
- max--;
- }
-#endif /* __linux__ */
-
if (grub_util_fd_write (fd, buf, max << disk->log_sector_size)
!= (ssize_t) (max << disk->log_sector_size))
return grub_error (GRUB_ERR_WRITE_ERROR, N_("cannot write to `%s': %s"),

29
grub-2.00-no-canon.patch Normal file
View file

@ -0,0 +1,29 @@
From: Valdimir Serbinenko <phcoder@gmail.com>
Subject: Don't canonicalise /dev/root and /dev/dm-*.
upstream rev 4408
--- a/util/getroot.c 2012-05-28 15:43:12 +0000
+++ b/util/getroot.c 2012-06-02 12:36:27 +0000
@@ -1036,10 +1036,16 @@
{
char *tmp = *cur;
int root, dm;
- *cur = canonicalize_file_name (tmp);
- if (*cur == NULL)
- grub_util_error (_("failed to get canonical path of %s"), tmp);
- free (tmp);
+ if (strcmp (*cur, "/dev/root") == 0
+ || strncmp (*cur, "/dev/dm-", sizeof ("/dev/dm-") - 1) == 0)
+ *cur = tmp;
+ else
+ {
+ *cur = canonicalize_file_name (tmp);
+ if (*cur == NULL)
+ grub_util_error (_("failed to get canonical path of %s"), tmp);
+ free (tmp);
+ }
root = (strcmp (*cur, "/dev/root") == 0);
dm = (strncmp (*cur, "/dev/dm-", sizeof ("/dev/dm-") - 1) == 0);
if (!dm && !root)

View file

@ -0,0 +1,67 @@
From: Valdimir Serbinenko <phcoder@gmail.com>
Subject: Reject huge flat panels and monitors over 4096x4096
https://bugzilla.redhat.com/show_bug.cgi?id=827003
Backport upstream rev 4412
diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
index 3e1cc23..4628dd0 100644
--- a/grub-core/video/efi_gop.c
+++ b/grub-core/video/efi_gop.c
@@ -368,7 +368,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
{
err = 1;
grub_gop_get_preferred_mode (&preferred_width, &preferred_height);
- if (err)
+ if (err || width >= 4096 || height >= 4096)
{
preferred_width = 800;
preferred_height = 600;
diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c
index 5656388..62e530a 100644
--- a/grub-core/video/i386/pc/vbe.c
+++ b/grub-core/video/i386/pc/vbe.c
@@ -581,7 +581,6 @@ grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
/* Use low memory scratch area as temporary storage for VESA BIOS calls. */
flat_panel_info = (struct grub_vbe_flat_panel_info *)
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + sizeof (struct grub_video_edid_info));
- grub_memset (flat_panel_info, 0, sizeof (*flat_panel_info));
if (controller_info.version >= 0x200
&& (grub_vbe_bios_get_ddc_capabilities (&ddc_level) & 0xff)
@@ -590,14 +589,18 @@ grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
if (grub_video_vbe_get_edid (&edid_info) == GRUB_ERR_NONE
&& grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE
&& grub_video_edid_preferred_mode (&edid_info, width, height)
- == GRUB_ERR_NONE)
+ == GRUB_ERR_NONE && *width < 4096 && *height < 4096)
return GRUB_ERR_NONE;
grub_errno = GRUB_ERR_NONE;
}
+ grub_memset (flat_panel_info, 0, sizeof (*flat_panel_info));
status = grub_vbe_bios_get_flat_panel_info (flat_panel_info);
- if (status == GRUB_VBE_STATUS_OK)
+ if (status == GRUB_VBE_STATUS_OK
+ && flat_panel_info->horizontal_size && flat_panel_info->vertical_size
+ && flat_panel_info->horizontal_size < 4096
+ && flat_panel_info->vertical_size < 4096)
{
*width = flat_panel_info->horizontal_size;
*height = flat_panel_info->vertical_size;
diff --git a/grub-core/video/video.c b/grub-core/video/video.c
index 67de85a..c36994f 100644
--- a/grub-core/video/video.c
+++ b/grub-core/video/video.c
@@ -415,7 +415,8 @@ grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
| (((unsigned int)
(edid_info->detailed_timings[0].vertical_hi & 0xf0))
<< 4);
- return GRUB_ERR_NONE;
+ if (*width && *height)
+ return GRUB_ERR_NONE;
}
return grub_error (GRUB_ERR_BAD_DEVICE, "no preferred mode available");

View file

@ -1,59 +0,0 @@
From 03f6e77635f4f311a2c7bdd581f6202fa52feef7 Mon Sep 17 00:00:00 2001
From: Valdimir Serbinenko <phcoder@gmail.com>
Date: Sun, 13 May 2012 18:23:02 +0000
Subject: [PATCH] Don't scan device tree if flag is set.
Don't scan device tree if GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS is
set.
=== modified file 'grub-core/disk/ieee1275/ofdisk.c'
---
grub-core/disk/ieee1275/ofdisk.c | 3 ++-
grub-core/kern/ieee1275/cmain.c | 3 +++
include/grub/ieee1275/ieee1275.h | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
index 56fed0a..6b734f7 100644
--- a/grub-core/disk/ieee1275/ofdisk.c
+++ b/grub-core/disk/ieee1275/ofdisk.c
@@ -159,7 +159,8 @@ scan (void)
}
grub_devalias_iterate (dev_iterate_alias);
- grub_ieee1275_devices_iterate (dev_iterate);
+ if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS))
+ grub_ieee1275_devices_iterate (dev_iterate);
}
static int
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
index 9e80757..e04ce5b 100644
--- a/grub-core/kern/ieee1275/cmain.c
+++ b/grub-core/kern/ieee1275/cmain.c
@@ -88,6 +88,9 @@ grub_ieee1275_find_options (void)
if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
is_qemu = 1;
+ if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS);
+
if (grub_strncmp (tmp, "PowerMac", sizeof ("PowerMac") - 1) == 0)
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS);
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index fb85db9..99a4bc1 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -116,6 +116,8 @@ enum grub_ieee1275_flag
1 address cell is used on PowerMacs.
*/
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS,
+
+ GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS
};
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
--
1.7.10.1

View file

@ -1,94 +0,0 @@
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}"); 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

@ -1,25 +0,0 @@
From e3c5e7e3accaced35b3e3ee367068d14bbce91bf Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 10 May 2012 16:31:29 -0400
Subject: [PATCH] Specifying .png in @image doesn't work - leaving it out
---
docs/grub-dev.texi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
index 51b4787..ddde5e9 100644
--- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi
@@ -1689,7 +1689,7 @@ right edges of two adjacent glyphs. The @strong{device width} field determines
the effective leading value that is used to render the font.
@end itemize
-@image{font_char_metrics,,,,.png}
+@image{font_char_metrics,,,,}
An illustration of how the various font metrics apply to characters.
--
1.7.10.1

View file

@ -1,16 +0,0 @@
From: Marko Ristola <marko.ristola@kolumbus.fi>
Date: 2011-08-07 07:43:01 EDT
Subject: [PATCH] Xen also uses initramfs not initrd filename
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
--- a/util/grub.d/20_linux_xen.in 2011-05-17 17:10:29 +0000
+++ b/util/grub.d/20_linux_xen.in 2011-09-14 19:02:23 +0000
@@ -154,6 +154,7 @@
for i in "initrd.img-${version}" "initrd-${version}.img" \
"initrd-${version}" "initrd.img-${alt_version}" \
"initrd-${alt_version}.img" "initrd-${alt_version}" \
+ "initramfs-${version}.img" "initramfs-${alt_version}" \
"initramfs-genkernel-${version}" \
"initramfs-genkernel-${alt_version}" ; do
if test -e "${dirname}/${i}" ; then

View file

@ -6,14 +6,14 @@
%ifarch x86_64
%define _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu}
%endif
#sparc is always compile 64 bit
# sparc is always compiled 64 bit
%ifarch %{sparc}
%define _target_platform sparc64-%{_vendor}-%{_target_os}%{?_gnu}
%endif
%if ! 0%{?efi}
%global efi %{ix86} x86_64 ia64
%global efiarchs %{ix86} x86_64 ia64
%ifarch %{ix86}
%global grubefiarch i386-efi
@ -51,21 +51,16 @@ Source0: ftp://alpha.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz
Source3: README.Fedora
Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz
Source5: theme.tar.bz2
Patch0: grub-1.99-handle-fwrite-return.patch
Patch1: grub-1.99-grub_test_assert_printf.patch
Patch0: grub-2.00-ieee1276.patch
Patch1: grub-2.00-no-canon.patch
Patch2: grub-1.99-just-say-linux.patch
Patch3: grub2-handle-initramfs-on-xen.patch
Patch4: grub-1.99-Fix-tests-of-zeroed-partition.patch
Patch5: grub-1.99-ppc-terminfo.patch
Patch7: grub-2.00~beta4-add-support-for-PowerMac-HFS-partitions.patch
Patch8: grub2-2.0-no-png-in-texi.patch
Patch9: grub-2.00-Fix-module-trampoline-for-ppc.patch
Patch10: grub-2.00-add-fw_path-search.patch
Patch11: grub-2.00-Add-fwsetup.patch
Patch12: grub-2.00-ppc-no-tree-scanning.patch
Patch13: grub-2.00-Dont-set-boot-on-ppc.patch
Patch14: grub-2.00-ignore-gnulib-gets-stupidity.patch
Patch15: grub-2.00-linux-mbr.patch
Patch16: grub-2.00-no-huge-video.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -73,8 +68,10 @@ BuildRequires: flex bison binutils python
BuildRequires: ncurses-devel xz-devel
BuildRequires: freetype-devel libusb-devel
%ifarch %{sparc} x86_64
# sparc builds need 64 bit glibc-devel - also for 32 bit userland
BuildRequires: /usr/lib64/crt1.o glibc-static
%else
# ppc64 builds need the ppc crt1.o
BuildRequires: /usr/lib/crt1.o glibc-static
%endif
BuildRequires: autoconf automake autogen device-mapper-devel
@ -87,8 +84,7 @@ Requires: %{name}-tools = %{epoch}:%{version}-%{release}
Requires(pre): dracut
Requires(post): dracut
# ExclusiveArch: %{ix86} x86_64 %{sparc}
ExcludeArch: s390 s390x
ExcludeArch: s390 s390x %{arm}
%description
The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
@ -96,7 +92,7 @@ bootloader with modular architecture. It support rich varietyof kernel formats,
file systems, computer architectures and hardware devices. This subpackage
provides support for PC BIOS systems.
%ifarch %{efi}
%ifarch %{efiarchs}
%package efi
Summary: GRUB for EFI systems.
Group: System Environment/Base
@ -122,7 +118,7 @@ provides tools for support of all platforms.
%prep
%setup -T -c -n grub-%{tarversion}
%ifarch %{efi}
%ifarch %{efiarchs}
%setup -D -q -T -a 0 -n grub-%{tarversion}
cd grub-%{tarversion}
cp %{SOURCE3} .
@ -150,7 +146,7 @@ git commit -a -q -m "%{tarversion} baseline."
git am %{patches}
%build
%ifarch %{efi}
%ifarch %{efiarchs}
cd grub-efi-%{tarversion}
./autogen.sh
%configure \
@ -218,7 +214,7 @@ sed -i -e 's,/boot/grub/,/boot/%{name}/,g' \
set -e
rm -fr $RPM_BUILD_ROOT
%ifarch %{efi}
%ifarch %{efiarchs}
cd grub-efi-%{tarversion}
make DESTDIR=$RPM_BUILD_ROOT install
@ -334,7 +330,7 @@ fi
%ghost %config(noreplace) /boot/%{name}/grub.cfg
%doc grub-%{tarversion}/COPYING
%ifarch %{efi}
%ifarch %{efiarchs}
%files efi
%defattr(-,root,root,-)
%{_libdir}/grub/%{grubefiarch}