merge mainline into hints

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-24 02:52:43 +01:00
commit 2b5c1a0810
6 changed files with 53 additions and 18 deletions

View file

@ -1,3 +1,32 @@
2011-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Account for possible escaped comma in device
name.
2011-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* util/ieee1275/ofpath.c (of_path_of_ide): Fix address for secondary
channel.
2011-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/ieee1275/openfw.c (grub_devalias_iterate): Fix
allocation and zero-setting.
(grub_ieee1275_get_devname): Check that alias is complete.
2011-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/disk.c (grub_disk_read): Fix hook calling for
unaligned segments.
2011-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Add ieee1275/
prefix.
(grub_ofdisk_open): Check and discard ieee1275 prefix.
* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Add ieee1275 prefix.
2011-12-23 Vladimir Serbinenko <phcoder@gmail.com> 2011-12-23 Vladimir Serbinenko <phcoder@gmail.com>
* docs/grub.texi (Filesystems): Update. * docs/grub.texi (Filesystems): Update.

View file

@ -199,10 +199,10 @@ grub_ofdisk_iterate (int (*hook) (const char *name),
continue; continue;
{ {
char buffer[sizeof ("ieee1275/") + grub_strlen (env->shortest)]; char buffer[sizeof ("ieee1275/") + grub_strlen (ent->shortest)];
char *ptr; char *ptr;
ptr = grub_stpcpy (buffer, "ieee1275/"); ptr = grub_stpcpy (buffer, "ieee1275/");
grub_strcpy (ptr, env->shortest); grub_strcpy (ptr, ent->shortest);
if (hook (buffer)) if (hook (buffer))
return 1; return 1;
} }
@ -247,7 +247,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
char prop[64]; char prop[64];
grub_ssize_t actual; grub_ssize_t actual;
if (grub_strncmp (devpath, "ieee1275/", sizeof ("ieee1275/") - 1) != 0) if (grub_strncmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) != 0)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"not IEEE1275 device"); "not IEEE1275 device");
devpath = compute_dev_path (name + sizeof ("ieee1275/") - 1); devpath = compute_dev_path (name + sizeof ("ieee1275/") - 1);

View file

@ -607,12 +607,13 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
while (l) while (l)
{ {
(disk->read_hook) (s, o, grub_size_t cl;
((l > GRUB_DISK_SECTOR_SIZE) cl = GRUB_DISK_SECTOR_SIZE - o;
? GRUB_DISK_SECTOR_SIZE if (cl > l)
: l)); cl = l;
(disk->read_hook) (s, o, cl);
s++; s++;
l -= GRUB_DISK_SECTOR_SIZE - o; l -= cl;
o = 0; o = 0;
} }
} }

View file

