merge mainline into ahci

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-03 16:03:13 +01:00
commit 092fd3a072
14 changed files with 201 additions and 48 deletions

View file

@ -1,3 +1,91 @@
2011-01-03 Dave Vasilevsky <dave@vasilevsky.ca>
* grub-core/fs/hfsplus.c: Make parent unsigned.
(grub_hfsplus_cmp_catkey): Don't compare using subtraction, it
overflows.
(grub_hfsplus_cmp_extkey): Likewise
2011-01-03 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Correctly use bootloader_id and not
GRUB_DISTRIBUTOR on efibootmgr line.
2011-01-03 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkfont.c (main): Report errors in FT_New_Face.
2010-12-31 Ian Campbell <ijc@hellion.org.uk>
* util/grub.d/20_linux_xen.in (linux_entry): Correctly capitalize
Xen and reorder menu item wording to make it clearer that this entry
will launch Xen. Print separate messages when loading Xen and
Linux.
2010-12-31 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/partmap/amiga.c (GRUB_AMIGA_PART_MAGIC): New define.
(amiga_partition_map_iterate): Check "PART" magic to avoid a very long
loop in case of incorrect amiga partmap.
2010-12-31 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/partmap/amiga.c (GRUB_AMIGA_RDSK_MAGIC): New define.
(amiga_partition_map_iterate): Use grub_memcmp instead of grub_strcmp.
Reported by:EHeM.
2010-12-31 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/bsdXX.c (grub_openbsd_find_ramdisk): Silence
spurious warning.
Reported by: crocket
2010-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/xnu.c (grub_cmd_xnu_kernel) [! GRUB_MACHINE_EFI]:
Preload EFIemu.
(grub_cmd_xnu_kernel64) [! GRUB_MACHINE_EFI]: Likewise.
2010-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/xnu.c (grub_cmd_xnu_kext): Abort if no kernel
is loaded
(grub_cmd_xnu_kextdir): Likewise.
(grub_cmd_xnu_splash): Likewise.
2010-12-27 Vladimir Serbinenko <phcoder@gmail.com>
Avoid using Reed-Solomon with 0 redundancy.
* grub-core/kern/i386/pc/startup.S: Remove 0-data check.
* grub-core/lib/reed_solomon.c (decode_block): Do not proceed on 0 data
or 0 redundancy.
(grub_reed_solomon_add_redundancy): Do not proceed with 0 redundancy.
(grub_reed_solomon_recover): Likewise.
2010-12-27 Vladimir Serbinenko <phcoder@gmail.com>
Don't use disk subsystem in freebsd_boot.
* grub-core/loader/i386/bsd.c (freebsd_bootdev): New variable.
(freebsd_biosdev): Likewise.
(grub_freebsd_boot): Use freebsd_bootdev and freebsd_biosdev.
(grub_cmd_freebsd): Set freebsd_bootdev and freebsd_biosdev.
2010-12-26 Vladimir Serbinenko <phcoder@gmail.com>
Handling of files of unknown size is currently limited. They can't be
used e.g. for initrd or modules. Moreover gzip handling of not
easily seekable files is buggy. Disable unknown file size for now. May
be inefficient but works.
* grub-core/io/gzio.c (test_header): Always retrieve the file size.
* grub-core/io/xzio.c (grub_xzio_open): Likewise.
2010-12-25 Mirko Parthey <mirko.parthey@informatik.tu-chemnitz.de>
* grub-core/boot/i386/pc/boot.S: Fix %es:%bx pointing to nowhere on
floppy probe.
2010-12-25 Jeroen Dekkers <jeroen@dekkers.ch>
* grub-core/disk/raid.c (insert_array): Don't add spurious members.

View file

@ -459,6 +459,8 @@ fd_probe_error_string: .asciz "Floppy"
1:
/* perform read */
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
movw %bx, %es
xorw %bx, %bx
movw $0x201, %ax
movb $0, %ch
movb $0, %dh

View file

