merge trunk

This commit is contained in:
Colin Watson 2011-02-17 14:51:11 +00:00
commit 28f9509eb7
42 changed files with 467 additions and 108 deletions

View file

@ -303,7 +303,7 @@ platform_DATA += moddep.lst
CLEANFILES += config.log syminfo.lst moddep.lst
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
sh $^ $@
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
platform_DATA += $(MOD_FILES)
CLEANFILES += $(MOD_FILES)

View file

@ -324,6 +324,7 @@ image = {
name = fwstart;
mips_yeeloong = boot/mips/yeeloong/fwstart.S;
objcopyflags = '-O binary';
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_yeeloong;
};
@ -1464,7 +1465,6 @@ module = {
name = ieee1275_fb;
ieee1275 = video/ieee1275.c;
enable = powerpc;
enable = sparc64;
};
module = {

View file

@ -38,7 +38,7 @@ write_bases (void)
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
& GRUB_MACHINE_PCI_WIN_MASK)
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
<< (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
}

View file

@ -62,11 +62,10 @@ ofdisk_hash_find (const char *devpath)
}
static struct ofdisk_hash_ent *
ofdisk_hash_add (char *devpath)
ofdisk_hash_add_real (char *devpath)
{
struct ofdisk_hash_ent *p;
struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)];
struct ofdisk_hash_ent *p, *pcan;
char *curcan;
p = grub_malloc(sizeof (*p));
if (!p)
@ -76,17 +75,27 @@ ofdisk_hash_add (char *devpath)
p->next = *head;
p->shortest = 0;
*head = p;
return p;
}
static struct ofdisk_hash_ent *
ofdisk_hash_add (char *devpath, char *curcan)
{
struct ofdisk_hash_ent *p, *pcan;
p = ofdisk_hash_add_real (devpath);
grub_dprintf ("disk", "devpath = %s, canonical = %s\n", devpath, curcan);
curcan = grub_ieee1275_canonicalise_devname (devpath);
if (!curcan)
{
grub_errno = GRUB_ERR_NONE;
p->shortest = devpath;
return p;
}
pcan = ofdisk_hash_find (curcan);
if (!pcan)
pcan = ofdisk_hash_add (curcan);
pcan = ofdisk_hash_add_real (curcan);
else
grub_free (curcan);
@ -118,17 +127,22 @@ scan (void)
return 0;
grub_dprintf ("disk", "disk name = %s\n", alias->name);
grub_dprintf ("disk", "disk name = %s, path = %s\n", alias->name,
alias->path);
op = ofdisk_hash_find (alias->path);
op = ofdisk_hash_find (alias->name);
if (!op)
{
char *name = grub_strdup (alias->name);
if (!name)
char *can = grub_strdup (alias->path);
if (!name || !can)
{
grub_errno = GRUB_ERR_NONE;
grub_free (name);
grub_free (can);
return 0;
}
op = ofdisk_hash_add (name);
op = ofdisk_hash_add (name, can);
}
return 0;
}
@ -247,7 +261,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
struct ofdisk_hash_ent *op;
op = ofdisk_hash_find (devpath);
if (!op)
op = ofdisk_hash_add (devpath);
op = ofdisk_hash_add (devpath, NULL);
else
grub_free (devpath);
if (!op)

View file

