merge mainline into filesys branch

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-12-31 15:02:07 +01:00
commit 2f70097d3e
28 changed files with 326 additions and 94 deletions

141
ChangeLog
View file

@ -1,3 +1,138 @@
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.
2010-12-25 Shea Levy <shlevy>
* grub-core/genmod.sh.in: Use @OBJCOPY@ rather than objcopy.
2010-12-25 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/30_os-prober.in: Don't emit drivemap directive for
Windows Server 2008.
Reported by: Devin Giddings.
2010-12-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/acpihalt.c (grub_acpi_halt): Sleep for 1.5 before
writing an error message because of async power management.
* grub-core/kern/mips/yeeloong/init.c (grub_halt): Likewise.
(grub_reboot): Likewise.
2010-12-23 Jordan Uggla <jordan.uggla@gmail.com>
* tests/util/grub-shell.in: Suppress "ACPI shutdown failed" error to
keep unit tests from failing when they shouldn't.
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
* include/grub/offsets.h (GRUB_KERNEL_I386_PC_RAW_SIZE): The
previous patch increased the size of the RS code by 20 bytes (at
least with gcc-4.4), so increase this by 20 bytes to match.
(GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART): Likewise.
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
* grub-core/lib/reed_solomon.c (gauss_solve): Fix size of standalone
scratch area. Make sure to initialise chosen in standalone mode as
well as non-standalone.
Reported by: Robert Hooker and Andy Whitcroft.
Tested by: Andy Whitcroft.
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
* grub-core/commands/echo.c (grub_cmd_echo): Make UTF-8-clean by
constructing a new unescaped string and passing it to grub_xputs in
one go, rather than passing characters to grub_printf one at a time.
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
* grub-core/fs/udf.c (read_string): Pacify GCC warning by
initialising utf16.
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig_lib.in (gettext_quoted): Add clarifying
comment. Add an extra layer of quotation, requiring the output of
this function to be used in a printf format string.
(gettext_printf): New function.
* util/grub.d/10_hurd.in: Use gettext_printf where appropriate.
Extract translatable strings from here-documents and use a temporary
variable instead, so that xgettext can find them.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/20_linux_xen.in: Likewise.
* po/grub.d.sed: New file.
* po/Makefile.in.in ($(DOMAIN).pot-update): Extract gettext_printf
arguments. Set c-format flags on all strings extracted from
util/grub.d/ (xgettext refuses to include these itself for strings
it extracted from a shell file, but these really are c-format).
2010-12-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_add_module):
Avoid next pointing to nowhere.
2010-12-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/affs.c (grub_affs_mount): Read data->bblock.rootblock
@ -20,6 +155,12 @@
(read_string): .. here.
(grub_udf_label): Use read_string.
2010-12-19 BVK Chaitanya <bvk.groups@gmail.com>
* grub-core/normal/menu_entry.c (run): Execute commands from menu
editor under argument scope.
Reported by: Jordan Uggla
2010-12-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkfont.c (main): Handle errors from FT_Set_Pixel_Sizes.

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

@ -36,6 +36,7 @@ typedef uint8_t grub_uint8_t;
#ifndef GRUB_DSDT_TEST
#include <grub/misc.h>
#include <grub/time.h>
#include <grub/cpu/io.h>
#endif
@ -324,6 +325,8 @@ grub_acpi_halt (void)
}
}
grub_millisleep (1500);
grub_printf ("ACPI shutdown failed\n");
}
#endif

View file

