update to grub 2.0 rc1

- drop backports of changes already included in 2.0rc1
- update grub-2.00-Add-fwsetup.patch
This commit is contained in:
Mads Kiilerich 2012-06-25 15:24:45 +02:00 committed by Peter Jones
parent 8205bedc55
commit 3734d8af18
11 changed files with 21 additions and 675 deletions

View File

@ -16,22 +16,22 @@ specific value and reboot.
6 files changed, 139 insertions(+)
create mode 100644 grub-core/commands/efi/efifwsetup.c
diff --git a/ChangeLog b/ChangeLog
index ce52576..29ebcbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-24 Peter Jones <pjones@redhat.com>
+
+ * grub-core/Makefile.core.def: add efifwsetup module
+ * grub-core/commands/efi/efifwsetup.c: add code for fwsetup command
+ * grub-core/kern/efi/efi.c (grub_efi_set_variable): New function
+ * include/grub/efi/api.h: add define for OsIndications variable
+ * include/grub/efi/efi.h: export grub_efi_set_variable
+
2012-05-31 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Bump to beta6.
#diff --git a/ChangeLog b/ChangeLog
#index ce52576..29ebcbd 100644
#--- a/ChangeLog
#+++ b/ChangeLog
#@@ -1,3 +1,11 @@
#+2012-05-24 Peter Jones <pjones@redhat.com>
#+
#+ * grub-core/Makefile.core.def: add efifwsetup module
#+ * grub-core/commands/efi/efifwsetup.c: add code for fwsetup command
#+ * grub-core/kern/efi/efi.c (grub_efi_set_variable): New function
#+ * include/grub/efi/api.h: add define for OsIndications variable
#+ * include/grub/efi/efi.h: export grub_efi_set_variable
#+
# 2012-05-31 Vladimir Serbinenko <phcoder@gmail.com>
#
# * 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
@ -181,9 +181,9 @@ index 6f12c76..7a418a6 100644
+ return grub_error (GRUB_ERR_IO, "could not set EFI variable `%s'", var);
+}
+
grub_uint64_t
grub_rtc_get_time_ms (void)
{
#pragma GCC diagnostic ignored "-Wcast-align"
/* Search the mods section from the PE32/PE32+ image. This code uses
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 26127de..a47a4e3 100644
--- a/include/grub/efi/api.h

View File

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

View File

@ -1,26 +0,0 @@
From f66d54b934710f54999debb72e8b7c620edece1d Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 25 May 2012 15:28:19 -0400
Subject: [PATCH] gnulib accused in build breaking shocker.
---
grub-core/gnulib/stdio.in.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/grub-core/gnulib/stdio.in.h b/grub-core/gnulib/stdio.in.h
index 80b9dbf..69932d9 100644
--- a/grub-core/gnulib/stdio.in.h
+++ b/grub-core/gnulib/stdio.in.h
@@ -141,7 +141,9 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
#undef gets
+#if 0
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
--
1.7.10.1

View File

@ -1,82 +0,0 @@
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"),

View File

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

@ -1,17 +0,0 @@
From: Vladimir Serbinenko <phcoder@gmail.com>
Subject: Avoid double-free in grub-probe
Date: 2012-06-05 15:16:14 +0000
=== modified file 'util/grub-probe.c'
--- a/util/grub-probe.c 2012-06-05 09:31:10 +0000
+++ b/util/grub-probe.c 2012-06-05 15:16:14 +0000
@@ -169,8 +169,6 @@
}
*d = 0;
- free ((char *) orig_path);
-
return new_path;
}

View File

@ -1,67 +0,0 @@
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,157 +0,0 @@
From 1f1ddb93b57618a20b2adf7096ca1b21e2d252cc Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 6 Jun 2012 11:12:12 -0400
Subject: [PATCH] Fixes for IBM PPC ieee1275 support.
---
ChangeLog | 17 +++++++++++++++++
util/grub-probe.c | 19 ++++++++++++++-----
util/ieee1275/ofpath.c | 39 +++++++++++++++++++++++++++++++++------
3 files changed, 64 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e00c07c..4568bdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2012-06-05 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/grub-probe.c (escape_of_path): Don't add ieee1275/.
+ (probe): Add ieee1275 to OFW devices.
+
+2012-06-04 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/ieee1275/ofpath.c (of_path_of_scsi): Fix wrong format specifier.
+
+2012-06-04 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Handle IBM OFW path.
+
+ * util/ieee1275/ofpath.c (find_obppath): Use devspec if obppath isn't
+ available.
+ (of_path_of_scsi): Handle vdevice.
+
2012-05-24 Peter Jones <pjones@redhat.com>
* grub-core/Makefile.core.def: add efifwsetup module
diff --git a/util/grub-probe.c b/util/grub-probe.c
index 8beb1bc..4db259b 100644
--- a/util/grub-probe.c
+++ b/util/grub-probe.c
@@ -157,11 +157,10 @@ escape_of_path (const char *orig_path)
if (!strchr (orig_path, ','))
return (char *) xstrdup (orig_path);
- new_path = xmalloc (strlen (orig_path) * 2 + sizeof ("ieee1275/"));
+ new_path = xmalloc (strlen (orig_path) * 2 + 1);
p = orig_path;
- grub_strcpy (new_path, "ieee1275/");
- d = new_path + sizeof ("ieee1275/") - 1;
+ d = new_path;
while ((c = *p++) != '\0')
{
if (c == ',')
@@ -499,9 +498,14 @@ probe (const char *path, char **device_names, char delim)
if (ofpath)
{
+ char *tmp = xmalloc (strlen (ofpath) + sizeof ("ieee1275/"));
+ char *p;
+ p = stpcpy (tmp, "ieee1275/");
+ strcpy (p, ofpath);
printf ("--hint-ieee1275='");
- print_full_name (ofpath, dev);
+ print_full_name (tmp, dev);
printf ("' ");
+ free (tmp);
}
biosname = guess_bios_drive (*curdev);
@@ -611,7 +615,12 @@ probe (const char *path, char **device_names, char delim)
if (ofpath)
{
- print_full_name (ofpath, dev);
+ char *tmp = xmalloc (strlen (ofpath) + sizeof ("ieee1275/"));
+ char *p;
+ p = stpcpy (tmp, "ieee1275/");
+ strcpy (p, ofpath);
+ print_full_name (tmp, dev);
+ free (tmp);
putchar (delim);
}
diff --git a/util/ieee1275/ofpath.c b/util/ieee1275/ofpath.c
index 03baced..c7f7cdf 100644
--- a/util/ieee1275/ofpath.c
+++ b/util/ieee1275/ofpath.c
@@ -65,7 +65,9 @@ grub_util_info (const char *fmt, ...)
fputc ('\n', stderr);
}
+#define grub_util_warn grub_util_info
#define _(x) x
+#define xstrdup strdup
#endif
static void
@@ -120,6 +122,12 @@ find_obppath (const char *sysfs_path_orig)
fd = open(path, O_RDONLY);
if (fd < 0 || fstat (fd, &st) < 0)
{
+ snprintf(path, path_size, "%s/devspec", sysfs_path);
+ fd = open(path, O_RDONLY);
+ }
+
+ if (fd < 0 || fstat (fd, &st) < 0)
+ {
kill_trailing_dir(sysfs_path);
if (!strcmp(sysfs_path, "/sys"))
{
@@ -391,17 +399,36 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev
disk_name = "disk";
digit_string = trailing_digits (device);
- if (*digit_string == '\0')
+ if (strncmp (of_path, "/vdevice/", sizeof ("/vdevice/") - 1) == 0)
{
- snprintf(disk, sizeof (disk), "/%s@%x,%d", disk_name, tgt, lun);
+ unsigned long id = 0x8000 | (tgt << 8) | (bus << 5) | lun;
+ if (*digit_string == '\0')
+ {
+ snprintf(disk, sizeof (disk), "/%s@%04lx000000000000", disk_name, id);
+ }
+ else
+ {
+ int part;
+
+ sscanf(digit_string, "%d", &part);
+ snprintf(disk, sizeof (disk),
+ "/%s@%04lx000000000000:%c", disk_name, id, 'a' + (part - 1));
+ }
}
else
{
- int part;
+ if (*digit_string == '\0')
+ {
+ snprintf(disk, sizeof (disk), "/%s@%x,%d", disk_name, tgt, lun);
+ }
+ else
+ {
+ int part;
- sscanf(digit_string, "%d", &part);
- snprintf(disk, sizeof (disk),
- "/%s@%x,%d:%c", disk_name, tgt, lun, 'a' + (part - 1));
+ sscanf(digit_string, "%d", &part);
+ snprintf(disk, sizeof (disk),
+ "/%s@%x,%d:%c", disk_name, tgt, lun, 'a' + (part - 1));
+ }
}
strcat(of_path, disk);
return of_path;
--
1.7.10.2

View File

@ -1,89 +0,0 @@
From a2bf9168b1a0e964b9db4bd2887aafdcf400d772 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 6 Jun 2012 12:14:19 -0400
Subject: [PATCH] Quiesce USB transactions on ppc.
---
grub-core/disk/ieee1275/ofdisk.c | 32 +++++++++++++++++++++++++++++
grub-core/loader/powerpc/ieee1275/linux.c | 2 ++
2 files changed, 34 insertions(+)
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
index 7266af6..b5bb713 100644
--- a/grub-core/disk/ieee1275/ofdisk.c
+++ b/grub-core/disk/ieee1275/ofdisk.c
@@ -23,6 +23,7 @@
#include <grub/ieee1275/ieee1275.h>
#include <grub/ieee1275/ofdisk.h>
#include <grub/i18n.h>
+#include <grub/time.h>
static char *last_devpath;
static grub_ieee1275_ihandle_t last_ihandle;
@@ -475,6 +476,34 @@ grub_ofdisk_init (void)
grub_disk_dev_register (&grub_ofdisk_dev);
}
+static int quiesce (struct grub_ieee1275_devalias *alias)
+{
+ static grub_ieee1275_ihandle_t ihandle;
+ struct set_color_args
+ {
+ struct grub_ieee1275_common_hdr common;
+ grub_ieee1275_cell_t method;
+ grub_ieee1275_cell_t ihandle;
+ grub_ieee1275_cell_t catch_result;
+ }
+ args;
+
+ if (grub_strcmp (alias->type, "usb") != 0)
+ return 0;
+
+
+ if (grub_ieee1275_open (alias->path, &ihandle))
+ return 0;
+
+ INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 1);
+ args.method = (grub_ieee1275_cell_t) "usb-quiesce";
+ args.ihandle = ihandle;
+
+ IEEE1275_CALL_ENTRY_FN (&args);
+ grub_ieee1275_close (ihandle);
+ return 0;
+}
+
void
grub_ofdisk_fini (void)
{
@@ -483,5 +512,8 @@ grub_ofdisk_fini (void)
last_ihandle = 0;
last_devpath = NULL;
+ grub_ieee1275_devices_iterate (quiesce);
+ grub_millisleep (10);
+
grub_disk_dev_unregister (&grub_ofdisk_dev);
}
diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c
index 5cfa988..a1abc2a 100644
--- a/grub-core/loader/powerpc/ieee1275/linux.c
+++ b/grub-core/loader/powerpc/ieee1275/linux.c
@@ -28,6 +28,7 @@
#include <grub/i18n.h>
#include <grub/memory.h>
#include <grub/lib/cmdline.h>
+#include <grub/cache.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -102,6 +103,7 @@ grub_linux_boot (void)
kernel_entry_t linuxmain;
grub_ssize_t actual;
+ grub_arch_sync_caches ((void *) linux_addr, linux_size);
/* Set the command line arguments. */
grub_ieee1275_set_property (grub_ieee1275_chosen, "bootargs", linux_args,
grub_strlen (linux_args) + 1, &actual);
--
1.7.10.2

View File

@ -1,162 +0,0 @@
From 6eb367e8ca2799f1ebfaeaa0fe69fe79c1aea884 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 6 Dec 2005 15:22:29 +0000
Subject: [PATCH] Support vscsi on IBM machines.
Support vscsi on IBM machines.
Tested by: Paulo Flabiano Smorigo.
Crucial information about API supplied by: Coleen <Last name unknown>.
Reviewed by: Coleen <Last name unknown>.
---
ChangeLog | 8 ++++
grub-core/disk/ieee1275/ofdisk.c | 91 ++++++++++++++++++++++++++++++--------
2 files changed, 80 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4568bdb..6765e38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/disk/ieee1275/ofdisk.c (scan): Support vscsi on IBM
+ machines.
+ Tested by: Paulo Flabiano Smorigo.
+ Crucial information about API supplied by: Coleen <Last name unknown>.
+ Reviewed by: Coleen <Last name unknown>.
+
2012-06-05 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-probe.c (escape_of_path): Don't add ieee1275/.
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
index 6b734f7..eb3ff4f 100644
--- a/grub-core/disk/ieee1275/ofdisk.c
+++ b/grub-core/disk/ieee1275/ofdisk.c
@@ -115,33 +115,28 @@ ofdisk_hash_add (char *devpath, char *curcan)
static void
scan (void)
{
- auto int dev_iterate_real (struct grub_ieee1275_devalias *alias,
- int use_name);
+ auto int dev_iterate_real (const char *name, const char *path);
- int dev_iterate_real (struct grub_ieee1275_devalias *alias, int use_name)
+ int dev_iterate_real (const char *name, const char *path)
{
struct ofdisk_hash_ent *op;
+ grub_dprintf ("disk", "disk name = %s, path = %s\n", name,
+ path);
- if (grub_strcmp (alias->type, "block") != 0)
- return 0;
-
- grub_dprintf ("disk", "disk name = %s, path = %s\n", alias->name,
- alias->path);
-
- op = ofdisk_hash_find (alias->path);
+ op = ofdisk_hash_find (path);
if (!op)
{
- char *name = grub_strdup (use_name ? alias->name : alias->path);
- char *can = grub_strdup (alias->path);
- if (!name || !can)
+ char *name_dup = grub_strdup (name);
+ char *can = grub_strdup (path);
+ if (!name_dup || !can)
{
grub_errno = GRUB_ERR_NONE;
- grub_free (name);
+ grub_free (name_dup);
grub_free (can);
return 0;
}
- op = ofdisk_hash_add (name, can);
+ op = ofdisk_hash_add (name_dup, can);
}
return 0;
}
@@ -149,18 +144,76 @@ scan (void)
auto int dev_iterate_alias (struct grub_ieee1275_devalias *alias);
int dev_iterate_alias (struct grub_ieee1275_devalias *alias)
{
- return dev_iterate_real (alias, 1);
+ if (grub_strcmp (alias->type, "block") != 0)
+ return 0;
+ return dev_iterate_real (alias->name, alias->path);
}
auto int dev_iterate (struct grub_ieee1275_devalias *alias);
int dev_iterate (struct grub_ieee1275_devalias *alias)
{
- return dev_iterate_real (alias, 0);
+ if (grub_strcmp (alias->type, "vscsi") == 0)
+ {
+ static grub_ieee1275_ihandle_t ihandle;
+ struct set_color_args
+ {
+ struct grub_ieee1275_common_hdr common;
+ grub_ieee1275_cell_t method;
+ grub_ieee1275_cell_t ihandle;
+ grub_ieee1275_cell_t catch_result;
+ grub_ieee1275_cell_t nentries;
+ grub_ieee1275_cell_t table;
+ }
+ args;
+ char *buf, *bufptr;
+ unsigned i;
+
+ if (grub_ieee1275_open (alias->path, &ihandle))
+ return 0;
+
+ INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3);
+ args.method = (grub_ieee1275_cell_t) "vscsi-report-luns";
+ args.ihandle = ihandle;
+ args.table = 0;
+ args.nentries = 0;
+
+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+ {
+ grub_ieee1275_close (ihandle);
+ return 0;
+ }
+
+ buf = grub_malloc (grub_strlen (alias->path) + 32);
+ if (!buf)
+ return 0;
+ bufptr = grub_stpcpy (buf, alias->path);
+
+ for (i = 0; i < args.nentries; i++)
+ {
+ grub_uint64_t *ptr;
+
+ ptr = *(grub_uint64_t **) (args.table + 4 + 8 * i);
+ while (*ptr)
+ {
+ grub_snprintf (bufptr, 32, "/disk@%" PRIxGRUB_UINT64_T, *ptr++);
+ if (dev_iterate_real (buf, buf))
+ return 1;
+ }
+ }
+ grub_ieee1275_close (ihandle);
+ grub_free (buf);
+ return 0;
+ }
+
+ if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS)
+ && grub_strcmp (alias->type, "block") == 0)
+ return dev_iterate_real (alias->path, alias->path);
+
+ return grub_children_iterate (alias->path, dev_iterate);
}
grub_devalias_iterate (dev_iterate_alias);
- if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS))
- grub_ieee1275_devices_iterate (dev_iterate);
+ grub_children_iterate ("/", dev_iterate);
}
static int
--
1.7.10.2

View File

@ -33,13 +33,13 @@
%endif
%global tarversion 2.00~beta6
%global tarversion 2.00~rc1
%undefine _missing_build_ids_terminate_build
Name: grub2
Epoch: 1
Version: 2.0
Release: 0.37.beta6%{?dist}
Release: 0.37.rc1%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
@ -50,20 +50,11 @@ 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-2.00-ieee1276.patch
Patch1: grub-2.00-no-canon.patch
Patch2: grub-1.99-just-say-linux.patch
Patch5: grub-1.99-ppc-terminfo.patch
Patch10: grub-2.00-add-fw_path-search.patch
Patch11: grub-2.00-Add-fwsetup.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
Patch17: grub-2.00-ppc-hints.patch
Patch18: grub-2.00-support-vscsi-on-ibm-ppc.patch
Patch19: grub-2.00-ppc-usb-quiesce.patch
Patch20: grub-2.00-no-double-free.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)