merge mainline into ahci

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-12-26 11:20:12 +01:00
commit 3d5f359d3b
18 changed files with 157 additions and 36 deletions

View file

@ -1,3 +1,74 @@
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> 2010-12-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_add_module): * grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_add_module):

View file

@ -36,6 +36,7 @@ typedef uint8_t grub_uint8_t;
#ifndef GRUB_DSDT_TEST #ifndef GRUB_DSDT_TEST
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/time.h>
#include <grub/cpu/io.h> #include <grub/cpu/io.h>
#endif #endif
@ -324,6 +325,8 @@ grub_acpi_halt (void)
} }
} }
grub_millisleep (1500);
grub_printf ("ACPI shutdown failed\n"); grub_printf ("ACPI shutdown failed\n");
} }
#endif #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++) for (i = 0; i < argc; i++)
{ {
char *arg = *args; 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++; args++;
if (!unescaped)
return grub_errno;
while (*arg) while (*arg)
{ {
/* In case `-e' is used, parse backslashes. */ /* 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) switch (*arg)
{ {
case '\\': case '\\':
grub_printf ("\\"); *p++ = '\\';
break; break;
case 'a': case 'a':
grub_printf ("\a"); *p++ = '\a';
break; break;
case 'c': case 'c':
@ -70,23 +76,23 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
break; break;
case 'f': case 'f':
grub_printf ("\f"); *p++ = '\f';
break; break;
case 'n': case 'n':
grub_printf ("\n"); *p++ = '\n';
break; break;
case 'r': case 'r':
grub_printf ("\r"); *p++ = '\r';
break; break;
case 't': case 't':
grub_printf ("\t"); *p++ = '\t';
break; break;
case 'v': case 'v':
grub_printf ("\v"); *p++ = '\v';
break; break;
} }
arg++; 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 /* This was not an escaped character, or escaping is not
enabled. */ enabled. */
grub_printf ("%c", *arg); *p++ = *arg;
arg++; arg++;
} }
*p = '\0';
grub_xputs (unescaped);
grub_free (unescaped);
/* If another argument follows, insert a space. */ /* If another argument follows, insert a space. */
if (i != argc - 1) if (i != argc - 1)
grub_printf (" " ); 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 /* We found more members of the array than the array
actually has according to its superblock. This shouldn't actually has according to its superblock. This shouldn't
happen normally. */ happen normally. */
grub_dprintf ("raid", "array->nr_devs > array->total_devs (%d)?!?", return grub_error (GRUB_ERR_BAD_DEVICE,
array->total_devs); "superfluous RAID member (%d found)",
array->total_devs);
if (array->members[new_array->index].device != NULL) if (array->members[new_array->index].device != NULL)
/* We found multiple devices with the same number. Again, /* We found multiple devices with the same number. Again,
this shouldn't happen. */ this shouldn't happen. */
grub_dprintf ("raid", "Found two disks with the number %d?!?", return grub_error (GRUB_ERR_BAD_DEVICE,
new_array->number); "found two disks with the number %d",
new_array->number);
if (new_array->disk_size < array->disk_size) if (new_array->disk_size < array->disk_size)
array->disk_size = new_array->disk_size; array->disk_size = new_array->disk_size;

View file

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

View file

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

View file

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

View file

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

View file

@ -38,9 +38,9 @@
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c #define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
/* The size of the first region which won't be compressed. */ /* 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. */ /* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE #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 \ --files-from=$(srcdir)/POTFILES-shell.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \ --copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address="$$msgid_bugs_address" \ --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) \ $(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-name="$${package_gnu}@PACKAGE@" \
--package-version='@VERSION@' \ --package-version='@VERSION@' \
--msgid-bugs-address="$$msgid_bugs_address" \ --msgid-bugs-address="$$msgid_bugs_address" \
--join-existing --language=Shell --keyword=gettext_quoted \ --join-existing --language=Shell \
--keyword=gettext_quoted --keyword=gettext_printf \
;; \ ;; \
esac esac
test ! -f $(DOMAIN).po || { \ 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 \ if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ 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} cat <<EOF >>${cfgfile}
source /boot/grub/testcase.cfg source /boot/grub/testcase.cfg
# Stop serial output to suppress "ACPI shutdown failed" error.
terminal_output console
halt halt
EOF EOF

View file

@ -187,8 +187,20 @@ version_find_latest ()
echo "$a" 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_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 () { uses_abstraction () {

View file

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

View file

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

View file

@ -94,13 +94,15 @@ EOF
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi fi
printf '%s\n' "${prepare_boot_cache}" printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF cat << EOF
echo '$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})' echo '$message'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF EOF
if test -n "${initrd}" ; then if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF cat << EOF
echo '$(gettext_quoted "Loading initial ramdisk ...")' echo '$message'
initrd ${rel_dirname}/${initrd} initrd ${rel_dirname}/${initrd}
EOF EOF
fi fi

View file

@ -73,14 +73,16 @@ linux_entry ()
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi fi
printf '%s\n' "${prepare_boot_cache}" printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF cat << EOF
echo '$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})' echo '$message'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF EOF
if test -n "${initrd}" ; then if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF cat << EOF
echo '$(gettext_quoted "Loading initial ramdisk ...")' echo '$message'
module ${rel_dirname}/${initrd} module ${rel_dirname}/${initrd}
EOF EOF
fi fi

View file

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