diff --git a/ChangeLog b/ChangeLog index f3fa4d4c0..a727bd4ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,59 @@ +2011-01-06 Colin Watson + + * 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 + + * 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 + + 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 + + * util/grub-install.in: Determine ofpathname, nvsetenv and efibootmgr + only when needed. + +2011-01-05 Vladimir Serbinenko + + * grub-core/term/terminfo.c (grub_terminfo_readkey): Handle keys with + CTRL. + +2011-01-05 Vladimir Serbinenko + + 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 + + * 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 + + * grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Check md/%s + names. + Reported by: David Pravec. + 2011-01-04 Vladimir Serbinenko * grub-core/disk/i386/pc/biosdisk.c (GRUB_MOD_INIT): Workaround buggy diff --git a/grub-core/kern/emu/getroot.c b/grub-core/kern/emu/getroot.c index a4cfaffc9..df3a4d765 100644 --- a/grub-core/kern/emu/getroot.c +++ b/grub-core/kern/emu/getroot.c @@ -135,8 +135,12 @@ grub_find_root_device_from_mountinfo (const char *dir, char **relroot) continue; 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 || - (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; /* 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__ { char *mdadm_name = get_mdadm_name (os_dev); + struct stat st; if (mdadm_name) { - free (grub_dev); - grub_dev = xasprintf ("md/%s", mdadm_name); + char *newname; + 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); } } diff --git a/grub-core/lib/efi/relocator.c b/grub-core/lib/efi/relocator.c index fc4de834b..0d346bea3 100644 --- a/grub-core/lib/efi/relocator.c +++ b/grub-core/lib/efi/relocator.c @@ -62,13 +62,25 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events) (char *) desc < ((char *) descs + mmapsize); 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) continue; events[counter].type = REG_FIRMWARE_START; - events[counter].pos = desc->physical_start; + events[counter].pos = start; counter++; events[counter].type = REG_FIRMWARE_END; - events[counter].pos = desc->physical_start + (desc->num_pages << 12); + events[counter].pos = end; counter++; } @@ -85,6 +97,9 @@ grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size) if (grub_efi_is_finished) 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; status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS, GRUB_EFI_LOADER_DATA, size >> 12, &address); diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c index 84cf1a17f..08cdcda37 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -252,7 +252,7 @@ struct grub_e820_mmap #define GRUB_E820_RESERVED 2 #define GRUB_E820_ACPI 3 #define GRUB_E820_NVS 4 -#define GRUB_E820_EXEC_CODE 5 +#define GRUB_E820_BADRAM 5 static void generate_e820_mmap (grub_size_t *len, grub_size_t *cnt, void *buf) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 95aa6b456..ca88c7403 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -418,9 +418,9 @@ grub_linux_boot (void) addr, size, GRUB_E820_NVS); break; - case GRUB_MEMORY_CODE: + case GRUB_MEMORY_BADRAM: grub_e820_add_region (params->e820_map, &e820_num, - addr, size, GRUB_E820_EXEC_CODE); + addr, size, GRUB_E820_BADRAM); break; default: diff --git a/grub-core/term/ieee1275/ofconsole.c b/grub-core/term/ieee1275/ofconsole.c index 2b0bddbbb..ab74f21da 100644 --- a/grub-core/term/ieee1275/ofconsole.c +++ b/grub-core/term/ieee1275/ofconsole.c @@ -170,6 +170,8 @@ grub_ofconsole_init_output (struct grub_term_output *term) grub_ofconsole_dimensions (); + grub_terminfo_output_init (term); + return 0; } diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c index d36388359..e672a89d6 100644 --- a/grub-core/term/serial.c +++ b/grub-core/term/serial.c @@ -104,6 +104,7 @@ static struct grub_term_input grub_serial_term_input = static struct grub_term_output grub_serial_term_output = { .name = "serial", + .init = grub_terminfo_output_init, .putchar = grub_terminfo_putchar, .getwh = grub_terminfo_getwh, .getxy = grub_terminfo_getxy, diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c index d01811959..0a8c75c74 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -403,6 +403,8 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, /* Backspace: Ctrl-h. */ if (c == 0x7f) c = '\b'; + if (c < 0x20 && c != '\t' && c!= '\b' && c != '\n' && c != '\r') + c = GRUB_TERM_CTRL | (c - 1 + 'a'); *len = 1; keys[0] = c; return; @@ -512,6 +514,13 @@ grub_terminfo_input_init (struct grub_term_input *termi) 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. */ static grub_err_t diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h index 63f99db62..9ba83eee2 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -68,7 +68,7 @@ #define GRUB_E820_RESERVED 2 #define GRUB_E820_ACPI 3 #define GRUB_E820_NVS 4 -#define GRUB_E820_EXEC_CODE 5 +#define GRUB_E820_BADRAM 5 #define GRUB_E820_MAX_ENTRY 128 diff --git a/include/grub/terminfo.h b/include/grub/terminfo.h index 8317995d8..5a552b327 100644 --- a/include/grub/terminfo.h +++ b/include/grub/terminfo.h @@ -56,6 +56,7 @@ struct grub_terminfo_output_state 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, grub_uint8_t x, grub_uint8_t y); void EXPORT_FUNC(grub_terminfo_cls) (grub_term_output_t term); diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index e35d6bc65..0213376d0 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -119,6 +119,7 @@ cat <${cfgfile} grubshell=yes insmod serial serial +terminfo serial dumb terminal_input serial terminal_output serial EOF diff --git a/util/grub-install.in b/util/grub-install.in index 716582dfd..90360c279 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -56,9 +56,6 @@ debug_image= update_nvram=yes -ofpathname="`which ofpathname`" -nvsetenv="`which nvsetenv`" -efibootmgr="`which efibootmgr 2>/dev/null || true`" removable=no efi_quiet= @@ -585,6 +582,8 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" --device-map="${device_map}" "${install_device}" || exit 1 elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then if [ x"$update_nvram" = xyes ]; then + ofpathname="`which ofpathname`" + nvsetenv="`which nvsetenv`" set "$ofpathname" dummy if test -f "$1"; then : @@ -621,6 +620,7 @@ elif [ x"$platform" = xefi ]; then cp "${grubdir}/core.${imgext}" "${efidir}/${efi_file}" # Try to make this image bootable using the EFI Boot Manager, if available. + efibootmgr="`which efibootmgr`" if test "$removable" = no && test -n "$efi_distributor" && \ test -n "$efibootmgr"; then # On Linux, we need the efivars kernel modules.