merge trunk

This commit is contained in:
Colin Watson 2011-01-07 17:26:15 +00:00
commit b7d86d53c4
12 changed files with 108 additions and 12 deletions

View file

@ -1,3 +1,59 @@
2011-01-06 Colin Watson <cjwatson@ubuntu.com>
* tests/util/grub-shell.in: Set serial terminfo type to `dumb', to
avoid causing test failures by clearing the screen.
2011-01-06 Colin Watson <cjwatson@ubuntu.com>
* grub-core/kern/emu/getroot.c (find_root_device_from_mountinfo):
Fix prefix check to handle the case where dir ends with a slash
(most significantly, "/" itself).
Reported by: Michael Vogt.
2011-01-05 Vladimir Serbinenko <phcoder@gmail.com>
Run terminfo_cls on initing terminfo output to clear the screen and
move the cursor to (0,0).
* grub-core/term/ieee1275/ofconsole.c (grub_ofconsole_init_output):
Call grub_terminfo_output_init.
* grub-core/term/serial.c (grub_serial_term_output): Set .init.
* grub-core/term/terminfo.c (grub_terminfo_output_init): New function.
* include/grub/terminfo.h (grub_terminfo_output_init): New declaration.
2011-01-05 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Determine ofpathname, nvsetenv and efibootmgr
only when needed.
2011-01-05 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/terminfo.c (grub_terminfo_readkey): Handle keys with
CTRL.
2011-01-05 Vladimir Serbinenko <phcoder@gmail.com>
The E820 type 5 is BADRAM, not EXEC_CODE.
* grub-core/loader/i386/bsd.c (GRUB_E820_EXEC_CODE): Removed.
(GRUB_E820_BADRAM): New define.
* grub-core/loader/i386/linux.c (grub_linux_boot): Translate code
into reserved. Propagate BADRAM.
* grub-core/loader/i386/bsd.c (GRUB_E820_EXEC_CODE): Removed.
(GRUB_E820_BADRAM): New define.
2011-01-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/efi/relocator.c (grub_relocator_firmware_fill_events):
Ignore the memory post-4G.
(grub_relocator_firmware_alloc_region): Additional debug statement.
2011-01-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Check md/%s
names.
Reported by: David Pravec.
2011-01-04 Vladimir Serbinenko <phcoder@gmail.com> 2011-01-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/i386/pc/biosdisk.c (GRUB_MOD_INIT): Workaround buggy * grub-core/disk/i386/pc/biosdisk.c (GRUB_MOD_INIT): Workaround buggy

View file

@ -135,8 +135,12 @@ grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
continue; continue;
enc_path_len = strlen (enc_path); enc_path_len = strlen (enc_path);
/* Check that enc_path is a prefix of dir. The prefix must either be
the entire string, or end with a slash, or be immediately followed
by a slash. */
if (strncmp (dir, enc_path, enc_path_len) != 0 || if (strncmp (dir, enc_path, enc_path_len) != 0 ||
(dir[enc_path_len] && dir[enc_path_len] != '/')) (enc_path_len && dir[enc_path_len - 1] != '/' &&
dir[enc_path_len] && dir[enc_path_len] != '/'))
continue; continue;
/* This is a parent of the requested directory. /proc/self/mountinfo /* This is a parent of the requested directory. /proc/self/mountinfo
@ -787,11 +791,18 @@ grub_util_get_grub_dev (const char *os_dev)
#ifdef __linux__ #ifdef __linux__
{ {
char *mdadm_name = get_mdadm_name (os_dev); char *mdadm_name = get_mdadm_name (os_dev);
struct stat st;
if (mdadm_name) if (mdadm_name)
{ {
free (grub_dev); char *newname;
grub_dev = xasprintf ("md/%s", mdadm_name); newname = xasprintf ("/dev/md/%s", mdadm_name);
if (stat (newname, &st) == 0)
{
free (grub_dev);
grub_dev = xasprintf ("md/%s", mdadm_name);
}
free (newname);
free (mdadm_name); free (mdadm_name);
} }
} }

View file

@ -62,13 +62,25 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events)
(char *) desc < ((char *) descs + mmapsize); (char *) desc < ((char *) descs + mmapsize);
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
{ {
grub_uint64_t start = desc->physical_start;
grub_uint64_t end = desc->physical_start + (desc->num_pages << 12);
/* post-4G addresses are never supported on 32-bit EFI.
Moreover it has been reported that some 64-bit EFI contrary to the
spec don't map post-4G pages. So if you enable post-4G allocations,
map pages manually or check that they are mapped.
*/
if (end >= 0x100000000ULL)
end = 0x100000000ULL;
if (end <= start)
continue;
if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY) if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY)
continue; continue;
events[counter].type = REG_FIRMWARE_START; events[counter].type = REG_FIRMWARE_START;
events[counter].pos = desc->physical_start; events[counter].pos = start;
counter++; counter++;
events[counter].type = REG_FIRMWARE_END; events[counter].type = REG_FIRMWARE_END;
events[counter].pos = desc->physical_start + (desc->num_pages << 12); events[counter].pos = end;
counter++; counter++;
} }
@ -85,6 +97,9 @@ grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size)
if (grub_efi_is_finished) if (grub_efi_is_finished)
return 1; return 1;
grub_dprintf ("relocator", "EFI alloc: %llx, %llx\n",
(unsigned long long) start, (unsigned long long) size);
b = grub_efi_system_table->boot_services; b = grub_efi_system_table->boot_services;
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS, status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS,
GRUB_EFI_LOADER_DATA, size >> 12, &address); GRUB_EFI_LOADER_DATA, size >> 12, &address);

View file

@ -252,7 +252,7 @@ struct grub_e820_mmap
#define GRUB_E820_RESERVED 2 #define GRUB_E820_RESERVED 2
#define GRUB_E820_ACPI 3 #define GRUB_E820_ACPI 3
#define GRUB_E820_NVS 4 #define GRUB_E820_NVS 4
#define GRUB_E820_EXEC_CODE 5 #define GRUB_E820_BADRAM 5
static void static void
generate_e820_mmap (grub_size_t *len, grub_size_t *cnt, void *buf) generate_e820_mmap (grub_size_t *len, grub_size_t *cnt, void *buf)

View file

@ -418,9 +418,9 @@ grub_linux_boot (void)
addr, size, GRUB_E820_NVS); addr, size, GRUB_E820_NVS);
break; break;
case GRUB_MEMORY_CODE: case GRUB_MEMORY_BADRAM:
grub_e820_add_region (params->e820_map, &e820_num, grub_e820_add_region (params->e820_map, &e820_num,
addr, size, GRUB_E820_EXEC_CODE); addr, size, GRUB_E820_BADRAM);
break; break;
default: default:

View file

@ -170,6 +170,8 @@ grub_ofconsole_init_output (struct grub_term_output *term)
grub_ofconsole_dimensions (); grub_ofconsole_dimensions ();
grub_terminfo_output_init (term);
return 0; return 0;
} }

View file

@ -104,6 +104,7 @@ static struct grub_term_input grub_serial_term_input =
static struct grub_term_output grub_serial_term_output = static struct grub_term_output grub_serial_term_output =
{ {
.name = "serial", .name = "serial",
.init = grub_terminfo_output_init,
.putchar = grub_terminfo_putchar, .putchar = grub_terminfo_putchar,
.getwh = grub_terminfo_getwh, .getwh = grub_terminfo_getwh,
.getxy = grub_terminfo_getxy, .getxy = grub_terminfo_getxy,

View file

@ -403,6 +403,8 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
/* Backspace: Ctrl-h. */ /* Backspace: Ctrl-h. */
if (c == 0x7f) if (c == 0x7f)
c = '\b'; c = '\b';
if (c < 0x20 && c != '\t' && c!= '\b' && c != '\n' && c != '\r')
c = GRUB_TERM_CTRL | (c - 1 + 'a');
*len = 1; *len = 1;
keys[0] = c; keys[0] = c;
return; return;
@ -512,6 +514,13 @@ grub_terminfo_input_init (struct grub_term_input *termi)
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
grub_err_t
grub_terminfo_output_init (struct grub_term_output *term)
{
grub_terminfo_cls (term);
return GRUB_ERR_NONE;
}
/* GRUB Command. */ /* GRUB Command. */
static grub_err_t static grub_err_t

View file

@ -68,7 +68,7 @@
#define GRUB_E820_RESERVED 2 #define GRUB_E820_RESERVED 2
#define GRUB_E820_ACPI 3 #define GRUB_E820_ACPI 3
#define GRUB_E820_NVS 4 #define GRUB_E820_NVS 4
#define GRUB_E820_EXEC_CODE 5 #define GRUB_E820_BADRAM 5
#define GRUB_E820_MAX_ENTRY 128 #define GRUB_E820_MAX_ENTRY 128

View file

@ -56,6 +56,7 @@ struct grub_terminfo_output_state
void (*put) (struct grub_term_output *term, const int c); void (*put) (struct grub_term_output *term, const int c);
}; };
grub_err_t EXPORT_FUNC(grub_terminfo_output_init) (struct grub_term_output *term);
void EXPORT_FUNC(grub_terminfo_gotoxy) (grub_term_output_t term, void EXPORT_FUNC(grub_terminfo_gotoxy) (grub_term_output_t term,
grub_uint8_t x, grub_uint8_t y); grub_uint8_t x, grub_uint8_t y);
void EXPORT_FUNC(grub_terminfo_cls) (grub_term_output_t term); void EXPORT_FUNC(grub_terminfo_cls) (grub_term_output_t term);

View file

@ -119,6 +119,7 @@ cat <<EOF >${cfgfile}
grubshell=yes grubshell=yes
insmod serial insmod serial
serial serial
terminfo serial dumb
terminal_input serial terminal_input serial
terminal_output serial terminal_output serial
EOF EOF

View file

@ -56,9 +56,6 @@ debug_image=
update_nvram=yes update_nvram=yes
ofpathname="`which ofpathname`"
nvsetenv="`which nvsetenv`"
efibootmgr="`which efibootmgr 2>/dev/null || true`"
removable=no removable=no
efi_quiet= efi_quiet=
@ -585,6 +582,8 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}"
--device-map="${device_map}" "${install_device}" || exit 1 --device-map="${device_map}" "${install_device}" || exit 1
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
if [ x"$update_nvram" = xyes ]; then if [ x"$update_nvram" = xyes ]; then
ofpathname="`which ofpathname`"
nvsetenv="`which nvsetenv`"
set "$ofpathname" dummy set "$ofpathname" dummy
if test -f "$1"; then if test -f "$1"; then
: :
@ -621,6 +620,7 @@ elif [ x"$platform" = xefi ]; then
cp "${grubdir}/core.${imgext}" "${efidir}/${efi_file}" cp "${grubdir}/core.${imgext}" "${efidir}/${efi_file}"
# Try to make this image bootable using the EFI Boot Manager, if available. # Try to make this image bootable using the EFI Boot Manager, if available.
efibootmgr="`which efibootmgr`"
if test "$removable" = no && test -n "$efi_distributor" && \ if test "$removable" = no && test -n "$efi_distributor" && \
test -n "$efibootmgr"; then test -n "$efibootmgr"; then
# On Linux, we need the efivars kernel modules. # On Linux, we need the efivars kernel modules.