@ -178,7 +178,7 @@ enum grub_hfsplus_filetype
/* Internal representation of a catalog key. */
struct grub_hfsplus_catkey_internal
{
int parent;
grub_uint32_t parent;
char *name;
};
@ -520,9 +520,12 @@ grub_hfsplus_cmp_catkey (struct grub_hfsplus_key *keya,
int i;
int diff;
diff = grub_be_to_cpu32 (catkey_a->parent) - catkey_b->parent;
if (diff)
return diff;
/* Safe unsigned comparison */
grub_uint32_t aparent = grub_be_to_cpu32 (catkey_a->parent);
if (aparent > catkey_b->parent)
return 1;
if (aparent < catkey_b->parent)
return -1;
/* Change the filename in keya so the endianness is correct. */
for (i = 0; i < grub_be_to_cpu16 (catkey_a->namelen); i++)
@ -555,15 +558,21 @@ grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya,
{
struct grub_hfsplus_extkey *extkey_a = &keya->extkey;
struct grub_hfsplus_extkey_internal *extkey_b = &keyb->extkey;
int diff;
grub_uint32_t akey;
diff = grub_be_to_cpu32 (extkey_a->fileid) - extkey_b->fileid;
if (diff)
return diff;
diff = grub_be_to_cpu32 (extkey_a->start) - extkey_b->start;
return diff;
/* Safe unsigned comparison */
akey = grub_be_to_cpu32 (extkey_a->fileid);
if (akey > extkey_b->fileid)
return 1;
if (akey < extkey_b->fileid)
return -1;
akey = grub_be_to_cpu32 (extkey_a->start);
if (akey > extkey_b->start)
return 1;
if (akey < extkey_b->start)
return -1;
return 0;
}
static char *

View file

@ -212,19 +212,18 @@ test_header (grub_file_t file)
gzio->data_offset = grub_file_tell (gzio->file);
grub_file_seek (gzio->file, grub_file_size (gzio->file) - 4);
if (grub_file_seekable (gzio->file))
{
if (grub_file_read (gzio->file, &orig_len, 4) != 4)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format");
return 0;
}
}
/* FIXME: this does not handle files whose original size is over 4GB.
But how can we know the real original size? */
file->size = grub_le_to_cpu32 (orig_len);
/* FIXME: don't do this on not easily seekable files. */
{
grub_file_seek (gzio->file, grub_file_size (gzio->file) - 4);
if (grub_file_read (gzio->file, &orig_len, 4) != 4)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format");
return 0;
}
/* FIXME: this does not handle files whose original size is over 4GB.
But how can we know the real original size? */
file->size = grub_le_to_cpu32 (orig_len);
}
initialize_tables (file);

View file