@ -164,7 +164,7 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
strings, so we will add a NULL byte at the end explicitly. */ strings, so we will add a NULL byte at the end explicitly. */
pathlen += 1; pathlen += 1;
devpath = grub_malloc (pathlen); devpath = grub_malloc (pathlen + 1);
if (! devpath) if (! devpath)
{ {
grub_free (devtype); grub_free (devtype);
@ -173,12 +173,15 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
} }
if (grub_ieee1275_get_property (aliases, aliasname, devpath, pathlen, if (grub_ieee1275_get_property (aliases, aliasname, devpath, pathlen,
&actual)) &actual) || actual < 0)
{ {
grub_dprintf ("devalias", "get_property (%s) failed\n", aliasname); grub_dprintf ("devalias", "get_property (%s) failed\n", aliasname);
goto nextprop; goto nextprop;
} }
devpath [actual] = '\0'; if (actual > pathlen)
actual = pathlen;
devpath[actual] = '\0';
devpath[pathlen] = '\0';
if (grub_ieee1275_finddevice (devpath, &dev)) if (grub_ieee1275_finddevice (devpath, &dev))
{ {
@ -294,7 +297,8 @@ grub_ieee1275_get_devname (const char *path)
int match_alias (struct grub_ieee1275_devalias *curalias) int match_alias (struct grub_ieee1275_devalias *curalias)
{ {
/* briQ firmware can change capitalization in /chosen/bootpath. */ /* briQ firmware can change capitalization in /chosen/bootpath. */
if (! grub_strncasecmp (curalias->path, path, pathlen)) if (grub_strncasecmp (curalias->path, path, pathlen) == 0
&& curalias->path[pathlen] == 0)
{ {
newpath = grub_strdup (curalias->name); newpath = grub_strdup (curalias->name);
return 1; return 1;
@ -446,7 +450,7 @@ grub_ieee1275_encode_devname (const char *path)
/* GRUB partition 1 is OF partition 0. */ /* GRUB partition 1 is OF partition 0. */
partno++; partno++;
encoding = grub_xasprintf ("%s,%d", device, partno); encoding = grub_xasprintf ("ieee1275/%s,%d", device, partno);
} }
else else
encoding = grub_strdup (device); encoding = grub_strdup (device);

View file

@ -526,13 +526,13 @@ if [ "x${devabstraction_module}" = "x" ] ; then
else else
install_drive="`"$grub_probe" --device-map="${device_map}" --target=drive --device "${install_device}"`" || exit 1 install_drive="`"$grub_probe" --device-map="${device_map}" --target=drive --device "${install_device}"`" || exit 1
fi fi
install_drive="`echo "${install_drive}" | sed -e s/,[a-z0-9,]*//g`" install_drive="`echo "${install_drive}" | sed -e 's/^(\(\([^,\\\\]\|\\\\\\\\\|\\\\,\)*\)\(\(,[a-zA-Z0-9]*\)*\))$/\1/'`"
fi fi
grub_drive="`"$grub_probe" --device-map="${device_map}" --target=drive --device "${grub_device}"`" || exit 1 grub_drive="`"$grub_probe" --device-map="${device_map}" --target=drive --device "${grub_device}"`" || exit 1
# Strip partition number # Strip partition number
grub_partition="`echo "${grub_drive}" | sed -e 's/^[^,]*[,)]//; s/)$//'`" grub_partition="`echo "${grub_drive}" | sed -e 's/^(\(\([^,\\\\]\|\\\\\\\\\|\\\\,\)*\)\(\(,[a-zA-Z0-9]*\)*\))$/\3/'`"
grub_drive="`echo "${grub_drive}" | sed -e s/,[a-z0-9,]*//g`" grub_drive="`echo "${grub_drive}" | sed -e 's/^(\(\([^,\\\\]\|\\\\\\\\\|\\\\,\)*\)\(\(,[a-zA-Z0-9]*\)*\))$/\1/'`"
if ([ "x$disk_module" != x ] && [ "x$disk_module" != xbiosdisk ]) || [ "x${grub_drive}" != "x${install_drive}" ] || ([ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${platform}" != x"ieee1275" ]); then if ([ "x$disk_module" != x ] && [ "x$disk_module" != xbiosdisk ]) || [ "x${grub_drive}" != "x${install_drive}" ] || ([ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${platform}" != x"ieee1275" ]); then
# generic method (used on coreboot and ata mod) # generic method (used on coreboot and ata mod)
uuid="`"$grub_probe" --device-map="${device_map}" --target=fs_uuid --device "${grub_device}"`" uuid="`"$grub_probe" --device-map="${device_map}" --target=fs_uuid --device "${grub_device}"`"
@ -571,7 +571,8 @@ if [ "x${devabstraction_module}" = "x" ] ; then
if [ x"$grub_partition" = x ]; then if [ x"$grub_partition" = x ]; then
prefix_drive="()" prefix_drive="()"
else else
prefix_drive="(,$grub_partition)" # Comma is already there
prefix_drive="($grub_partition)"
fi fi
fi fi
else else

View file

@ -245,7 +245,7 @@ of_path_of_ide(char *of_path,
p = get_basename (sysfs_path); p = get_basename (sysfs_path);
sscanf(p, "%d.%d", &chan, &devno); sscanf(p, "%d.%d", &chan, &devno);
ret = __of_path_common(of_path, sysfs_path, device, devno); ret = __of_path_common(of_path, sysfs_path, device, 2 * chan + devno);
free (sysfs_path); free (sysfs_path);
return ret; return ret;