@ -44,8 +44,14 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
for (i = 0; i < argc; i++)
{
char *arg = *args;
/* Unescaping results in a string no longer than the original. */
char *unescaped = grub_malloc (grub_strlen (arg) + 1);
char *p = unescaped;
args++;
if (!unescaped)
return grub_errno;
while (*arg)
{
/* In case `-e' is used, parse backslashes. */
@ -58,11 +64,11 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
switch (*arg)
{
case '\\':
grub_printf ("\\");
*p++ = '\\';
break;
case 'a':
grub_printf ("\a");
*p++ = '\a';
break;
case 'c':
@ -70,23 +76,23 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
break;
case 'f':
grub_printf ("\f");
*p++ = '\f';
break;
case 'n':
grub_printf ("\n");
*p++ = '\n';
break;
case 'r':
grub_printf ("\r");
*p++ = '\r';
break;
case 't':
grub_printf ("\t");
*p++ = '\t';
break;
case 'v':
grub_printf ("\v");
*p++ = '\v';
break;
}
arg++;
@ -95,10 +101,14 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
/* This was not an escaped character, or escaping is not
enabled. */
grub_printf ("%c", *arg);
*p++ = *arg;
arg++;
}
*p = '\0';
grub_xputs (unescaped);
grub_free (unescaped);
/* If another argument follows, insert a space. */
if (i != argc - 1)
grub_printf (" " );

View file

@ -522,14 +522,16 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
/* We found more members of the array than the array
actually has according to its superblock. This shouldn't
happen normally. */
grub_dprintf ("raid", "array->nr_devs > array->total_devs (%d)?!?",
array->total_devs);
return grub_error (GRUB_ERR_BAD_DEVICE,
"superfluous RAID member (%d found)",
array->total_devs);
if (array->members[new_array->index].device != NULL)
/* We found multiple devices with the same number. Again,
this shouldn't happen. */
grub_dprintf ("raid", "Found two disks with the number %d?!?",
new_array->number);
return grub_error (GRUB_ERR_BAD_DEVICE,
"found two disks with the number %d",
new_array->number);
if (new_array->disk_size < array->disk_size)
array->disk_size = new_array->disk_size;

View file

@ -792,7 +792,7 @@ fail:
static char *
read_string (grub_uint8_t *raw, grub_size_t sz)
{
grub_uint16_t *utf16;
grub_uint16_t *utf16 = NULL;
char *ret;
grub_size_t utf16len = 0;

View file

@ -35,7 +35,7 @@ deps=`grep ^$modname: $moddep | sed s@^.*:@@`
rm -f $tmpfile $outfile
# stripout .modname and .moddeps sections from input module
objcopy -R .modname -R .moddeps $infile $tmpfile
@OBJCOPY@ -R .modname -R .moddeps $infile $tmpfile
# Attach .modname and .moddeps sections
t1=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
@ -45,9 +45,9 @@ t2=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
for dep in $deps; do printf "$dep\0" >> $t2; done
if test -n "$deps"; then
objcopy --add-section .modname=$t1 --add-section .moddeps=$t2 $tmpfile
@OBJCOPY@ --add-section .modname=$t1 --add-section .moddeps=$t2 $tmpfile
else
objcopy --add-section .modname=$t1 $tmpfile
@OBJCOPY@ --add-section .modname=$t1 $tmpfile
fi
rm -f $t1 $t2

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

@ -223,6 +223,8 @@ grub_halt (void)
grub_outb (grub_inb (GRUB_CPU_LOONGSON_GPIOCFG)
& ~GRUB_CPU_LOONGSON_SHUTDOWN_GPIO, GRUB_CPU_LOONGSON_GPIOCFG);
grub_millisleep (1500);
grub_printf ("Shutdown failed\n");
grub_refresh ();
while (1);
@ -239,6 +241,8 @@ grub_reboot (void)
{
grub_write_ec (GRUB_MACHINE_EC_COMMAND_REBOOT);
grub_millisleep (1500);
grub_printf ("Reboot failed\n");
grub_refresh ();
while (1);

View file

@ -18,6 +18,8 @@
#ifdef TEST
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define xmalloc malloc
#define grub_memset memset
#define grub_memcpy memcpy
@ -25,8 +27,6 @@
#ifndef STANDALONE
#ifdef TEST
#include <string.h>
#include <stdlib.h>
typedef unsigned int grub_size_t;
typedef unsigned char grub_uint8_t;
typedef unsigned short grub_uint16_t;
@ -45,6 +45,7 @@ typedef unsigned char grub_uint8_t;
typedef unsigned short grub_uint16_t;
#else
#include <grub/types.h>
#include <grub/misc.h>
#endif
void
grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs);
@ -207,11 +208,12 @@ gauss_solve (gf_single_t *eq, int n, int m, gf_single_t *sol)
#ifndef STANDALONE
chosen = xmalloc (n * sizeof (int));
grub_memset (chosen, -1, n * sizeof (int));
#else
chosen = (void *) scratch;
scratch += n;
scratch += n * sizeof (int);
#endif
for (i = 0; i < n; i++)
chosen[i] = -1;
for (i = 0; i < m; i++)
sol[i] = 0;
gauss_eliminate (eq, n, m, chosen);
@ -228,7 +230,7 @@ gauss_solve (gf_single_t *eq, int n, int m, gf_single_t *sol)
#ifndef STANDALONE
free (chosen);
#else
scratch -= n;
scratch -= n * sizeof (int);
#endif
}
@ -370,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++)
@ -412,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;
@ -439,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
@ -452,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

@ -641,6 +641,7 @@ grub_multiboot_add_module (grub_addr_t start, grub_size_t size,
return grub_errno;
newmod->start = start;
newmod->size = size;
newmod->next = 0;
for (i = 0; i < argc; i++)
len += grub_strlen (argv[i]) + 1;

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

@ -1163,37 +1163,35 @@ clear_completions_all (struct screen *screen)
static int
run (struct screen *screen)
{
int currline = 0;
char *nextline;
char *script;
int errs_before;
grub_menu_t menu;
char *dummy[1] = { NULL };
auto grub_err_t editor_getline (char **line, int cont);
grub_err_t editor_getline (char **line, int cont __attribute__ ((unused)))
{
struct line *linep = screen->lines + currline;
char *p;
auto char * editor_getsource (void);
char * editor_getsource (void)
{
int i;
int size = 0;
char *source;
if (currline > screen->num_lines)
{
*line = 0;
return 0;
}
for (i = 0; i < screen->num_lines; i++)
size += screen->lines[i].len + 1;
/* Trim down space characters. */
for (p = linep->buf + linep->len - 1;
p >= linep->buf && grub_isspace (*p);
p--)
;
*++p = '\0';
source = grub_malloc (size + 1);
if (! source)
return NULL;
linep->len = p - linep->buf;
for (p = linep->buf; grub_isspace (*p); p++)
;
*line = grub_strdup (p);
currline++;
return 0;
}
size = 0;
for (i = 0; i < screen->num_lines; i++)
{
grub_strcpy (source + size, screen->lines[i].buf);
size += screen->lines[i].len;
source[size++] = '\n';
}
source[size] = '\0';
return source;
}
grub_cls ();
grub_printf (" ");
@ -1212,12 +1210,11 @@ run (struct screen *screen)
}
/* Execute the script, line for line. */
while (currline < screen->num_lines)
{
editor_getline (&nextline, 0);
if (grub_normal_parse_line (nextline, editor_getline))
break;
}
script = editor_getsource ();
if (! script)
return 0;
grub_script_execute_sourcecode (script, 0, dummy);
grub_free (script);
if (errs_before != grub_err_printed_errors)
grub_wait_after_message ();

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;
@ -87,7 +88,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);