@ -222,7 +222,8 @@ grub_xzio_open (grub_file_t io)
xzio->buf.out_pos = 0;
xzio->buf.out_size = XZBUFSIZ;
if (!test_header (file) || !(grub_file_seekable (io) && test_footer (file)))
/* FIXME: don't test footer on not easily seekable files. */
if (!test_header (file) || !test_footer (file))
{
grub_errno = GRUB_ERR_NONE;
grub_file_seek (io, 0);

View file

@ -151,8 +151,6 @@ LOCAL (codestart):
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
movl reed_solomon_redundancy, %ecx
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
testl %edx, %edx
jz post_reed_solomon
call EXT_C (grub_reed_solomon_recover)
jmp post_reed_solomon

View file

@ -372,6 +372,10 @@ decode_block (gf_single_t *ptr, grub_size_t s,
grub_size_t rr = (rs + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
gf_single_t m[ds + rr];
/* Nothing to do. */
if (!ds || !rr)
continue;
for (j = 0; j < (int) ds; j++)
m[j] = ptr[SECTOR_SIZE * j + i];
for (j = 0; j < (int) rr; j++)
@ -414,6 +418,10 @@ grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size,
gf_single_t *ptr = buffer;
gf_single_t *rptr = ptr + s;
/* Nothing to do. */
if (!rs)
return;
while (s > 0)
{
grub_size_t tt;
@ -441,6 +449,10 @@ grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs)
gf_single_t *ptr = ptr_;
gf_single_t *rptr = ptr + s;
/* Nothing to do. */
if (!rs)
return;
#if defined (STANDALONE)
init_inverts ();
#endif
@ -454,8 +466,8 @@ grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs)
tt = cs + crs;
if (tt > MAX_BLOCK_SIZE)
{
cs = cs * MAX_BLOCK_SIZE / tt;
crs = crs * MAX_BLOCK_SIZE / tt;
cs = (cs * MAX_BLOCK_SIZE) / tt;
crs = (crs * MAX_BLOCK_SIZE) / tt;
}
decode_block (ptr, cs, rptr, crs);
ptr += cs;

View file

@ -521,6 +521,8 @@ grub_netbsd_list_modules (void)
/* This function would be here but it's under different license. */
#include "bsd_pagetable.c"
static grub_uint32_t freebsd_bootdev, freebsd_biosdev;
static grub_err_t
grub_freebsd_boot (void)
{
@ -528,7 +530,6 @@ grub_freebsd_boot (void)
grub_uint8_t *p, *p0;
grub_addr_t p_target;
grub_size_t p_size = 0;
grub_uint32_t bootdev, biosdev, unit, slice, part;
grub_err_t err;
grub_size_t tag_buf_len = 0;
@ -564,11 +565,7 @@ grub_freebsd_boot (void)
bi.version = FREEBSD_BOOTINFO_VERSION;
bi.length = sizeof (bi);
grub_bsd_get_device (&biosdev, &unit, &slice, &part);
bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) +
(unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT));
bi.boot_device = biosdev;
bi.boot_device = freebsd_biosdev;
p_size = 0;
grub_env_iterate (iterate_env_count);
@ -741,7 +738,7 @@ grub_freebsd_boot (void)
state.ebp = stack_target;
stack[0] = entry; /* "Return" address. */
stack[1] = bootflags | FREEBSD_RB_BOOTINFO;
stack[2] = bootdev;
stack[2] = freebsd_bootdev;
stack[3] = 0;
stack[4] = 0;
stack[5] = 0;
@ -1371,6 +1368,8 @@ grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE)
{
grub_uint32_t unit, slice, part;
kern_end = ALIGN_PAGE (kern_end);
if (is_elf_kernel)
{
@ -1414,6 +1413,10 @@ grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
if (err)
return err;
}
grub_bsd_get_device (&freebsd_biosdev, &unit, &slice, &part);
freebsd_bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) +
(unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT));
grub_loader_set (grub_freebsd_boot, grub_bsd_unload, 0);
}

View file

@ -511,7 +511,7 @@ SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file,
grub_err_t err;
Elf_Ehdr e;
Elf_Shdr *s;
char *shdr;
char *shdr = NULL;
err = read_headers (file, &e, &shdr);
if (err)

View file

