From 55e2c84fe32f49242b54fc90e0b6a5ade1dc1ab0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sat, 16 Nov 2013 21:11:01 +0100 Subject: [PATCH 01/40] * util/grub-install.c: Add new option --no-bootsector to skip installing of bootsector. Accept --grub-setup=/bin/true as backwards-compatible synonym. --- ChangeLog | 6 ++++++ util/grub-install.c | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46be8e6d8..0814b2b38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-16 Vladimir Serbinenko + + * util/grub-install.c: Add new option --no-bootsector to skip + installing of bootsector. Accept --grub-setup=/bin/true as + backwards-compatible synonym. + 2013-11-16 Andrey Borzenkov * util/grub-install.c (device_map_check_duplicates): Fix incorrect diff --git a/util/grub-install.c b/util/grub-install.c index 100f09379..454b7b847 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -67,6 +67,7 @@ static char * bootloader_id; static int have_load_cfg = 0; static FILE * load_cfg_f = NULL; static char *load_cfg; +static int install_bootsector = 1; enum { @@ -91,7 +92,8 @@ enum OPTION_DEBUG, OPTION_DEBUG_IMAGE, OPTION_NO_FLOPPY, - OPTION_DISK_MODULE + OPTION_DISK_MODULE, + OPTION_NO_BOOTSECTOR }; static int fs_probe = 1; @@ -110,9 +112,13 @@ argp_parser (int key, char *arg, struct argp_state *state) fs_probe = 0; return 0; + case OPTION_SETUP: + if (!grub_strstr (arg, "setup")) + install_bootsector = 0; + return 0; + /* Accept and ignore for compatibility. */ case OPTION_FONT: - case OPTION_SETUP: case OPTION_MKRELPATH: case OPTION_PROBE: case OPTION_EDITENV: @@ -170,6 +176,10 @@ argp_parser (int key, char *arg, struct argp_state *state) allow_floppy = 1; return 0; + case OPTION_NO_BOOTSECTOR: + install_bootsector = 0; + return 0; + case OPTION_DEBUG: verbosity++; return 0; @@ -224,6 +234,10 @@ static struct argp_option options[] = { {"no-nvram", OPTION_NO_NVRAM, 0, 0, N_("don't update the `boot-device' NVRAM variable. " "This option is only available on IEEE1275 targets."), 2}, + {"skip-fs-probe",'s',0, 0, + N_("do not probe for filesystems in DEVICE"), 0}, + {"no-bootsector", OPTION_NO_BOOTSECTOR, 0, 0, + N_("do not install bootsector"), 0}, {"debug", OPTION_DEBUG, 0, OPTION_HIDDEN, 0, 2}, {"no-floppy", OPTION_NO_FLOPPY, 0, OPTION_HIDDEN, 0, 2}, @@ -235,9 +249,6 @@ static struct argp_option options[] = { N_("the ID of bootloader. This option is only available on EFI."), 2}, {"efi-directory", OPTION_EFI_DIRECTORY, N_("DIR"), 0, N_("use DIR as the EFI System Partition root."), 2}, - {"skip-fs-probe",'s',0, 0, - N_("do not probe for filesystems in DEVICE"), 0}, - {0, 0, 0, 0, 0, 0} }; @@ -1388,7 +1399,8 @@ main (int argc, char *argv[]) "boot.img"); grub_install_copy_file (boot_img_src, boot_img, 1); - grub_util_info ("grub_bios_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'", + grub_util_info ("%sgrub_bios_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'", + install_bootsector ? "" : "NOT RUNNING: ", allow_floppy ? "--allow-floppy " : "", verbosity ? "--verbose " : "", force ? "--force " : "", @@ -1398,9 +1410,10 @@ main (int argc, char *argv[]) install_device); /* Now perform the installation. */ - grub_util_bios_setup (platdir, "boot.img", "core.img", - install_drive, force, - fs_probe, allow_floppy); + if (install_bootsector) + grub_util_bios_setup (platdir, "boot.img", "core.img", + install_drive, force, + fs_probe, allow_floppy); break; } case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275: @@ -1412,7 +1425,8 @@ main (int argc, char *argv[]) "boot.img"); grub_install_copy_file (boot_img_src, boot_img, 1); - grub_util_info ("grub_sparc_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'", + grub_util_info ("%sgrub_sparc_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'", + install_bootsector ? "" : "NOT RUNNING: ", allow_floppy ? "--allow-floppy " : "", verbosity ? "--verbose " : "", force ? "--force " : "", @@ -1422,9 +1436,10 @@ main (int argc, char *argv[]) install_drive); /* Now perform the installation. */ - grub_util_sparc_setup (platdir, "boot.img", "core.img", - install_device, force, - fs_probe, allow_floppy); + if (install_bootsector) + grub_util_sparc_setup (platdir, "boot.img", "core.img", + install_device, force, + fs_probe, allow_floppy); break; } From d4d55b29e0ad7df8447f3ffebb15fa35d2e6a04b Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 00:54:40 +0100 Subject: [PATCH 02/40] * util/grub-install-common.c (platforms): Fix the order of entries and remove useless field val. --- ChangeLog | 5 +++++ util/grub-install-common.c | 39 +++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0814b2b38..3f891a84e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Vladimir Serbinenko + + * util/grub-install-common.c (platforms): Fix the order of entries and + remove useless field val. + 2013-11-16 Vladimir Serbinenko * util/grub-install.c: Add new option --no-bootsector to skip diff --git a/util/grub-install-common.c b/util/grub-install-common.c index 75a315d06..c60d2df4f 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -585,28 +585,27 @@ copy_locales (const char *dstd) static struct { - enum grub_install_plat val; const char *cpu; const char *platform; -} platforms[] = +} platforms[GRUB_INSTALL_PLATFORM_MAX] = { - { GRUB_INSTALL_PLATFORM_I386_PC, "i386", "pc" }, - { GRUB_INSTALL_PLATFORM_I386_EFI, "i386", "efi" }, - { GRUB_INSTALL_PLATFORM_I386_QEMU, "i386", "qemu" }, - { GRUB_INSTALL_PLATFORM_I386_COREBOOT, "i386", "coreboot" }, - { GRUB_INSTALL_PLATFORM_I386_MULTIBOOT, "i386", "multiboot" }, - { GRUB_INSTALL_PLATFORM_I386_IEEE1275, "i386", "ieee1275" }, - { GRUB_INSTALL_PLATFORM_X86_64_EFI, "x86_64", "efi" }, - { GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel", "loongson" }, - { GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS, "mipsel", "qemu_mips" }, - { GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips", "qemu_mips" }, - { GRUB_INSTALL_PLATFORM_MIPSEL_ARC, "mipsel", "arc" }, - { GRUB_INSTALL_PLATFORM_MIPS_ARC, "mips", "arc" }, - { GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275, "sparc64", "ieee1275" }, - { GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275, "powerpc", "ieee1275" }, - { GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64", "efi" }, - { GRUB_INSTALL_PLATFORM_ARM_EFI, "arm", "efi" }, - { GRUB_INSTALL_PLATFORM_ARM_UBOOT, "arm", "uboot" }, + [GRUB_INSTALL_PLATFORM_I386_PC] = { "i386", "pc" }, + [GRUB_INSTALL_PLATFORM_I386_EFI] = { "i386", "efi" }, + [GRUB_INSTALL_PLATFORM_I386_QEMU] = { "i386", "qemu" }, + [GRUB_INSTALL_PLATFORM_I386_COREBOOT] = { "i386", "coreboot" }, + [GRUB_INSTALL_PLATFORM_I386_MULTIBOOT] = { "i386", "multiboot" }, + [GRUB_INSTALL_PLATFORM_I386_IEEE1275] = { "i386", "ieee1275" }, + [GRUB_INSTALL_PLATFORM_X86_64_EFI] = { "x86_64", "efi" }, + [GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON] = { "mipsel", "loongson" }, + [GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS] = { "mipsel", "qemu_mips" }, + [GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS] = { "mips", "qemu_mips" }, + [GRUB_INSTALL_PLATFORM_MIPSEL_ARC] = { "mipsel", "arc" }, + [GRUB_INSTALL_PLATFORM_MIPS_ARC] = { "mips", "arc" }, + [GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275] = { "sparc64", "ieee1275" }, + [GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275] = { "powerpc", "ieee1275" }, + [GRUB_INSTALL_PLATFORM_IA64_EFI] = { "ia64", "efi" }, + [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, + [GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" }, }; char * @@ -825,7 +824,7 @@ grub_install_get_target (const char *src) && strcmp (platforms[i].platform, pl) == 0) { free (fn); - return platforms[i].val; + return i; } grub_util_error (_("Unknown platform `%s-%s'"), c, pl); } From 889ebe922b50afd5241f6586f5656810972f4308 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 00:57:54 +0100 Subject: [PATCH 03/40] * tests/util/grub-shell.in: Use escc-ch-b on powerpc. This is missing counterpart of fixing the naming of escc ports. --- ChangeLog | 5 +++++ tests/util/grub-shell.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3f891a84e..6a8edf5d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Vladimir Serbinenko + + * tests/util/grub-shell.in: Use escc-ch-b on powerpc. This is missing + counterpart of fixing the naming of escc ports. + 2013-11-17 Vladimir Serbinenko * util/grub-install-common.c (platforms): Fix the order of entries and diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 22277fbdf..ddd10d106 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -79,7 +79,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in boot=hd qemu=qemu-system-ppc console=console - serial_port=escc-ch-a + serial_port=escc-ch-b serial_null="-serial null" netbootext=elf ;; From 8df6eff6daf851f470e63ca598095629ee942faa Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 01:01:47 +0100 Subject: [PATCH 04/40] * include/grub/misc.h: Replace check for __sparc64__ with one for __sparc__ as __sparc64__ isn't actually defined. --- ChangeLog | 5 +++++ include/grub/misc.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6a8edf5d7..72b8bf873 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Vladimir Serbinenko + + * include/grub/misc.h: Replace check for __sparc64__ with one for + __sparc__ as __sparc64__ isn't actually defined. + 2013-11-17 Vladimir Serbinenko * tests/util/grub-shell.in: Use escc-ch-b on powerpc. This is missing diff --git a/include/grub/misc.h b/include/grub/misc.h index 9c8faf274..3d7147797 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -465,7 +465,7 @@ EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b); #endif -#if defined (__sparc64__) || defined (__powerpc__) +#if defined (__sparc__) || defined (__powerpc__) unsigned EXPORT_FUNC (__ctzdi2) (grub_uint64_t x); #define NEED_CTZDI2 1 From 3a129dba5966b2f07cebcf22edede7dd69b11533 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 02:01:21 +0100 Subject: [PATCH 05/40] * util/grub-install-common.c (grub_install_parse): Recognize --compress=none like shell script did. --- ChangeLog | 5 +++++ util/grub-install-common.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 72b8bf873..1fc953885 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Vladimir Serbinenko + + * util/grub-install-common.c (grub_install_parse): Recognize + --compress=none like shell script did. + 2013-11-17 Vladimir Serbinenko * include/grub/misc.h: Replace check for __sparc64__ with one for diff --git a/util/grub-install-common.c b/util/grub-install-common.c index c60d2df4f..d29da380d 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -329,7 +329,8 @@ grub_install_parse (int key, char *arg) handle_install_list (&install_fonts, arg, 0); return 1; case GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS: - if (strcmp (arg, "no") == 0) + if (strcmp (arg, "no") == 0 + || strcmp (arg, "none") == 0) { compress_func = NULL; return 1; From 66c00cb159bd2317ca8b9aeb9332cb75163f9ee9 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 02:03:03 +0100 Subject: [PATCH 06/40] * util/grub-mkrescue.c (main): Use right source file for bootinfo.txt. --- ChangeLog | 4 ++++ util/grub-mkrescue.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1fc953885..365aecc9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-17 Vladimir Serbinenko + + * util/grub-mkrescue.c (main): Use right source file for bootinfo.txt. + 2013-11-17 Vladimir Serbinenko * util/grub-install-common.c (grub_install_parse): Recognize diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index 0b8c39bcb..512aca8d2 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -679,7 +679,7 @@ main (int argc, char *argv[]) char *grub_chrp = grub_util_path_concat (2, source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275], "grub.chrp"); char *bisrc = grub_util_path_concat (2, source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275], - "grub.chrp"); + "bootinfo.txt"); char *bootx = grub_util_path_concat (2, core_services, "BootX"); char *ppc_chrp = grub_util_path_concat (3, iso9660_dir, "ppc", "chrp"); char *bitgt = grub_util_path_concat (3, iso9660_dir, "ppc", "bootinfo.txt"); From 6aa6077bcc38cd00a068ceb905dfe9ee7bd9c53c Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 02:05:45 +0100 Subject: [PATCH 07/40] * util/grub-mkrescue.c (main): Add trailing \n in .disk_label.contentDetails to be in line with previous shell script. --- ChangeLog | 5 +++++ util/grub-mkrescue.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 365aecc9d..813074e75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Vladimir Serbinenko + + * util/grub-mkrescue.c (main): Add trailing \n in + .disk_label.contentDetails to be in line with previous shell script. + 2013-11-17 Vladimir Serbinenko * util/grub-mkrescue.c (main): Use right source file for bootinfo.txt. diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index 512aca8d2..df55f3dcf 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -583,7 +583,7 @@ main (int argc, char *argv[]) free (label); label_text = grub_util_path_concat (2, core_services, ".disk_label.contentDetails"); f = grub_util_fopen (label_text, "wb"); - fprintf (f, "%s", label_string); + fprintf (f, "%s\n", label_string); fclose (f); free (label_string); free (label_text); From b80c2d6d4b0c3b79d102ef8921c15db3c8f2833a Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 02:09:15 +0100 Subject: [PATCH 08/40] * tests/core_compress_test.in: Use full arguments as grub-mkimage-extra now needs full arguments. --- ChangeLog | 5 +++++ tests/core_compress_test.in | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 813074e75..23011288e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Vladimir Serbinenko + + * tests/core_compress_test.in: Use full arguments as grub-mkimage-extra + now needs full arguments. + 2013-11-17 Vladimir Serbinenko * util/grub-mkrescue.c (main): Add trailing \n in diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in index f97c0240b..1003587cc 100644 --- a/tests/core_compress_test.in +++ b/tests/core_compress_test.in @@ -27,10 +27,10 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in esac -if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=-C --grub-mkimage-extra=xz)" != "Hello World" ]; then +if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=xz)" != "Hello World" ]; then exit 1 fi -if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=-C --grub-mkimage-extra=none)" != "Hello World" ]; then +if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=none)" != "Hello World" ]; then exit 1 fi From 0ab8e025c164d07f8e23ec2f6fd382489e4d6370 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 02:13:33 +0100 Subject: [PATCH 09/40] * grub-core/tests/cmdline_cat_test.c (cmdline_cat_test): Ignore errors of loading gfxterm as gfxterm is embed in kernel on some platforms. * grub-core/tests/gfxterm_menu.c (gfxterm_menu): Likewise. Load gfxmenu. --- ChangeLog | 7 +++++++ grub-core/tests/cmdline_cat_test.c | 1 + grub-core/tests/gfxterm_menu.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 23011288e..40fd400d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-17 Vladimir Serbinenko + + * grub-core/tests/cmdline_cat_test.c (cmdline_cat_test): Ignore errors + of loading gfxterm as gfxterm is embed in kernel on some platforms. + * grub-core/tests/gfxterm_menu.c (gfxterm_menu): Likewise. + Load gfxmenu. + 2013-11-17 Vladimir Serbinenko * tests/core_compress_test.in: Use full arguments as grub-mkimage-extra diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c index 55e90a9d7..3337d34cb 100644 --- a/grub-core/tests/cmdline_cat_test.c +++ b/grub-core/tests/cmdline_cat_test.c @@ -74,6 +74,7 @@ cmdline_cat_test (void) unsigned i; grub_dl_load ("gfxterm"); + grub_errno = GRUB_ERR_NONE; if (grub_font_load ("unicode") == 0) { diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c index 915875909..68531892f 100644 --- a/grub-core/tests/gfxterm_menu.c +++ b/grub-core/tests/gfxterm_menu.c @@ -101,6 +101,10 @@ gfxterm_menu (void) grub_dl_load ("gettext"); grub_dl_load ("gfxterm"); + grub_errno = GRUB_ERR_NONE; + + grub_dl_load ("gfxmenu"); + if (grub_font_load ("unicode") == 0) { grub_test_assert (0, "unicode font not found: %s", grub_errmsg); From 77dae919b6a6cc16d660171e61c9e0ba119c7b41 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 17 Nov 2013 02:16:21 +0100 Subject: [PATCH 10/40] * tests/grub_func_test.in: Increase memory reservation as on EFI we need to leave some memory to firmware. --- ChangeLog | 5 +++++ tests/grub_func_test.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 40fd400d6..8a6f0ed46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Vladimir Serbinenko + + * tests/grub_func_test.in: Increase memory reservation as on EFI we need + to leave some memory to firmware. + 2013-11-17 Vladimir Serbinenko * grub-core/tests/cmdline_cat_test.c (cmdline_cat_test): Ignore errors diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in index c039ffde0..cfb200cf9 100644 --- a/tests/grub_func_test.in +++ b/tests/grub_func_test.in @@ -4,7 +4,7 @@ set -e . "@builddir@/grub-core/modinfo.sh" # Increase memory as some of tests are high-resolution and need a lot of memory. -out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600 --files="/boot/grub/fonts/unicode.pf2"="@builddir@/"unicode.pf2 --qemu-opts="-m 512"` +out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600 --files="/boot/grub/fonts/unicode.pf2"="@builddir@/"unicode.pf2 --qemu-opts="-m 1G"` if [ "$(echo "$out" | tail -n 1)" != "ALL TESTS PASSED" ]; then echo "Functional test failure: $out" From 7d400406a77a61b04ae79194b630ada2a5019b92 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Sun, 17 Nov 2013 15:38:09 +0100 Subject: [PATCH 11/40] * grub-core/disk/uboot/ubootdisk.c: Include SCSI disks. --- ChangeLog | 4 ++++ grub-core/disk/uboot/ubootdisk.c | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8a6f0ed46..aa4f4cfc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-17 Ian Campbell + + * grub-core/disk/uboot/ubootdisk.c: Include SCSI disks. + 2013-11-17 Vladimir Serbinenko * tests/grub_func_test.in: Increase memory reservation as on EFI we need diff --git a/grub-core/disk/uboot/ubootdisk.c b/grub-core/disk/uboot/ubootdisk.c index f2c7a6acd..a5ce07a99 100644 --- a/grub-core/disk/uboot/ubootdisk.c +++ b/grub-core/disk/uboot/ubootdisk.c @@ -47,6 +47,7 @@ grub_ubootdisk_register (struct device_info *newdev) { case DT_STOR_IDE: case DT_STOR_SATA: + case DT_STOR_SCSI: case DT_STOR_MMC: case DT_STOR_USB: /* hd */ From 44ce3a93b67efc2dde802d861d110fa79305f385 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 01:49:14 +0100 Subject: [PATCH 12/40] * include/grub/mips/setjmp.h (grub_jmp_buf): Fix buffer size. setjmp.S uses 12 entries but buffer is declared with only 11 entries. --- ChangeLog | 6 ++++++ include/grub/mips/setjmp.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index aa4f4cfc8..cfb9fb30b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-18 Vladimir Serbinenko + + * include/grub/mips/setjmp.h (grub_jmp_buf): Fix buffer size. + + setjmp.S uses 12 entries but buffer is declared with only 11 entries. + 2013-11-17 Ian Campbell * grub-core/disk/uboot/ubootdisk.c: Include SCSI disks. diff --git a/include/grub/mips/setjmp.h b/include/grub/mips/setjmp.h index 5ce45f508..a99dde9ef 100644 --- a/include/grub/mips/setjmp.h +++ b/include/grub/mips/setjmp.h @@ -19,7 +19,7 @@ #ifndef GRUB_SETJMP_CPU_HEADER #define GRUB_SETJMP_CPU_HEADER 1 -typedef unsigned long grub_jmp_buf[11]; +typedef unsigned long grub_jmp_buf[12]; int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE; void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); From 4336b5d85ef2b5d53fd7e54cae5cb0674b35b7e0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 02:03:36 +0100 Subject: [PATCH 13/40] * util/grub-mkrescue.c (make_image_fwdisk_abs): Insert all partmap modules to be in line with make_image_abs. --- ChangeLog | 5 +++++ util/grub-mkrescue.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cfb9fb30b..050f0b70d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * util/grub-mkrescue.c (make_image_fwdisk_abs): Insert all partmap + modules to be in line with make_image_abs. + 2013-11-18 Vladimir Serbinenko * include/grub/mips/setjmp.h (grub_jmp_buf): Fix buffer size. diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index df55f3dcf..3b6b742bb 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -290,12 +290,24 @@ make_image_fwdisk_abs (enum grub_install_plat plat, const char *mkimage_target, const char *output) { + char *load_cfg; + FILE *load_cfg_f; + if (!source_dirs[plat]) return; + grub_util_info (N_("enabling %s support ..."), + mkimage_target); + + load_cfg = grub_util_make_temporary_file (); + + load_cfg_f = grub_util_fopen (load_cfg, "wb"); + write_part (load_cfg_f, source_dirs[plat]); + fclose (load_cfg_f); + grub_install_push_module ("iso9660"); grub_install_make_image_wrap (source_dirs[plat], "()/boot/grub", output, - 0, 0, mkimage_target, 0, + 0, load_cfg, mkimage_target, 0, GRUB_COMPRESSION_AUTO); grub_install_pop_module (); } From 59c943ecf6bf26a3ef07c9ebd85a21f9402eeee0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 02:35:32 +0100 Subject: [PATCH 14/40] * grub-core/lib/powerpc/setjmp.S (grub_setjmp): Save r31. (grub_longjmp): Restore r31. * include/grub/powerpc/setjmp.h (grub_jmp_buf): Reserve space for r31. --- ChangeLog | 6 ++++++ grub-core/lib/powerpc/setjmp.S | 10 ++++++---- include/grub/powerpc/setjmp.h | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 050f0b70d..49d75e070 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/lib/powerpc/setjmp.S (grub_setjmp): Save r31. + (grub_longjmp): Restore r31. + * include/grub/powerpc/setjmp.h (grub_jmp_buf): Reserve space for r31. + 2013-11-18 Vladimir Serbinenko * util/grub-mkrescue.c (make_image_fwdisk_abs): Insert all partmap diff --git a/grub-core/lib/powerpc/setjmp.S b/grub-core/lib/powerpc/setjmp.S index c301a7b07..716b563fa 100644 --- a/grub-core/lib/powerpc/setjmp.S +++ b/grub-core/lib/powerpc/setjmp.S @@ -47,10 +47,11 @@ FUNCTION(grub_setjmp) stw 28, 60(3) stw 29, 64(3) stw 30, 68(3) + stw 31, 72(3) mflr 4 - stw 4, 72(3) - mfcr 4 stw 4, 76(3) + mfcr 4 + stw 4, 80(3) li 3, 0 blr @@ -76,9 +77,10 @@ FUNCTION(grub_longjmp) lwz 28, 60(3) lwz 29, 64(3) lwz 30, 68(3) - lwz 5, 72(3) - mtlr 5 + lwz 31, 72(3) lwz 5, 76(3) + mtlr 5 + lwz 5, 80(3) mtcr 5 mr. 3, 4 bne 1f diff --git a/include/grub/powerpc/setjmp.h b/include/grub/powerpc/setjmp.h index 9beddfdb2..7c2d184fa 100644 --- a/include/grub/powerpc/setjmp.h +++ b/include/grub/powerpc/setjmp.h @@ -19,7 +19,7 @@ #ifndef GRUB_SETJMP_CPU_HEADER #define GRUB_SETJMP_CPU_HEADER 1 -typedef unsigned long grub_jmp_buf[20]; +typedef unsigned long grub_jmp_buf[21]; int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE; void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); From da93d6753b6a914708d042b08768599873d3f6c7 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 02:37:46 +0100 Subject: [PATCH 15/40] * grub-core/commands/legacycfg.c (grub_legacy_check_md5_password): Plug memory leak. --- ChangeLog | 5 +++++ grub-core/commands/legacycfg.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 49d75e070..57e82f05c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/commands/legacycfg.c (grub_legacy_check_md5_password): Plug + memory leak. + 2013-11-18 Vladimir Serbinenko * grub-core/lib/powerpc/setjmp.S (grub_setjmp): Save r31. diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c index 4443341b4..f429a5d1b 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c @@ -735,6 +735,7 @@ grub_legacy_check_md5_password (int argc, char **args, char *entered) { struct legacy_md5_password *pw = NULL; + int ret; if (args[0][0] != '-' || args[0][1] != '-') { @@ -751,7 +752,9 @@ grub_legacy_check_md5_password (int argc, char **args, if (!pw) return 0; - return check_password_md5_real (entered, pw); + ret = check_password_md5_real (entered, pw); + grub_free (pw); + return ret; } static grub_err_t From 7bbb60cfbde10543bc053c79ab82db253c4e31fe Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 02:40:17 +0100 Subject: [PATCH 16/40] * grub-core/commands/verify.c (free_pk): Plug memory leak. (grub_load_public_key): Likewise. (grub_verify_signature_real): Likewise. (grub_cmd_verify_signature): Likewise. --- ChangeLog | 7 +++++++ grub-core/commands/verify.c | 30 +++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57e82f05c..beac10772 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/commands/verify.c (free_pk): Plug memory leak. + (grub_load_public_key): Likewise. + (grub_verify_signature_real): Likewise. + (grub_cmd_verify_signature): Likewise. + 2013-11-18 Vladimir Serbinenko * grub-core/commands/legacycfg.c (grub_legacy_check_md5_password): Plug diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c index 3e61c2257..dbe7e83c0 100644 --- a/grub-core/commands/verify.c +++ b/grub-core/commands/verify.c @@ -192,6 +192,10 @@ free_pk (struct grub_public_key *pk) struct grub_public_subkey *nsk, *sk; for (sk = pk->subkeys; sk; sk = nsk) { + grub_size_t i; + for (i = 0; i < ARRAY_SIZE (sk->mpis); i++) + if (sk->mpis[i]) + gcry_mpi_release (sk->mpis[i]); nsk = sk->next; grub_free (sk); } @@ -244,6 +248,7 @@ grub_load_public_key (grub_file_t f) if (type == 0xff) { grub_free (fingerprint_context); + grub_free (buffer); return ret; } @@ -631,6 +636,9 @@ grub_verify_signature_real (char *buf, grub_size_t size, if ((*pkalgos[pk].algo)->verify (0, hmpi, mpis, sk->mpis, 0, 0)) goto fail; + grub_free (context); + grub_free (readbuf); + return GRUB_ERR_NONE; fail: @@ -736,8 +744,8 @@ static grub_err_t grub_cmd_verify_signature (grub_extcmd_context_t ctxt, int argc, char **args) { - grub_file_t f, sig; - grub_err_t err; + grub_file_t f = NULL, sig = NULL; + grub_err_t err = GRUB_ERR_NONE; struct grub_public_key *pk = NULL; grub_dprintf ("crypt", "alive\n"); @@ -768,19 +776,27 @@ grub_cmd_verify_signature (grub_extcmd_context_t ctxt, grub_file_filter_disable_all (); f = grub_file_open (args[0]); if (!f) - return grub_errno; + { + err = grub_errno; + goto fail; + } grub_file_filter_disable_all (); sig = grub_file_open (args[1]); if (!sig) { - grub_file_close (f); - return grub_errno; + err = grub_errno; + goto fail; } err = grub_verify_signature (f, sig, pk); - grub_file_close (f); - grub_file_close (sig); + fail: + if (sig) + grub_file_close (sig); + if (f) + grub_file_close (f); + if (pk) + free_pk (pk); return err; } From 33d02a42d64cf06cada1c389e5abba4b9d196cc5 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 02:41:42 +0100 Subject: [PATCH 17/40] * grub-core/kern/file.c (grub_file_open): Free file->name on failure. (grub_file_close): Free file->name. --- ChangeLog | 5 +++++ grub-core/kern/file.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index beac10772..ea7f15c33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/kern/file.c (grub_file_open): Free file->name on failure. + (grub_file_close): Free file->name. + 2013-11-18 Vladimir Serbinenko * grub-core/commands/verify.c (free_pk): Plug memory leak. diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c index ea1817a41..24da12bb9 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -87,9 +87,6 @@ grub_file_open (const char *name) if (! file) goto fail; - file->name = grub_strdup (name); - grub_errno = GRUB_ERR_NONE; - file->device = device; if (device->disk && file_name[0] != '/') @@ -105,6 +102,9 @@ grub_file_open (const char *name) if ((file->fs->open) (file, file_name) != GRUB_ERR_NONE) goto fail; + file->name = grub_strdup (name); + grub_errno = GRUB_ERR_NONE; + for (filter = 0; file && filter < ARRAY_SIZE (grub_file_filters_enabled); filter++) if (grub_file_filters_enabled[filter]) @@ -187,6 +187,7 @@ grub_file_close (grub_file_t file) if (file->device) grub_device_close (file->device); + grub_free (file->name); grub_free (file); return grub_errno; } From 35d4761ce2b154523c3c43b6331b0ab537b7a5e2 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 02:43:29 +0100 Subject: [PATCH 18/40] * grub-core/normal/cmdline.c (grub_cmdline_get): Plug memory leak. --- ChangeLog | 4 ++++ grub-core/normal/cmdline.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea7f15c33..c93e3d103 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/normal/cmdline.c (grub_cmdline_get): Plug memory leak. + 2013-11-18 Vladimir Serbinenko * grub-core/kern/file.c (grub_file_open): Free file->name on failure. diff --git a/grub-core/normal/cmdline.c b/grub-core/normal/cmdline.c index 2ef500ffb..204d15a4b 100644 --- a/grub-core/normal/cmdline.c +++ b/grub-core/normal/cmdline.c @@ -379,12 +379,18 @@ grub_cmdline_get (const char *prompt_translated) cl_terms = grub_malloc (sizeof (cl_terms[0]) * nterms); if (!cl_terms) - return 0; + { + grub_free (buf); + return 0; + } cl_term_cur = cl_terms; unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t)); if (!unicode_msg) - return 0;; + { + grub_free (buf); + return 0; + } msg_len = grub_utf8_to_ucs4 (unicode_msg, msg_len - 1, (grub_uint8_t *) prompt_translated, -1, 0); unicode_msg[msg_len++] = ' '; @@ -621,6 +627,7 @@ grub_cmdline_get (const char *prompt_translated) case '\e': grub_free (cl_terms); + grub_free (buf); return 0; case '\b': From 04f39f6df8fed3db08c6333d3b557d15bfe3d5a2 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 02:45:25 +0100 Subject: [PATCH 19/40] * grub-core/lib/relocator.c (grub_mm_check_real): Accept const char * as file argument. --- ChangeLog | 5 +++++ grub-core/lib/relocator.c | 2 +- include/grub/mm.h | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c93e3d103..2ff66607f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/lib/relocator.c (grub_mm_check_real): Accept const char * + as file argument. + 2013-11-18 Vladimir Serbinenko * grub-core/normal/cmdline.c (grub_cmdline_get): Plug memory leak. diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c index c86c5e886..9f9770bc4 100644 --- a/grub-core/lib/relocator.c +++ b/grub-core/lib/relocator.c @@ -1618,7 +1618,7 @@ grub_relocator_prepare_relocs (struct grub_relocator *rel, grub_addr_t addr, } void -grub_mm_check_real (char *file, int line) +grub_mm_check_real (const char *file, int line) { grub_mm_region_t r; grub_mm_header_t p, pa; diff --git a/include/grub/mm.h b/include/grub/mm.h index 047006944..c6660af71 100644 --- a/include/grub/mm.h +++ b/include/grub/mm.h @@ -35,7 +35,7 @@ void EXPORT_FUNC(grub_free) (void *ptr); void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size); void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size); -void grub_mm_check_real (char *file, int line); +void grub_mm_check_real (const char *file, int line); #define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__); /* For debugging. */ From 6f1bc8bc0f1c6d911d162e2930450fb1dd5abb99 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 04:32:33 +0100 Subject: [PATCH 20/40] On i386-ieee1275 we run in paged mode. So we need to explicitly map the devices before accessing them. --- ChangeLog | 5 ++++ grub-core/Makefile.core.def | 1 + grub-core/bus/i386/ieee1275/pci.c | 42 +++++++++++++++++++++++++++++++ include/grub/i386/pci.h | 16 ++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 grub-core/bus/i386/ieee1275/pci.c diff --git a/ChangeLog b/ChangeLog index 2ff66607f..7f1cf0e53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + On i386-ieee1275 we run in paged mode. So we need to explicitly map + the devices before accessing them. + 2013-11-18 Vladimir Serbinenko * grub-core/lib/relocator.c (grub_mm_check_real): Accept const char * diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 4fff57f16..5cd84b183 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -563,6 +563,7 @@ module = { module = { name = pci; common = bus/pci.c; + i386_ieee1275 = bus/i386/ieee1275/pci.c; enable = i386_pc; enable = i386_ieee1275; diff --git a/grub-core/bus/i386/ieee1275/pci.c b/grub-core/bus/i386/ieee1275/pci.c new file mode 100644 index 000000000..1fd3b5610 --- /dev/null +++ b/grub-core/bus/i386/ieee1275/pci.c @@ -0,0 +1,42 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include + +volatile void * +grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)), + grub_addr_t base, + grub_size_t size) +{ + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE)) + return (volatile void *) base; + if (grub_ieee1275_map (base, base, size, 7)) + grub_fatal ("couldn't map 0x%lx", base); + return (volatile void *) base; +} + +void +grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)), + volatile void *mem __attribute__ ((unused)), + grub_size_t size __attribute__ ((unused))) +{ +} diff --git a/include/grub/i386/pci.h b/include/grub/i386/pci.h index 795dec58b..dffeb5695 100644 --- a/include/grub/i386/pci.h +++ b/include/grub/i386/pci.h @@ -70,6 +70,8 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data) grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3)); } +#ifndef GRUB_MACHINE_IEEE1275 + static inline volatile void * grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)), grub_addr_t base, @@ -85,5 +87,19 @@ grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)), { } +#else + +volatile void * +grub_pci_device_map_range (grub_pci_device_t dev, + grub_addr_t base, + grub_size_t size); + +void +grub_pci_device_unmap_range (grub_pci_device_t dev, + volatile void *mem, + grub_size_t size); + +#endif + #endif /* GRUB_CPU_PCI_H */ From 2df8f43d3e0457c0f48df754e6b7ddfb44d5f3bc Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 10:01:36 +0100 Subject: [PATCH 21/40] * grub-core/lib/sparc64/setjmp.S: Force spilling of current window. --- ChangeLog | 4 ++++ grub-core/lib/sparc64/setjmp.S | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7f1cf0e53..8f4de761a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/lib/sparc64/setjmp.S: Force spilling of current window. + 2013-11-18 Vladimir Serbinenko On i386-ieee1275 we run in paged mode. So we need to explicitly map diff --git a/grub-core/lib/sparc64/setjmp.S b/grub-core/lib/sparc64/setjmp.S index ec9c53057..6c11bdda0 100644 --- a/grub-core/lib/sparc64/setjmp.S +++ b/grub-core/lib/sparc64/setjmp.S @@ -41,7 +41,11 @@ FUNCTION(grub_setjmp) FUNCTION(grub_longjmp) ldx [%o0 + 0x10], %g1 movrz %o1, 1, %o1 + + save %sp, -64, %sp flushw + restore + ldx [%o0 + 0x00], %o7 ldx [%o0 + 0x08], %fp sub %fp, 192, %sp From a284320e1e0e44773960b76b9e0ce23c5ea362b5 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 11:38:00 +0100 Subject: [PATCH 22/40] Fix handling of install lists. --- ChangeLog | 4 ++++ util/grub-install-common.c | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f4de761a..8e286bf76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-18 Vladimir Serbinenko + + Fix handling of install lists. + 2013-11-18 Vladimir Serbinenko * grub-core/lib/sparc64/setjmp.S: Force spilling of current window. diff --git a/util/grub-install-common.c b/util/grub-install-common.c index d29da380d..bdb81a72d 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -271,6 +271,7 @@ handle_install_list (struct install_list *il, const char *val, } il->n_alloc = il->n_entries + 1; il->entries = xmalloc (il->n_alloc * sizeof (il->entries[0])); + ptr = val; for (ce = il->entries; ; ce++) { const char *bptr; @@ -284,7 +285,6 @@ handle_install_list (struct install_list *il, const char *val, *ce = xmalloc (ptr - bptr + 1); memcpy (*ce, bptr, ptr - bptr); (*ce)[ptr - bptr] = '\0'; - ce++; } *ce = NULL; } @@ -662,10 +662,17 @@ grub_install_copy_files (const char *src, install_modules.entries); for (p = path_list; p; p = p->next) { - char *srcf = grub_util_path_concat_ext (2, src, p->name, ".mo"); - char *dstf = grub_util_path_concat_ext (2, dst, p->name, ".mo"); + const char *srcf = p->name; + const char *dir; + char *dstf; + + dir = grub_strrchr (srcf, '/'); + if (dir) + dir++; + else + dir = srcf; + dstf = grub_util_path_concat (2, dst, dir); grub_install_compress_file (srcf, dstf, 1); - free (srcf); free (dstf); } } From 4bf703206dd72914cc697232e76e1a87a7ec74a0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 11:45:55 +0100 Subject: [PATCH 23/40] * grub-core/tests/cmdline_cat_test.c: Don't reload unifont if it's already loaded. This saves memory needed for tests, --- ChangeLog | 5 +++++ grub-core/tests/cmdline_cat_test.c | 10 +++++++++- grub-core/tests/gfxterm_menu.c | 11 ++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e286bf76..e1989f780 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/tests/cmdline_cat_test.c: Don't reload unifont if it's + already loaded. This saves memory needed for tests, + 2013-11-18 Vladimir Serbinenko Fix handling of install lists. diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c index 3337d34cb..c3de5c464 100644 --- a/grub-core/tests/cmdline_cat_test.c +++ b/grub-core/tests/cmdline_cat_test.c @@ -66,17 +66,25 @@ struct grub_procfs_entry test_txt = .get_contents = get_test_txt }; +#define FONT_NAME "Unknown Regular 16" /* Functional test main method. */ static void cmdline_cat_test (void) { unsigned i; + grub_font_t font; grub_dl_load ("gfxterm"); grub_errno = GRUB_ERR_NONE; - if (grub_font_load ("unicode") == 0) + font = grub_font_get (FONT_NAME); + if (font && grub_strcmp (font->name, FONT_NAME) != 0) + font = 0; + if (!font) + font = grub_font_load ("unicode"); + + if (!font) { grub_test_assert (0, "unicode font not found: %s", grub_errmsg); return; diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c index 68531892f..879fbc003 100644 --- a/grub-core/tests/gfxterm_menu.c +++ b/grub-core/tests/gfxterm_menu.c @@ -91,12 +91,15 @@ struct { "gfxterm_high", "menu_color_highlight", "blue/red" }, }; +#define FONT_NAME "Unknown Regular 16" /* Functional test main method. */ static void gfxterm_menu (void) { unsigned i, j; + grub_font_t font; + grub_dl_load ("png"); grub_dl_load ("gettext"); grub_dl_load ("gfxterm"); @@ -105,7 +108,13 @@ gfxterm_menu (void) grub_dl_load ("gfxmenu"); - if (grub_font_load ("unicode") == 0) + font = grub_font_get (FONT_NAME); + if (font && grub_strcmp (font->name, FONT_NAME) != 0) + font = 0; + if (!font) + font = grub_font_load ("unicode"); + + if (!font) { grub_test_assert (0, "unicode font not found: %s", grub_errmsg); return; From f8b4c3b6b3a9633faa2d8240b6b4d62259caae5b Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 11:48:07 +0100 Subject: [PATCH 24/40] * grub-core/tests/gfxterm_menu.c: Skip high-resolution tests on low-memory platforms where we don't have enough memory for them. * grub-core/tests/videotest_checksum.c: Likewise. --- ChangeLog | 6 ++++++ grub-core/tests/gfxterm_menu.c | 11 ++++++++++- grub-core/tests/videotest_checksum.c | 17 ++++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1989f780..05d25e958 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/tests/gfxterm_menu.c: Skip high-resolution tests on + low-memory platforms where we don't have enough memory for them. + * grub-core/tests/videotest_checksum.c: Likewise. + 2013-11-18 Vladimir Serbinenko * grub-core/tests/cmdline_cat_test.c: Don't reload unifont if it's diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c index 879fbc003..8f63dc27a 100644 --- a/grub-core/tests/gfxterm_menu.c +++ b/grub-core/tests/gfxterm_menu.c @@ -125,7 +125,16 @@ gfxterm_menu (void) for (j = 0; j < ARRAY_SIZE (tests); j++) for (i = 0; i < GRUB_TEST_VIDEO_SMALL_N_MODES; i++) { - grub_uint64_t start = grub_get_time_ms (); + grub_uint64_t start; + +#if defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_IEEE1275) + if (grub_test_video_modes[i].width > 1024) + continue; + if (grub_strcmp (tests[j].name, "gfxmenu") == 0 + && grub_test_video_modes[i].width > 800) + continue; +#endif + start = grub_get_time_ms (); grub_video_capture_start (&grub_test_video_modes[i], grub_video_fbstd_colors, diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c index ee7058f51..f120496b6 100644 --- a/grub-core/tests/videotest_checksum.c +++ b/grub-core/tests/videotest_checksum.c @@ -40,9 +40,20 @@ videotest_checksum (void) for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++) { - grub_video_capture_start (&grub_test_video_modes[i], - grub_video_fbstd_colors, - grub_test_video_modes[i].number_of_colors); + grub_err_t err; +#if defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_IEEE1275) + if (grub_test_video_modes[i].width > 1024) + continue; +#endif + err = grub_video_capture_start (&grub_test_video_modes[i], + grub_video_fbstd_colors, + grub_test_video_modes[i].number_of_colors); + if (err) + { + grub_test_assert (0, "can't start capture: %s", grub_errmsg); + grub_print_error (); + continue; + } grub_terminal_input_fake_sequence ((int []) { '\n' }, 1); grub_video_checksum ("videotest"); From 256ee7ac6a2ec92bc8b9a2c7fb27d9db616b8379 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 11:51:46 +0100 Subject: [PATCH 25/40] * tests/util/grub-shell.in: For powerpc tests put the CD-ROM as primary master since with some combinations of qemu and firmware only primary IDE channel is available. --- ChangeLog | 6 ++++++ tests/util/grub-shell.in | 24 ++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05d25e958..821a6396c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-18 Vladimir Serbinenko + + * tests/util/grub-shell.in: For powerpc tests put the CD-ROM as primary + master since with some combinations of qemu and firmware only primary + IDE channel is available. + 2013-11-18 Vladimir Serbinenko * grub-core/tests/gfxterm_menu.c: Skip high-resolution tests on diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index ddd10d106..0abdf1794 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -354,39 +354,43 @@ if [ x$boot != xnet ] && [ x$boot != xemu ]; then fi if [ x$boot = xhd ]; then if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mips-arc ]; then - device=hdb + device="hdb " else - device=hda + device="hda " fi bootdev="-boot c" fi if [ x$boot = xcd ]; then - device=cdrom + if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = powerpc-ieee1275 ]; then + device="-drive if=ide,media=cdrom,file=" + else + device="cdrom " + fi bootdev="-boot d" fi if [ x$boot = xfd ]; then - device=fda + device="fda " bootdev="-boot a" fi if [ x$boot = xqemu ]; then bootdev="-bios ${rom_directory}/qemu.img" - device=cdrom + device="cdrom " fi if [ x$boot = xmipsel_qemu ]; then bootdev="-kernel ${rom_directory}/mipsel-qemu_mips.elf" - device=cdrom + device="cdrom " fi if [ x$boot = xmipsel_fulong2e ]; then bootdev="-kernel ${rom_directory}/mipsel-loongson.elf -append machtype=lemote-fuloong-2e" - device=cdrom + device="cdrom " fi if [ x$boot = xmips_qemu ]; then bootdev="-kernel ${rom_directory}/mips-qemu_mips.elf" - device=cdrom + device="cdrom " fi if [ x$boot = xcoreboot ]; then @@ -394,7 +398,7 @@ if [ x$boot = xcoreboot ]; then cp "${GRUB_COREBOOT_ROM}" "${imgfile}" "${GRUB_CBFSTOOL}" "${imgfile}" add-payload "${rom_directory}/coreboot.elf" fallback/payload bootdev="-bios ${imgfile}" - device=cdrom + device="cdrom " test -z "$debug" || echo "Coreboot image: ${imgfile}" >&2 fi @@ -435,7 +439,7 @@ elif [ x$boot = xemu ]; then @builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim rm -rf "$grubdir" else - timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim + timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} | cat | tr -d "\r" | do_trim fi if [ x$boot = xcoreboot ]; then test -n "$debug" || rm -f "${imgfile}" From 3bf4088b8b5a6acba59babe829d4f4bc18fc3e7a Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 18 Nov 2013 12:27:44 +0000 Subject: [PATCH 26/40] * grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file): Handle errors from mkstemp. (grub_util_make_temporary_dir): Handle errors from mkdtemp. --- ChangeLog | 6 ++++++ grub-core/osdep/unix/hostdisk.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e286bf76..409fc70ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-18 Colin Watson + + * grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file): + Handle errors from mkstemp. + (grub_util_make_temporary_dir): Handle errors from mkdtemp. + 2013-11-18 Vladimir Serbinenko Fix handling of install lists. diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c index 1ca1abbfb..78d4adb71 100644 --- a/grub-core/osdep/unix/hostdisk.c +++ b/grub-core/osdep/unix/hostdisk.c @@ -281,7 +281,8 @@ grub_util_make_temporary_file (void) memcpy (tmp, t, tl); memcpy (tmp + tl, "/grub.XXXXXX", sizeof ("/grub.XXXXXX")); - mkstemp (tmp); + if (mkstemp (tmp) == -1) + grub_util_error (_("cannot make temporary file: %s"), strerror (errno)); return tmp; } @@ -298,7 +299,9 @@ grub_util_make_temporary_dir (void) memcpy (tmp, t, tl); memcpy (tmp + tl, "/grub.XXXXXX", sizeof ("/grub.XXXXXX")); - mkdtemp (tmp); + if (!mkdtemp (tmp)) + grub_util_error (_("cannot make temporary directory: %s"), + strerror (errno)); return tmp; } From 5e3cb8a7479c37a68b0e1ae02fff7ba5be4ff711 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 14:35:18 +0100 Subject: [PATCH 27/40] * grub-core/term/terminfo.c (grub_cmd_terminfo): Fix a typo to make -g work again. --- ChangeLog | 5 +++++ grub-core/term/terminfo.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 821a6396c..65f1a421c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/term/terminfo.c (grub_cmd_terminfo): Fix a typo to make -g + work again. + 2013-11-18 Vladimir Serbinenko * tests/util/grub-shell.in: For powerpc tests put the CD-ROM as primary diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c index 0bb355277..3d48b198f 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -748,8 +748,8 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args) { struct grub_terminfo_output_state *data = (struct grub_terminfo_output_state *) cur->data; - data->pos.x = w; - data->pos.y = h; + data->size.x = w; + data->size.y = h; } if (argc == 1) From 96adefdb122144aeec54cea5f064b7c77b774c39 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 14:36:31 +0100 Subject: [PATCH 28/40] * util/grub-mkrescue.c (main): Fix a typo to make yeeloong part work again. --- ChangeLog | 5 +++++ util/grub-mkrescue.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 65f1a421c..ae8f24f14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * util/grub-mkrescue.c (main): Fix a typo to make yeeloong part + work again. + 2013-11-18 Vladimir Serbinenko * grub-core/term/terminfo.c (grub_cmd_terminfo): Fix a typo to make -g diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index 3b6b742bb..5eec03747 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -769,7 +769,7 @@ main (int argc, char *argv[]) make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-loongson-elf", "loongson.elf", GRUB_COMPRESSION_XZ); make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-yeeloong-flash", "mipsel-yeeloong.bin", GRUB_COMPRESSION_XZ); - make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fulong2f-flash", "mipsel-fuloong2f.bin", GRUB_COMPRESSION_XZ); + make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fuloong2f-flash", "mipsel-fuloong2f.bin", GRUB_COMPRESSION_XZ); make_image (GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips-qemu_mips-elf", "roms/mips-qemu_mips.elf", GRUB_COMPRESSION_AUTO); From ea7c1a7d90cb21772ba6a1e04dd6507f54dab7fd Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 14:38:31 +0100 Subject: [PATCH 29/40] * grub-core/tests/videotest_checksum.c: Don't reload unifont if it's already loaded. This saves memory needed for tests, --- ChangeLog | 5 +++++ grub-core/tests/videotest_checksum.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ae8f24f14..b38485d0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/tests/videotest_checksum.c: Don't reload unifont if it's + already loaded. This saves memory needed for tests, + 2013-11-18 Vladimir Serbinenko * util/grub-mkrescue.c (main): Fix a typo to make yeeloong part diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c index f120496b6..a4bff5ed8 100644 --- a/grub-core/tests/videotest_checksum.c +++ b/grub-core/tests/videotest_checksum.c @@ -26,13 +26,22 @@ GRUB_MOD_LICENSE ("GPLv3+"); +#define FONT_NAME "Unknown Regular 16" + /* Functional test main method. */ static void videotest_checksum (void) { unsigned i; + grub_font_t font; - if (grub_font_load ("unicode") == 0) + font = grub_font_get (FONT_NAME); + if (font && grub_strcmp (font->name, FONT_NAME) != 0) + font = 0; + if (!font) + font = grub_font_load ("unicode"); + + if (!font) { grub_test_assert (0, "unicode font not found: %s", grub_errmsg); return; From 35c2851cc117ac07076b513a5936fe514d4fe154 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 14:40:41 +0100 Subject: [PATCH 30/40] * tests/util/grub-shell.in: Use -cdrom and don't force cdrom on primary master on pseries. --- ChangeLog | 5 +++++ tests/util/grub-shell.in | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b38485d0b..959db45df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * tests/util/grub-shell.in: Use -cdrom and don't force cdrom + on primary master on pseries. + 2013-11-18 Vladimir Serbinenko * grub-core/tests/videotest_checksum.c: Don't reload unifont if it's diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 0abdf1794..b0081cb7f 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -211,6 +211,7 @@ for option in "$@"; do serial_null= qemuopts="$qemuopts -M pseries -no-reboot" trim=1 + pseries=y ;; --qemu-opts=*) qs=`echo "$option" | sed -e 's/--qemu-opts=//'` @@ -361,7 +362,7 @@ if [ x$boot = xhd ]; then bootdev="-boot c" fi if [ x$boot = xcd ]; then - if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = powerpc-ieee1275 ]; then + if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = powerpc-ieee1275 ] && [ x$pseries != xy ] ; then device="-drive if=ide,media=cdrom,file=" else device="cdrom " From 1e8e2e78a599af9504847aa86ed37bb06be1ee9d Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 18 Nov 2013 14:02:11 +0000 Subject: [PATCH 31/40] * tests/util/grub-shell.in: Don't fail on emu platform if po/*.gmo files have not been built. --- ChangeLog | 5 +++++ tests/util/grub-shell.in | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fec4dc731..2c43f6a9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Colin Watson + + * tests/util/grub-shell.in: Don't fail on emu platform if po/*.gmo + files have not been built. + 2013-11-18 Colin Watson * grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file): diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index b0081cb7f..b3632a883 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -434,7 +434,11 @@ elif [ x$boot = xemu ]; then mkdir -p "$grubdir/locale" cp "@builddir@/"unicode.pf2 "$grubdir/fonts/unicode.pf2" cp -R "@srcdir@/themes/starfield" "$grubdir/themes/starfield" - cp -R "@srcdir@/po/"*.gmo "$grubdir/locale/" + for file in "@srcdir@/po/"*.gmo; do + if [ -f "$file" ]; then + cp "$file" "$grubdir/locale/" + fi + done cp "${cfgfile}" "$grubdir/grub.cfg" cp "${source}" "$grubdir/testcase.cfg" @builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim From b40ce6518056e77c1e3aa2f8366a1944832b055f Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 15:59:55 +0100 Subject: [PATCH 32/40] * util/grub-install-common.c (grub_install_copy_files): Fix module destination directory. --- ChangeLog | 5 +++++ util/grub-install-common.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fec4dc731..ff2c821e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * util/grub-install-common.c (grub_install_copy_files): Fix module + destination directory. + 2013-11-18 Colin Watson * grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file): diff --git a/util/grub-install-common.c b/util/grub-install-common.c index bdb81a72d..0bc7ea3ae 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -671,7 +671,7 @@ grub_install_copy_files (const char *src, dir++; else dir = srcf; - dstf = grub_util_path_concat (2, dst, dir); + dstf = grub_util_path_concat (2, dst_platform, dir); grub_install_compress_file (srcf, dstf, 1); free (dstf); } From b7526e7806dc7d81b809ec093f9256024231e8b0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 16:05:47 +0100 Subject: [PATCH 33/40] * Makefile.am (default_payload.elf): Add pata to loaded modules. Load config file from (cbfsdisk)/etc/grub.cfg. --- ChangeLog | 5 +++++ Makefile.am | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ff2c821e3..68694c7bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * Makefile.am (default_payload.elf): Add pata to loaded modules. + Load config file from (cbfsdisk)/etc/grub.cfg. + 2013-11-18 Vladimir Serbinenko * util/grub-install-common.c (grub_install_copy_files): Fix module diff --git a/Makefile.am b/Makefile.am index 114c20045..506325693 100644 --- a/Makefile.am +++ b/Makefile.am @@ -394,7 +394,7 @@ bootcheck: $(BOOTCHECKS) if COND_i386_coreboot default_payload.elf: grub-mkstandalone grub-mkimage - pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump setpci lsacpi chain' --fonts= --themes= --locales= -d grub-core/ + pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg endif windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows From a1f00cc55711e5b4b63011d5d059107b9b0b883f Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 18 Nov 2013 15:30:47 +0000 Subject: [PATCH 34/40] * util/grub-mkrescue.c (main): Fix typo. --- ChangeLog | 4 ++++ util/grub-mkrescue.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1a7d8f0b..c356df282 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-18 Colin Watson + + * util/grub-mkrescue.c (main): Fix typo. + 2013-11-18 Vladimir Serbinenko * Makefile.am (default_payload.elf): Add pata to loaded modules. diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index 5eec03747..6b7239846 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -388,8 +388,7 @@ main (int argc, char *argv[]) xorriso_push ("-graft-points"); iso9660_dir = grub_util_make_temporary_dir (); - grub_util_info ("temporaray iso9660 dir is `%s'", - iso9660_dir); + grub_util_info ("temporary iso9660 dir is `%s'", iso9660_dir); boot_grub = grub_util_path_concat (3, iso9660_dir, "boot", "grub"); grub_install_mkdir_p (boot_grub); romdir = grub_util_path_concat (2, boot_grub, "roms"); From efb8de492ad278630d98082907a4bff1ded7cc95 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 16:32:22 +0100 Subject: [PATCH 35/40] * tests/util/grub-shell.in: Increase console size to 1024x1024. --- ChangeLog | 4 ++++ tests/util/grub-shell.in | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e1a7d8f0b..2303e5fa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-18 Vladimir Serbinenko + + * tests/util/grub-shell.in: Increase console size to 1024x1024. + 2013-11-18 Vladimir Serbinenko * Makefile.am (default_payload.elf): Add pata to loaded modules. diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index b3632a883..5f20b64e0 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -307,7 +307,7 @@ else fi cat <>${cfgfile} -terminfo -g 255x255 ${term} dumb +terminfo -g 1024x1024 ${term} dumb terminal_input ${term} terminal_output ${term} EOF From 74e632fea8b57650ee15bbc7db7d29d4c4357e8d Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 16:39:45 +0100 Subject: [PATCH 36/40] * grub-core/kern/mips/qemu_mips/init.c (grub_machine_init): Update clock frequency to 200 MHz, --- ChangeLog | 5 +++++ grub-core/kern/mips/qemu_mips/init.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2303e5fa0..87c4cace5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/kern/mips/qemu_mips/init.c (grub_machine_init): Update + clock frequency to 200 MHz, + 2013-11-18 Vladimir Serbinenko * tests/util/grub-shell.in: Increase console size to 1024x1024. diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c index 2ea2eb4fd..be88b77d2 100644 --- a/grub-core/kern/mips/qemu_mips/init.c +++ b/grub-core/kern/mips/qemu_mips/init.c @@ -49,7 +49,7 @@ grub_machine_init (void) } /* FIXME: measure this. */ - grub_arch_cpuclock = 64000000; + grub_arch_cpuclock = 200000000; modend = grub_modules_get_end (); grub_mm_init_region ((void *) modend, grub_arch_memsize From 39ff43c579870df6758757663432c4849c80d532 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 16:58:55 +0100 Subject: [PATCH 37/40] * grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to current memory when allocating large chunks. This significantly decreases memory fragmentation. --- ChangeLog | 6 ++++++ grub-core/kern/mm.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index aa39cb968..ba6af6af6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to + current memory when allocating large chunks. This significantly + decreases memory fragmentation. + 2013-11-18 Colin Watson * util/grub-mkrescue.c (main): Fix typo. diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 6111eef7e..53f3475f5 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c @@ -298,7 +298,10 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) /* Mark find as a start marker for next allocation to fasten it. This will have side effect of fragmenting memory as small pieces before this will be un-used. */ - *first = q; + /* So do it only for chunks under 64K. */ + if (n < (0x10000 >> GRUB_MM_ALIGN_LOG2) + || *first == p) + *first = q; return p + 1; } From 60870be86cd4b54bfdd6bcd08b82b9a99f19b812 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 18 Nov 2013 16:16:33 +0000 Subject: [PATCH 38/40] * tests/gzcompress_test.in: Skip if gzip is not installed (unlikely, but for symmetry). * tests/lzocompress_test.in: Skip if lzop is not installed. * tests/xzcompress_test.in: Skip if xz is not installed. --- ChangeLog | 7 +++++++ tests/gzcompress_test.in | 5 +++++ tests/lzocompress_test.in | 5 +++++ tests/xzcompress_test.in | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index aa39cb968..7f7941601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-18 Colin Watson + + * tests/gzcompress_test.in: Skip if gzip is not installed (unlikely, + but for symmetry). + * tests/lzocompress_test.in: Skip if lzop is not installed. + * tests/xzcompress_test.in: Skip if xz is not installed. + 2013-11-18 Colin Watson * util/grub-mkrescue.c (main): Fix typo. diff --git a/tests/gzcompress_test.in b/tests/gzcompress_test.in index 5cc352eef..11b6bb208 100644 --- a/tests/gzcompress_test.in +++ b/tests/gzcompress_test.in @@ -19,6 +19,11 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" +if ! which gzip >/dev/null 2>&1; then + echo "gzip not installed; cannot test gzip compression." + exit 77 +fi + if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=gz)" != "Hello World" ]; then exit 1 fi diff --git a/tests/lzocompress_test.in b/tests/lzocompress_test.in index 54428c33b..41984c254 100644 --- a/tests/lzocompress_test.in +++ b/tests/lzocompress_test.in @@ -19,6 +19,11 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" +if ! which lzop >/dev/null 2>&1; then + echo "lzop not installed; cannot test lzo compression." + exit 77 +fi + if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo)" != "Hello World" ]; then exit 1 fi diff --git a/tests/xzcompress_test.in b/tests/xzcompress_test.in index 63f5fd190..b2bd999ec 100644 --- a/tests/xzcompress_test.in +++ b/tests/xzcompress_test.in @@ -19,6 +19,11 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" +if ! which xz >/dev/null 2>&1; then + echo "xz not installed; cannot test xz compression." + exit 77 +fi + if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=xz)" != "Hello World" ]; then exit 1 fi From 45bf8b3a75492085f2a7a0563b301caabfbeb63d Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 17:41:37 +0100 Subject: [PATCH 39/40] * grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the pointer to 32K. This is the size of cache element which is the most common allocation >1K. This way the pointer is always around blocks of 32K and so we keep performance while decreasing fragmentation. --- ChangeLog | 7 +++++++ grub-core/kern/mm.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ba6af6af6..6b66c8e51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-18 Vladimir Serbinenko + + * grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the + pointer to 32K. This is the size of cache element which is the most + common allocation >1K. This way the pointer is always around blocks + of 32K and so we keep performance while decreasing fragmentation. + 2013-11-18 Vladimir Serbinenko * grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 53f3475f5..1c3d02388 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c @@ -299,7 +299,7 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) This will have side effect of fragmenting memory as small pieces before this will be un-used. */ /* So do it only for chunks under 64K. */ - if (n < (0x10000 >> GRUB_MM_ALIGN_LOG2) + if (n < (0x8000 >> GRUB_MM_ALIGN_LOG2) || *first == p) *first = q; From bb2b275b7d5a1214ead1bea718d93ad9934b59d8 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 18 Nov 2013 17:42:54 +0100 Subject: [PATCH 40/40] * tests/grub_func_test.in: Decrease RAM size to 512M. With less fragmentation 512M is enough. --- ChangeLog | 5 +++++ tests/grub_func_test.in | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6b66c8e51..8978c7f46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Vladimir Serbinenko + + * tests/grub_func_test.in: Decrease RAM size to 512M. With less + fragmentation 512M is enough. + 2013-11-18 Vladimir Serbinenko * grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in index cfb200cf9..c8cc26376 100644 --- a/tests/grub_func_test.in +++ b/tests/grub_func_test.in @@ -3,8 +3,16 @@ set -e . "@builddir@/grub-core/modinfo.sh" +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: Max RAM is 256M + mips-qemu_mips | mipsel-qemu_mips) + mem=256M;; + *) + mem=512M;; +esac + # Increase memory as some of tests are high-resolution and need a lot of memory. -out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600 --files="/boot/grub/fonts/unicode.pf2"="@builddir@/"unicode.pf2 --qemu-opts="-m 1G"` +out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600 --files="/boot/grub/fonts/unicode.pf2"="@builddir@/"unicode.pf2 --qemu-opts="-m $mem"` if [ "$(echo "$out" | tail -n 1)" != "ALL TESTS PASSED" ]; then echo "Functional test failure: $out"