From a75f4f62ae0a2142ee3cf49fa0b0d7c31ec1afcb Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 2 Nov 2010 22:51:51 +0000 Subject: [PATCH 1/9] * util/bin2h.c (main): Fix spelling error in generated output. --- ChangeLog | 4 ++++ util/bin2h.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c92c49562..843056669 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-11-02 Colin Watson + + * util/bin2h.c (main): Fix spelling error in generated output. + 2010-11-01 Grégoire Sutre * grub-core/partmap/bsdlabel.c (iterate_real): Fix an integer overflow. diff --git a/util/bin2h.c b/util/bin2h.c index e81ede8c6..ee1c7fd32 100644 --- a/util/bin2h.c +++ b/util/bin2h.c @@ -96,7 +96,7 @@ main (int argc, char *argv[]) if (b == EOF) goto abort; - printf ("/* THIS CHUNK OF BYTES IS AUTOMATICALY GENERATED */\n" + printf ("/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n" "unsigned char %s[] =\n{\n", sym); while (1) From 1a3aaff40fb877607809adc26335fde56a7d7925 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Thu, 4 Nov 2010 13:58:29 +0100 Subject: [PATCH 2/9] 2010-11-04 Robert Millan * util/deviceiter.c (grub_util_iterate_devices): Increase SCSI limit to 48 (to cope with Sun Fire X4500), and IDE limit to 96 (its SATA disks are detected as slaveless IDE master drives on kFreeBSD). Reported by Carsten Aulbert. --- ChangeLog | 8 ++++++++ util/deviceiter.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 843056669..42100ed78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-11-04 Robert Millan + + * util/deviceiter.c (grub_util_iterate_devices): Increase SCSI + limit to 48 (to cope with Sun Fire X4500), and IDE limit to 96 + (its SATA disks are detected as slaveless IDE master drives on + kFreeBSD). + Reported by Carsten Aulbert. + 2010-11-02 Colin Watson * util/bin2h.c (main): Fix spelling error in generated output. diff --git a/util/deviceiter.c b/util/deviceiter.c index 1cf511934..34d34b7bb 100644 --- a/util/deviceiter.c +++ b/util/deviceiter.c @@ -601,7 +601,7 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int), #endif /* __linux__ */ /* IDE disks. */ - for (i = 0; i < 26; i++) + for (i = 0; i < 96; i++) { char name[16]; @@ -655,7 +655,7 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int), #endif /* __linux__ */ /* The rest is SCSI disks. */ - for (i = 0; i < 26; i++) + for (i = 0; i < 48; i++) { char name[16]; From b9b3839f6dcbac86a86472496397b076445b62f9 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Fri, 5 Nov 2010 19:48:55 +0100 Subject: [PATCH 3/9] 2010-11-05 Robert Millan On Yeeloong, pass machine type information to Linux. * grub-core/loader/mips/linux.c [GRUB_MACHINE_MIPS_YEELOONG] (LOONGSON_MACHTYPE): New macro, set to "machtype=lemote-yeeloong-2f-8.9inches". [LOONGSON_MACHTYPE] (grub_cmd_linux): Pass LOONGSON_MACHTYPE as additional argument to Linux. --- ChangeLog | 10 ++++++++++ grub-core/loader/mips/linux.c | 26 +++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 42100ed78..d9d2ebbe5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-11-05 Robert Millan + + On Yeeloong, pass machine type information to Linux. + + * grub-core/loader/mips/linux.c [GRUB_MACHINE_MIPS_YEELOONG] + (LOONGSON_MACHTYPE): New macro, set to + "machtype=lemote-yeeloong-2f-8.9inches". + [LOONGSON_MACHTYPE] (grub_cmd_linux): Pass LOONGSON_MACHTYPE as + additional argument to Linux. + 2010-11-04 Robert Millan * util/deviceiter.c (grub_util_iterate_devices): Increase SCSI diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c index 44ab64eb5..7b1836982 100644 --- a/grub-core/loader/mips/linux.c +++ b/grub-core/loader/mips/linux.c @@ -32,6 +32,14 @@ #include #include +#ifdef GRUB_MACHINE_MIPS_YEELOONG +/* This can be detected on runtime from PMON, but: + a) it wouldn't work when GRUB is the firmware + and + b) for now we only support Yeeloong anyway. */ +#define LOONGSON_MACHTYPE "machtype=lemote-yeeloong-2f-8.9inches" +#endif + static grub_dl_t my_mod; static int loaded; @@ -214,6 +222,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* For arguments. */ linux_argc = argc; +#ifdef LOONGSON_MACHTYPE + linux_argc++; +#endif /* Main arguments. */ size = (linux_argc) * sizeof (grub_uint32_t); /* Initrd address and size. */ @@ -226,7 +237,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* Normal arguments. */ for (i = 1; i < argc; i++) size += ALIGN_UP (grub_strlen (argv[i]) + 1, 4); - +#ifdef LOONGSON_MACHTYPE + size += ALIGN_UP (sizeof (LOONGSON_MACHTYPE), 4); +#endif + /* rd arguments. */ size += ALIGN_UP (sizeof ("rd_start=0xXXXXXXXXXXXXXXXX"), 4); size += ALIGN_UP (sizeof ("rd_size=0xXXXXXXXXXXXXXXXX"), 4); @@ -263,6 +277,16 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), linux_argv++; linux_args += ALIGN_UP (sizeof ("a0"), 4); +#ifdef LOONGSON_MACHTYPE + /* In Loongson platform, it is the responsibility of the bootloader/firmware + to supply the OS kernel with machine type information. */ + grub_memcpy (linux_args, LOONGSON_MACHTYPE, sizeof (LOONGSON_MACHTYPE)); + *linux_argv = (grub_uint8_t *) linux_args - (grub_uint8_t *) playground + + target_addr; + linux_argv++; + linux_args += ALIGN_UP (sizeof (LOONGSON_MACHTYPE), 4); +#endif + for (i = 1; i < argc; i++) { grub_memcpy (linux_args, argv[i], grub_strlen (argv[i]) + 1); From 6c9e4c0c8940cdd5160cd526ca28ab33630f021c Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Fri, 5 Nov 2010 22:56:14 +0100 Subject: [PATCH 4/9] 2010-11-05 Robert Millan * util/grub-mkconfig.in: Remove gfxterm.mod probe (no longer needed). --- ChangeLog | 5 +++++ util/grub-mkconfig.in | 14 -------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9d2ebbe5..906ebec69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-05 Robert Millan + + * util/grub-mkconfig.in: Remove gfxterm.mod probe (no longer + needed). + 2010-11-05 Robert Millan On Yeeloong, pass machine type information to Linux. diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index b59911cd0..73f730131 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -168,20 +168,6 @@ fi for x in ${GRUB_TERMINAL_OUTPUT}; do if [ "x${x}" = "xgfxterm" ]; then - # If this platform supports gfxterm, try to use it. - if ! test -e ${GRUB_PREFIX}/gfxterm.mod ; then - if [ "x$termoutdefault" != "x1" ]; then - echo "gfxterm isn't available on your platform" >&2 ; exit 1 - fi - GRUB_TERMINAL_OUTPUT= - break; - fi - if [ ! -s "${GRUB_PREFIX}/video.lst" ] ; then - if [ "x$termoutdefault" != "x1" ]; then - echo "No suitable backend could be found for gfxterm." >&2 ; exit 1 - fi - GRUB_TERMINAL_OUTPUT= - fi if [ -n "$GRUB_FONT" ] ; then if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then GRUB_FONT_PATH=${GRUB_FONT} From 9c693bd66a9546a6000c2b7151f9f62e6074f28b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 6 Nov 2010 20:40:08 +0100 Subject: [PATCH 5/9] Properly register serial terminfo. Reported by: Jordan Uggla * grub-core/term/serial.c (grub_serial_terminfo_input_template): New const. (grub_serial_terminfo_output_template): Likewise. (grub_cmd_serial): Register "serial" with terminfo. (GRUB_MOD_INIT(serial)): Fill grub_serial_terminfo_input and grub_serial_terminfo_output. --- ChangeLog | 12 ++++++++++++ grub-core/term/serial.c | 18 ++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 906ebec69..5185bb380 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-11-06 Vladimir Serbinenko + + Properly register serial terminfo. + Reported by: Jordan Uggla + + * grub-core/term/serial.c (grub_serial_terminfo_input_template): New + const. + (grub_serial_terminfo_output_template): Likewise. + (grub_cmd_serial): Register "serial" with terminfo. + (GRUB_MOD_INIT(serial)): Fill grub_serial_terminfo_input and + grub_serial_terminfo_output. + 2010-11-05 Robert Millan * util/grub-mkconfig.in: Remove gfxterm.mod probe (no longer diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c index 1ef17aa25..d36388359 100644 --- a/grub-core/term/serial.c +++ b/grub-core/term/serial.c @@ -69,7 +69,7 @@ serial_fetch (grub_term_input_t term) return data->port->driver->fetch (data->port); } -struct grub_serial_input_state grub_serial_terminfo_input = +const struct grub_serial_input_state grub_serial_terminfo_input_template = { .tinfo = { @@ -77,7 +77,7 @@ struct grub_serial_input_state grub_serial_terminfo_input = } }; -struct grub_serial_output_state grub_serial_terminfo_output = +const struct grub_serial_output_state grub_serial_terminfo_output_template = { .tinfo = { @@ -87,6 +87,10 @@ struct grub_serial_output_state grub_serial_terminfo_output = } }; +struct grub_serial_input_state grub_serial_terminfo_input; + +struct grub_serial_output_state grub_serial_terminfo_output; + int registered = 0; static struct grub_term_input grub_serial_term_input = @@ -216,6 +220,8 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) { if (!registered) { + grub_terminfo_output_register (&grub_serial_term_output, "vt100"); + grub_term_register_input ("serial", &grub_serial_term_input); grub_term_register_output ("serial", &grub_serial_term_output); } @@ -337,6 +343,14 @@ GRUB_MOD_INIT(serial) cmd = grub_register_extcmd ("serial", grub_cmd_serial, 0, N_("[OPTIONS...]"), N_("Configure serial port."), options); + grub_memcpy (&grub_serial_terminfo_output, + &grub_serial_terminfo_output_template, + sizeof (grub_serial_terminfo_output)); + + grub_memcpy (&grub_serial_terminfo_input, + &grub_serial_terminfo_input_template, + sizeof (grub_serial_terminfo_input)); + #ifndef GRUB_MACHINE_EMU grub_ns8250_init (); #endif From 6972dea93712cacfd20c13a1c7eb7382e574ee36 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 6 Nov 2010 21:37:13 +0100 Subject: [PATCH 6/9] * util/grub-install.in: Replace useless recomendation to pass --modules with a recomendation to report a bug. --- ChangeLog | 5 +++++ util/grub-install.in | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5185bb380..8dea7854c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-06 Vladimir Serbinenko + + * util/grub-install.in: Replace useless recomendation to pass + --modules with a recomendation to report a bug. + 2010-11-06 Vladimir Serbinenko Properly register serial terminfo. diff --git a/util/grub-install.in b/util/grub-install.in index 8b0f5ebe1..20b3cab46 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -466,9 +466,9 @@ fi # Create the core image. First, auto-detect the filesystem module. fs_module=`$grub_probe --target=fs --device ${grub_device}` -if test "x$fs_module" = x -a "x$modules" = x; then - echo "Auto-detection of a filesystem module failed." 1>&2 - echo "Please specify the module with the option \`--modules' explicitly." 1>&2 +if test "x$fs_module" = x ; then + echo "Auto-detection of a filesystem of ${grub_device} failed." 1>&2 + echo "Please report this together with the output of \"$grub_probe --target=fs -v ${grubdir}\" to " 1>&2 exit 1 fi From 34706ddc061427713d45894d4a54498461df92ae Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 6 Nov 2010 21:54:24 +0100 Subject: [PATCH 7/9] * grub-core/fs/ntfs.c (grub_ntfs_uuid): Make uppercase. --- ChangeLog | 4 ++++ grub-core/fs/ntfs.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8dea7854c..24ef00f8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-11-06 Vladimir Serbinenko + + * grub-core/fs/ntfs.c (grub_ntfs_uuid): Make uppercase. + 2010-11-06 Vladimir Serbinenko * util/grub-install.in: Replace useless recomendation to pass diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c index dd041e23a..414f6513d 100644 --- a/grub-core/fs/ntfs.c +++ b/grub-core/fs/ntfs.c @@ -1072,7 +1072,11 @@ grub_ntfs_uuid (grub_device_t device, char **uuid) data = grub_ntfs_mount (disk); if (data) { + char *ptr; *uuid = grub_xasprintf ("%016llx", (unsigned long long) data->uuid); + if (*uuid) + for (ptr = *uuid; *ptr; ptr++) + *ptr = grub_toupper (*ptr); } else *uuid = NULL; From 4a1a0153c347f378ee9c43527ca8233bcd21ee1c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 6 Nov 2010 23:52:56 +0100 Subject: [PATCH 8/9] * include/grub/emu/misc.h: Don't include grub/util/libzfs.h. * include/grub/emu/misc.h (grub_get_libzfs_handle): Move from here ... * include/grub/util/libzfs.h (grub_get_libzfs_handle): ... here. --- ChangeLog | 6 ++++++ include/grub/emu/misc.h | 3 --- include/grub/util/libzfs.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24ef00f8d..e7ffe6403 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-11-06 Vladimir Serbinenko + + * include/grub/emu/misc.h: Don't include grub/util/libzfs.h. + * include/grub/emu/misc.h (grub_get_libzfs_handle): Move from here ... + * include/grub/util/libzfs.h (grub_get_libzfs_handle): ... here. + 2010-11-06 Vladimir Serbinenko * grub-core/fs/ntfs.c (grub_ntfs_uuid): Make uppercase. diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 47a80d3d7..ef0d18300 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -24,7 +24,6 @@ #include #include -#include #ifdef __CYGWIN__ # include @@ -79,6 +78,4 @@ extern char * canonicalize_file_name (const char *path); int grub_device_mapper_supported (void); #endif -libzfs_handle_t *grub_get_libzfs_handle (void); - #endif /* GRUB_EMU_MISC_H */ diff --git a/include/grub/util/libzfs.h b/include/grub/util/libzfs.h index 0500f70d7..a02caa335 100644 --- a/include/grub/util/libzfs.h +++ b/include/grub/util/libzfs.h @@ -42,4 +42,6 @@ extern nvlist_t *zpool_get_config (zpool_handle_t *, nvlist_t **); #endif /* ! HAVE_LIBZFS_H */ +libzfs_handle_t *grub_get_libzfs_handle (void); + #endif From 80c6d25eef6eb48a2c349b19ddb1b33d70333ebe Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 7 Nov 2010 00:10:49 +0100 Subject: [PATCH 9/9] * grub-core/kern/emu/hostdisk.c (convert_system_partition_to_system_disk): Handle devices like "sdaa1". --- ChangeLog | 5 +++++ grub-core/kern/emu/hostdisk.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7ffe6403..9faa0121d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-07 Vladimir Serbinenko + + * grub-core/kern/emu/hostdisk.c + (convert_system_partition_to_system_disk): Handle devices like "sdaa1". + 2010-11-06 Vladimir Serbinenko * include/grub/emu/misc.h: Don't include grub/util/libzfs.h. diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c index 08f60ee66..12dbe7469 100644 --- a/grub-core/kern/emu/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -1152,16 +1152,22 @@ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st) || strncmp ("sd", p, 2) == 0) && p[2] >= 'a' && p[2] <= 'z') { - /* /dev/[hsv]d[a-z][0-9]* */ - p[3] = '\0'; + char *pp = p + 2; + while (*pp >= 'a' && *pp <= 'z') + pp++; + /* /dev/[hsv]d[a-z]+[0-9]* */ + *pp = '\0'; return path; } /* If this is a Xen virtual block device. */ if ((strncmp ("xvd", p, 3) == 0) && p[3] >= 'a' && p[3] <= 'z') { - /* /dev/xvd[a-z][0-9]* */ - p[4] = '\0'; + char *pp = p + 3; + while (*pp >= 'a' && *pp <= 'z') + pp++; + /* /dev/xvd[a-z]+[0-9]* */ + *pp = '\0'; return path; }