View file

@ -38,9 +38,9 @@
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
/* The size of the first region which won't be compressed. */
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xc90
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xca4
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x6f8
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x70c
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE

View file

@ -173,7 +173,8 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in $(srcdir)/POTFILES-shell
--files-from=$(srcdir)/POTFILES-shell.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address="$$msgid_bugs_address" \
--join-existing --language=Shell --keyword=gettext_quoted \
--join-existing --language=Shell \
--keyword=gettext_quoted --keyword=gettext_printf \
;; \
*) \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
@ -183,10 +184,13 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in $(srcdir)/POTFILES-shell
--package-name="$${package_gnu}@PACKAGE@" \
--package-version='@VERSION@' \
--msgid-bugs-address="$$msgid_bugs_address" \
--join-existing --language=Shell --keyword=gettext_quoted \
--join-existing --language=Shell \
--keyword=gettext_quoted --keyword=gettext_printf \
;; \
esac
test ! -f $(DOMAIN).po || { \
sed -f grub.d.sed < $(DOMAIN).po > $(DOMAIN).1po && \
mv $(DOMAIN).1po $(DOMAIN).po; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \

2
po/grub.d.sed Normal file
View file

@ -0,0 +1,2 @@
/^#: util\/grub\.d\//a\
#, c-format

View file

@ -132,6 +132,8 @@ done
cat <<EOF >>${cfgfile}
source /boot/grub/testcase.cfg
# Stop serial output to suppress "ACPI shutdown failed" error.
terminal_output console
halt
EOF

View file

@ -187,8 +187,20 @@ version_find_latest ()
echo "$a"
}
# One layer of quotation is eaten by "", the second by sed, and the third by
# printf; so this turns ' into \'. Note that you must use the output of
# this function in a printf format string.
gettext_quoted () {
$gettext "$@" | sed "s/'/'\\\\''/g"
$gettext "$@" | sed "s/'/'\\\\\\\\''/g"
}
# Run the first argument through gettext_quoted, and then pass that and all
# remaining arguments to printf. This is a useful abbreviation and tends to
# be easier to type.
gettext_printf () {
local format="$1"
shift
printf "$(gettext_quoted "$format")" "$@"
}
uses_abstraction () {

View file

@ -81,14 +81,16 @@ do
menuentry "${OS} ${KERNEL}" ${CLASS} {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading GNU Mach ...")"
cat << EOF
echo '$(gettext_quoted "Loading GNU Mach ...")'
echo '$message'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading the Hurd ...")"
cat << EOF
echo '$(gettext_quoted "Loading the Hurd ...")'
echo '$message'
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\
@ -103,13 +105,15 @@ EOF
menuentry "${OS} ${KERNEL} (recovery mode)" ${CLASS} {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading GNU Mach ...")"
cat << EOF
echo '$(gettext_quoted "Loading GNU Mach ...")'
echo '$message'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} -s
EOF
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
message="$(gettext_printf "Loading the Hurd ...")"
cat << EOF
echo '$(gettext_quoted "Loading the Hurd ...")'
echo '$message'
module /hurd/${hurd_fs}.static ${hurd_fs} \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\

View file

@ -84,8 +84,9 @@ kfreebsd_entry ()
fi
printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})"
cat << EOF
echo '$(printf "$(gettext_quoted "Loading kernel of FreeBSD %s ...")" ${version})'
echo '$message'
kfreebsd ${rel_dirname}/${basename} ${args}
EOF

View file

@ -94,13 +94,15 @@ EOF
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})"
cat << EOF
echo '$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})'
echo '$message'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF
echo '$(gettext_quoted "Loading initial ramdisk ...")'
echo '$message'
initrd ${rel_dirname}/${initrd}
EOF
fi

View file

@ -73,14 +73,16 @@ 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})"
cat << EOF
echo '$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})'
echo '$message'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF
echo '$(gettext_quoted "Loading initial ramdisk ...")'
echo '$message'
module ${rel_dirname}/${initrd}
EOF
fi

View file

@ -111,7 +111,7 @@ EOF
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
case ${LONGNAME} in
Windows\ Vista*|Windows\ 7*)
Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
;;
*)
cat << EOF