@ -143,7 +143,8 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
&sb))
return grub_errno;
if (grub_le_to_cpu32 (sb.magic) != SB_MAGIC)
if (grub_le_to_cpu32 (sb.magic) != SB_MAGIC
|| grub_le_to_cpu64 (sb.super_offset) != sector)
continue;
{

View file

@ -570,7 +570,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
{
for (p = array_list; p != NULL; p = p->next)
{
if (! p->name && p->number == array->number)
if (p->number == array->number)
break;
}
}

View file

@ -506,7 +506,7 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
if (scsi->blocksize != GRUB_DISK_SECTOR_SIZE)
{
unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
if (! (spb != 0 && (scsi->blocksize & GRUB_DISK_SECTOR_SIZE) == 0))
if (spb == 0 || (scsi->blocksize & (GRUB_DISK_SECTOR_SIZE - 1)) != 0)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unsupported SCSI block size");

View file

@ -281,7 +281,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
}
file->data = data;
file->not_easly_seekable = 1;
file->not_easily_seekable = 1;
grub_memcpy (file_int, file, sizeof (struct grub_file));
curr_file = file_int;

View file

@ -364,12 +364,14 @@ grub_cmd_zfs_bootfs (grub_command_t cmd __attribute__ ((unused)), int argc,
grub_free (nv);
grub_free (nvlist);
bootfs = grub_xasprintf ("zfs-bootfs=%s/%llu%s%s%s%s",
bootfs = grub_xasprintf ("zfs-bootfs=%s/%llu%s%s%s%s%s%s",
poolname, (unsigned long long) mdnobj,
bootpath ? ",bootpath=" : "",
bootpath ? : "",
devid ? ",diskdevid=" : "",
devid ? : "");
bootpath ? ",bootpath=\"" : "",
bootpath ? : "",
bootpath ? "\"" : "",
devid ? ",diskdevid=\"" : "",
devid ? : "",
devid ? "\"" : "");
if (!bootfs)
return grub_errno;
if (argc >= 2)

View file

@ -52,8 +52,8 @@ fi
rm -f $t1 $t2
if test x@TARGET_APPLE_CC@ != x1; then
if ! test -z "@TARGET_OBJ2ELF@"; then
./@TARGET_OBJ2ELF@ $tmpfile || exit 1
if ! test -z "${TARGET_OBJ2ELF}"; then
./${TARGET_OBJ2ELF} $tmpfile || exit 1
fi
if test x@platform@ != xemu; then
@STRIP@ --strip-unneeded \

View file

@ -74,7 +74,7 @@ grub_bufio_open (grub_file_t io, int size)
file->data = bufio;
file->read_hook = 0;
file->fs = &grub_bufio_fs;
file->not_easly_seekable = io->not_easly_seekable;
file->not_easily_seekable = io->not_easily_seekable;
return file;
}

View file

@ -1151,7 +1151,7 @@ grub_gzio_open (grub_file_t io)
file->data = gzio;
file->read_hook = 0;
file->fs = &grub_gzio_fs;
file->not_easly_seekable = 1;
file->not_easily_seekable = 1;
if (! test_gzip_header (file))
{

View file

@ -200,7 +200,7 @@ grub_xzio_open (grub_file_t io)
file->read_hook = 0;
file->fs = &grub_xzio_fs;
file->size = GRUB_FILE_SIZE_UNKNOWN;
file->not_easly_seekable = 1;
file->not_easily_seekable = 1;
if (grub_file_tell (xzio->file) != 0)
grub_file_seek (xzio->file, 0);

View file

@ -17,7 +17,9 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config-util.h>
#include <config.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <assert.h>

View file

@ -84,6 +84,9 @@ grub_ieee1275_find_options (void)
if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
is_qemu = 1;
if (grub_strncmp (tmp, "PowerMac", sizeof ("PowerMac") - 1) == 0)
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS);
if (is_smartfirmware)
{
/* Broken in all versions */

View file

@ -50,6 +50,12 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"couldn't examine /memory/available property");
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS))
{
address_cells = 1;
size_cells = 1;
}
/* Decode each entry and call `hook'. */
i = 0;
available_size /= sizeof (grub_uint32_t);

View file

@ -41,6 +41,7 @@ extern void grub_at_keyboard_init (void);
extern void grub_serial_init (void);
extern void grub_terminfo_init (void);
extern void grub_keylayouts_init (void);
extern void grub_boot_init (void);
/* FIXME: use interrupt to count high. */
grub_uint64_t
@ -210,6 +211,8 @@ grub_machine_init (void)
grub_terminfo_init ();
grub_serial_init ();
grub_boot_init ();
}
void

View file