@ -34,6 +34,10 @@
#include <grub/env.h>
#include <grub/i18n.h>
#if defined (__i386) && !defined (GRUB_MACHINE_EFI)
#include <grub/autoefi.h>
#endif
struct grub_xnu_devtree_key *grub_xnu_devtree_root = 0;
static int driverspackagenum = 0;
static int driversnum = 0;
@ -424,6 +428,12 @@ grub_cmd_xnu_kernel (grub_command_t cmd __attribute__ ((unused)),
if (ptr != grub_xnu_cmdline)
*(ptr - 1) = 0;
#if defined (__i386) && !defined (GRUB_MACHINE_EFI)
err = grub_efiemu_autocore ();
if (err)
return err;
#endif
grub_loader_set (grub_xnu_boot, grub_xnu_unload, 0);
grub_xnu_lock ();
@ -529,6 +539,12 @@ grub_cmd_xnu_kernel64 (grub_command_t cmd __attribute__ ((unused)),
if (ptr != grub_xnu_cmdline)
*(ptr - 1) = 0;
#if defined (__i386) && !defined (GRUB_MACHINE_EFI)
err = grub_efiemu_autocore ();
if (err)
return err;
#endif
grub_loader_set (grub_xnu_boot, grub_xnu_unload, 0);
grub_xnu_lock ();
@ -1198,6 +1214,10 @@ grub_cmd_xnu_kext (grub_command_t cmd __attribute__ ((unused)),
int argc, char *args[])
{
grub_file_t binfile = 0;
if (! grub_xnu_heap_size)
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
if (argc == 2)
{
/* User explicitly specified plist and binary. */
@ -1229,6 +1249,9 @@ grub_cmd_xnu_kextdir (grub_command_t cmd __attribute__ ((unused)),
if (argc != 1 && argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "directory name required");
if (! grub_xnu_heap_size)
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
if (argc == 1)
return grub_xnu_scan_dir_for_kexts (args[0],
"console,root,local-root,network-root",
@ -1370,6 +1393,9 @@ grub_cmd_xnu_splash (grub_extcmd_context_t ctxt,
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
if (! grub_xnu_heap_size)
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
if (ctxt->state[XNU_SPLASH_CMD_ARGINDEX_MODE].set &&
grub_strcmp (ctxt->state[XNU_SPLASH_CMD_ARGINDEX_MODE].arg,
"stretch") == 0)

View file

@ -27,6 +27,7 @@ struct grub_amiga_rdsk
{
/* "RDSK". */
grub_uint8_t magic[4];
#define GRUB_AMIGA_RDSK_MAGIC "RDSK"
grub_uint32_t size;
grub_int32_t checksum;
grub_uint32_t scsihost;
@ -43,6 +44,7 @@ struct grub_amiga_partition
{
/* "PART". */
grub_uint8_t magic[4];
#define GRUB_AMIGA_PART_MAGIC "PART"
grub_int32_t size;
grub_int32_t checksum;
grub_uint32_t scsihost;
@ -87,7 +89,8 @@ amiga_partition_map_iterate (grub_disk_t disk,
if (grub_disk_read (disk, pos, 0, sizeof (rdsk), &rdsk))
return grub_errno;
if (grub_strcmp ((char *) rdsk.magic, "RDSK") == 0)
if (grub_memcmp (rdsk.magic, GRUB_AMIGA_RDSK_MAGIC,
sizeof (rdsk.magic)) == 0)
{
/* Found the first PART block. */
next = grub_be_to_cpu32 (rdsk.partitionlst);
@ -108,6 +111,9 @@ amiga_partition_map_iterate (grub_disk_t disk,
if (grub_disk_read (disk, next, 0, sizeof (apart), &apart))
return grub_errno;
if (grub_memcmp (apart.magic, GRUB_AMIGA_PART_MAGIC,
sizeof (apart.magic)) == 0)
/* Calculate the first block and the size of the partition. */
part.start = (grub_be_to_cpu32 (apart.lowcyl)
* grub_be_to_cpu32 (apart.heads)

View file

@ -656,7 +656,7 @@ elif [ x"$platform" = xefi ]; then
efidir_disk="$(echo "$clean_devmap" | grep "^$(echo "$efidir_drive" | sed 's/,[^)]*//')" | cut -f2)"
efidir_part="$(echo "$efidir_drive" | sed 's/^([^,]*,[^0-9]*//; s/[^0-9].*//')"
efibootmgr $efi_quiet -c -d "$efidir_disk" -p "$efidir_part" -w \
-L "$GRUB_DISTRIBUTOR" -l "\\EFI\\$efi_distributor\\$efi_file"
-L "$bootloader_id" -l "\\EFI\\$efi_distributor\\$efi_file"
fi
fi
fi

View file

@ -1146,11 +1146,18 @@ main (int argc, char *argv[])
{
FT_Face ft_face;
int size;
FT_Error err;
if (FT_New_Face (ft_lib, argv[optind], font_index, &ft_face))
err = FT_New_Face (ft_lib, argv[optind], font_index, &ft_face);
if (err)
{
grub_util_info ("can't open file %s, index %d", argv[optind],
font_index);
grub_printf ("can't open file %s, index %d: error %d", argv[optind],
font_index, err);
if (err > 0 && err < (signed) ARRAY_SIZE (ft_errmsgs))
printf (": %s\n", ft_errmsgs[err]);
else
printf ("\n");
continue;
}

View file

@ -60,11 +60,11 @@ linux_entry ()
args="$5"
xen_args="$6"
if ${recovery} ; then
title="$(gettext_quoted "%s, with Linux %s and XEN %s (recovery mode)")"
title="$(gettext_quoted "%s, with Xen %s and Linux %s (recovery mode)")"
else
title="$(gettext_quoted "%s, with Linux %s and XEN %s")"
title="$(gettext_quoted "%s, with Xen %s and Linux %s")"
fi
printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}" "${xen_version}"
printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${xen_version}" "${version}"
if ! ${recovery} ; then
save_default_entry | sed -e "s/^/\t/"
fi
@ -73,10 +73,12 @@ linux_entry ()
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading Linux %s ..." ${version})"
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF
echo '$message'
echo '$xmessage'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
echo '$lmessage'
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then