@ -152,7 +152,8 @@ grub_linux_load32 (grub_elf_t elf)
Elf32_Addr base_addr;
grub_addr_t seg_addr;
grub_uint32_t align;
int offset;
grub_uint32_t offset;
Elf32_Addr entry;
linux_size = grub_elf32_size (elf, &base_addr, &align);
if (linux_size == 0)
@ -160,9 +161,12 @@ grub_linux_load32 (grub_elf_t elf)
/* Pad it; the kernel scribbles over memory beyond its load address. */
linux_size += 0x100000;
offset = elf->ehdr.ehdr32.e_entry - base_addr;
/* Linux's entry point incorrectly contains a virtual address. */
entry = elf->ehdr.ehdr32.e_entry & ~ELF32_LOADMASK;
/* Linux's incorrectly contains a virtual address. */
base_addr &= ~ELF32_LOADMASK;
offset = entry - base_addr;
/* On some systems, firmware occupies the memory we're trying to use.
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate
@ -196,7 +200,8 @@ grub_linux_load64 (grub_elf_t elf)
Elf64_Addr base_addr;
grub_addr_t seg_addr;
grub_uint64_t align;
int offset;
grub_uint64_t offset;
Elf64_Addr entry;
linux_size = grub_elf64_size (elf, &base_addr, &align);
if (linux_size == 0)
@ -204,9 +209,10 @@ grub_linux_load64 (grub_elf_t elf)
/* Pad it; the kernel scribbles over memory beyond its load address. */
linux_size += 0x100000;
offset = elf->ehdr.ehdr64.e_entry - base_addr;
/* Linux's incorrectly contains a virtual address. */
base_addr &= ~ELF64_LOADMASK;
entry = elf->ehdr.ehdr64.e_entry & ~ELF64_LOADMASK;
offset = entry - base_addr;
/* Linux's incorrectly contains a virtual address. */
/* On some systems, firmware occupies the memory we're trying to use.
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate

View file

@ -148,7 +148,7 @@ grub_env_context_close (void)
grub_err_t
grub_env_extractor_close (int source)
{
grub_menu_t menu, menu2;
grub_menu_t menu = NULL;
grub_menu_entry_t *last;
grub_err_t err;
@ -161,6 +161,7 @@ grub_env_extractor_close (int source)
if (source)
{
grub_menu_t menu2;
menu2 = grub_env_get_menu ();
last = &menu2->entry_list;

View file

@ -159,7 +159,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
{
grub_err_t err = GRUB_ERR_NONE;
int errs_before;
grub_menu_t menu;
grub_menu_t menu = NULL;
char *optr, *buf, *oldchosen = NULL, *olddefault = NULL;
const char *ptr, *chosen, *def;
grub_size_t sz = 0;

View file

@ -26,7 +26,7 @@
#include <grub/msdos_partition.h>
#ifdef GRUB_UTIL
#include <grub/util/misc.h>
#include <grub/emu/misc.h>
#endif
static struct grub_partition_map grub_bsdlabel_partition_map;
@ -101,7 +101,8 @@ iterate_real (grub_disk_t disk, grub_disk_addr_t sector, int freebsd,
#ifdef GRUB_UTIL
char *partname;
/* disk->partition != NULL as 0 < delta */
partname = grub_partition_get_name (disk->partition);
partname = disk->partition ? grub_partition_get_name (disk->partition)
: "";
grub_util_warn ("Discarding improperly nested partition (%s,%s,%s%d)",
disk->name, partname, p.partmap->name, p.number + 1);
grub_free (partname);

View file

@ -232,10 +232,10 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
break;
}
if (end >= *nsectors + 1)
if (end >= *nsectors + 2)
{
int i;
*nsectors = end - 1;
unsigned i;
*nsectors = end - 2;
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
if (!*sectors)
return grub_errno;

View file

@ -25,6 +25,8 @@
static unsigned
round_up_exp (unsigned v)
{
COMPILE_TIME_ASSERT (sizeof (v) == 4);
v--;
v |= v >> 1;
v |= v >> 2;
@ -32,9 +34,6 @@ round_up_exp (unsigned v)
v |= v >> 8;
v |= v >> 16;
if (sizeof (v) > 4)
v |= v >> 32;
v++;
v += (v == 0);