Rebase to newer upstream (git snapshot)

This commit is contained in:
Peter Jones 2013-05-02 16:54:52 -04:00
parent a05f9de1dc
commit a5bd9f682f
370 changed files with 138038 additions and 997 deletions

View File

@ -0,0 +1,612 @@
From 8c5886df17cdfb148d4e17bddf38143ed65fe674 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 28 Jun 2012 15:27:54 +0200
Subject: [PATCH 001/364] Add monochrome text support (mda_text, aka
`hercules' in grub-legacy).
* grub-core/Makefile.core.def (mda_text): New module.
* grub-core/lib/legacy_parse.c (grub_legacy_parse): Support `hercules'.
* grub-core/term/i386/vga_common.c (grub_console_cur_color): Moved to ..
* grub-core/term/i386/pc/vga_text.c (cur_color): ... here
* grub-core/term/i386/pc/console.c (grub_console_cur_color): ... and
here.
* grub-core/term/i386/vga_common.c (grub_console_getwh): Moved to ..
* grub-core/term/i386/pc/vga_text.c (grub_console_getwh): ... here
* grub-core/term/i386/pc/console.c (grub_console_getwh): ... and
here.
* grub-core/term/i386/vga_common.c (grub_console_setcolorstate): Moved
to ..
* grub-core/term/i386/pc/vga_text.c (grub_console_setcolorstate):
... here
* grub-core/term/i386/pc/console.c (grub_console_setcolorstate): ... and
here.
* grub-core/term/i386/vga_common.c: Removed.
* include/grub/i386/vga_common.h: Likewise.
* include/grub/vga.h (grub_vga_cr_bw_write): New function.
(grub_vga_cr_bw_read): Likewise.
* include/grub/vgaregs.h (GRUB_VGA_IO_CR_BW_INDEX): New enum value.
(GRUB_VGA_IO_CR_BW_DATA): Likewise.
* grub-core/term/i386/pc/vga_text.c [MODE_MDA]: Call
grub_vga_cr_bw_read/grub_vga_cr_bw_write instead of
grub_vga_cr_read/grub_vga_cr_write.
(grub_vga_text_setcolorstate) [MODE_MDA]: Ignore color.
---
ChangeLog | 31 +++++++++
grub-core/Makefile.core.def | 12 ++--
grub-core/lib/legacy_parse.c | 15 ++--
grub-core/term/i386/pc/console.c | 27 ++++++++
grub-core/term/i386/pc/vga_text.c | 141 +++++++++++++++++++++++++++++++++-----
grub-core/term/i386/vga_common.c | 48 -------------
include/grub/i386/pc/console.h | 1 -
include/grub/i386/vga_common.h | 32 ---------
include/grub/vga.h | 14 ++++
include/grub/vgaregs.h | 2 +
10 files changed, 213 insertions(+), 110 deletions(-)
delete mode 100644 grub-core/term/i386/vga_common.c
delete mode 100644 include/grub/i386/vga_common.h
diff --git a/ChangeLog b/ChangeLog
index 81bdae9..f6e864a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2012-06-28 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Add monochrome text support (mda_text, aka `hercules' in grub-legacy).
+
+ * grub-core/Makefile.core.def (mda_text): New module.
+ * grub-core/lib/legacy_parse.c (grub_legacy_parse): Support `hercules'.
+ * grub-core/term/i386/vga_common.c (grub_console_cur_color): Moved to ..
+ * grub-core/term/i386/pc/vga_text.c (cur_color): ... here
+ * grub-core/term/i386/pc/console.c (grub_console_cur_color): ... and
+ here.
+ * grub-core/term/i386/vga_common.c (grub_console_getwh): Moved to ..
+ * grub-core/term/i386/pc/vga_text.c (grub_console_getwh): ... here
+ * grub-core/term/i386/pc/console.c (grub_console_getwh): ... and
+ here.
+ * grub-core/term/i386/vga_common.c (grub_console_setcolorstate): Moved
+ to ..
+ * grub-core/term/i386/pc/vga_text.c (grub_console_setcolorstate):
+ ... here
+ * grub-core/term/i386/pc/console.c (grub_console_setcolorstate): ... and
+ here.
+ * grub-core/term/i386/vga_common.c: Removed.
+ * include/grub/i386/vga_common.h: Likewise.
+ * include/grub/vga.h (grub_vga_cr_bw_write): New function.
+ (grub_vga_cr_bw_read): Likewise.
+ * include/grub/vgaregs.h (GRUB_VGA_IO_CR_BW_INDEX): New enum value.
+ (GRUB_VGA_IO_CR_BW_DATA): Likewise.
+ * grub-core/term/i386/pc/vga_text.c [MODE_MDA]: Call
+ grub_vga_cr_bw_read/grub_vga_cr_bw_write instead of
+ grub_vga_cr_read/grub_vga_cr_write.
+ (grub_vga_text_setcolorstate) [MODE_MDA]: Ignore color.
+
2012-06-27 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Bump version to 2.00.
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 39e77a4..5c2fcc2 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -123,9 +123,6 @@ kernel = {
i386_coreboot_multiboot_qemu = kern/i386/coreboot/init.c;
i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c;
- i386_coreboot_multiboot_qemu = term/i386/vga_common.c;
- i386_pc = term/i386/vga_common.c;
-
x86 = kern/i386/pit.c;
efi = disk/efi/efidisk.c;
@@ -175,7 +172,6 @@ kernel = {
mips_qemu_mips = term/at_keyboard.c;
mips_qemu_mips = commands/keylayouts.c;
mips_qemu_mips = term/i386/pc/vga_text.c;
- mips_qemu_mips = term/i386/vga_common.c;
mips_qemu_mips = kern/vga_init.c;
mips_arc = kern/mips/arc/init.c;
@@ -1591,11 +1587,17 @@ module = {
module = {
name = vga_text;
common = term/i386/pc/vga_text.c;
- common = term/i386/vga_common.c;
enable = i386_pc;
};
module = {
+ name = mda_text;
+ common = term/i386/pc/mda_text.c;
+ enable = i386_pc;
+ enable = i386_coreboot_multiboot_qemu;
+};
+
+module = {
name = video_cirrus;
x86 = video/cirrus.c;
enable = x86;
diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c
index 775eaad..14768b8 100644
--- a/grub-core/lib/legacy_parse.c
+++ b/grub-core/lib/legacy_parse.c
@@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2004,2010 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2004,2010,2012 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
@@ -290,7 +290,7 @@ static struct legacy_command legacy_commands[] =
" default values are COM1, 9600, 8N1."},
/* FIXME: setkey unsupported. */ /* NUL_TERMINATE */
/* NOTE: setup unsupported. */
- /* FIXME: --no-echo, --no-edit, hercules unsupported. */
+ /* FIXME: --no-echo, --no-edit unsupported. */
/* NOTE: both terminals are activated so --silent and --timeout
are useless. */
{"terminal", NULL, NULL, 0, 0, {}, FLAG_TERMINAL | FLAG_IGNORE_REST,
@@ -507,8 +507,8 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
int dumb = 0, lines = 24;
#ifdef TODO
int no_echo = 0, no_edit = 0;
- int hercules = 0;
#endif
+ int hercules = 0;
int console = 0, serial = 0;
/* Big enough for any possible resulting command. */
char outbuf[256] = "";
@@ -541,10 +541,8 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
if (grub_memcmp (ptr, "serial", sizeof ("serial") - 1) == 0)
serial = 1;
-#ifdef TODO
if (grub_memcmp (ptr, "hercules", sizeof ("hercules") - 1) == 0)
hercules = 1;
-#endif
while (*ptr && !grub_isspace (*ptr))
ptr++;
while (*ptr && grub_isspace (*ptr))
@@ -561,7 +559,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
grub_strcpy (outptr, "serial ");
outptr += grub_strlen (outptr);
}
- if (console)
+ if (console || hercules)
{
grub_strcpy (outptr, "console ");
outptr += grub_strlen (outptr);
@@ -578,6 +576,11 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
grub_strcpy (outptr, "console ");
outptr += grub_strlen (outptr);
}
+ if (hercules)
+ {
+ grub_strcpy (outptr, "mda_text ");
+ outptr += grub_strlen (outptr);
+ }
grub_strcpy (outptr, "; ");
outptr += grub_strlen (outptr);
if (serial)
diff --git a/grub-core/term/i386/pc/console.c b/grub-core/term/i386/pc/console.c
index 7cf5ffc..a681435 100644
--- a/grub-core/term/i386/pc/console.c
+++ b/grub-core/term/i386/pc/console.c
@@ -22,6 +22,8 @@
#include <grub/types.h>
#include <grub/machine/int.h>
+static grub_uint8_t grub_console_cur_color = 0x7;
+
static void
int10_9 (grub_uint8_t ch, grub_uint16_t n)
{
@@ -250,6 +252,31 @@ grub_console_getkeystatus (struct grub_term_input *term __attribute__ ((unused))
return bios_data_area->keyboard_flag_lower & ~0x80;
}
+static grub_uint16_t
+grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
+{
+ return (80 << 8) | 25;
+}
+
+static void
+grub_console_setcolorstate (struct grub_term_output *term,
+ grub_term_color_state state)
+{
+ switch (state) {
+ case GRUB_TERM_COLOR_STANDARD:
+ grub_console_cur_color = GRUB_TERM_DEFAULT_STANDARD_COLOR & 0x7f;
+ break;
+ case GRUB_TERM_COLOR_NORMAL:
+ grub_console_cur_color = term->normal_color & 0x7f;
+ break;
+ case GRUB_TERM_COLOR_HIGHLIGHT:
+ grub_console_cur_color = term->highlight_color & 0x7f;
+ break;
+ default:
+ break;
+ }
+}
+
static struct grub_term_input grub_console_term_input =
{
.name = "console",
diff --git a/grub-core/term/i386/pc/vga_text.c b/grub-core/term/i386/pc/vga_text.c
index c934c68..d1e4ef9 100644
--- a/grub-core/term/i386/pc/vga_text.c
+++ b/grub-core/term/i386/pc/vga_text.c
@@ -17,10 +17,17 @@
*/
#include <grub/dl.h>
-#include <grub/i386/vga_common.h>
#include <grub/cpu/io.h>
#include <grub/types.h>
#include <grub/vga.h>
+#include <grub/term.h>
+
+/* MODESET is used for testing to force monochrome or colour mode.
+ You shouldn't use mda_text on vga.
+ */
+#ifdef MODESET
+#include <grub/machine/int.h>
+#endif
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
#include <grub/machine/console.h>
@@ -35,10 +42,21 @@ static int grub_curr_x, grub_curr_y;
#ifdef __mips__
#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb00b8000)
+#define cr_read grub_vga_cr_read
+#define cr_write grub_vga_cr_write
+#elif defined (MODE_MDA)
+#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb0000)
+#define cr_read grub_vga_cr_bw_read
+#define cr_write grub_vga_cr_bw_write
+static grub_uint8_t cur_color;
#else
#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb8000)
+#define cr_read grub_vga_cr_read
+#define cr_write grub_vga_cr_write
#endif
+static grub_uint8_t cur_color = 0x7;
+
static void
screen_write_char (int x, int y, short c)
{
@@ -55,8 +73,8 @@ static void
update_cursor (void)
{
unsigned int pos = grub_curr_y * COLS + grub_curr_x;
- grub_vga_cr_write (pos >> 8, GRUB_VGA_CR_CURSOR_ADDR_HIGH);
- grub_vga_cr_write (pos & 0xFF, GRUB_VGA_CR_CURSOR_ADDR_LOW);
+ cr_write (pos >> 8, GRUB_VGA_CR_CURSOR_ADDR_HIGH);
+ cr_write (pos & 0xFF, GRUB_VGA_CR_CURSOR_ADDR_LOW);
}
static void
@@ -72,7 +90,7 @@ inc_y (void)
for (x = 0; x < COLS; x++)
screen_write_char (x, y, screen_read_char (x, y + 1));
for (x = 0; x < COLS; x++)
- screen_write_char (x, ROWS - 1, ' ' | (grub_console_cur_color << 8));
+ screen_write_char (x, ROWS - 1, ' ' | (cur_color << 8));
}
}
@@ -103,7 +121,7 @@ grub_vga_text_putchar (struct grub_term_output *term __attribute__ ((unused)),
break;
default:
screen_write_char (grub_curr_x, grub_curr_y,
- c->base | (grub_console_cur_color << 8));
+ c->base | (cur_color << 8));
inc_x ();
}
@@ -130,7 +148,7 @@ grub_vga_text_cls (struct grub_term_output *term)
{
int i;
for (i = 0; i < ROWS * COLS; i++)
- VGA_TEXT_SCREEN[i] = grub_cpu_to_le16 (' ' | (grub_console_cur_color << 8));
+ VGA_TEXT_SCREEN[i] = grub_cpu_to_le16 (' ' | (cur_color << 8));
grub_vga_text_gotoxy (term, 0, 0);
}
@@ -139,49 +157,136 @@ grub_vga_text_setcursor (struct grub_term_output *term __attribute__ ((unused)),
int on)
{
grub_uint8_t old;
- old = grub_vga_cr_read (GRUB_VGA_CR_CURSOR_START);
+ old = cr_read (GRUB_VGA_CR_CURSOR_START);
if (on)
- grub_vga_cr_write (old & ~GRUB_VGA_CR_CURSOR_START_DISABLE,
- GRUB_VGA_CR_CURSOR_START);
+ cr_write (old & ~GRUB_VGA_CR_CURSOR_START_DISABLE,
+ GRUB_VGA_CR_CURSOR_START);
else
- grub_vga_cr_write (old | GRUB_VGA_CR_CURSOR_START_DISABLE,
- GRUB_VGA_CR_CURSOR_START);
+ cr_write (old | GRUB_VGA_CR_CURSOR_START_DISABLE,
+ GRUB_VGA_CR_CURSOR_START);
}
static grub_err_t
-grub_vga_text_init_fini (struct grub_term_output *term)
+grub_vga_text_init (struct grub_term_output *term)
{
+#ifdef MODESET
+ struct grub_bios_int_registers regs;
+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
+
+#ifdef MODE_MDA
+ regs.eax = 7;
+#else
+ regs.eax = 3;
+#endif
+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
+ grub_bios_interrupt (0x10, &regs);
+#endif
grub_vga_text_cls (term);
return 0;
}
+static grub_err_t
+grub_vga_text_fini (struct grub_term_output *term)
+{
+#ifdef MODESET
+ struct grub_bios_int_registers regs;
+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
+
+ regs.eax = 3;
+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
+ grub_bios_interrupt (0x10, &regs);
+#endif
+ grub_vga_text_cls (term);
+ return 0;
+}
+
+static grub_uint16_t
+grub_vga_text_getwh (struct grub_term_output *term __attribute__ ((unused)))
+{
+ return (80 << 8) | 25;
+}
+
+#ifndef MODE_MDA
+
+static void
+grub_vga_text_setcolorstate (struct grub_term_output *term,
+ grub_term_color_state state)
+{
+ switch (state) {
+ case GRUB_TERM_COLOR_STANDARD:
+ cur_color = GRUB_TERM_DEFAULT_STANDARD_COLOR & 0x7f;
+ break;
+ case GRUB_TERM_COLOR_NORMAL:
+ cur_color = term->normal_color & 0x7f;
+ break;
+ case GRUB_TERM_COLOR_HIGHLIGHT:
+ cur_color = term->highlight_color & 0x7f;
+ break;
+ default:
+ break;
+ }
+}
+
+#else
+static void
+grub_vga_text_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+ grub_term_color_state state)
+{
+ switch (state) {
+ case GRUB_TERM_COLOR_STANDARD:
+ cur_color = 0x07;
+ break;
+ case GRUB_TERM_COLOR_NORMAL:
+ cur_color = 0x07;
+ break;
+ case GRUB_TERM_COLOR_HIGHLIGHT:
+ cur_color = 0x70;
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
static struct grub_term_output grub_vga_text_term =
{
+#ifdef MODE_MDA
+ .name = "mda_text",
+#else
.name = "vga_text",
- .init = grub_vga_text_init_fini,
- .fini = grub_vga_text_init_fini,
+#endif
+ .init = grub_vga_text_init,
+ .fini = grub_vga_text_fini,
.putchar = grub_vga_text_putchar,
- .getwh = grub_console_getwh,
+ .getwh = grub_vga_text_getwh,
.getxy = grub_vga_text_getxy,
.gotoxy = grub_vga_text_gotoxy,
.cls = grub_vga_text_cls,
- .setcolorstate = grub_console_setcolorstate,
+ .setcolorstate = grub_vga_text_setcolorstate,
.setcursor = grub_vga_text_setcursor,
.flags = GRUB_TERM_CODE_TYPE_CP437,
.normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
.highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
};
-#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
+#ifdef MODE_MDA
+GRUB_MOD_INIT(mda_text)
+#elif defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
void grub_vga_text_init (void)
#else
GRUB_MOD_INIT(vga_text)
#endif
{
+#ifdef MODE_MDA
+ grub_term_register_output ("mda_text", &grub_vga_text_term);
+#else
grub_term_register_output ("vga_text", &grub_vga_text_term);
+#endif
}
-#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
+#ifdef MODE_MDA
+GRUB_MOD_FINI(mda_text)
+#elif defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
void grub_vga_text_fini (void)
#else
GRUB_MOD_FINI(vga_text)
diff --git a/grub-core/term/i386/vga_common.c b/grub-core/term/i386/vga_common.c
deleted file mode 100644
index 0c21769..0000000
--- a/grub-core/term/i386/vga_common.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002,2003,2005,2007,2008 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 <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/i386/vga_common.h>
-#include <grub/term.h>
-#include <grub/types.h>
-
-grub_uint8_t grub_console_cur_color = 0x7;
-
-grub_uint16_t
-grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
-{
- return (80 << 8) | 25;
-}
-
-void
-grub_console_setcolorstate (struct grub_term_output *term,
- grub_term_color_state state)
-{
- switch (state) {
- case GRUB_TERM_COLOR_STANDARD:
- grub_console_cur_color = GRUB_TERM_DEFAULT_STANDARD_COLOR & 0x7f;
- break;
- case GRUB_TERM_COLOR_NORMAL:
- grub_console_cur_color = term->normal_color & 0x7f;
- break;
- case GRUB_TERM_COLOR_HIGHLIGHT:
- grub_console_cur_color = term->highlight_color & 0x7f;
- break;
- default:
- break;
- }
-}
diff --git a/include/grub/i386/pc/console.h b/include/grub/i386/pc/console.h
index f752b9a..191964f 100644
--- a/include/grub/i386/pc/console.h
+++ b/include/grub/i386/pc/console.h
@@ -24,7 +24,6 @@
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/term.h>
-#include <grub/i386/vga_common.h>
/* Initialize the console system. */
void grub_console_init (void);
diff --git a/include/grub/i386/vga_common.h b/include/grub/i386/vga_common.h
deleted file mode 100644
index 8727903..0000000
--- a/include/grub/i386/vga_common.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002,2005,2007,2008 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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_VGA_COMMON_CPU_HEADER
-#define GRUB_VGA_COMMON_CPU_HEADER 1
-
-#include <grub/types.h>
-#include <grub/symbol.h>
-#include <grub/term.h>
-
-extern grub_uint8_t grub_console_cur_color;
-
-grub_uint16_t grub_console_getwh (struct grub_term_output *term);
-void grub_console_setcolorstate (struct grub_term_output *term,
- grub_term_color_state state);
-
-#endif /* ! GRUB_VGA_COMMON_CPU_HEADER */
diff --git a/include/grub/vga.h b/include/grub/vga.h
index 81d40a1..1d8449c 100644
--- a/include/grub/vga.h
+++ b/include/grub/vga.h
@@ -57,6 +57,20 @@ grub_vga_cr_read (grub_uint8_t addr)
}
static inline void
+grub_vga_cr_bw_write (grub_uint8_t val, grub_uint8_t addr)
+{
+ grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_INDEX);
+ grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_DATA);
+}
+
+static inline grub_uint8_t
+grub_vga_cr_bw_read (grub_uint8_t addr)
+{
+ grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_INDEX);
+ return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_DATA);
+}
+
+static inline void
grub_vga_sr_write (grub_uint8_t val, grub_uint8_t addr)
{
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX);
diff --git a/include/grub/vgaregs.h b/include/grub/vgaregs.h
index a7b13ee..1a666a1 100644
--- a/include/grub/vgaregs.h
+++ b/include/grub/vgaregs.h
@@ -26,6 +26,8 @@
enum
{
+ GRUB_VGA_IO_CR_BW_INDEX = 0x3b4,
+ GRUB_VGA_IO_CR_BW_DATA = 0x3b5,
GRUB_VGA_IO_ARX = 0x3c0,
GRUB_VGA_IO_ARX_READ = 0x3c1,
GRUB_VGA_IO_MISC_WRITE = 0x3c2,
--
1.8.1.4

View File

@ -0,0 +1,22 @@
From d72015266eb5f1cf712db5edec3aa6926447f668 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 28 Jun 2012 15:36:48 +0200
Subject: [PATCH 002/364] missing file from last commit
---
grub-core/term/i386/pc/mda_text.c | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 grub-core/term/i386/pc/mda_text.c
diff --git a/grub-core/term/i386/pc/mda_text.c b/grub-core/term/i386/pc/mda_text.c
new file mode 100644
index 0000000..907a36e
--- /dev/null
+++ b/grub-core/term/i386/pc/mda_text.c
@@ -0,0 +1,3 @@
+#define MODE_MDA 1
+#include "vga_text.c"
+
--
1.8.1.4

View File

@ -0,0 +1,58 @@
From ec6a8c449294b215a2c4019f42110a0c1f770ac2 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:14:37 +0200
Subject: [PATCH 003/364] * grub-core/loader/i386/linux.c
(find_efi_mmap_size): Don't decrease efi_mmap_size. Reported by: Stuart
Hayes.
---
ChangeLog | 6 ++++++
grub-core/loader/i386/linux.c | 7 +++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f6e864a..53ad372 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/loader/i386/linux.c (find_efi_mmap_size): Don't decrease
+ efi_mmap_size.
+ Reported by: Stuart Hayes.
+
2012-06-28 Vladimir Serbinenko <phcoder@gmail.com>
Add monochrome text support (mda_text, aka `hercules' in grub-legacy).
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 62087cf..d34b2f8 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -118,12 +118,13 @@ find_efi_mmap_size (void)
int ret;
grub_efi_memory_descriptor_t *mmap;
grub_efi_uintn_t desc_size;
+ grub_efi_uintn_t cur_mmap_size = mmap_size;
- mmap = grub_malloc (mmap_size);
+ mmap = grub_malloc (cur_mmap_size);
if (! mmap)
return 0;
- ret = grub_efi_get_memory_map (&mmap_size, mmap, 0, &desc_size, 0);
+ ret = grub_efi_get_memory_map (&cur_mmap_size, mmap, 0, &desc_size, 0);
grub_free (mmap);
if (ret < 0)
@@ -134,6 +135,8 @@ find_efi_mmap_size (void)
else if (ret > 0)
break;
+ if (mmap_size < cur_mmap_size)
+ mmap_size = cur_mmap_size;
mmap_size += (1 << 12);
}
--
1.8.1.4

View File

@ -0,0 +1,61 @@
From d2ccb3209c62de4292107df4207c02ee59dc11a9 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:19:22 +0200
Subject: [PATCH 004/364] * include/grub/list.h
(FOR_LIST_ELEMENTS_SAFE): New macro. * include/grub/command.h
(FOR_COMMANDS_SAFE): Likewise. * grub-core/commands/help.c
(grub_cmd_help): Use FOR_COMMANDS_SAFE.
---
grub-core/commands/help.c | 5 +++--
include/grub/command.h | 1 +
include/grub/list.h | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/grub-core/commands/help.c b/grub-core/commands/help.c
index d64c289..f0be89b 100644
--- a/grub-core/commands/help.c
+++ b/grub-core/commands/help.c
@@ -99,12 +99,13 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
else
{
int i;
- grub_command_t cmd_iter, cmd;
+ grub_command_t cmd_iter, cmd, cmd_next;
for (i = 0; i < argc; i++)
{
currarg = args[i];
- FOR_COMMANDS(cmd_iter)
+
+ FOR_COMMANDS_SAFE (cmd_iter, cmd_next)
{
if (!(cmd_iter->prio & GRUB_COMMAND_FLAG_ACTIVE))
continue;
diff --git a/include/grub/command.h b/include/grub/command.h
index 6d43499..8705a63 100644
--- a/include/grub/command.h
+++ b/include/grub/command.h
@@ -121,6 +121,7 @@ grub_command_execute (const char *name, int argc, char **argv)
}
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
+#define FOR_COMMANDS_SAFE(var, next) FOR_LIST_ELEMENTS_SAFE((var), (next), grub_command_list)
void grub_register_core_commands (void);
diff --git a/include/grub/list.h b/include/grub/list.h
index cadb2d9..6f6dec0 100644
--- a/include/grub/list.h
+++ b/include/grub/list.h
@@ -35,6 +35,7 @@ void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
void EXPORT_FUNC(grub_list_remove) (grub_list_t item);
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
+#define FOR_LIST_ELEMENTS_SAFE(var, nxt, list) for ((var) = (list), (nxt) = ((var) ? (var)->next : 0); (var); (var) = (nxt), (nxt) = (var)->next)
static inline void *
grub_bad_type_cast_real (int line, const char *file)
--
1.8.1.4

View File

@ -0,0 +1,47 @@
From 21c2f856cbdf4a98d015ed05bb6b9b16c021af9c Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:20:51 +0200
Subject: [PATCH 005/364] * gentpl.py: Make mans depend on
grub-mkconfig_lib.
---
ChangeLog | 10 ++++++++++
gentpl.py | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 53ad372..aaeeb05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+ * gentpl.py: Make mans depend on grub-mkconfig_lib.
+
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * include/grub/list.h (FOR_LIST_ELEMENTS_SAFE): New macro.
+ * include/grub/command.h (FOR_COMMANDS_SAFE): Likewise.
+ * grub-core/commands/help.c (grub_cmd_help): Use FOR_COMMANDS_SAFE.
+
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/loader/i386/linux.c (find_efi_mmap_size): Don't decrease
efi_mmap_size.
Reported by: Stuart Hayes.
diff --git a/gentpl.py b/gentpl.py
index 13a6081..bab4a8a 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -487,7 +487,7 @@ def installdir(default="bin"):
def manpage():
r = "if COND_MAN_PAGES\n"
r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n")
- r += rule("[+ name +].[+ mansection +]", "[+ name +]", """
+ r += rule("[+ name +].[+ mansection +]", "[+ name +] grub-mkconfig_lib", """
chmod a+x [+ name +]
PATH=$(builddir):$$PATH pkgdatadir=$(builddir) $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -o $@ [+ name +]
""")
--
1.8.1.4

View File

@ -0,0 +1,53 @@
From 8ec34c46a3cc4cacce65e3a2a671e08548c6a95e Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:22:50 +0200
Subject: [PATCH 006/364] * grub-core/net/tftp.c (ack): Fix endianness
problem. (tftp_receive): Likewise. Reported by: Michael
Davidsaver.
---
ChangeLog | 6 ++++++
grub-core/net/tftp.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index aaeeb05..12de11f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/net/tftp.c (ack): Fix endianness problem.
+ (tftp_receive): Likewise.
+ Reported by: Michael Davidsaver.
+
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
* gentpl.py: Make mans depend on grub-mkconfig_lib.
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 9c70efb..d0f39ea 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block)
tftph_ack = (struct tftphdr *) nb_ack.data;
tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
- tftph_ack->u.ack.block = block;
+ tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
err = grub_net_send_udp_packet (data->sock, &nb_ack);
if (err)
@@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
grub_priority_queue_pop (data->pq);
if (file->device->net->packs.count < 50)
- err = ack (data, tftph->u.data.block);
+ err = ack (data, data->block + 1);
else
{
file->device->net->stall = 1;
--
1.8.1.4

View File

@ -0,0 +1,182 @@
From c545d0bb2fe87b5a8ea6a903e4e9c113595ccfff Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:28:42 +0200
Subject: [PATCH 007/364] * grub-core/fs/ext2.c: Experimental support
for 64-bit.
---
ChangeLog | 4 ++++
grub-core/fs/ext2.c | 56 +++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 12de11f..93ad0ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/fs/ext2.c: Experimental support for 64-bit.
+
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/net/tftp.c (ack): Fix endianness problem.
(tftp_receive): Likewise.
Reported by: Michael Davidsaver.
diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c
index c50e379..bd1ab24 100644
--- a/grub-core/fs/ext2.c
+++ b/grub-core/fs/ext2.c
@@ -65,7 +65,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
/* The inode size. */
#define EXT2_INODE_SIZE(data) \
- (EXT2_REVISION (data) == EXT2_GOOD_OLD_REVISION \
+ (data->sblock.revision_level \
+ == grub_cpu_to_le32_compile_time (EXT2_GOOD_OLD_REVISION) \
? EXT2_GOOD_OLD_INODE_SIZE \
: grub_le_to_cpu16 (data->sblock.inode_size))
@@ -105,7 +106,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
* flags here as the related features are implemented into the driver. */
#define EXT2_DRIVER_SUPPORTED_INCOMPAT ( EXT2_FEATURE_INCOMPAT_FILETYPE \
| EXT4_FEATURE_INCOMPAT_EXTENTS \
- | EXT4_FEATURE_INCOMPAT_FLEX_BG )
+ | EXT4_FEATURE_INCOMPAT_FLEX_BG \
+ | EXT4_FEATURE_INCOMPAT_64BIT)
/* List of rationales for the ignored "incompatible" features:
* needs_recovery: Not really back-incompatible - was added as such to forbid
* ext2 drivers from mounting an ext3 volume with a dirty
@@ -179,7 +181,7 @@ struct grub_ext2_sblock
grub_uint32_t hash_seed[4];
grub_uint8_t def_hash_version;
grub_uint8_t jnl_backup_type;
- grub_uint16_t reserved_word_pad;
+ grub_uint16_t group_desc_size;
grub_uint32_t default_mount_opts;
grub_uint32_t first_meta_bg;
grub_uint32_t mkfs_time;
@@ -197,6 +199,14 @@ struct grub_ext2_block_group
grub_uint16_t used_dirs;
grub_uint16_t pad;
grub_uint32_t reserved[3];
+ grub_uint32_t block_id_hi;
+ grub_uint32_t inode_id_hi;
+ grub_uint32_t inode_table_id_hi;
+ grub_uint16_t free_blocks_hi;
+ grub_uint16_t free_inodes_hi;
+ grub_uint16_t used_dirs_hi;
+ grub_uint16_t pad2;
+ grub_uint32_t reserved2[3];
};
/* The ext2 inode. */
@@ -310,6 +320,7 @@ struct grub_fshelp_node
struct grub_ext2_data
{
struct grub_ext2_sblock sblock;
+ int log_group_desc_size;
grub_disk_t disk;
struct grub_ext2_inode *inode;
struct grub_fshelp_node diropen;
@@ -328,7 +339,7 @@ grub_ext2_blockgroup (struct grub_ext2_data *data, int group,
return grub_disk_read (data->disk,
((grub_le_to_cpu32 (data->sblock.first_data_block) + 1)
<< LOG2_EXT2_BLOCK_SIZE (data)),
- group * sizeof (struct grub_ext2_block_group),
+ group << data->log_group_desc_size,
sizeof (struct grub_ext2_block_group), blkgrp);
}
@@ -362,7 +373,7 @@ grub_ext4_find_leaf (struct grub_ext2_data *data, grub_properly_aligned_t *buf,
return 0;
block = grub_le_to_cpu16 (index[i].leaf_hi);
- block = (block << 32) + grub_le_to_cpu32 (index[i].leaf);
+ block = (block << 32) | grub_le_to_cpu32 (index[i].leaf);
if (grub_disk_read (data->disk,
block << LOG2_EXT2_BLOCK_SIZE (data),
0, EXT2_BLOCK_SIZE(data), buf))
@@ -377,11 +388,11 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
{
struct grub_ext2_data *data = node->data;
struct grub_ext2_inode *inode = &node->inode;
- int blknr = -1;
+ grub_disk_addr_t blknr = -1;
unsigned int blksz = EXT2_BLOCK_SIZE (data);
int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data);
- if (grub_le_to_cpu32(inode->flags) & EXT4_EXTENTS_FLAG)
+ if (inode->flags & grub_cpu_to_le32_compile_time (EXT4_EXTENTS_FLAG))
{
GRUB_PROPERLY_ALIGNED_ARRAY (buf, EXT2_BLOCK_SIZE(data));
struct grub_ext4_extent_header *leaf;
@@ -535,6 +546,7 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
int inodes_per_block;
unsigned int blkno;
unsigned int blkoff;
+ grub_disk_addr_t base;
/* It is easier to calculate if the first inode is 0. */
ino--;
@@ -551,10 +563,14 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
blkoff = (ino % grub_le_to_cpu32 (sblock->inodes_per_group))
% inodes_per_block;
+ base = grub_le_to_cpu32 (blkgrp.inode_table_id);
+ if (data->log_group_desc_size >= 6)
+ base |= (((grub_disk_addr_t) grub_le_to_cpu32 (blkgrp.inode_table_id_hi))
+ << 32);
+
/* Read the inode. */
if (grub_disk_read (data->disk,
- (((grub_disk_addr_t) grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno)
- << LOG2_EXT2_BLOCK_SIZE (data)),
+ ((base + blkno) << LOG2_EXT2_BLOCK_SIZE (data)),
EXT2_INODE_SIZE (data) * blkoff,
sizeof (struct grub_ext2_inode), inode))
return grub_errno;
@@ -578,7 +594,7 @@ grub_ext2_mount (grub_disk_t disk)
goto fail;
/* Make sure this is an ext2 filesystem. */
- if (grub_le_to_cpu16 (data->sblock.magic) != EXT2_MAGIC
+ if (data->sblock.magic != grub_cpu_to_le16_compile_time (EXT2_MAGIC)
|| grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16)
{
grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
@@ -586,13 +602,29 @@ grub_ext2_mount (grub_disk_t disk)
}
/* Check the FS doesn't have feature bits enabled that we don't support. */
- if (grub_le_to_cpu32 (data->sblock.feature_incompat)
- & ~(EXT2_DRIVER_SUPPORTED_INCOMPAT | EXT2_DRIVER_IGNORED_INCOMPAT))
+ if (data->sblock.revision_level != grub_cpu_to_le32_compile_time (EXT2_GOOD_OLD_REVISION)
+ && (data->sblock.feature_incompat
+ & grub_cpu_to_le32_compile_time (~(EXT2_DRIVER_SUPPORTED_INCOMPAT
+ | EXT2_DRIVER_IGNORED_INCOMPAT))))
{
grub_error (GRUB_ERR_BAD_FS, "filesystem has unsupported incompatible features");
goto fail;
}
+ if (data->sblock.revision_level != grub_cpu_to_le32_compile_time (EXT2_GOOD_OLD_REVISION)
+ && (data->sblock.feature_incompat
+ & grub_cpu_to_le32_compile_time (EXT4_FEATURE_INCOMPAT_64BIT))
+ && data->sblock.group_desc_size != 0
+ && ((data->sblock.group_desc_size & (data->sblock.group_desc_size - 1))
+ == 0)
+ && (data->sblock.group_desc_size & grub_cpu_to_le16_compile_time (0x1fe0)))
+ {
+ grub_uint16_t b = grub_le_to_cpu16 (data->sblock.group_desc_size);
+ for (data->log_group_desc_size = 0; b != (1 << data->log_group_desc_size);
+ data->log_group_desc_size++);
+ }
+ else
+ data->log_group_desc_size = 5;
data->disk = disk;
--
1.8.1.4

View File

@ -0,0 +1,48 @@
From 2cce795e46cef6c5f057d46bae9a845621ca4a95 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:30:04 +0200
Subject: [PATCH 008/364] * grub-core/term/efi/serial.c: Support 1.5
stop bits.
---
ChangeLog | 4 ++++
grub-core/term/efi/serial.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 93ad0ac..5f73c88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/term/efi/serial.c: Support 1.5 stop bits.
+
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/fs/ext2.c: Experimental support for 64-bit.
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/grub-core/term/efi/serial.c b/grub-core/term/efi/serial.c
index da8c3ce..dc5f33b 100644
--- a/grub-core/term/efi/serial.c
+++ b/grub-core/term/efi/serial.c
@@ -44,6 +44,7 @@ do_real_config (struct grub_serial_port *port)
};
const grub_efi_stop_bits_t stop_bits[] = {
[GRUB_SERIAL_STOP_BITS_1] = GRUB_EFI_SERIAL_1_STOP_BIT,
+ [GRUB_SERIAL_STOP_BITS_1_5] = GRUB_EFI_SERIAL_1_5_STOP_BITS,
[GRUB_SERIAL_STOP_BITS_2] = GRUB_EFI_SERIAL_2_STOP_BITS,
};
@@ -111,6 +112,7 @@ serial_hw_configure (struct grub_serial_port *port,
N_("unsupported serial port parity"));
if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1
+ && config->stop_bits != GRUB_SERIAL_STOP_BITS_1_5
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_2)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("unsupported serial port stop bits number"));
--
1.8.1.4

View File

@ -0,0 +1,107 @@
From 134e4df1335b0498684d093b55332f87c2e8a301 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:31:31 +0200
Subject: [PATCH 009/364] * grub-core/lib/legacy_parse.c: Support clear
and testload.
---
ChangeLog | 4 ++++
grub-core/lib/legacy_parse.c | 14 +++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 5f73c88..e606116 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/lib/legacy_parse.c: Support clear and testload.
+
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/term/efi/serial.c: Support 1.5 stop bits.
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c
index 14768b8..ddfaec4 100644
--- a/grub-core/lib/legacy_parse.c
+++ b/grub-core/lib/legacy_parse.c
@@ -65,6 +65,7 @@ struct legacy_command
*/
static struct legacy_command legacy_commands[] =
{
+ /* FIXME: background unsupported. */
{"blocklist", "blocklist '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
"Print the blocklist notation of the file FILE."},
{"boot", "boot\n", NULL, 0, 0, {}, 0, 0,
@@ -82,6 +83,8 @@ static struct legacy_command legacy_commands[] =
2, {TYPE_FORCE_OPTION, TYPE_FILE}, 0, "[--force] FILE",
"Load the chain-loader FILE. If --force is specified, then load it"
" forcibly, whether the boot loader signature is present or not."},
+ {"clear", "clear\n", NULL, 0, 0, {}, 0, 0,
+ "Clear the screen."},
{"cmp", "cmp '%s' '%s'\n", NULL, 0,
2, {TYPE_FILE, TYPE_FILE}, FLAG_IGNORE_REST, "FILE1 FILE2",
"Compare the file FILE1 with the FILE2 and inform the different values"
@@ -125,6 +128,7 @@ static struct legacy_command legacy_commands[] =
{"displaymem", "lsmmap\n", NULL, 0, 0, {}, 0, 0,
"Display what GRUB thinks the system address space map of the"
" machine is, including all regions of physical RAM installed."},
+ /* FIXME: device and efimap unsupported. */
/* NOTE: embed unsupported. */
{"fallback", "set fallback='%s'\n", NULL, 0,
1, {TYPE_VERBATIM}, 0, "NUM...",
@@ -136,6 +140,8 @@ static struct legacy_command legacy_commands[] =
{"find", "search -f '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILENAME",
"Search for the filename FILENAME in all of partitions and print the list of"
" the devices which contain the file."},
+ /* FIXME: findiso unsupported. */
+ /* FIXME: foreground unsupported. */
/* FIXME: fstest unsupported. */
/* NOTE: The obsolete C/H/S geometry isn't shown anymore. */
{"geometry", "insmod regexp; ls -l (%s*)\n", NULL, 0, 1, {TYPE_VERBATIM}, 0, "DRIVE",
@@ -243,6 +249,7 @@ static struct legacy_command legacy_commands[] =
{"pause", "echo %s; if ! sleep -i 60; then return; fi\n", NULL, 0, 1,
{TYPE_REST_VERBATIM}, 0,
"[MESSAGE ...]", "Print MESSAGE, then wait until a key is pressed."},
+ /* FIXME: quit unsupported. */
/* FIXME: rarp unsupported. */
{"read", "read_dword %s\n", NULL, 0, 1, {TYPE_INT}, 0, "ADDR",
"Read a 32-bit value from memory at address ADDR and"
@@ -288,11 +295,14 @@ static struct legacy_command legacy_commands[] =
" STOP is the length of stop bit(s). The option --device can be used only"
" in the grub shell, which specifies the file name of a tty device. The"
" default values are COM1, 9600, 8N1."},
+ /* FIXME: silent unsupported. */
+ /* FIXME: splashimage unsupported. */
/* FIXME: setkey unsupported. */ /* NUL_TERMINATE */
/* NOTE: setup unsupported. */
/* FIXME: --no-echo, --no-edit unsupported. */
/* NOTE: both terminals are activated so --silent and --timeout
are useless. */
+ /* FIXME: graphics unsupported. */
{"terminal", NULL, NULL, 0, 0, {}, FLAG_TERMINAL | FLAG_IGNORE_REST,
"[--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] "
"[--silent] [console] [serial] [hercules]",
@@ -307,7 +317,7 @@ static struct legacy_command legacy_commands[] =
" seconds. The option --lines specifies the maximum number of lines."
" The option --silent is used to suppress messages."},
/* FIXME: terminfo unsupported. */ /* NUL_TERMINATE */
- {"testload", "cat '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
+ {"testload", "testload '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
"Read the entire contents of FILE in several different ways and"
" compares them, to test the filesystem code. "
" If this test succeeds, then a good next"
@@ -334,6 +344,8 @@ static struct legacy_command legacy_commands[] =
" the information about only the mode."},
{"vbeprobe", "insmod vbe; videoinfo\n", NULL, 0, 0, {},
FLAG_FALLBACK, NULL, NULL}
+ /* FIXME: verbose unsupported. */
+ /* FIXME: version unsupported. */
};
char *
--
1.8.1.4

View File

@ -0,0 +1,39 @@
From f1c2b05162cc583ec64ae0b3cdf5ef128d2ca05c Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 7 Jul 2012 14:29:01 +0200
Subject: [PATCH 010/364] * grub-core/Makefile.am: Fix path to
boot/i386/pc/startup_raw.S.
---
ChangeLog | 4 ++++
grub-core/Makefile.am | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e606116..5e54eda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-07-07 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/Makefile.am: Fix path to boot/i386/pc/startup_raw.S.
+
2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/legacy_parse.c: Support clear and testload.
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 7dc2519..cc4fb68 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -63,7 +63,7 @@ grub_script.yy.c: grub_script.yy.h
rs_decoder.S: $(srcdir)/lib/reed_solomon.c
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3 -ffreestanding
-kern/i386/pc/startup.S: $(builddir)/rs_decoder.S
+boot/i386/pc/startup_raw.S: $(builddir)/rs_decoder.S
boot/mips/loongson/fwstart.S: $(builddir)/sm712_start.S
CLEANFILES += grub_script.yy.c grub_script.yy.h
--
1.8.1.4

View File

@ -0,0 +1,67 @@
From a7fa3c8e8c7b2dab5a704493b7965bbc60f84bed Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 22 Jul 2012 16:21:24 +0200
Subject: [PATCH 011/364] Fix coreboot compilation.
* grub-core/term/i386/pc/vga_text.c (grub_vga_text_init): Rename to ...
(grub_vga_text_init_real): ... this.
(grub_vga_text_fini): Rename to ...
(grub_vga_text_fini_real): ... this.
---
ChangeLog | 9 +++++++++
grub-core/term/i386/pc/vga_text.c | 8 ++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5e54eda..35e76af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Fix coreboot compilation.
+
+ * grub-core/term/i386/pc/vga_text.c (grub_vga_text_init): Rename to ...
+ (grub_vga_text_init_real): ... this.
+ (grub_vga_text_fini): Rename to ...
+ (grub_vga_text_fini_real): ... this.
+
2012-07-07 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/Makefile.am: Fix path to boot/i386/pc/startup_raw.S.
diff --git a/grub-core/term/i386/pc/vga_text.c b/grub-core/term/i386/pc/vga_text.c
index d1e4ef9..74c155c 100644
--- a/grub-core/term/i386/pc/vga_text.c
+++ b/grub-core/term/i386/pc/vga_text.c
@@ -167,7 +167,7 @@ grub_vga_text_setcursor (struct grub_term_output *term __attribute__ ((unused)),
}
static grub_err_t
-grub_vga_text_init (struct grub_term_output *term)
+grub_vga_text_init_real (struct grub_term_output *term)
{
#ifdef MODESET
struct grub_bios_int_registers regs;
@@ -186,7 +186,7 @@ grub_vga_text_init (struct grub_term_output *term)
}
static grub_err_t
-grub_vga_text_fini (struct grub_term_output *term)
+grub_vga_text_fini_real (struct grub_term_output *term)
{
#ifdef MODESET
struct grub_bios_int_registers regs;
@@ -255,8 +255,8 @@ static struct grub_term_output grub_vga_text_term =
#else
.name = "vga_text",
#endif
- .init = grub_vga_text_init,
- .fini = grub_vga_text_fini,
+ .init = grub_vga_text_init_real,
+ .fini = grub_vga_text_fini_real,
.putchar = grub_vga_text_putchar,
.getwh = grub_vga_text_getwh,
.getxy = grub_vga_text_getxy,
--
1.8.1.4

View File

@ -0,0 +1,68 @@
From 1f75c529d5309defb33c8c216422003eee1248a5 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 22 Jul 2012 16:23:46 +0200
Subject: [PATCH 012/364] * grub-core/normal/autofs.c
(autoload_fs_module): Save and restore filter state.
---
ChangeLog | 5 +++++
grub-core/normal/autofs.c | 17 +++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 35e76af..38374a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/normal/autofs.c (autoload_fs_module): Save and restore
+ filter state.
+
+2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+
Fix coreboot compilation.
* grub-core/term/i386/pc/vga_text.c (grub_vga_text_init): Rename to ...
diff --git a/grub-core/normal/autofs.c b/grub-core/normal/autofs.c
index 0b27abf..721b9c3 100644
--- a/grub-core/normal/autofs.c
+++ b/grub-core/normal/autofs.c
@@ -32,11 +32,21 @@ static int
autoload_fs_module (void)
{
grub_named_list_t p;
+ int ret = 0;
+ grub_file_filter_t grub_file_filters_was[GRUB_FILE_FILTER_MAX];
+
+ grub_memcpy (grub_file_filters_was, grub_file_filters_enabled,
+ sizeof (grub_file_filters_enabled));
+ grub_memcpy (grub_file_filters_enabled, grub_file_filters_all,
+ sizeof (grub_file_filters_enabled));
while ((p = fs_module_list) != NULL)
{
if (! grub_dl_get (p->name) && grub_dl_load (p->name))
- return 1;
+ {
+ ret = 1;
+ break;
+ }
if (grub_errno)
grub_print_error ();
@@ -46,7 +56,10 @@ autoload_fs_module (void)
grub_free (p);
}
- return 0;
+ grub_memcpy (grub_file_filters_enabled, grub_file_filters_was,
+ sizeof (grub_file_filters_enabled));
+
+ return ret;
}
/* Read the file fs.lst for auto-loading. */
--
1.8.1.4

View File

@ -0,0 +1,73 @@
From 4942f9b133e52828d2441309beea0e9278e8b80c Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 22 Jul 2012 16:27:03 +0200
Subject: [PATCH 013/364] * grub-core/lib/xzembed/xz_dec_stream.c
(hash_validate): Fix behaviour if hash function is unavailable.
(dec_stream_header): Likewise.
---
ChangeLog | 6 ++++++
grub-core/lib/xzembed/xz_dec_stream.c | 15 ++++++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 38374a3..892d31b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/lib/xzembed/xz_dec_stream.c (hash_validate): Fix behaviour
+ if hash function is unavailable.
+ (dec_stream_header): Likewise.
+
+2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/normal/autofs.c (autoload_fs_module): Save and restore
filter state.
diff --git a/grub-core/lib/xzembed/xz_dec_stream.c b/grub-core/lib/xzembed/xz_dec_stream.c
index 0d79b1f..6170b0c 100644
--- a/grub-core/lib/xzembed/xz_dec_stream.c
+++ b/grub-core/lib/xzembed/xz_dec_stream.c
@@ -403,18 +403,25 @@ static enum xz_ret hash_validate(struct xz_dec *s, struct xz_buf *b,
}
#endif
- do {
+ if (b->in_pos == b->in_size)
+ return XZ_OK;
+
+ if (!crc32 && s->hash_size == 0)
+ s->pos += 8;
+
+ while (s->pos < (crc32 ? 32 : s->hash_size * 8)) {
if (b->in_pos == b->in_size)
return XZ_OK;
#ifndef GRUB_EMBED_DECOMPRESSOR
- if (hash && s->hash_value[s->pos / 8] != b->in[b->in_pos++])
+ if (hash && s->hash_value[s->pos / 8] != b->in[b->in_pos])
return XZ_DATA_ERROR;
#endif
+ b->in_pos++;
s->pos += 8;
- } while (s->pos < (crc32 ? 32 : s->hash_size * 8));
+ }
#ifndef GRUB_EMBED_DECOMPRESSOR
if (s->hash)
@@ -529,8 +536,6 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
s->hash->init(s->index.hash.hash_context);
s->hash->init(s->block.hash.hash_context);
}
- if (!s->hash)
- return XZ_OPTIONS_ERROR;
#endif
}
else
--
1.8.1.4

View File

@ -0,0 +1,83 @@
From 6a6140eac9a2d0889dcf6d118979d4af242b8060 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 22 Jul 2012 16:30:48 +0200
Subject: [PATCH 014/364] * grub-core/loader/i386/bsd.c
(grub_bsd_elf32_size_hook): Fix mask. (grub_bsd_elf32_hook): Likewise.
(grub_bsd_elf64_size_hook): Likewise. (grub_bsd_elf64_hook): Likewise.
(grub_bsd_load_elf): Likewise.
---
ChangeLog | 8 ++++++++
grub-core/loader/i386/bsd.c | 10 +++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 892d31b..f514465 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/loader/i386/bsd.c (grub_bsd_elf32_size_hook): Fix mask.
+ (grub_bsd_elf32_hook): Likewise.
+ (grub_bsd_elf64_size_hook): Likewise.
+ (grub_bsd_elf64_hook): Likewise.
+ (grub_bsd_load_elf): Likewise.
+
+2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/lib/xzembed/xz_dec_stream.c (hash_validate): Fix behaviour
if hash function is unavailable.
(dec_stream_header): Likewise.
diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
index 0fd4df0..6e024e4 100644
--- a/grub-core/loader/i386/bsd.c
+++ b/grub-core/loader/i386/bsd.c
@@ -1309,7 +1309,7 @@ grub_bsd_elf32_size_hook (grub_elf_t elf __attribute__ ((unused)),
&& phdr->p_type != PT_DYNAMIC)
return 0;
- paddr = phdr->p_paddr & 0xFFFFFF;
+ paddr = phdr->p_paddr & 0xFFFFFFF;
if (paddr < kern_start)
kern_start = paddr;
@@ -1333,7 +1333,7 @@ grub_bsd_elf32_hook (Elf32_Phdr * phdr, grub_addr_t * addr, int *do_load)
}
*do_load = 1;
- phdr->p_paddr &= 0xFFFFFF;
+ phdr->p_paddr &= 0xFFFFFFF;
paddr = phdr->p_paddr;
*addr = (grub_addr_t) (paddr - kern_start + (grub_uint8_t *) kern_chunk_src);
@@ -1351,7 +1351,7 @@ grub_bsd_elf64_size_hook (grub_elf_t elf __attribute__ ((unused)),
&& phdr->p_type != PT_DYNAMIC)
return 0;
- paddr = phdr->p_paddr & 0xffffff;
+ paddr = phdr->p_paddr & 0xfffffff;
if (paddr < kern_start)
kern_start = paddr;
@@ -1375,7 +1375,7 @@ grub_bsd_elf64_hook (Elf64_Phdr * phdr, grub_addr_t * addr, int *do_load)
}
*do_load = 1;
- paddr = phdr->p_paddr & 0xffffff;
+ paddr = phdr->p_paddr & 0xfffffff;
*addr = (grub_addr_t) (paddr - kern_start + (grub_uint8_t *) kern_chunk_src);
@@ -1394,7 +1394,7 @@ grub_bsd_load_elf (grub_elf_t elf, const char *filename)
{
grub_relocator_chunk_t ch;
- entry = elf->ehdr.ehdr32.e_entry & 0xFFFFFF;
+ entry = elf->ehdr.ehdr32.e_entry & 0xFFFFFFF;
err = grub_elf32_phdr_iterate (elf, filename,
grub_bsd_elf32_size_hook, NULL);
if (err)
--
1.8.1.4

View File

@ -0,0 +1,368 @@
From c0be2c2099805c621f27d5b3ced224db437a582c Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 22 Jul 2012 19:59:06 +0200
Subject: [PATCH 015/364] New command `lsefi'.
* grub-core/Makefile.core.def (lsefi): New module.
* grub-core/commands/efi/lsefi.c: New file.
* include/grub/efi/api.h: Add more GUIDs.
---
ChangeLog | 8 +++
grub-core/Makefile.core.def | 6 ++
grub-core/commands/efi/lsefi.c | 153 +++++++++++++++++++++++++++++++++++++++++
include/grub/efi/api.h | 142 +++++++++++++++++++++++++++++++++++++-
4 files changed, 308 insertions(+), 1 deletion(-)
create mode 100644 grub-core/commands/efi/lsefi.c
diff --git a/ChangeLog b/ChangeLog
index f514465..a21708c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+ New command `lsefi'.
+
+ * grub-core/Makefile.core.def (lsefi): New module.
+ * grub-core/commands/efi/lsefi.c: New file.
+ * include/grub/efi/api.h: Add more GUIDs.
+
+2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/loader/i386/bsd.c (grub_bsd_elf32_size_hook): Fix mask.
(grub_bsd_elf32_hook): Likewise.
(grub_bsd_elf64_size_hook): Likewise.
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 5c2fcc2..de702d6 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -569,6 +569,12 @@ module = {
};
module = {
+ name = lsefi;
+ common = commands/efi/lsefi.c;
+ enable = efi;
+};
+
+module = {
name = blocklist;
common = commands/blocklist.c;
};
diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
new file mode 100644
index 0000000..8dffbdc
--- /dev/null
+++ b/grub-core/commands/efi/lsefi.c
@@ -0,0 +1,153 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
+ */
+#include <grub/types.h>
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/efi/api.h>
+#include <grub/efi/edid.h>
+#include <grub/efi/pci.h>
+#include <grub/efi/efi.h>
+#include <grub/efi/uga_draw.h>
+#include <grub/efi/graphics_output.h>
+#include <grub/efi/console_control.h>
+#include <grub/command.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+struct known_protocol
+{
+ grub_efi_guid_t guid;
+ const char *name;
+} known_protocols[] =
+ {
+ { GRUB_EFI_DISK_IO_GUID, "disk" },
+ { GRUB_EFI_BLOCK_IO_GUID, "block" },
+ { GRUB_EFI_SERIAL_IO_GUID, "serial" },
+ { GRUB_EFI_SIMPLE_NETWORK_GUID, "network" },
+ { GRUB_EFI_PXE_GUID, "pxe" },
+ { GRUB_EFI_DEVICE_PATH_GUID, "device path" },
+ { GRUB_EFI_PCI_IO_GUID, "PCI" },
+ { GRUB_EFI_PCI_ROOT_IO_GUID, "PCI root" },
+ { GRUB_EFI_EDID_ACTIVE_GUID, "active EDID" },
+ { GRUB_EFI_EDID_DISCOVERED_GUID, "discovered EDID" },
+ { GRUB_EFI_EDID_OVERRIDE_GUID, "override EDID" },
+ { GRUB_EFI_GOP_GUID, "GOP" },
+ { GRUB_EFI_UGA_DRAW_GUID, "UGA draw" },
+ { GRUB_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, "simple text output" },
+ { GRUB_EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, "simple text input" },
+ { GRUB_EFI_SIMPLE_POINTER_PROTOCOL_GUID, "simple pointer" },
+ { GRUB_EFI_CONSOLE_CONTROL_GUID, "console control" },
+ { GRUB_EFI_ABSOLUTE_POINTER_PROTOCOL_GUID, "absolute pointer" },
+ { GRUB_EFI_DRIVER_BINDING_PROTOCOL_GUID, "EFI driver binding" },
+ { GRUB_EFI_LOAD_FILE_PROTOCOL_GUID, "load file" },
+ { GRUB_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, "simple FS" },
+ { GRUB_EFI_TAPE_IO_PROTOCOL_GUID, "tape I/O" },
+ { GRUB_EFI_UNICODE_COLLATION_PROTOCOL_GUID, "unicode collation" },
+ { GRUB_EFI_SCSI_IO_PROTOCOL_GUID, "SCSI I/O" },
+ { GRUB_EFI_USB2_HC_PROTOCOL_GUID, "USB host" },
+ { GRUB_EFI_DEBUG_SUPPORT_PROTOCOL_GUID, "debug support" },
+ { GRUB_EFI_DEBUGPORT_PROTOCOL_GUID, "debug port" },
+ { GRUB_EFI_DECOMPRESS_PROTOCOL_GUID, "decompress" },
+ { GRUB_EFI_LOADED_IMAGE_PROTOCOL_GUID, "loaded image" },
+ { GRUB_EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID, "device path to text" },
+ { GRUB_EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID, "device path utilities" },
+ { GRUB_EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID, "device path from text" },
+ { GRUB_EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID, "HII config routing" },
+ { GRUB_EFI_HII_DATABASE_PROTOCOL_GUID, "HII database" },
+ { GRUB_EFI_HII_STRING_PROTOCOL_GUID, "HII string" },
+ { GRUB_EFI_HII_IMAGE_PROTOCOL_GUID, "HII image" },
+ { GRUB_EFI_HII_FONT_PROTOCOL_GUID, "HII font" },
+ { GRUB_EFI_COMPONENT_NAME2_PROTOCOL_GUID, "component name 2" },
+ { GRUB_EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID,
+ "HII configuration access" },
+ { GRUB_EFI_USB_IO_PROTOCOL_GUID, "USB I/O" },
+ };
+
+static grub_err_t
+grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
+ int argc __attribute__ ((unused)),
+ char **args __attribute__ ((unused)))
+{
+ grub_efi_handle_t *handles;
+ grub_efi_uintn_t num_handles;
+ unsigned i, j, k;
+
+ handles = grub_efi_locate_handle (GRUB_EFI_ALL_HANDLES,
+ NULL, NULL, &num_handles);
+
+ for (i = 0; i < num_handles; i++)
+ {
+ grub_efi_handle_t handle = handles[i];
+ grub_efi_status_t status;
+ grub_efi_uintn_t num_protocols;
+ grub_efi_guid_t **protocols;
+ grub_efi_device_path_t *dp;
+
+ grub_printf ("Handle %p\n", handle);
+
+ dp = grub_efi_get_device_path (handle);
+ if (dp)
+ {
+ grub_printf (" ");
+ grub_efi_print_device_path (dp);
+ }
+
+ status = efi_call_3 (grub_efi_system_table->boot_services->protocols_per_handle,
+ handle, &protocols, &num_protocols);
+ if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Unable to retrieve protocols\n");
+ for (j = 0; j < num_protocols; j++)
+ {
+ for (k = 0; k < ARRAY_SIZE (known_protocols); k++)
+ if (grub_memcmp (protocols[j], &known_protocols[k].guid,
+ sizeof (known_protocols[k].guid)) == 0)
+ break;
+ if (k < ARRAY_SIZE (known_protocols))
+ grub_printf (" %s\n", known_protocols[k].name);
+ else
+ grub_printf (" %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
+ protocols[j]->data1,
+ protocols[j]->data2,
+ protocols[j]->data3,
+ (unsigned) protocols[j]->data4[0],
+ (unsigned) protocols[j]->data4[1],
+ (unsigned) protocols[j]->data4[2],
+ (unsigned) protocols[j]->data4[3],
+ (unsigned) protocols[j]->data4[4],
+ (unsigned) protocols[j]->data4[5],
+ (unsigned) protocols[j]->data4[6],
+ (unsigned) protocols[j]->data4[7]);
+ }
+
+ }
+
+ return 0;
+}
+
+static grub_command_t cmd;
+
+GRUB_MOD_INIT(lsefi)
+{
+ cmd = grub_register_command ("lsefi", grub_cmd_lsefi,
+ NULL, "Display EFI handles.");
+}
+
+GRUB_MOD_FINI(lsefi)
+{
+ grub_unregister_command (cmd);
+}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 26127de..9e7a8d8 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -104,9 +104,149 @@
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
+#define GRUB_EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
+ { 0x387477c1, 0x69c7, 0x11d2, \
+ { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
+ }
+
+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
+ { 0xdd9e7534, 0x7762, 0x4698, \
+ { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } \
+ }
+
+#define GRUB_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
+ { 0x387477c2, 0x69c7, 0x11d2, \
+ { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
+ }
+
+#define GRUB_EFI_SIMPLE_POINTER_PROTOCOL_GUID \
+ { 0x31878c87, 0xb75, 0x11d5, \
+ { 0x9a, 0x4f, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ }
+
+#define GRUB_EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \
+ { 0x8D59D32B, 0xC655, 0x4AE9, \
+ { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } \
+ }
+
+#define GRUB_EFI_DRIVER_BINDING_PROTOCOL_GUID \
+ { 0x18A031AB, 0xB443, 0x4D1A, \
+ { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 } \
+ }
+
+#define GRUB_EFI_LOADED_IMAGE_PROTOCOL_GUID \
+ { 0x5B1B31A1, 0x9562, 0x11d2, \
+ { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \
+ }
+
+#define GRUB_EFI_LOAD_FILE_PROTOCOL_GUID \
+ { 0x56EC3091, 0x954C, 0x11d2, \
+ { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \
+ }
+
+#define GRUB_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
+ { 0x0964e5b22, 0x6459, 0x11d2, \
+ { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
+ }
+
+#define GRUB_EFI_TAPE_IO_PROTOCOL_GUID \
+ { 0x1e93e633, 0xd65a, 0x459e, \
+ { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \
+ }
+
+#define GRUB_EFI_UNICODE_COLLATION_PROTOCOL_GUID \
+ { 0x1d85cd7f, 0xf43d, 0x11d2, \
+ { 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ }
+
+#define GRUB_EFI_SCSI_IO_PROTOCOL_GUID \
+ { 0x932f47e6, 0x2362, 0x4002, \
+ { 0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \
+ }
+
+#define GRUB_EFI_USB2_HC_PROTOCOL_GUID \
+ { 0x3e745226, 0x9818, 0x45b6, \
+ { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } \
+ }
+
+#define GRUB_EFI_DEBUG_SUPPORT_PROTOCOL_GUID \
+ { 0x2755590C, 0x6F3C, 0x42FA, \
+ { 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \
+ }
+
+#define GRUB_EFI_DEBUGPORT_PROTOCOL_GUID \
+ { 0xEBA4E8D2, 0x3858, 0x41EC, \
+ { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \
+ }
+
+#define GRUB_EFI_DECOMPRESS_PROTOCOL_GUID \
+ { 0xd8117cfe, 0x94a6, 0x11d4, \
+ { 0x9a, 0x3a, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ }
+
+#define GRUB_EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
+ { 0x8b843e20, 0x8132, 0x4852, \
+ { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } \
+ }
+
+#define GRUB_EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
+ { 0x379be4e, 0xd706, 0x437d, \
+ { 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \
+ }
+
+#define GRUB_EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \
+ { 0x5c99a21, 0xc70f, 0x4ad2, \
+ { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } \
+ }
+
+#define GRUB_EFI_ACPI_TABLE_PROTOCOL_GUID \
+ { 0xffe06bdd, 0x6107, 0x46a6, \
+ { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c} \
+ }
+
+#define GRUB_EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \
+ { 0x587e72d7, 0xcc50, 0x4f79, \
+ { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } \
+ }
+
+#define GRUB_EFI_HII_DATABASE_PROTOCOL_GUID \
+ { 0xef9fc172, 0xa1b2, 0x4693, \
+ { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } \
+ }
+
+#define GRUB_EFI_HII_STRING_PROTOCOL_GUID \
+ { 0xfd96974, 0x23aa, 0x4cdc, \
+ { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } \
+ }
+
+#define GRUB_EFI_HII_IMAGE_PROTOCOL_GUID \
+ { 0x31a6406a, 0x6bdf, 0x4e46, \
+ { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } \
+ }
+
+#define GRUB_EFI_HII_FONT_PROTOCOL_GUID \
+ { 0xe9ca4775, 0x8657, 0x47fc, \
+ { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } \
+ }
+
+#define GRUB_EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID \
+ { 0x330d4706, 0xf2a0, 0x4e4f, \
+ { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } \
+ }
+
+#define GRUB_EFI_COMPONENT_NAME2_PROTOCOL_GUID \
+ { 0x6a7a5cff, 0xe8d9, 0x4f70, \
+ { 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14} \
+ }
+
+#define GRUB_EFI_USB_IO_PROTOCOL_GUID \
+ { 0x2B2F68D6, 0x0CD2, 0x44cf, \
+ { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \
+ }
+
#define GRUB_EFI_MPS_TABLE_GUID \
{ 0xeb9d2d2f, 0x2d88, 0x11d3, \
- { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ { 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
#define GRUB_EFI_ACPI_TABLE_GUID \
--
1.8.1.4

View File

@ -0,0 +1,162 @@
From 14589a819717d1d6614687202159a0070bba1f8f Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 22 Jul 2012 20:02:17 +0200
Subject: [PATCH 016/364] * util/grub-mkconfig_lib.in (grub_quote):
Remove extra layer of escape. * util/grub.d/10_hurd.in: Add missing quoting.
* util/grub.d/10_illumos.in: Likewise. * util/grub.d/10_kfreebsd.in:
Likewise. * util/grub.d/10_linux.in: Likewise. *
util/grub.d/20_linux_xen.in: Likewise.
---
ChangeLog | 9 +++++++++
util/grub-mkconfig_lib.in | 10 +++++-----
util/grub.d/10_hurd.in | 4 ++--
util/grub.d/10_illumos.in | 1 +
util/grub.d/10_kfreebsd.in | 2 +-
util/grub.d/10_linux.in | 4 ++--
util/grub.d/20_linux_xen.in | 6 +++---
7 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a21708c..0db6239 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+ * util/grub-mkconfig_lib.in (grub_quote): Remove extra layer of escape.
+ * util/grub.d/10_hurd.in: Add missing quoting.
+ * util/grub.d/10_illumos.in: Likewise.
+ * util/grub.d/10_kfreebsd.in: Likewise.
+ * util/grub.d/10_linux.in: Likewise.
+ * util/grub.d/20_linux_xen.in: Likewise.
+
+2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
+
New command `lsefi'.
* grub-core/Makefile.core.def (lsefi): New module.
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 76133b4..beb52ee 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -255,19 +255,19 @@ version_find_latest ()
echo "$version_find_latest_a"
}
-# One layer of quotation is eaten by "", the second by sed, and the third by
-# printf; so this turns ' into \'. Note that you must use the output of
+# One layer of quotation is eaten by "" and the second by
+# sed; so this turns ' into \'. Note that you must use the output of
# this function in a printf format string.
grub_quote () {
- sed "s/'/'\\\\\\\\''/g"
+ sed "s/'/'\\\\''/g"
}
gettext_quoted () {
- gettext "$@" | sed "s/'/'\\\\\\\\''/g"
+ gettext "$@" | grub_quote
}
-# Run the first argument through gettext_quoted, and then pass that and all
+# Run the first argument through gettext, and then pass that and all
# remaining arguments to printf. This is a useful abbreviation and tends to
# be easier to type.
gettext_printf () {
diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in
index 6451060..45f0ad3 100644
--- a/util/grub.d/10_hurd.in
+++ b/util/grub.d/10_hurd.in
@@ -117,7 +117,7 @@ EOF
opts=
fi
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} $opts ${GRUB_CMDLINE_GNUMACH}
EOF
@@ -133,7 +133,7 @@ EOF
fi
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
module /hurd/${hurd_fs}.static ${hurd_fs} $opts \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\
diff --git a/util/grub.d/10_illumos.in b/util/grub.d/10_illumos.in
index 422d56f..2477466 100644
--- a/util/grub.d/10_illumos.in
+++ b/util/grub.d/10_illumos.in
@@ -46,6 +46,7 @@ message="$(gettext_printf "Loading kernel of Illumos ...")"
ISADIR=
fi
zfs-bootfs $($grub_mkrelpath /) ZFS_BOOTFS
+ echo '$(echo "$message" | grub_quote)'
multiboot $($grub_mkrelpath /platform/i86pc/kernel)/\$ISADIR/unix /platform/i86pc/kernel/\$ISADIR/unix -B \$ZFS_BOOTFS,console=text
module $($grub_mkrelpath /platform/i86pc)/\$ISADIR/boot_archive /platform/i86pc/\$ISADIR/boot_archive
}
diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in
index 93405a6..b0e84e2 100644
--- a/util/grub.d/10_kfreebsd.in
+++ b/util/grub.d/10_kfreebsd.in
@@ -100,7 +100,7 @@ kfreebsd_entry ()
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
kfreebsd ${rel_dirname}/${basename} ${args}
EOF
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 14402e8..35f7a83 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -134,14 +134,14 @@ linux_entry ()
fi
message="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
initrd ${rel_dirname}/${initrd}
EOF
fi
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 1d94502..33f1592 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -120,16 +120,16 @@ linux_entry ()
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
- echo '$xmessage'
+ echo '$(echo "$xmessage" | grub_quote)'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
- echo '$lmessage'
+ echo '$(echo "$lmessage" | grub_quote)'
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
module ${rel_dirname}/${initrd}
EOF
fi
--
1.8.1.4

View File

@ -0,0 +1,59 @@
From 6054ac4ca1ce5f3e4589bfead3c9c05af89f9ace Mon Sep 17 00:00:00 2001
From: starous <starous@pracovna>
Date: Sun, 22 Jul 2012 21:09:30 +0200
Subject: [PATCH 017/364] EHCI and OHCI PCI bus master
---
ChangeLog | 5 +++++
grub-core/bus/usb/ehci.c | 5 +++++
grub-core/bus/usb/ohci.c | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0db6239..01d4f92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-22 Ales Nesrsta <starous@volny.cz>
+
+ * grub-core/bus/usb/ehci.c: PCI iter. - added PCI bus master setting.
+ * grub-core/bus/usb/ohci.c: PCI iter. - added PCI bus master setting.
+
2012-07-22 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkconfig_lib.in (grub_quote): Remove extra layer of escape.
diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c
index b700519..d99a4be 100644
--- a/grub-core/bus/usb/ehci.c
+++ b/grub-core/bus/usb/ehci.c
@@ -533,6 +533,11 @@ grub_ehci_pci_iter (grub_pci_device_t dev,
"EHCI grub_ehci_pci_iter: registers above 4G are not supported\n");
return 0;
}
+
+ /* Set bus master - needed for coreboot, VMware, broken BIOSes etc. */
+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
+ grub_pci_write_word(addr,
+ GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr));
grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: 32-bit EHCI OK\n");
}
diff --git a/grub-core/bus/usb/ohci.c b/grub-core/bus/usb/ohci.c
index 23cf631..6fabb4b 100644
--- a/grub-core/bus/usb/ohci.c
+++ b/grub-core/bus/usb/ohci.c
@@ -270,6 +270,11 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
return 0;
#endif
+ /* Set bus master - needed for coreboot, VMware, broken BIOSes etc. */
+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
+ grub_pci_write_word(addr,
+ GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr));
+
grub_dprintf ("ohci", "class=0x%02x 0x%02x interface 0x%02x\n",
class, subclass, interf);
}
--
1.8.1.4

View File

@ -0,0 +1,115 @@
From 8d7ed36e113b21de18a1b4a2bf81d218d79114d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= <gregoire.sutre@gmail.com>
Date: Wed, 1 Aug 2012 00:18:57 +0200
Subject: [PATCH 018/364] Update manual NetBSD-wise.
---
ChangeLog | 5 +++++
docs/grub.texi | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 01d4f92..b246d4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-31 Grégoire Sutre <gregoire.sutre@gmail.com>
+
+ * docs/grub.texi: Note that NetBSD/i386 is Multiboot-compliant.
+ (NetBSD): New subsection.
+
2012-07-22 Ales Nesrsta <starous@volny.cz>
* grub-core/bus/usb/ehci.c: PCI iter. - added PCI bus master setting.
diff --git a/docs/grub.texi b/docs/grub.texi
index b5954da..b0e7f59 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -311,8 +311,10 @@ tables are also loaded.
@item Support non-Multiboot kernels
Support many of the various free 32-bit kernels that lack Multiboot
-compliance (primarily FreeBSD, NetBSD, OpenBSD, and
-Linux). Chain-loading of other boot loaders is also supported.
+compliance (primarily FreeBSD, NetBSD@footnote{The NetBSD/i386 kernel
+is Multiboot-compliant, but lacks support for Multiboot modules.},
+OpenBSD, and Linux). Chain-loading of other boot loaders is also
+supported.
@item Load multiples modules
Fully support the Multiboot feature of loading multiple modules.
@@ -897,6 +899,7 @@ Here, we describe some caveats on several operating systems.
@menu
* GNU/Hurd::
* GNU/Linux::
+* NetBSD::
* DOS/Windows::
@end menu
@@ -997,6 +1000,63 @@ the size, run the command @command{uppermem} @emph{before} loading the
kernel. @xref{uppermem}, for more information.
+@node NetBSD
+@subsection NetBSD
+
+Booting a NetBSD kernel from GRUB is also relatively easy: first set
+GRUB's root device, then load the kernel and the modules, and finally
+run @command{boot}.
+
+@enumerate
+@item
+Set GRUB's root device to the partition holding the NetBSD root file
+system. For a disk with a NetBSD disk label, this is usually the first
+partition (a:). In that case, and assuming that the partition is on the
+first hard disk, set GRUB's root device as follows:
+
+@example
+grub> @kbd{insmod part_bsd}
+grub> @kbd{set root=(hd0,netbsd1)}
+@end example
+
+For a disk with a GUID Partition Table (GPT), and assuming that the
+NetBSD root partition is the third GPT partition, do this:
+
+@example
+grub> @kbd{insmod part_gpt}
+grub> @kbd{set root=(hd0,gpt3)}
+@end example
+
+@item
+Load the kernel using the command @command{knetbsd}:
+
+@example
+grub> @kbd{knetbsd /netbsd}
+@end example
+
+Various options may be given to @command{knetbsd}. These options are,
+for the most part, the same as in the NetBSD boot loader. For instance,
+to boot the system in single-user mode and with verbose messages, do
+this:
+
+@example
+grub> @kbd{knetbsd /netbsd -s -v}
+@end example
+
+@item
+If needed, load kernel modules with the command
+@command{knetbsd_module_elf}. A typical example is the module for the
+root file system:
+
+@example
+grub> @kbd{knetbsd_module_elf /stand/amd64/6.0/modules/ffs/ffs.kmod}
+@end example
+
+@item
+Finally, run the command @command{boot} (@pxref{boot}).
+@end enumerate
+
+
@node DOS/Windows
@subsection DOS/Windows
--
1.8.1.4

View File

@ -0,0 +1,68 @@
From 8b2ef54da3e28cf66637a09c2a2afad9ee56a535 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= <gregoire.sutre@gmail.com>
Date: Wed, 1 Aug 2012 01:06:53 +0200
Subject: [PATCH 019/364] Regenerate po/POTFILES.in with the following commmand
in a clean tree:
export LC_ALL=en_US.UTF-8
find . -iname '*.[ch]' | sort > po/POTFILES.in
---
ChangeLog | 4 ++++
po/POTFILES.in | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b246d4e..dd1fda8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-07-31 Grégoire Sutre <gregoire.sutre@gmail.com>
+ * po/POTFILES.in: Regenerated.
+
+2012-07-31 Grégoire Sutre <gregoire.sutre@gmail.com>
+
* docs/grub.texi: Note that NetBSD/i386 is Multiboot-compliant.
(NetBSD): New subsection.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 987b37a..01cc53c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -32,6 +32,7 @@
./grub-core/commands/efi/acpi.c
./grub-core/commands/efi/fixvideo.c
./grub-core/commands/efi/loadbios.c
+./grub-core/commands/efi/lsefi.c
./grub-core/commands/efi/lsefimmap.c
./grub-core/commands/efi/lsefisystab.c
./grub-core/commands/efi/lssal.c
@@ -558,8 +559,8 @@
./grub-core/term/emu/console.c
./grub-core/term/gfxterm.c
./grub-core/term/i386/pc/console.c
+./grub-core/term/i386/pc/mda_text.c
./grub-core/term/i386/pc/vga_text.c
-./grub-core/term/i386/vga_common.c
./grub-core/term/ieee1275/console.c
./grub-core/term/ieee1275/escc.c
./grub-core/term/ieee1275/serial.c
@@ -730,7 +731,6 @@
./include/grub/i386/time.h
./include/grub/i386/tsc.h
./include/grub/i386/types.h
-./include/grub/i386/vga_common.h
./include/grub/i386/xnu.h
./include/grub/ia64/efi/memory.h
./include/grub/ia64/efi/time.h
@@ -867,6 +867,7 @@
./include/grub/util/ofpath.h
./include/grub/util/resolve.h
./include/grub/vga.h
+./include/grub/vgaregs.h
./include/grub/video_fb.h
./include/grub/video.h
./include/grub/x86_64/at_keyboard.h
--
1.8.1.4

View File

@ -0,0 +1,38 @@
From cb6d50b03d383cae32b0fbe308acc76c9d041fc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= <gregoire.sutre@gmail.com>
Date: Sun, 5 Aug 2012 16:49:03 +0200
Subject: [PATCH 020/364] Strengthen the configure test for working -nostdinc
-isystem.
---
ChangeLog | 4 ++++
configure.ac | 1 +
2 files changed, 5 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index dd1fda8..a0a81b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-08-05 Grégoire Sutre <gregoire.sutre@gmail.com>
+
+ * configure.ac: Strengthen the test for working -nostdinc -isystem.
+
2012-07-31 Grégoire Sutre <gregoire.sutre@gmail.com>
* po/POTFILES.in: Regenerated.
diff --git a/configure.ac b/configure.ac
index 91b36d0..190665d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -717,6 +717,7 @@ AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
SAVED_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
+#include <stddef.h>
int va_arg_func (int fixed, va_list args);]], [[]])],
[grub_cv_cc_isystem=yes],
[grub_cv_cc_isystem=no])
--
1.8.1.4

View File

@ -0,0 +1,27 @@
From 96aea00a1794415ecc4f01d3e05569927df19420 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Tue, 4 Sep 2012 18:33:33 +0100
Subject: [PATCH 021/364] * .bzrignore: Add grub-bios-setup, grub-ofpathname,
and grub-sparc64-setup.
---
.bzrignore | 3 +++
ChangeLog | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index a0a81b1..ed23d17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-04 Colin Watson <cjwatson@ubuntu.com>
+
+ * .bzrignore: Add grub-bios-setup, grub-ofpathname, and
+ grub-sparc64-setup.
+
2012-08-05 Grégoire Sutre <gregoire.sutre@gmail.com>
* configure.ac: Strengthen the test for working -nostdinc -isystem.
--
1.8.1.4

View File

@ -0,0 +1,38 @@
From cec2f4441396afd4c6abad10e51e5f0fe1dad686 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Tue, 4 Sep 2012 18:39:40 +0100
Subject: [PATCH 022/364] * docs/man/grub-mkdevicemap.h2m: Remove, since
grub-mkdevicemap is gone.
---
ChangeLog | 5 +++++
docs/man/grub-mkdevicemap.h2m | 4 ----
2 files changed, 5 insertions(+), 4 deletions(-)
delete mode 100644 docs/man/grub-mkdevicemap.h2m
diff --git a/ChangeLog b/ChangeLog
index ed23d17..09ffe65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-04 Colin Watson <cjwatson@debian.org>
+
+ * docs/man/grub-mkdevicemap.h2m: Remove, since grub-mkdevicemap is
+ gone.
+
2012-09-04 Colin Watson <cjwatson@ubuntu.com>
* .bzrignore: Add grub-bios-setup, grub-ofpathname, and
diff --git a/docs/man/grub-mkdevicemap.h2m b/docs/man/grub-mkdevicemap.h2m
deleted file mode 100644
index 3ef8e97..0000000
--- a/docs/man/grub-mkdevicemap.h2m
+++ /dev/null
@@ -1,4 +0,0 @@
-[NAME]
-grub-mkdevicemap \- generate a GRUB device map file automatically
-[SEE ALSO]
-.BR grub-install (8)
--
1.8.1.4

View File

@ -0,0 +1,27 @@
From 9023fdb4b0f75d3c8e1d0e1b0199ecd416a18c59 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Tue, 4 Sep 2012 18:56:13 +0100
Subject: [PATCH 023/364] * grub-core/mmap/mips/loongson: Remove empty
directory.
---
ChangeLog | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 09ffe65..5a938ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-2012-09-04 Colin Watson <cjwatson@debian.org>
+2012-09-04 Colin Watson <cjwatson@ubuntu.com>
+
+ * grub-core/mmap/mips/loongson: Remove empty directory.
+
+2012-09-04 Colin Watson <cjwatson@ubuntu.com>
* docs/man/grub-mkdevicemap.h2m: Remove, since grub-mkdevicemap is
gone.
--
1.8.1.4

View File

@ -0,0 +1,46 @@
From 75887218d652d578af29494dd54cd8733643653b Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Tue, 4 Sep 2012 18:59:41 +0100
Subject: [PATCH 024/364] * Makefile.am (EXTRA_DIST): Add
grub-core/tests/boot/linux.init-mips.S,
grub-core/tests/boot/linux.init-ppc.S, and
grub-core/tests/boot/linux-ppc.cfg.
---
ChangeLog | 7 +++++++
Makefile.am | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 5a938ae..b1950ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-09-04 Colin Watson <cjwatson@ubuntu.com>
+ * Makefile.am (EXTRA_DIST): Add
+ grub-core/tests/boot/linux.init-mips.S,
+ grub-core/tests/boot/linux.init-ppc.S, and
+ grub-core/tests/boot/linux-ppc.cfg.
+
+2012-09-04 Colin Watson <cjwatson@ubuntu.com>
+
* grub-core/mmap/mips/loongson: Remove empty directory.
2012-09-04 Colin Watson <cjwatson@ubuntu.com>
diff --git a/Makefile.am b/Makefile.am
index db9e930..3bb911c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -377,7 +377,7 @@ if COND_powerpc_ieee1275
BOOTCHECKS = bootcheck-linux-ppc
endif
-EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg
+EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg
.PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \
bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \
--
1.8.1.4

View File

@ -0,0 +1,45 @@
From e8ec492c1f16328149e2e2c1eed6c300529bcb7a Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Tue, 4 Sep 2012 23:35:38 +0100
Subject: [PATCH 025/364] * Makefile.am (EXTRA_DIST): Add linguas.sh. It's
only strictly required for checkouts from bzr, but it may be useful for users
or distributors wishing to update translations against a tarball
distribution, and it can be helpful for the tarball to be a superset of
what's in bzr.
---
ChangeLog | 8 ++++++++
Makefile.am | 2 ++
2 files changed, 10 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index b1950ab..fbef0c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-09-04 Colin Watson <cjwatson@ubuntu.com>
+ * Makefile.am (EXTRA_DIST): Add linguas.sh. It's only strictly
+ required for checkouts from bzr, but it may be useful for users or
+ distributors wishing to update translations against a tarball
+ distribution, and it can be helpful for the tarball to be a superset
+ of what's in bzr.
+
+2012-09-04 Colin Watson <cjwatson@ubuntu.com>
+
* Makefile.am (EXTRA_DIST): Add
grub-core/tests/boot/linux.init-mips.S,
grub-core/tests/boot/linux.init-ppc.S, and
diff --git a/Makefile.am b/Makefile.am
index 3bb911c..30aa5a7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -390,3 +390,5 @@ SUCCESSFUL_BOOT_STRING=3e49994fd5d82b7c9298d672d774080d
BOOTCHECK_TIMEOUT=180
bootcheck: $(BOOTCHECKS)
+
+EXTRA_DIST += linguas.sh
--
1.8.1.4

View File

@ -0,0 +1,39 @@
From 981361e1db432371d895ac1339cc4a940cd6830e Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 5 Sep 2012 08:45:07 +0200
Subject: [PATCH 026/364] * grub-core/fs/xfs.c (grub_xfs_read_block):
Make keys a const pointer.
---
ChangeLog | 4 ++++
grub-core/fs/xfs.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index fbef0c3..0cf6bea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/xfs.c (grub_xfs_read_block): Make keys a const pointer.
+
2012-09-04 Colin Watson <cjwatson@ubuntu.com>
* Makefile.am (EXTRA_DIST): Add linguas.sh. It's only strictly
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
index 2c6b00c..1ed048f 100644
--- a/grub-core/fs/xfs.c
+++ b/grub-core/fs/xfs.c
@@ -285,7 +285,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (node->inode.format == XFS_INODE_FORMAT_BTREE)
{
- grub_uint64_t *keys;
+ const grub_uint64_t *keys;
int recoffset;
leaf = grub_malloc (node->data->bsize);
--
1.8.1.4

View File

@ -0,0 +1,41 @@
From 33437c4676de37bf30679b5874813af38e5c00c2 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 5 Sep 2012 08:47:39 +0200
Subject: [PATCH 027/364] * grub-core/partmap/dvh.c (grub_dvh_is_valid):
Add missing byteswap.
---
ChangeLog | 4 ++++
grub-core/partmap/dvh.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0cf6bea..70f0c86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/partmap/dvh.c (grub_dvh_is_valid): Add missing byteswap.
+
+2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/fs/xfs.c (grub_xfs_read_block): Make keys a const pointer.
2012-09-04 Colin Watson <cjwatson@ubuntu.com>
diff --git a/grub-core/partmap/dvh.c b/grub-core/partmap/dvh.c
index c8f467e..79ec01b 100644
--- a/grub-core/partmap/dvh.c
+++ b/grub-core/partmap/dvh.c
@@ -57,7 +57,7 @@ grub_dvh_is_valid (grub_uint32_t *label)
for (pos = label;
pos < (label + sizeof (struct grub_dvh_block) / 4);
pos++)
- sum += *pos;
+ sum += grub_be_to_cpu32 (*pos);
return ! sum;
}
--
1.8.1.4

View File

@ -0,0 +1,42 @@
From b7ae222dae310111f17da6e1fc072237977ac417 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 5 Sep 2012 08:51:31 +0200
Subject: [PATCH 028/364] * grub-core/script/yylex.l: Ignore
unused-function and sign-compare warnings.
---
ChangeLog | 5 +++++
grub-core/script/yylex.l | 2 ++
2 files changed, 7 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 70f0c86..66a0245 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/script/yylex.l: Ignore unused-function and sign-compare
+ warnings.
+
+2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/partmap/dvh.c (grub_dvh_is_valid): Add missing byteswap.
2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l
index f6a39c5..8fdcfef 100644
--- a/grub-core/script/yylex.l
+++ b/grub-core/script/yylex.l
@@ -29,6 +29,8 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wsign-compare"
#define yyfree grub_lexer_yyfree
#define yyalloc grub_lexer_yyalloc
--
1.8.1.4

View File

@ -0,0 +1,67 @@
From 41596a656df83fe0bd72944b711c127c68d28a94 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 5 Sep 2012 08:56:08 +0200
Subject: [PATCH 029/364] * grub-core/disk/ieee1275/ofdisk.c (scan):
Check function return value. * grub-core/lib/ieee1275/datetime.c
(grub_get_datetime): Likewise. (grub_set_datetime): Likewise.
---
ChangeLog | 6 ++++++
grub-core/disk/ieee1275/ofdisk.c | 2 +-
grub-core/lib/ieee1275/datetime.c | 4 ++--
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 66a0245..ff982b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/disk/ieee1275/ofdisk.c (scan): Check function return value.
+ * grub-core/lib/ieee1275/datetime.c (grub_get_datetime): Likewise.
+ (grub_set_datetime): Likewise.
+
+2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/script/yylex.l: Ignore unused-function and sign-compare
warnings.
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
index b0aa7ec..c9535a0 100644
--- a/grub-core/disk/ieee1275/ofdisk.c
+++ b/grub-core/disk/ieee1275/ofdisk.c
@@ -178,7 +178,7 @@ scan (void)
args.table = 0;
args.nentries = 0;
- if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1 || args.catch_result)
{
grub_ieee1275_close (ihandle);
return 0;
diff --git a/grub-core/lib/ieee1275/datetime.c b/grub-core/lib/ieee1275/datetime.c
index 1947135..8792429 100644
--- a/grub-core/lib/ieee1275/datetime.c
+++ b/grub-core/lib/ieee1275/datetime.c
@@ -89,7 +89,7 @@ grub_get_datetime (struct grub_datetime *datetime)
grub_ieee1275_close (ihandle);
- if (status == -1)
+ if (status == -1 || args.catch_result)
return grub_error (GRUB_ERR_IO, "get-time failed");
datetime->year = args.year;
@@ -148,7 +148,7 @@ grub_set_datetime (struct grub_datetime *datetime)
grub_ieee1275_close (ihandle);
- if (status == -1)
+ if (status == -1 || args.catch_result)
return grub_error (GRUB_ERR_IO, "set-time failed");
return GRUB_ERR_NONE;
--
1.8.1.4

View File

@ -0,0 +1,40 @@
From 53a8f5760591b14160bc07ef10f083882516ad27 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 5 Sep 2012 09:00:39 +0100
Subject: [PATCH 030/364] * util/import_gcry.py: Sort cipher_files, to make
build system generation more deterministic.
---
ChangeLog | 5 +++++
util/import_gcry.py | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index ff982b3..9124825 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-05 Colin Watson <cjwatson@ubuntu.com>
+
+ * util/import_gcry.py: Sort cipher_files, to make build system
+ generation more deterministic.
+
2012-09-05 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/ieee1275/ofdisk.c (scan): Check function return value.
diff --git a/util/import_gcry.py b/util/import_gcry.py
index 18966a6..64c5870 100644
--- a/util/import_gcry.py
+++ b/util/import_gcry.py
@@ -40,7 +40,7 @@ try:
except:
print ("WARNING: %s already exists" % cipher_dir_out)
-cipher_files = os.listdir (cipher_dir_in)
+cipher_files = sorted (os.listdir (cipher_dir_in))
conf = codecs.open (os.path.join ("grub-core", "Makefile.gcry.def"), "w", "utf-8")
conf.write ("AutoGen definitions Makefile.tpl;\n\n")
confutil = codecs.open ("Makefile.utilgcry.def", "w", "utf-8")
--
1.8.1.4

39
0031-NEWS-Fix-typo.patch Normal file
View File

@ -0,0 +1,39 @@
From f333a71c6c02232151d9af98a8beae3b5e23e102 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 5 Sep 2012 13:55:54 +0100
Subject: [PATCH 031/364] * NEWS: Fix typo.
---
ChangeLog | 4 ++++
NEWS | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 9124825..9323887 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-09-05 Colin Watson <cjwatson@ubuntu.com>
+ * NEWS: Fix typo.
+
+2012-09-05 Colin Watson <cjwatson@ubuntu.com>
+
* util/import_gcry.py: Sort cipher_files, to make build system
generation more deterministic.
diff --git a/NEWS b/NEWS
index f9b06ab..4bb5f98 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
New in 2.00:
-* Appearence:
+* Appearance:
* Official theme for gfxmenu (starfield)
* Menu is organised with submenus.
* Better default video mode selection using EDID.
--
1.8.1.4

View File

@ -0,0 +1,38 @@
From 4b13dd6c2fe6f75027c51f4b2616509040a5ea33 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Wed, 5 Sep 2012 16:09:41 +0200
Subject: [PATCH 032/364] * configure.ac: Add SuSe path.
---
ChangeLog | 4 ++++
configure.ac | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 9323887..10b1ab3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-05 Jiri Slaby <jslaby@suse.cz>
+
+ * configure.ac: Add SuSe path.
+
2012-09-05 Colin Watson <cjwatson@ubuntu.com>
* NEWS: Fix typo.
diff --git a/configure.ac b/configure.ac
index 190665d..ea3830a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,7 +242,7 @@ fi
FONT_SOURCE=
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
- for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
+ for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni; do
if test -f "$dir/unifont.$ext"; then
FONT_SOURCE="$dir/unifont.$ext"
break 2
--
1.8.1.4

View File

@ -1,42 +1,44 @@
From 2c7cdc59a8d6cb7800c73b90aa75cc8b21807af6 Mon Sep 17 00:00:00 2001
From 9e9382ece3511ff530cfb3e1c1e7a7dbaa3416b6 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 24 May 2012 08:37:21 -0400
Subject: [PATCH] Add support for entering the firmware setup screen.
Date: Sat, 8 Sep 2012 09:40:24 +0200
Subject: [PATCH 033/364] * grub-core/Makefile.core.def (efifwsetup):
New module. * grub-core/commands/efi/efifwsetup.c: New file. *
grub-core/kern/efi/efi.c (grub_efi_set_variable): New function *
include/grub/efi/api.h (GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI): New
define. * include/grub/efi/efi.h (grub_efi_set_variable): New proto.
This adds a command "fwsetup", with which you can enter your firmware
setup screen. The mechanism is to set a global UEFI variable with a
specific value and reboot.
---
ChangeLog | 8 ++++
grub-core/Makefile.core.def | 6 +++
grub-core/commands/efi/efifwsetup.c | 88 +++++++++++++++++++++++++++++++++++
grub-core/kern/efi/efi.c | 30 ++++++++++++
include/grub/efi/api.h | 2 +
include/grub/efi/efi.h | 5 ++
6 files changed, 139 insertions(+)
ChangeLog | 9 ++++
grub-core/Makefile.core.def | 6 +++
grub-core/commands/efi/efifwsetup.c | 90 +++++++++++++++++++++++++++++++++++++
grub-core/kern/efi/efi.c | 30 +++++++++++++
include/grub/efi/api.h | 2 +
include/grub/efi/efi.h | 5 +++
6 files changed, 142 insertions(+)
create mode 100644 grub-core/commands/efi/efifwsetup.c
#diff --git a/ChangeLog b/ChangeLog
#index ce52576..29ebcbd 100644
#--- a/ChangeLog
#+++ b/ChangeLog
#@@ -1,3 +1,11 @@
#+2012-05-24 Peter Jones <pjones@redhat.com>
#+
#+ * grub-core/Makefile.core.def: add efifwsetup module
#+ * grub-core/commands/efi/efifwsetup.c: add code for fwsetup command
#+ * grub-core/kern/efi/efi.c (grub_efi_set_variable): New function
#+ * include/grub/efi/api.h: add define for OsIndications variable
#+ * include/grub/efi/efi.h: export grub_efi_set_variable
#+
# 2012-05-31 Vladimir Serbinenko <phcoder@gmail.com>
#
# * configure.ac: Bump to beta6.
diff --git a/ChangeLog b/ChangeLog
index 10b1ab3..e8f0577 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-09-08 Peter Jones <pjones@redhat.com>
+
+ * grub-core/Makefile.core.def (efifwsetup): New module.
+ * grub-core/commands/efi/efifwsetup.c: New file.
+ * grub-core/kern/efi/efi.c (grub_efi_set_variable): New function
+ * include/grub/efi/api.h (GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI):
+ New define.
+ * include/grub/efi/efi.h (grub_efi_set_variable): New proto.
+
2012-09-05 Jiri Slaby <jslaby@suse.cz>
* configure.ac: Add SuSe path.
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 000cf0d..d0c06d5 100644
index de702d6..7a7b97a 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -576,6 +576,12 @@ module = {
@@ -575,6 +575,12 @@ module = {
};
module = {
@ -51,10 +53,10 @@ index 000cf0d..d0c06d5 100644
};
diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c
new file mode 100644
index 0000000..756a14c
index 0000000..7a137a7
--- /dev/null
+++ b/grub-core/commands/efi/efifwsetup.c
@@ -0,0 +1,88 @@
@@ -0,0 +1,90 @@
+/* fwsetup.c - Reboot into firmware setup menu. */
+/*
+ * GRUB -- GRand Unified Bootloader
@ -73,12 +75,14 @@ index 0000000..756a14c
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/types.h>
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/efi/api.h>
+#include <grub/efi/efi.h>
+#include <grub/command.h>
+#include <grub/i18n.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
@ -93,18 +97,18 @@ index 0000000..756a14c
+ grub_size_t oi_size;
+ grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+
+ old_os_indications = grub_efi_get_variable("OsIndications", &global,
+ &oi_size);
+ old_os_indications = grub_efi_get_variable ("OsIndications", &global,
+ &oi_size);
+
+ if (old_os_indications != NULL && oi_size == sizeof(*old_os_indications))
+ if (old_os_indications != NULL && oi_size == sizeof (os_indications))
+ os_indications |= *old_os_indications;
+
+ status = grub_efi_set_variable("OsIndications", &global, &os_indications,
+ sizeof (os_indications));
+ status = grub_efi_set_variable ("OsIndications", &global, &os_indications,
+ sizeof (os_indications));
+ if (status != GRUB_ERR_NONE)
+ return status;
+
+ grub_reboot();
+ grub_reboot ();
+
+ return GRUB_ERR_BUG;
+}
@ -112,14 +116,14 @@ index 0000000..756a14c
+static grub_command_t cmd = NULL;
+
+static grub_efi_boolean_t
+efifwsetup_is_supported(void)
+efifwsetup_is_supported (void)
+{
+ grub_efi_uint64_t *os_indications_supported = NULL;
+ grub_size_t oi_size = 0;
+ grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+
+ os_indications_supported = grub_efi_get_variable("OsIndicationsSupported",
+ &global, &oi_size);
+ os_indications_supported = grub_efi_get_variable ("OsIndicationsSupported",
+ &global, &oi_size);
+
+ if (!os_indications_supported)
+ return 0;
@ -130,25 +134,25 @@ index 0000000..756a14c
+ return 0;
+}
+
+GRUB_MOD_INIT(efifwsetup)
+GRUB_MOD_INIT (efifwsetup)
+{
+ if (efifwsetup_is_supported())
+ cmd = grub_register_command("fwsetup", grub_cmd_fwsetup, "",
+ "Reboot into firmware setup menu.");
+ if (efifwsetup_is_supported ())
+ cmd = grub_register_command ("fwsetup", grub_cmd_fwsetup, NULL,
+ N_("Reboot into firmware setup menu."));
+
+}
+
+GRUB_MOD_FINI(efifwsetup)
+GRUB_MOD_FINI (efifwsetup)
+{
+ if (cmd)
+ grub_unregister_command (cmd);
+}
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 6f12c76..7a418a6 100644
index 02d2f9a..e8a62ec 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -230,6 +230,36 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
return NULL;
@@ -181,6 +181,36 @@ grub_efi_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
return grub_error (GRUB_ERR_IO, "set_virtual_address_map failed");
}
+grub_err_t
@ -170,22 +174,22 @@ index 6f12c76..7a418a6 100644
+
+ r = grub_efi_system_table->runtime_services;
+
+ grub_efi_uint32_t attributes = GRUB_EFI_VARIABLE_NON_VOLATILE |
+ GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ GRUB_EFI_VARIABLE_RUNTIME_ACCESS;
+
+ status = efi_call_5 (r->set_variable, var16, guid, attributes, datasize,data);
+ status = efi_call_5 (r->set_variable, var16, guid,
+ (GRUB_EFI_VARIABLE_NON_VOLATILE
+ | GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
+ | GRUB_EFI_VARIABLE_RUNTIME_ACCESS),
+ datasize, data);
+ if (status == GRUB_EFI_SUCCESS)
+ return GRUB_ERR_NONE;
+
+ return grub_error (GRUB_ERR_IO, "could not set EFI variable `%s'", var);
+}
+
#pragma GCC diagnostic ignored "-Wcast-align"
/* Search the mods section from the PE32/PE32+ image. This code uses
void *
grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
grub_size_t *datasize_out)
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 26127de..a47a4e3 100644
index 9e7a8d8..ae61730 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -58,6 +58,8 @@
@ -214,5 +218,5 @@ index e67d92b..489cf9e 100644
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
const grub_efi_device_path_t *dp2);
--
1.7.10.1
1.8.1.4

View File

@ -0,0 +1,50 @@
From 8f779ade959a72267dcc045ad71012bf37cb96e0 Mon Sep 17 00:00:00 2001
From: Benoit Gschwind <gschwind>
Date: Mon, 10 Sep 2012 09:34:29 +0200
Subject: [PATCH 034/364] * grub-core/loader/efi/appleloader.c
(devpath_8): New var. (devs): Add devpath_8.
---
ChangeLog | 5 +++++
grub-core/loader/efi/appleloader.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index e8f0577..6886bcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-10 Benoit Gschwind <gschwind>
+
+ * grub-core/loader/efi/appleloader.c (devpath_8): New var.
+ (devs): Add devpath_8.
+
2012-09-08 Peter Jones <pjones@redhat.com>
* grub-core/Makefile.core.def (efifwsetup): New module.
diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c
index e2de89f..56d5538 100644
--- a/grub-core/loader/efi/appleloader.c
+++ b/grub-core/loader/efi/appleloader.c
@@ -127,6 +127,10 @@ static struct piwg_full_device_path devpath_6 = MAKE_PIWG_PATH (0xffcc4000,
static struct piwg_full_device_path devpath_7 = MAKE_PIWG_PATH (0xff981000,
0xffc8ffff);
+/* mid-2012 MBP retina (MacBookPro10,1) */
+static struct piwg_full_device_path devpath_8 = MAKE_PIWG_PATH (0xff990000,
+ 0xffb2ffff);
+
struct devdata
{
const char *model;
@@ -142,6 +146,7 @@ struct devdata devs[] =
{"MB NV", (grub_efi_device_path_t *) &devpath_5},
{"MB NV2", (grub_efi_device_path_t *) &devpath_6},
{"MBP2011", (grub_efi_device_path_t *) &devpath_7},
+ {"MBP2012", (grub_efi_device_path_t *) &devpath_8},
{NULL, NULL},
};
--
1.8.1.4

View File

@ -0,0 +1,106 @@
From 56348e90bcc1076de7b2aba73b52fa1bafee4478 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Tue, 11 Sep 2012 07:53:26 +0200
Subject: [PATCH 035/364] * grub-core/disk/diskfilter.c (free_array)
[GRUB_UTIL]: Fix memory leak. * util/getroot.c (grub_find_device): Likewise.
(get_mdadm_uuid): Likewise. (grub_util_is_imsm): Likewise.
(grub_util_pull_device): Likewise. * util/grub-probe.c (probe): Likewise.
---
ChangeLog | 9 +++++++++
grub-core/disk/diskfilter.c | 3 +++
util/getroot.c | 13 +++++++++++--
util/grub-probe.c | 1 +
4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6886bcc..c697e17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-09-11 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/disk/diskfilter.c (free_array) [GRUB_UTIL]: Fix memory leak.
+ * util/getroot.c (grub_find_device): Likewise.
+ (get_mdadm_uuid): Likewise.
+ (grub_util_is_imsm): Likewise.
+ (grub_util_pull_device): Likewise.
+ * util/grub-probe.c (probe): Likewise.
+
2012-09-10 Benoit Gschwind <gschwind>
* grub-core/loader/efi/appleloader.c (devpath_8): New var.
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
index 6e9745e..ce4c706 100644
--- a/grub-core/disk/diskfilter.c
+++ b/grub-core/disk/diskfilter.c
@@ -1130,6 +1130,9 @@ free_array (void)
grub_disk_close (pv->disk);
if (pv->id.uuidlen)
grub_free (pv->id.uuid);
+#ifdef GRUB_UTIL
+ grub_free (pv->partmaps);
+#endif
grub_free (pv->internal_id);
grub_free (pv);
}
diff --git a/util/getroot.c b/util/getroot.c
index e103fb6..b97bea6 100644
--- a/util/getroot.c
+++ b/util/getroot.c
@@ -918,7 +918,10 @@ grub_find_device (const char *dir, dev_t dev)
grub files */
if (strcmp(res, "/dev/root") == 0)
- continue;
+ {
+ free (res);
+ continue;
+ }
if (chdir (saved_cwd) < 0)
grub_util_error ("%s", _("cannot restore the original directory"));
@@ -1363,6 +1366,7 @@ get_mdadm_uuid (const char *os_dev)
out:
close (fd);
waitpid (pid, NULL, 0);
+ free (buf);
return name;
}
@@ -1437,6 +1441,8 @@ grub_util_is_imsm (const char *os_dev)
}
}
+ free (buf);
+
return 0;
out:
@@ -1577,7 +1583,10 @@ grub_util_pull_device (const char *os_dev)
char **devicelist = grub_util_raid_getmembers (os_dev, 0);
int i;
for (i = 0; devicelist[i];i++)
- grub_util_pull_device (devicelist[i]);
+ {
+ grub_util_pull_device (devicelist[i]);
+ free (devicelist[i]);
+ }
free (devicelist);
}
#endif
diff --git a/util/grub-probe.c b/util/grub-probe.c
index 6dd1073..c2a0f62 100644
--- a/util/grub-probe.c
+++ b/util/grub-probe.c
@@ -474,6 +474,7 @@ probe (const char *path, char **device_names, char delim)
printf ("%s", label);
putchar (delim);
}
+ grub_device_close (dev);
goto end;
}
--
1.8.1.4

View File

@ -0,0 +1,70 @@
From c7d45a90490c5f3337a6412a6ebe500e3a41a63b Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 12 Sep 2012 08:27:26 +0200
Subject: [PATCH 036/364] Don't require grub-mkconfig_lib to generate
manpages for programs.
* gentpl.py (manpage): Additional argument adddeps. Add adddeps to
dependencies, don't add grub-mkconfig_lib.
(program): Pass empty adddeps.
(script): Pass grub-mkconfig_lib as adddeps.
---
ChangeLog | 9 +++++++++
gentpl.py | 8 ++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c697e17..8576923 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-09-12 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Don't require grub-mkconfig_lib to generate manpages for programs.
+
+ * gentpl.py (manpage): Additional argument adddeps. Add adddeps to
+ dependencies, don't add grub-mkconfig_lib.
+ (program): Pass empty adddeps.
+ (script): Pass grub-mkconfig_lib as adddeps.
+
2012-09-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/diskfilter.c (free_array) [GRUB_UTIL]: Fix memory leak.
diff --git a/gentpl.py b/gentpl.py
index bab4a8a..6d7f613 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -484,10 +484,10 @@ def library(platform):
def installdir(default="bin"):
return "[+ IF installdir +][+ installdir +][+ ELSE +]" + default + "[+ ENDIF +]"
-def manpage():
+def manpage(adddeps):
r = "if COND_MAN_PAGES\n"
r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n")
- r += rule("[+ name +].[+ mansection +]", "[+ name +] grub-mkconfig_lib", """
+ r += rule("[+ name +].[+ mansection +]", "[+ name +] " + adddeps, """
chmod a+x [+ name +]
PATH=$(builddir):$$PATH pkgdatadir=$(builddir) $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -o $@ [+ name +]
""")
@@ -503,7 +503,7 @@ def program(platform, test=False):
r += gvar_add("TESTS", "[+ name +]")
r += "[+ ELSE +]"
r += var_add(installdir() + "_PROGRAMS", "[+ name +]")
- r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
+ r += "[+ IF mansection +]" + manpage("") + "[+ ENDIF +]"
r += "[+ ENDIF +]"
r += var_set(cname() + "_SOURCES", platform_sources(platform))
@@ -532,7 +532,7 @@ def script(platform):
r += gvar_add ("TESTS", "[+ name +]")
r += "[+ ELSE +]"
r += var_add(installdir() + "_SCRIPTS", "[+ name +]")
- r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
+ r += "[+ IF mansection +]" + manpage("grub-mkconfig_lib") + "[+ ENDIF +]"
r += "[+ ENDIF +]"
r += rule("[+ name +]", platform_sources(platform) + " $(top_builddir)/config.status", """
--
1.8.1.4

View File

@ -0,0 +1,90 @@
From 085ef74104c8f1a5d2cc68a0d1a2e0569827d6f4 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 12 Sep 2012 08:31:05 +0200
Subject: [PATCH 037/364] * include/grub/efi/api.h
(grub_efi_runtime_services): Make vendor_guid a const pointer. *
grub-core/efiemu/runtime/efiemu.c (efiemu_memcpy): Make from a const
pointer. (efiemu_set_variable): Make vendor_guid a const pointer.
---
ChangeLog | 8 ++++++++
grub-core/efiemu/runtime/efiemu.c | 14 +++++++-------
include/grub/efi/api.h | 2 +-
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8576923..527e9d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-09-12 Vladimir Serbinenko <phcoder@gmail.com>
+ * include/grub/efi/api.h (grub_efi_runtime_services): Make vendor_guid
+ a const pointer.
+ * grub-core/efiemu/runtime/efiemu.c (efiemu_memcpy): Make from a
+ const pointer.
+ (efiemu_set_variable): Make vendor_guid a const pointer.
+
+2012-09-12 Vladimir Serbinenko <phcoder@gmail.com>
+
Don't require grub-mkconfig_lib to generate manpages for programs.
* gentpl.py (manpage): Additional argument adddeps. Add adddeps to
diff --git a/grub-core/efiemu/runtime/efiemu.c b/grub-core/efiemu/runtime/efiemu.c
index 84b02cb..d923e40 100644
--- a/grub-core/efiemu/runtime/efiemu.c
+++ b/grub-core/efiemu/runtime/efiemu.c
@@ -78,7 +78,7 @@ efiemu_get_next_variable_name (grub_efi_uintn_t *variable_name_size,
grub_efi_status_t
efiemu_set_variable (grub_efi_char16_t *variable_name,
- grub_efi_guid_t *vendor_guid,
+ const grub_efi_guid_t *vendor_guid,
grub_efi_uint32_t attributes,
grub_efi_uintn_t data_size,
void *data);
@@ -131,11 +131,11 @@ extern grub_uint32_t efiemu_time_accuracy;
/* Some standard functions because we need to be standalone */
static void
-efiemu_memcpy (void *to, void *from, int count)
+efiemu_memcpy (void *to, const void *from, int count)
{
int i;
for (i = 0; i < count; i++)
- ((grub_uint8_t *) to)[i] = ((grub_uint8_t *) from)[i];
+ ((grub_uint8_t *) to)[i] = ((const grub_uint8_t *) from)[i];
}
static int
@@ -503,10 +503,10 @@ grub_efi_status_t EFI_FUNC
grub_efi_status_t
EFI_FUNC (efiemu_set_variable) (grub_efi_char16_t *variable_name,
- grub_efi_guid_t *vendor_guid,
- grub_efi_uint32_t attributes,
- grub_efi_uintn_t data_size,
- void *data)
+ const grub_efi_guid_t *vendor_guid,
+ grub_efi_uint32_t attributes,
+ grub_efi_uintn_t data_size,
+ void *data)
{
struct efi_variable *efivar;
grub_uint8_t *ptr;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index ae61730..2917d14 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1208,7 +1208,7 @@ struct grub_efi_runtime_services
grub_efi_status_t
(*set_variable) (grub_efi_char16_t *variable_name,
- grub_efi_guid_t *vendor_guid,
+ const grub_efi_guid_t *vendor_guid,
grub_efi_uint32_t attributes,
grub_efi_uintn_t data_size,
void *data);
--
1.8.1.4

View File

@ -0,0 +1,74 @@
From 5ba7247c064336767ee6b0ad9465b547ac90322a Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 14 Sep 2012 11:23:36 +0100
Subject: [PATCH 038/364] * grub-core/term/terminfo.c: Only fix up powerpc key
repeat on IEEE1275 machines. Fixes powerpc-emu compilation. *
include/grub/terminfo.h: Likewise.
---
ChangeLog | 6 ++++++
grub-core/term/terminfo.c | 6 +++---
include/grub/terminfo.h | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 527e9d1..941ed93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-14 Colin Watson <cjwatson@ubuntu.com>
+
+ * grub-core/term/terminfo.c: Only fix up powerpc key repeat on
+ IEEE1275 machines. Fixes powerpc-emu compilation.
+ * include/grub/terminfo.h: Likewise.
+
2012-09-12 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/efi/api.h (grub_efi_runtime_services): Make vendor_guid
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
index e35563f..d421e4e 100644
--- a/grub-core/term/terminfo.c
+++ b/grub-core/term/terminfo.c
@@ -33,7 +33,7 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/time.h>
-#ifdef __powerpc__
+#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
#include <grub/ieee1275/ieee1275.h>
#endif
@@ -563,7 +563,7 @@ grub_terminfo_getkey (struct grub_term_input *termi)
grub_terminfo_readkey (termi, data->input_buf,
&data->npending, data->readkey);
-#ifdef __powerpc__
+#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
if (data->npending == 1 && data->input_buf[0] == '\e'
&& grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_REPEAT)
&& grub_get_time_ms () - data->last_key_time < 1000
@@ -580,7 +580,7 @@ grub_terminfo_getkey (struct grub_term_input *termi)
int ret;
data->npending--;
ret = data->input_buf[0];
-#ifdef __powerpc__
+#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_REPEAT))
{
data->last_key = ret;
diff --git a/include/grub/terminfo.h b/include/grub/terminfo.h
index c081a92..20541a9 100644
--- a/include/grub/terminfo.h
+++ b/include/grub/terminfo.h
@@ -32,7 +32,7 @@ struct grub_terminfo_input_state
{
int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN];
int npending;
-#ifdef __powerpc__
+#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
int last_key;
grub_uint64_t last_key_time;
#endif
--
1.8.1.4

View File

@ -0,0 +1,44 @@
From 7efa81764aa812d1f44ff53fb42472befea19f0b Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 17 Sep 2012 16:58:50 +0100
Subject: [PATCH 039/364] * util/grub-mkconfig_lib.in (grub_quote): Remove
outdated sentence from comment.
---
ChangeLog | 5 +++++
util/grub-mkconfig_lib.in | 6 ++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 941ed93..de80a94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-17 Colin Watson <cjwatson@debian.org>
+
+ * util/grub-mkconfig_lib.in (grub_quote): Remove outdated sentence
+ from comment.
+
2012-09-14 Colin Watson <cjwatson@ubuntu.com>
* grub-core/term/terminfo.c: Only fix up powerpc key repeat on
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index beb52ee..a9f5809 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -255,10 +255,8 @@ version_find_latest ()
echo "$version_find_latest_a"
}
-# One layer of quotation is eaten by "" and the second by
-# sed; so this turns ' into \'. Note that you must use the output of
-# this function in a printf format string.
-
+# One layer of quotation is eaten by "" and the second by sed; so this turns
+# ' into \'.
grub_quote () {
sed "s/'/'\\\\''/g"
}
--
1.8.1.4

View File

@ -0,0 +1,42 @@
From 1f5027bb0ec48851cc2f9c54552a6ec1f1145930 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Tue, 18 Sep 2012 11:44:29 +0200
Subject: [PATCH 040/364] * grub-core/loader/i386/linux.c
(grub_cmd_linux): Fix incorrect le-conversion. Reported by: BURETTE,
Bernard.
---
ChangeLog | 6 ++++++
grub-core/loader/i386/linux.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index de80a94..b524cf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-18 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/loader/i386/linux.c (grub_cmd_linux): Fix incorrect
+ le-conversion.
+ Reported by: BURETTE, Bernard.
+
2012-09-17 Colin Watson <cjwatson@debian.org>
* util/grub-mkconfig_lib.in (grub_quote): Remove outdated sentence
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index d34b2f8..bcb037c 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -839,7 +839,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
#ifdef GRUB_MACHINE_EFI
#ifdef __x86_64__
- if (grub_le_to_cpu16 (params->version < 0x0208) &&
+ if (grub_le_to_cpu16 (params->version) < 0x0208 &&
((grub_addr_t) grub_efi_system_table >> 32) != 0)
return grub_error(GRUB_ERR_BAD_OS,
"kernel does not support 64-bit addressing");
--
1.8.1.4

View File

@ -0,0 +1,121 @@
From 731ae0c1c7c0458a257e75c55b7739881dc2d5ed Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Tue, 18 Sep 2012 11:52:19 +0200
Subject: [PATCH 041/364] * grub-core/kern/ieee1275/cmain.c
(grub_ieee1275_find_options): Set
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN on mac. *
grub-core/term/ieee1275/console.c (grub_console_init_lately): Use
ieee1275-nocursor if GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN is set.
* grub-core/term/terminfo.c (grub_terminfo_set_current): Add new type
ieee1275-nocursor. * include/grub/ieee1275/ieee1275.h
(grub_ieee1275_flag): New value
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN.
---
ChangeLog | 11 +++++++++++
grub-core/kern/ieee1275/cmain.c | 1 +
grub-core/term/ieee1275/console.c | 3 ++-
grub-core/term/terminfo.c | 15 ++++++++++++---
include/grub/ieee1275/ieee1275.h | 4 +++-
5 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b524cf6..3752a79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-09-18 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
+ GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN on mac.
+ * grub-core/term/ieee1275/console.c (grub_console_init_lately): Use
+ ieee1275-nocursor if GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN is set.
+ * grub-core/term/terminfo.c (grub_terminfo_set_current): Add new type
+ ieee1275-nocursor.
+ * include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New value
+ GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN.
+
+2012-09-18 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/loader/i386/linux.c (grub_cmd_linux): Fix incorrect
le-conversion.
Reported by: BURETTE, Bernard.
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
index dd04d39..789669a 100644
--- a/grub-core/kern/ieee1275/cmain.c
+++ b/grub-core/kern/ieee1275/cmain.c
@@ -117,6 +117,7 @@ grub_ieee1275_find_options (void)
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS);
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX);
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_VIRT_TO_REAL_BROKEN);
+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN);
break;
}
}
diff --git a/grub-core/term/ieee1275/console.c b/grub-core/term/ieee1275/console.c
index a8dfcff..93b81f4 100644
--- a/grub-core/term/ieee1275/console.c
+++ b/grub-core/term/ieee1275/console.c
@@ -247,9 +247,10 @@ grub_console_init_lately (void)
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
type = "dumb";
+ else if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN))
+ type = "ieee1275-nocursor";
else
type = "ieee1275";
-
grub_terminfo_init ();
grub_terminfo_output_register (&grub_console_term_output, type);
}
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
index d421e4e..a0f8d18 100644
--- a/grub-core/term/terminfo.c
+++ b/grub-core/term/terminfo.c
@@ -143,7 +143,8 @@ grub_terminfo_set_current (struct grub_term_output *term,
return grub_errno;
}
- if (grub_strcmp ("ieee1275", str) == 0)
+ if (grub_strcmp ("ieee1275", str) == 0
+ || grub_strcmp ("ieee1275-nocursor", str) == 0)
{
data->name = grub_strdup ("ieee1275");
data->gotoxy = grub_strdup ("\e[%i%p1%d;%p2%dH");
@@ -153,8 +154,16 @@ grub_terminfo_set_current (struct grub_term_output *term,
data->cls = grub_strdup (" \e[2J");
data->reverse_video_on = grub_strdup ("\e[7m");
data->reverse_video_off = grub_strdup ("\e[m");
- data->cursor_on = grub_strdup ("\e[?25h");
- data->cursor_off = grub_strdup ("\e[?25l");
+ if (grub_strcmp ("ieee1275", str) == 0)
+ {
+ data->cursor_on = grub_strdup ("\e[?25h");
+ data->cursor_off = grub_strdup ("\e[?25l");
+ }
+ else
+ {
+ data->cursor_on = 0;
+ data->cursor_off = 0;
+ }
data->setcolor = grub_strdup ("\e[3%p1%dm\e[4%p2%dm");
return grub_errno;
}
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 38a75fd..ee9b707 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -123,7 +123,9 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_VIRT_TO_REAL_BROKEN,
- GRUB_IEEE1275_FLAG_BROKEN_REPEAT
+ GRUB_IEEE1275_FLAG_BROKEN_REPEAT,
+
+ GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN,
};
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
--
1.8.1.4

View File

@ -0,0 +1,360 @@
From f46ac5e6c44d2fed8dcd8451196e6141d89cd90d Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Tue, 18 Sep 2012 13:04:06 +0200
Subject: [PATCH 042/364] * util/grub-mkconfig_lib.in (grub_tab): New
variable. (grub_add_tab): New function. * util/grub.d/10_hurd.in:
Replace \t with $grub_tab orgrub_add_tab. * util/grub.d/10_illumos.in:
Likewise. * util/grub.d/10_kfreebsd.in: Likewise. *
util/grub.d/10_linux.in: Likewise. * util/grub.d/10_netbsd.in: Likewise.
* util/grub.d/10_windows.in: Likewise. * util/grub.d/10_xnu.in:
Likewise. * util/grub.d/20_linux_xen.in: Likewise. *
util/grub.d/30_os-prober.in: Likewise.
---
ChangeLog | 14 ++++++++++++++
util/grub-mkconfig_lib.in | 7 +++++++
util/grub.d/10_hurd.in | 8 ++++----
util/grub.d/10_illumos.in | 4 ++--
util/grub.d/10_kfreebsd.in | 8 ++++----
util/grub.d/10_linux.in | 8 ++++----
util/grub.d/10_netbsd.in | 10 +++++-----
util/grub.d/10_windows.in | 6 +++---
util/grub.d/10_xnu.in | 4 ++--
util/grub.d/20_linux_xen.in | 6 +++---
util/grub.d/30_os-prober.in | 20 ++++++++++----------
11 files changed, 58 insertions(+), 37 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3752a79..32849c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2012-09-18 Vladimir Serbinenko <phcoder@gmail.com>
+ * util/grub-mkconfig_lib.in (grub_tab): New variable.
+ (grub_add_tab): New function.
+ * util/grub.d/10_hurd.in: Replace \t with $grub_tab orgrub_add_tab.
+ * util/grub.d/10_illumos.in: Likewise.
+ * util/grub.d/10_kfreebsd.in: Likewise.
+ * util/grub.d/10_linux.in: Likewise.
+ * util/grub.d/10_netbsd.in: Likewise.
+ * util/grub.d/10_windows.in: Likewise.
+ * util/grub.d/10_xnu.in: Likewise.
+ * util/grub.d/20_linux_xen.in: Likewise.
+ * util/grub.d/30_os-prober.in: Likewise.
+
+2012-09-18 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN on mac.
* grub-core/term/ieee1275/console.c (grub_console_init_lately): Use
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index a9f5809..8f21eb2 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -347,3 +347,10 @@ grub_fmt () {
cat
fi
}
+
+grub_tab=" "
+
+grub_add_tab () {
+ sed -e "s/^/$grub_tab/"
+}
+
diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in
index 45f0ad3..00efd68 100644
--- a/util/grub.d/10_hurd.in
+++ b/util/grub.d/10_hurd.in
@@ -108,7 +108,7 @@ menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnuhurd-s
EOF
fi
- prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | sed -e "s/^/\t/"|sed "s/^/$submenu_indentation/"
+ prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | grub_add_tab|sed "s/^/$submenu_indentation/"
message="$(gettext_printf "Loading GNU Mach ...")"
if [ x$type = xrecovery ] ; then
@@ -122,9 +122,9 @@ EOF
EOF
if [ x$type != xrecovery ] ; then
- save_default_entry | sed -e "s/^/\t/"| sed "s/^/$submenu_indentation/"
+ save_default_entry | grub_add_tab| sed "s/^/$submenu_indentation/"
fi
- prepare_grub_to_access_device "${GRUB_DEVICE}" | sed -e "s/^/\t/"| sed "s/^/$submenu_indentation/"
+ prepare_grub_to_access_device "${GRUB_DEVICE}" | grub_add_tab| sed "s/^/$submenu_indentation/"
message="$(gettext_printf "Loading the Hurd ...")"
if [ x$type = xrecovery ] ; then
opts=
@@ -158,7 +158,7 @@ do
if [ "x$is_first_entry" = xtrue ]; then
hurd_entry "$kernel" simple
- submenu_indentation="\t"
+ submenu_indentation="$grub_tab"
# TRANSLATORS: %s is replaced with an OS name
echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnuhurd-advanced-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {"
diff --git a/util/grub.d/10_illumos.in b/util/grub.d/10_illumos.in
index 2477466..0de616e 100644
--- a/util/grub.d/10_illumos.in
+++ b/util/grub.d/10_illumos.in
@@ -35,8 +35,8 @@ case "${GRUB_DISTRIBUTOR}" in
esac
echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_option 'illumos-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {"
-save_default_entry | sed -e "s/^/\t/"
-prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | sed -e "s/^/\t/"
+save_default_entry | grub_add_tab
+prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | grub_add_tab
message="$(gettext_printf "Loading kernel of Illumos ...")"
cat << EOF
insmod gzio
diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in
index b0e84e2..260dda8 100644
--- a/util/grub.d/10_kfreebsd.in
+++ b/util/grub.d/10_kfreebsd.in
@@ -54,7 +54,7 @@ load_kfreebsd_module ()
fi
if [ -z "${prepare_module_dir_cache}" ]; then
- prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
+ prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | grub_add_tab)"
fi
printf '%s\n' "${prepare_module_dir_cache}"
@@ -91,10 +91,10 @@ kfreebsd_entry ()
echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_option 'kfreebsd-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
fi
if [ x$type != xrecovery ] ; then
- save_default_entry | sed -e "s/^/\t/" | sed "s/^/$submenu_indentation/"
+ save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
fi
if [ -z "${prepare_boot_cache}" ]; then
- prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
+ prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
@@ -213,7 +213,7 @@ while [ "x$list" != "x" ] ; do
if [ "x$is_first_entry" = xtrue ]; then
kfreebsd_entry "${OS}" "${version}" simple
- submenu_indentation="\t"
+ submenu_indentation="$grub_tab"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 35f7a83..0724e16 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -101,7 +101,7 @@ linux_entry ()
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
fi
if [ x$type != xrecovery ] ; then
- save_default_entry | sed -e "s/^/\t/"
+ save_default_entry | grub_add_tab
fi
# Use ELILO's generic "efifb" when it's known to be available.
@@ -123,12 +123,12 @@ linux_entry ()
if [ x$dirname = x/ ]; then
if [ -z "${prepare_root_cache}" ]; then
- prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/")"
+ prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
fi
printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/"
else
if [ -z "${prepare_boot_cache}" ]; then
- prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
+ prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
fi
@@ -230,7 +230,7 @@ while [ "x$list" != "x" ] ; do
linux_entry "${OS}" "${version}" simple \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
- submenu_indentation="\t"
+ submenu_indentation="$grub_tab"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in
index 65275d7..b76332b 100644
--- a/util/grub.d/10_netbsd.in
+++ b/util/grub.d/10_netbsd.in
@@ -77,10 +77,10 @@ netbsd_load_fs_module ()
prepare_grub_to_access_device $(${grub_probe} -t device "${kmodule}") | sed -e 's,^, ,'
case "${loader}" in
knetbsd)
- printf "\tknetbsd_module_elf %s\n" "${kmodule_rel}"
+ printf "$grub_tabknetbsd_module_elf %s\n" "${kmodule_rel}"
;;
multiboot)
- printf "\tmodule %s\n" "${kmodule_rel}"
+ printf "$grub_tabmodule %s\n" "${kmodule_rel}"
;;
esac
}
@@ -121,11 +121,11 @@ netbsd_entry ()
printf "%s\n" "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
case "${loader}" in
knetbsd)
- printf "\tknetbsd %s -r %s %s\n" \
+ printf "$grub_tabknetbsd %s -r %s %s\n" \
"${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" | sed "s/^/$submenu_indentation/"
;;
multiboot)
- printf "\tmultiboot %s %s root=%s %s\n" \
+ printf "$grub_tabmultiboot %s %s root=%s %s\n" \
"${kernel}" "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" | sed "s/^/$submenu_indentation/"
;;
esac
@@ -159,7 +159,7 @@ for k in $(ls -t /netbsd*) ; do
if [ "x$is_first_entry" = xtrue ]; then
netbsd_entry "knetbsd" "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
- submenu_indentation="\t"
+ submenu_indentation="$grub_tab"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
diff --git a/util/grub.d/10_windows.in b/util/grub.d/10_windows.in
index e5839cd..9025914 100644
--- a/util/grub.d/10_windows.in
+++ b/util/grub.d/10_windows.in
@@ -45,7 +45,7 @@ get_os_name_from_boot_ini ()
sort | uniq | wc -l`" = 1 || return 1
# Search 'default=PARTITION'
- get_os_name_from_boot_ini_part=`sed -n 's,^default=,,p' "$1" | sed 's,\\\\,/,g;s,[ \t\r]*$,,;1q'`
+ get_os_name_from_boot_ini_part=`sed -n 's,^default=,,p' "$1" | sed 's,\\\\,/,g;s,[ $grub_tab\r]*$,,;1q'`
test -n "$get_os_name_from_boot_ini_part" || return 1
# Search 'PARTITION="NAME" ...'
@@ -87,8 +87,8 @@ for drv in $drives ; do
menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(grub_get_device_id "${dev}")' {
EOF
- save_default_entry | sed -e 's,^,\t,'
- prepare_grub_to_access_device "$dev" | sed 's,^,\t,'
+ save_default_entry | sed -e 's,^,$grub_tab,'
+ prepare_grub_to_access_device "$dev" | sed 's,^,$grub_tab,'
test -z "$needmap" || cat <<EOF
drivemap -s (hd0) \$root
EOF
diff --git a/util/grub.d/10_xnu.in b/util/grub.d/10_xnu.in
index 55a9546..4270385 100644
--- a/util/grub.d/10_xnu.in
+++ b/util/grub.d/10_xnu.in
@@ -39,8 +39,8 @@ osx_entry() {
cat << EOF
menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")' {
EOF
- save_default_entry | sed -e "s/^/ /"
- prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/ /"
+ save_default_entry | grub_add_tab
+ prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab
cat << EOF
load_video
set do_resume=0
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 33f1592..d4d0110 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -110,11 +110,11 @@ linux_entry ()
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
fi
if [ x$type != xrecovery ] ; then
- save_default_entry | sed -e "s/^/\t/" | sed "s/^/$submenu_indentation/"
+ save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
fi
if [ -z "${prepare_boot_cache}" ]; then
- prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
+ prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
@@ -236,7 +236,7 @@ while [ "x${xen_list}" != "x" ] ; do
linux_entry "${OS}" "${version}" "${xen_version}" simple \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
- submenu_indentation="\t\t"
+ submenu_indentation="$grub_tab$grub_tab"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index bcc6c25..bf47dc3 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -54,8 +54,8 @@ osx_entry() {
cat << EOF
menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' {
EOF
- save_default_entry | sed -e "s/^/\t/"
- prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+ save_default_entry | grub_add_tab
+ prepare_grub_to_access_device ${DEVICE} | grub_add_tab
cat << EOF
load_video
set do_resume=0
@@ -126,8 +126,8 @@ for OS in ${OSPROBED} ; do
cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
EOF
- save_default_entry | sed -e "s/^/\t/"
- prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+ save_default_entry | grub_add_tab
+ prepare_grub_to_access_device ${DEVICE} | grub_add_tab
case ${LONGNAME} in
Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
@@ -181,14 +181,14 @@ EOF
used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
if [ -z "${prepare_boot_cache}" ]; then
- prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
+ prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
fi
if [ "x$is_first_entry" = xtrue ]; then
cat << EOF
menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
EOF
- save_default_entry | sed -e "s/^/\t/"
+ save_default_entry | grub_add_tab
printf '%s\n' "${prepare_boot_cache}"
cat << EOF
linux ${LKERNEL} ${LPARAMS}
@@ -208,8 +208,8 @@ EOF
cat << EOF
menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
EOF
- save_default_entry | sed -e "s/^/\t\t/"
- printf '%s\n' "${prepare_boot_cache}" | sed -e "s/^/\t/"
+ save_default_entry | sed -e "s/^/$grub_tab$grub_tab/"
+ printf '%s\n' "${prepare_boot_cache}" | grub_add_tab
cat << EOF
linux ${LKERNEL} ${LPARAMS}
EOF
@@ -243,8 +243,8 @@ EOF
cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
EOF
- save_default_entry | sed -e "s/^/\t/"
- prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+ save_default_entry | grub_add_tab
+ prepare_grub_to_access_device ${DEVICE} | grub_add_tab
grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
--
1.8.1.4

View File

@ -0,0 +1,109 @@
From fc8c72d6ad43b3fd7a960e67bbacd6fe8d68e48a Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 19 Sep 2012 02:41:51 +0100
Subject: [PATCH 043/364] * util/grub-setup.c (write_rootdev): Remove unused
core_img parameter. Update all callers. (setup): Define core_sectors only if
GRUB_SETUP_BIOS, to appease 'gcc -Wunused-but-set-variable'. Remove
unnecessary nested #ifdef GRUB_SETUP_BIOS.
---
ChangeLog | 10 +++++++++-
util/grub-setup.c | 12 +++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 32849c6..1ab401d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-09-19 Colin Watson <cjwatson@ubuntu.com>
+
+ * util/grub-setup.c (write_rootdev): Remove unused core_img
+ parameter. Update all callers.
+ (setup): Define core_sectors only if GRUB_SETUP_BIOS, to appease
+ 'gcc -Wunused-but-set-variable'. Remove unnecessary nested #ifdef
+ GRUB_SETUP_BIOS.
+
2012-09-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkconfig_lib.in (grub_tab): New variable.
@@ -29,7 +37,7 @@
le-conversion.
Reported by: BURETTE, Bernard.
-2012-09-17 Colin Watson <cjwatson@debian.org>
+2012-09-17 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig_lib.in (grub_quote): Remove outdated sentence
from comment.
diff --git a/util/grub-setup.c b/util/grub-setup.c
index 085e8df..de0417f 100644
--- a/util/grub-setup.c
+++ b/util/grub-setup.c
@@ -105,7 +105,7 @@
#endif
static void
-write_rootdev (char *core_img, grub_device_t root_dev,
+write_rootdev (grub_device_t root_dev,
char *boot_img, grub_uint64_t first_sector)
{
#ifdef GRUB_SETUP_BIOS
@@ -148,7 +148,9 @@ setup (const char *dir,
char *boot_img, *core_img;
char *root = 0;
size_t boot_size, core_size;
+#ifdef GRUB_SETUP_BIOS
grub_uint16_t core_sectors;
+#endif
grub_device_t root_dev = 0, dest_dev, core_dev;
struct grub_boot_blocklist *first_block, *block;
char *tmp_img;
@@ -229,8 +231,10 @@ setup (const char *dir,
core_path = grub_util_get_path (dir, core_file);
core_size = grub_util_get_image_size (core_path);
+#ifdef GRUB_SETUP_BIOS
core_sectors = ((core_size + GRUB_DISK_SECTOR_SIZE - 1)
>> GRUB_DISK_SECTOR_BITS);
+#endif
if (core_size < GRUB_DISK_SECTOR_SIZE)
grub_util_error (_("the size of `%s' is too small"), core_path);
#ifdef GRUB_SETUP_BIOS
@@ -386,7 +390,6 @@ setup (const char *dir,
is_ldm = grub_util_is_ldm (dest_dev->disk);
-#ifdef GRUB_SETUP_BIOS
if (fs_probe)
{
if (!fs && !dest_partmap)
@@ -424,7 +427,6 @@ setup (const char *dir,
dest_dev->disk->name, dest_partmap->name);
}
-#endif
/* Copy the partition table. */
if (dest_partmap ||
@@ -520,7 +522,7 @@ setup (const char *dir,
block->len = 0;
block->segment = 0;
- write_rootdev (core_img, root_dev, boot_img, first_sector);
+ write_rootdev (root_dev, boot_img, first_sector);
core_img = realloc (core_img, nsec * GRUB_DISK_SECTOR_SIZE);
first_block = (struct grub_boot_blocklist *) (core_img
@@ -858,7 +860,7 @@ unable_to_embed:
free (core_path_dev);
free (tmp_img);
- write_rootdev (core_img, root_dev, boot_img, first_sector);
+ write_rootdev (root_dev, boot_img, first_sector);
/* Write the first two sectors of the core image onto the disk. */
grub_util_info ("opening the core image `%s'", core_path);
--
1.8.1.4

View File

@ -0,0 +1,52 @@
From fbc6f5faf45f489125f98a11f3593cd43b4d6b76 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 19 Sep 2012 02:44:54 +0100
Subject: [PATCH 044/364] * grub-core/partmap/msdos.c (pc_partition_map_embed):
Revert incorrect off-by-one fix from 2011-02-12. A 62-sector core image
should fit before end == 63.
---
ChangeLog | 6 ++++++
grub-core/partmap/msdos.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1ab401d..5db804e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-09-19 Colin Watson <cjwatson@ubuntu.com>
+ * grub-core/partmap/msdos.c (pc_partition_map_embed): Revert
+ incorrect off-by-one fix from 2011-02-12. A 62-sector core image
+ should fit before end == 63.
+
+2012-09-19 Colin Watson <cjwatson@ubuntu.com>
+
* util/grub-setup.c (write_rootdev): Remove unused core_img
parameter. Update all callers.
(setup): Define core_sectors only if GRUB_SETUP_BIOS, to appease
diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c
index 6e54a74..10ca3f0 100644
--- a/grub-core/partmap/msdos.c
+++ b/grub-core/partmap/msdos.c
@@ -316,14 +316,14 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
break;
}
- if (end >= *nsectors + 2)
+ if (end >= *nsectors + 1)
{
unsigned i, j;
char *embed_signature_check;
unsigned int orig_nsectors, avail_nsectors;
orig_nsectors = *nsectors;
- *nsectors = end - 2;
+ *nsectors = end - 1;
avail_nsectors = *nsectors;
if (*nsectors > max_nsectors)
*nsectors = max_nsectors;
--
1.8.1.4

View File

@ -0,0 +1,125 @@
From b37a32bb89c476b0ead4c40900de29fe8d73d27e Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Sat, 22 Sep 2012 21:19:58 +0100
Subject: [PATCH 045/364] Fix grub-emu build on FreeBSD.
* Makefile.util.def (grub-mount): Add LIBGEOM to ldadd.
* grub-core/net/drivers/emu/emunet.c: Only include Linux-specific
headers on Linux.
(GRUB_MOD_INIT): Return immediately on non-Linux platforms; this
implementation is currently Linux-specific.
* util/getroot.c (exec_pipe): Define only on Linux or when either
libzfs or libnvpair is unavailable.
(find_root_devices_from_poolname): Remove unused path variable.
---
ChangeLog | 13 +++++++++++++
Makefile.util.def | 2 +-
grub-core/net/drivers/emu/emunet.c | 11 +++++++++--
util/getroot.c | 7 ++++++-
4 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5db804e..3eda38f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-09-22 Colin Watson <cjwatson@ubuntu.com>
+
+ Fix grub-emu build on FreeBSD.
+
+ * Makefile.util.def (grub-mount): Add LIBGEOM to ldadd.
+ * grub-core/net/drivers/emu/emunet.c: Only include Linux-specific
+ headers on Linux.
+ (GRUB_MOD_INIT): Return immediately on non-Linux platforms; this
+ implementation is currently Linux-specific.
+ * util/getroot.c (exec_pipe): Define only on Linux or when either
+ libzfs or libnvpair is unavailable.
+ (find_root_devices_from_poolname): Remove unused path variable.
+
2012-09-19 Colin Watson <cjwatson@ubuntu.com>
* grub-core/partmap/msdos.c (pc_partition_map_embed): Revert
diff --git a/Makefile.util.def b/Makefile.util.def
index b80187c..72057cf 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -266,7 +266,7 @@ program = {
ldadd = libgrubgcry.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
- ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) -lfuse';
+ ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM) -lfuse';
condition = COND_GRUB_MOUNT;
};
diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c
index 7a7aeaf..6b533dd 100644
--- a/grub-core/net/drivers/emu/emunet.c
+++ b/grub-core/net/drivers/emu/emunet.c
@@ -21,8 +21,10 @@
#include <sys/socket.h>
#include <grub/net.h>
#include <sys/types.h>
-#include <linux/if.h>
-#include <linux/if_tun.h>
+#ifdef __linux__
+# include <linux/if.h>
+# include <linux/if_tun.h>
+#endif /* __linux__ */
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
@@ -97,6 +99,7 @@ static struct grub_net_card emucard =
GRUB_MOD_INIT(emunet)
{
+#ifdef __linux__
struct ifreq ifr;
fd = open ("/dev/net/tun", O_RDWR | O_NONBLOCK);
if (fd < 0)
@@ -110,6 +113,10 @@ GRUB_MOD_INIT(emunet)
return;
}
grub_net_card_register (&emucard);
+#else /* !__linux__ */
+ fd = -1;
+ return;
+#endif /* __linux__ */
}
GRUB_MOD_FINI(emunet)
diff --git a/util/getroot.c b/util/getroot.c
index b97bea6..c2a25c9 100644
--- a/util/getroot.c
+++ b/util/getroot.c
@@ -220,6 +220,9 @@ xgetcwd (void)
#if !defined (__MINGW32__) && !defined (__CYGWIN__) && !defined (__GNU__)
+#if (defined (__linux__) || \
+ !defined (HAVE_LIBZFS) || !defined (HAVE_LIBNVPAIR))
+
static pid_t
exec_pipe (char **argv, int *fd)
{
@@ -258,6 +261,8 @@ exec_pipe (char **argv, int *fd)
}
}
+#endif
+
static char **
find_root_devices_from_poolname (char *poolname)
{
@@ -269,7 +274,7 @@ find_root_devices_from_poolname (char *poolname)
zpool_handle_t *zpool;
libzfs_handle_t *libzfs;
nvlist_t *config, *vdev_tree;
- nvlist_t **children, **path;
+ nvlist_t **children;
unsigned int nvlist_count;
unsigned int i;
char *device = 0;
--
1.8.1.4

View File

@ -0,0 +1,40 @@
From e6f215afa8ff4d586f71276fc12ea14eb1e6cd8b Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 24 Sep 2012 18:50:35 +0100
Subject: [PATCH 046/364] * util/grub-install.in: Make the error message if
$source_dir doesn't exist more useful.
---
ChangeLog | 5 +++++
util/grub-install.in | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 3eda38f..a53c5cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-24 Colin Watson <cjwatson@ubuntu.com>
+
+ * util/grub-install.in: Make the error message if $source_dir
+ doesn't exist more useful.
+
2012-09-22 Colin Watson <cjwatson@ubuntu.com>
Fix grub-emu build on FreeBSD.
diff --git a/util/grub-install.in b/util/grub-install.in
index e19f1cd..56be98f 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -330,7 +330,7 @@ if [ x$source_dir = x ]; then
fi
if ! [ -d "$source_dir" ]; then
- gettext_printf "%s doesn't exist. Please specify --target or --directory\\n" "source_dir"
+ gettext_printf "%s doesn't exist. Please specify --target or --directory\\n" "$source_dir"
exit 1
fi
--
1.8.1.4

View File

@ -0,0 +1,202 @@
From d36c4c3115977beb5f9247c6c6f0a2a209389f45 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 26 Sep 2012 09:33:41 +0200
Subject: [PATCH 047/364] * grub-core/fs/affs.c (grub_affs_mount):
Support AFFS bootblock in sector 1.
---
ChangeLog | 5 ++
grub-core/fs/affs.c | 139 ++++++++++++++++++++++++++--------------------------
2 files changed, 74 insertions(+), 70 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a53c5cc..d81a9a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-26 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/affs.c (grub_affs_mount): Support AFFS bootblock in
+ sector 1.
+
2012-09-24 Colin Watson <cjwatson@ubuntu.com>
* util/grub-install.in: Make the error message if $source_dir
diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c
index ef65479..848a455 100644
--- a/grub-core/fs/affs.c
+++ b/grub-core/fs/affs.c
@@ -97,6 +97,7 @@ enum
};
#define AFFS_MAX_LOG_BLOCK_SIZE 4
+#define AFFS_MAX_SUPERBLOCK 1
@@ -184,94 +185,92 @@ grub_affs_mount (grub_disk_t disk)
{
struct grub_affs_data *data;
grub_uint32_t *rootblock = 0;
- struct grub_affs_rblock *rblock;
+ struct grub_affs_rblock *rblock = 0;
int log_blocksize = 0;
+ int bsnum = 0;
data = grub_zalloc (sizeof (struct grub_affs_data));
if (!data)
return 0;
- /* Read the bootblock. */
- grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock),
- &data->bblock);
- if (grub_errno)
- goto fail;
-
- /* Make sure this is an affs filesystem. */
- if (grub_strncmp ((char *) (data->bblock.type), "DOS", 3))
- {
- grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
- goto fail;
- }
-
- /* Test if the filesystem is a OFS filesystem. */
- if (! (data->bblock.flags & GRUB_AFFS_FLAG_FFS))
- {
- grub_error (GRUB_ERR_BAD_FS, "OFS not yet supported");
- goto fail;
- }
-
- /* No sane person uses more than 8KB for a block. At least I hope
- for that person because in that case this won't work. */
- rootblock = grub_malloc (GRUB_DISK_SECTOR_SIZE << AFFS_MAX_LOG_BLOCK_SIZE);
- if (!rootblock)
- goto fail;
-
- rblock = (struct grub_affs_rblock *) rootblock;
-
- /* The filesystem blocksize is not stored anywhere in the filesystem
- itself. One way to determine it is try reading blocks for the
- rootblock until the checksum is correct. */
- for (log_blocksize = 0; log_blocksize <= AFFS_MAX_LOG_BLOCK_SIZE;
- log_blocksize++)
+ for (bsnum = 0; bsnum < AFFS_MAX_SUPERBLOCK + 1; bsnum++)
{
- grub_uint32_t *currblock = rootblock;
- unsigned int i;
- grub_uint32_t checksum = 0;
-
- /* Read the rootblock. */
- grub_disk_read (disk,
- (grub_uint64_t) grub_be_to_cpu32 (data->bblock.rootblock)
- << log_blocksize, 0,
- GRUB_DISK_SECTOR_SIZE << log_blocksize, rootblock);
+ /* Read the bootblock. */
+ grub_disk_read (disk, bsnum, 0, sizeof (struct grub_affs_bblock),
+ &data->bblock);
if (grub_errno)
goto fail;
- if (rblock->type != grub_cpu_to_be32_compile_time (2)
- || rblock->htsize == 0
- || currblock[(GRUB_DISK_SECTOR_SIZE << log_blocksize)
- / sizeof (*currblock) - 1]
- != grub_cpu_to_be32_compile_time (1))
+ /* Make sure this is an affs filesystem. */
+ if (grub_strncmp ((char *) (data->bblock.type), "DOS", 3) != 0
+ /* Test if the filesystem is a OFS filesystem. */
+ || !(data->bblock.flags & GRUB_AFFS_FLAG_FFS))
continue;
- for (i = 0; i < (GRUB_DISK_SECTOR_SIZE << log_blocksize)
- / sizeof (*currblock);
- i++)
- checksum += grub_be_to_cpu32 (currblock[i]);
+ /* No sane person uses more than 8KB for a block. At least I hope
+ for that person because in that case this won't work. */
+ if (!rootblock)
+ rootblock = grub_malloc (GRUB_DISK_SECTOR_SIZE
+ << AFFS_MAX_LOG_BLOCK_SIZE);
+ if (!rootblock)
+ goto fail;
- if (checksum == 0)
- break;
- }
- if (log_blocksize > AFFS_MAX_LOG_BLOCK_SIZE)
- {
- grub_error (GRUB_ERR_BAD_FS, "AFFS blocksize couldn't be determined");
- goto fail;
- }
+ rblock = (struct grub_affs_rblock *) rootblock;
+
+ /* The filesystem blocksize is not stored anywhere in the filesystem
+ itself. One way to determine it is try reading blocks for the
+ rootblock until the checksum is correct. */
+ for (log_blocksize = 0; log_blocksize <= AFFS_MAX_LOG_BLOCK_SIZE;
+ log_blocksize++)
+ {
+ grub_uint32_t *currblock = rootblock;
+ unsigned int i;
+ grub_uint32_t checksum = 0;
+
+ /* Read the rootblock. */
+ grub_disk_read (disk,
+ (grub_uint64_t) grub_be_to_cpu32 (data->bblock.rootblock)
+ << log_blocksize, 0,
+ GRUB_DISK_SECTOR_SIZE << log_blocksize, rootblock);
+ if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
+ {
+ grub_errno = 0;
+ break;
+ }
+ if (grub_errno)
+ goto fail;
- data->log_blocksize = log_blocksize;
- data->disk = disk;
- data->htsize = grub_be_to_cpu32 (rblock->htsize);
- data->diropen.data = data;
- data->diropen.block = grub_be_to_cpu32 (data->bblock.rootblock);
- data->diropen.parent = NULL;
- grub_memcpy (&data->diropen.di, rootblock, sizeof (data->diropen.di));
+ if (rblock->type != grub_cpu_to_be32_compile_time (2)
+ || rblock->htsize == 0
+ || currblock[(GRUB_DISK_SECTOR_SIZE << log_blocksize)
+ / sizeof (*currblock) - 1]
+ != grub_cpu_to_be32_compile_time (1))
+ continue;
- grub_free (rootblock);
+ for (i = 0; i < (GRUB_DISK_SECTOR_SIZE << log_blocksize)
+ / sizeof (*currblock);
+ i++)
+ checksum += grub_be_to_cpu32 (currblock[i]);
- return data;
+ if (checksum == 0)
+ {
+ data->log_blocksize = log_blocksize;
+ data->disk = disk;
+ data->htsize = grub_be_to_cpu32 (rblock->htsize);
+ data->diropen.data = data;
+ data->diropen.block = grub_be_to_cpu32 (data->bblock.rootblock);
+ data->diropen.parent = NULL;
+ grub_memcpy (&data->diropen.di, rootblock,
+ sizeof (data->diropen.di));
+ grub_free (rootblock);
+
+ return data;
+ }
+ }
+ }
fail:
- if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
+ if (grub_errno == GRUB_ERR_NONE || grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
grub_free (data);
--
1.8.1.4

View File

@ -0,0 +1,41 @@
From 9196249442d3d9b360b77a5bd35ffb6c49935c78 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 26 Sep 2012 13:12:20 +0100
Subject: [PATCH 048/364] * util/grub-mkconfig_lib.in
(is_path_readable_by_grub): Redirect errors from grub-probe to /dev/null, not
stdout.
---
ChangeLog | 5 +++++
util/grub-mkconfig_lib.in | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index d81a9a6..c43f8a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-26 Colin Watson <cjwatson@ubuntu.com>
+
+ * util/grub-mkconfig_lib.in (is_path_readable_by_grub): Redirect
+ errors from grub-probe to /dev/null, not stdout.
+
2012-09-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/affs.c (grub_affs_mount): Support AFFS bootblock in
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 8f21eb2..3574839 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -65,7 +65,7 @@ is_path_readable_by_grub ()
# ... or if we can't figure out the abstraction module, for example if
# memberlist fails on an LVM volume group.
- if abstractions="`"${grub_probe}" -t abstraction "$path"`" 2>&1 ; then
+ if abstractions="`"${grub_probe}" -t abstraction "$path"`" 2> /dev/null ; then
:
else
return 1
--
1.8.1.4

View File

@ -0,0 +1,44 @@
From 42593e7230fad9f87732c1687cb5daff918f2fa1 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 26 Sep 2012 13:51:13 +0100
Subject: [PATCH 049/364] * Makefile.util.def (grub-mknetdir): Move to
$prefix/bin. Reported by: Daniel Kahn Gillmor. Fixes Debian bug #688799.
---
ChangeLog | 5 +++++
Makefile.util.def | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c43f8a4..2658573 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-09-26 Colin Watson <cjwatson@ubuntu.com>
+ * Makefile.util.def (grub-mknetdir): Move to $prefix/bin.
+ Reported by: Daniel Kahn Gillmor. Fixes Debian bug #688799.
+
+2012-09-26 Colin Watson <cjwatson@ubuntu.com>
+
* util/grub-mkconfig_lib.in (is_path_readable_by_grub): Redirect
errors from grub-probe to /dev/null, not stdout.
diff --git a/Makefile.util.def b/Makefile.util.def
index 72057cf..8324ede 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -487,8 +487,8 @@ script = {
};
script = {
- mansection = 8;
- installdir = sbin;
+ mansection = 1;
+ installdir = bin;
name = grub-mknetdir;
common = util/grub-mknetdir.in;
--
1.8.1.4

View File

@ -0,0 +1,132 @@
From 8c38cb1283a0cf1c8eae465bff26e0ca966ac43a Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 5 Oct 2012 13:09:19 +0100
Subject: [PATCH 050/364] * grub-core/loader/i386/linux.c (allocate_pages): Fix
spelling of preferred_address. (grub_cmd_linux): Likewise. *
grub-core/net/icmp6.c (struct prefix_option): Fix spelling of
preferred_lifetime. Update all users.
---
ChangeLog | 8 ++++++++
grub-core/loader/i386/linux.c | 18 +++++++++---------
grub-core/net/icmp6.c | 6 +++---
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2658573..d0aeab6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-05 Colin Watson <cjwatson@debian.org>
+
+ * grub-core/loader/i386/linux.c (allocate_pages): Fix spelling of
+ preferred_address.
+ (grub_cmd_linux): Likewise.
+ * grub-core/net/icmp6.c (struct prefix_option): Fix spelling of
+ preferred_lifetime. Update all users.
+
2012-09-26 Colin Watson <cjwatson@ubuntu.com>
* Makefile.util.def (grub-mknetdir): Move to $prefix/bin.
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index bcb037c..fc0ebe7 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -191,7 +191,7 @@ free_pages (void)
static grub_err_t
allocate_pages (grub_size_t prot_size, grub_size_t *align,
grub_size_t min_align, int relocatable,
- grub_uint64_t prefered_address)
+ grub_uint64_t preferred_address)
{
grub_err_t err;
@@ -215,8 +215,8 @@ allocate_pages (grub_size_t prot_size, grub_size_t *align,
if (relocatable)
{
err = grub_relocator_alloc_chunk_align (relocator, &ch,
- prefered_address,
- prefered_address,
+ preferred_address,
+ preferred_address,
prot_size, 1,
GRUB_RELOCATOR_PREFERENCE_LOW,
1);
@@ -235,7 +235,7 @@ allocate_pages (grub_size_t prot_size, grub_size_t *align,
}
else
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
- prefered_address,
+ preferred_address,
prot_size);
if (err)
goto fail;
@@ -680,7 +680,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
int i;
grub_size_t align, min_align;
int relocatable;
- grub_uint64_t preffered_address = GRUB_LINUX_BZIMAGE_ADDR;
+ grub_uint64_t preferred_address = GRUB_LINUX_BZIMAGE_ADDR;
grub_dl_ref (my_mod);
@@ -775,22 +775,22 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
prot_size = grub_le_to_cpu32 (lh.init_size);
prot_init_space = page_align (prot_size);
if (relocatable)
- preffered_address = grub_le_to_cpu64 (lh.pref_address);
+ preferred_address = grub_le_to_cpu64 (lh.pref_address);
else
- preffered_address = GRUB_LINUX_BZIMAGE_ADDR;
+ preferred_address = GRUB_LINUX_BZIMAGE_ADDR;
}
else
{
min_align = align;
prot_size = prot_file_size;
- preffered_address = GRUB_LINUX_BZIMAGE_ADDR;
+ preferred_address = GRUB_LINUX_BZIMAGE_ADDR;
/* Usually, the compression ratio is about 50%. */
prot_init_space = page_align (prot_size) * 3;
}
if (allocate_pages (prot_size, &align,
min_align, relocatable,
- preffered_address))
+ preferred_address))
goto fail;
params = (struct linux_kernel_params *) &linux_params;
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
index 4fc343d..9ded94b 100644
--- a/grub-core/net/icmp6.c
+++ b/grub-core/net/icmp6.c
@@ -55,7 +55,7 @@ struct prefix_option
grub_uint8_t prefixlen;
grub_uint8_t flags;
grub_uint32_t valid_lifetime;
- grub_uint32_t prefered_lifetime;
+ grub_uint32_t preferred_lifetime;
grub_uint32_t reserved;
grub_uint64_t prefix[2];
} __attribute__ ((packed));
@@ -370,14 +370,14 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
struct grub_net_slaac_mac_list *slaac;
if (!(opt->flags & FLAG_SLAAC)
|| (grub_be_to_cpu64 (opt->prefix[0]) >> 48) == 0xfe80
- || (grub_be_to_cpu32 (opt->prefered_lifetime)
+ || (grub_be_to_cpu32 (opt->preferred_lifetime)
> grub_be_to_cpu32 (opt->valid_lifetime))
|| opt->prefixlen != 64)
{
grub_dprintf ("net", "discarded prefix: %d, %d, %d, %d\n",
!(opt->flags & FLAG_SLAAC),
(grub_be_to_cpu64 (opt->prefix[0]) >> 48) == 0xfe80,
- (grub_be_to_cpu32 (opt->prefered_lifetime)
+ (grub_be_to_cpu32 (opt->preferred_lifetime)
> grub_be_to_cpu32 (opt->valid_lifetime)),
opt->prefixlen != 64);
continue;
--
1.8.1.4

View File

@ -0,0 +1,26 @@
From 331fdad4315282f8e367e291131e048593a3a068 Mon Sep 17 00:00:00 2001
From: Christoph Junghans <ottxor@gentoo.org>
Date: Fri, 12 Oct 2012 15:04:02 +0200
Subject: [PATCH 051/364] * grub-core/Makefile.am (moddep.lst): Use $(AWK)
instead of awk
---
grub-core/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index cc4fb68..9cb14e2 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -349,7 +349,7 @@ syminfo.lst: gensyminfo.sh kernel_syms.lst $(MODULE_FILES)
# generate global module dependencies list
moddep.lst: syminfo.lst genmoddep.awk video.lst
- cat $< | sort | awk -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
+ cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
platform_DATA += moddep.lst
CLEANFILES += config.log syminfo.lst moddep.lst
--
1.8.1.4

View File

@ -0,0 +1,42 @@
From a940b1492cc0c066725e5e49882602fb0e5c7399 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 12 Oct 2012 15:34:33 +0100
Subject: [PATCH 052/364] * grub-core/commands/configfile.c (GRUB_MOD_INIT):
Correct description of extract_entries_configfile.
---
ChangeLog | 7 ++++++-
grub-core/commands/configfile.c | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d0aeab6..9280dba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2012-10-05 Colin Watson <cjwatson@debian.org>
+2012-10-12 Colin Watson <cjwatson@ubuntu.com>
+
+ * grub-core/commands/configfile.c (GRUB_MOD_INIT): Correct
+ description of extract_entries_configfile.
+
+2012-10-05 Colin Watson <cjwatson@ubuntu.com>
* grub-core/loader/i386/linux.c (allocate_pages): Fix spelling of
preferred_address.
diff --git a/grub-core/commands/configfile.c b/grub-core/commands/configfile.c
index 99c0a24..f2d2abb 100644
--- a/grub-core/commands/configfile.c
+++ b/grub-core/commands/configfile.c
@@ -78,7 +78,7 @@ GRUB_MOD_INIT(configfile)
cmd_extractor_configfile =
grub_register_command ("extract_entries_configfile", grub_cmd_source,
N_("FILE"),
- N_("Load another config file without changing context but take only menu entries.")
+ N_("Load another config file but take only menu entries.")
);
cmd_dot =
--
1.8.1.4

View File

@ -0,0 +1,71 @@
From 5bf54ea7bf0fc7d1c2b9806a57566ad25179d07c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= <gregoire.sutre@gmail.com>
Date: Sun, 28 Oct 2012 11:55:22 +0100
Subject: [PATCH 053/364] Fix ordering and tab indentation of NetBSD boot menu
entries.
---
ChangeLog | 5 +++++
util/grub.d/10_netbsd.in | 12 ++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c7b07bb..caea96d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-28 Grégoire Sutre <gregoire.sutre@gmail.com>
+
+ * util/grub.d/10_netbsd.in: Fix tab indentation and make sure
+ that /netbsd appears first (when it exists).
+
2012-10-12 Colin Watson <cjwatson@ubuntu.com>
* grub-core/commands/configfile.c (GRUB_MOD_INIT): Correct
diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in
index b76332b..dead5c1 100644
--- a/util/grub.d/10_netbsd.in
+++ b/util/grub.d/10_netbsd.in
@@ -74,13 +74,13 @@ netbsd_load_fs_module ()
fi
kmodule_rel=$(make_system_path_relative_to_its_root "$kmodule") || return
- prepare_grub_to_access_device $(${grub_probe} -t device "${kmodule}") | sed -e 's,^, ,'
+ prepare_grub_to_access_device $(${grub_probe} -t device "${kmodule}") | sed -e 's,^, ,' | sed "s/^/$submenu_indentation/"
case "${loader}" in
knetbsd)
- printf "$grub_tabknetbsd_module_elf %s\n" "${kmodule_rel}"
+ printf "${grub_tab}knetbsd_module_elf %s\n" "${kmodule_rel}" | sed "s/^/$submenu_indentation/"
;;
multiboot)
- printf "$grub_tabmodule %s\n" "${kmodule_rel}"
+ printf "${grub_tab}module %s\n" "${kmodule_rel}" | sed "s/^/$submenu_indentation/"
;;
esac
}
@@ -121,11 +121,11 @@ netbsd_entry ()
printf "%s\n" "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
case "${loader}" in
knetbsd)
- printf "$grub_tabknetbsd %s -r %s %s\n" \
+ printf "${grub_tab}knetbsd %s -r %s %s\n" \
"${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" | sed "s/^/$submenu_indentation/"
;;
multiboot)
- printf "$grub_tabmultiboot %s %s root=%s %s\n" \
+ printf "${grub_tab}multiboot %s %s root=%s %s\n" \
"${kernel}" "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" | sed "s/^/$submenu_indentation/"
;;
esac
@@ -147,7 +147,7 @@ pattern="^ELF[^,]*executable.*statically linked"
submenu_indentation=""
is_first_entry=true
-for k in $(ls -t /netbsd*) ; do
+for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do
if ! grub_file_is_not_garbage "$k" ; then
continue
fi
--
1.8.1.4

View File

@ -0,0 +1,39 @@
From ae12080106554c5dd5e2d19799f08a0aa72c9be9 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 28 Nov 2012 14:14:20 +0100
Subject: [PATCH 054/364] * grub-core/net/bootp.c (parse_dhcp_vendor):
Fix double increment.
---
ChangeLog | 4 ++++
grub-core/net/bootp.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index caea96d..1759da4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-11-28 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+
+ * grub-core/net/bootp.c (parse_dhcp_vendor): Fix double increment.
+
2012-10-28 Grégoire Sutre <gregoire.sutre@gmail.com>
* util/grub.d/10_netbsd.in: Fix tab indentation and make sure
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index bc07d53..f36d4cd 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -122,7 +122,7 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
ptr += 4;
}
}
- break;
+ continue;
case GRUB_NET_BOOTP_HOSTNAME:
set_env_limn_ro (name, "hostname", (char *) ptr, taglength);
break;
--
1.8.1.4

View File

@ -0,0 +1,40 @@
From aa3830c409ca40e6f0b71279ddb3409262a7bd96 Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@arm.com>
Date: Wed, 28 Nov 2012 14:18:45 +0100
Subject: [PATCH 055/364] * include/grub/types.h: Fix functionality
unaffecting typo in GRUB_TARGET_WORDSIZE conditional macro.
---
ChangeLog | 5 +++++
include/grub/types.h | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 1759da4..b26bfcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-28 Leif Lindholm <leif.lindholm@arm.com>
+
+ * include/grub/types.h: Fix functionality unaffecting typo in
+ GRUB_TARGET_WORDSIZE conditional macro.
+
2012-11-28 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
* grub-core/net/bootp.c (parse_dhcp_vendor): Fix double increment.
diff --git a/include/grub/types.h b/include/grub/types.h
index 3e677c6..22d1be7 100644
--- a/include/grub/types.h
+++ b/include/grub/types.h
@@ -50,7 +50,7 @@
# error "This architecture is not supported because sizeof(void *) != 4 and sizeof(void *) != 8"
#endif
-#if !defined (GRUB_UTIL) & !defined (GRUB_TARGET_WORDSIZE)
+#if !defined (GRUB_UTIL) && !defined (GRUB_TARGET_WORDSIZE)
# if GRUB_TARGET_SIZEOF_VOID_P == 4
# define GRUB_TARGET_WORDSIZE 32
# elif GRUB_TARGET_SIZEOF_VOID_P == 8
--
1.8.1.4

View File

@ -0,0 +1,307 @@
From b4ec418af5d77275f3b3cf5e7566eaa4ecd713bd Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 8 Dec 2012 20:56:58 +0100
Subject: [PATCH 056/364] Support big-endian UFS1.
* Makefile.util.def (libgrubmods): Add ufs_be.c
* grub-core/Makefile.core.def (ufs1_be): New module.
* grub-core/fs/ufs_be.c: New file.
* grub-core/fs/ufs.c: Declare grub_ufs_to_le* and use them throughout
the file.
---
ChangeLog | 10 ++++++
Makefile.util.def | 1 +
grub-core/Makefile.core.def | 5 +++
grub-core/fs/ufs.c | 83 +++++++++++++++++++++++++++++----------------
grub-core/fs/ufs_be.c | 2 ++
5 files changed, 72 insertions(+), 29 deletions(-)
create mode 100644 grub-core/fs/ufs_be.c
diff --git a/ChangeLog b/ChangeLog
index b26bfcb..d565547 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-12-08 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Support big-endian UFS1.
+
+ * Makefile.util.def (libgrubmods): Add ufs_be.c
+ * grub-core/Makefile.core.def (ufs1_be): New module.
+ * grub-core/fs/ufs_be.c: New file.
+ * grub-core/fs/ufs.c: Declare grub_ufs_to_le* and use them throughout
+ the file.
+
2012-11-28 Leif Lindholm <leif.lindholm@arm.com>
* include/grub/types.h: Fix functionality unaffecting typo in
diff --git a/Makefile.util.def b/Makefile.util.def
index 8324ede..01f7456 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -90,6 +90,7 @@ library = {
common = grub-core/fs/udf.c;
common = grub-core/fs/ufs2.c;
common = grub-core/fs/ufs.c;
+ common = grub-core/fs/ufs_be.c;
common = grub-core/fs/xfs.c;
common = grub-core/fs/zfs/zfscrypt.c;
common = grub-core/fs/zfs/zfs.c;
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 7a7b97a..6752429 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1181,6 +1181,11 @@ module = {
};
module = {
+ name = ufs1_be;
+ common = fs/ufs_be.c;
+};
+
+module = {
name = ufs2;
common = fs/ufs2.c;
};
diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c
index bd0cd1f..3f2dba1 100644
--- a/grub-core/fs/ufs.c
+++ b/grub-core/fs/ufs.c
@@ -49,18 +49,30 @@ GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_UFS_VOLNAME_LEN 32
+#ifdef MODE_BIGENDIAN
+#define grub_ufs_to_cpu16 grub_be_to_cpu16
+#define grub_ufs_to_cpu32 grub_be_to_cpu32
+#define grub_ufs_to_cpu64 grub_be_to_cpu64
+#define grub_cpu_to_ufs32_compile_time grub_cpu_to_be32_compile_time
+#else
+#define grub_ufs_to_cpu16 grub_le_to_cpu16
+#define grub_ufs_to_cpu32 grub_le_to_cpu32
+#define grub_ufs_to_cpu64 grub_le_to_cpu64
+#define grub_cpu_to_ufs32_compile_time grub_cpu_to_le32_compile_time
+#endif
+
/* Calculate in which group the inode can be found. */
-#define UFS_BLKSZ(sblock) (grub_le_to_cpu32 (sblock->bsize))
+#define UFS_BLKSZ(sblock) (grub_ufs_to_cpu32 (sblock->bsize))
#define UFS_LOG_BLKSZ(sblock) (data->log2_blksz)
#ifdef MODE_UFS2
-#define INODE_ENDIAN(data,field,bits1,bits2) grub_le_to_cpu##bits2 (data->inode.field)
+#define INODE_ENDIAN(data,field,bits1,bits2) grub_ufs_to_cpu##bits2 (data->inode.field)
#else
-#define INODE_ENDIAN(data,field,bits1,bits2) grub_le_to_cpu##bits1 (data->inode.field)
+#define INODE_ENDIAN(data,field,bits1,bits2) grub_ufs_to_cpu##bits1 (data->inode.field)
#endif
-#define INODE_SIZE(data) grub_le_to_cpu64 (data->inode.size)
-#define INODE_MODE(data) grub_le_to_cpu16 (data->inode.mode)
+#define INODE_SIZE(data) grub_ufs_to_cpu64 (data->inode.size)
+#define INODE_MODE(data) grub_ufs_to_cpu16 (data->inode.mode)
#ifdef MODE_UFS2
#define LOG_INODE_BLKSZ 3
#else
@@ -234,7 +246,7 @@ grub_ufs_get_file_block (struct grub_ufs_data *data, grub_disk_addr_t blk)
if (blk < GRUB_UFS_DIRBLKS)
return INODE_DIRBLOCKS (data, blk);
- log2_blksz = grub_le_to_cpu32 (data->sblock.log2_blksz);
+ log2_blksz = grub_ufs_to_cpu32 (data->sblock.log2_blksz);
blk -= GRUB_UFS_DIRBLKS;
@@ -366,7 +378,7 @@ grub_ufs_read_file (struct grub_ufs_data *data,
{
data->disk->read_hook = read_hook;
grub_disk_read (data->disk,
- blknr << grub_le_to_cpu32 (data->sblock.log2_blksz),
+ blknr << grub_ufs_to_cpu32 (data->sblock.log2_blksz),
skipfirst, blockend, buf);
data->disk->read_hook = 0;
if (grub_errno)
@@ -389,17 +401,17 @@ grub_ufs_read_inode (struct grub_ufs_data *data, int ino, char *inode)
struct grub_ufs_sblock *sblock = &data->sblock;
/* Determine the group the inode is in. */
- int group = ino / grub_le_to_cpu32 (sblock->ino_per_group);
+ int group = ino / grub_ufs_to_cpu32 (sblock->ino_per_group);
/* Determine the inode within the group. */
- int grpino = ino % grub_le_to_cpu32 (sblock->ino_per_group);
+ int grpino = ino % grub_ufs_to_cpu32 (sblock->ino_per_group);
/* The first block of the group. */
- int grpblk = group * (grub_le_to_cpu32 (sblock->frags_per_group));
+ int grpblk = group * (grub_ufs_to_cpu32 (sblock->frags_per_group));
#ifndef MODE_UFS2
- grpblk += grub_le_to_cpu32 (sblock->cylg_offset)
- * (group & (~grub_le_to_cpu32 (sblock->cylg_mask)));
+ grpblk += grub_ufs_to_cpu32 (sblock->cylg_offset)
+ * (group & (~grub_ufs_to_cpu32 (sblock->cylg_mask)));
#endif
if (!inode)
@@ -409,8 +421,8 @@ grub_ufs_read_inode (struct grub_ufs_data *data, int ino, char *inode)
}
grub_disk_read (data->disk,
- ((grub_le_to_cpu32 (sblock->inoblk_offs) + grpblk)
- << grub_le_to_cpu32 (data->sblock.log2_blksz))
+ ((grub_ufs_to_cpu32 (sblock->inoblk_offs) + grpblk)
+ << grub_ufs_to_cpu32 (data->sblock.log2_blksz))
+ grpino / UFS_INODE_PER_BLOCK,
(grpino % UFS_INODE_PER_BLOCK)
* sizeof (struct grub_ufs_inode),
@@ -501,7 +513,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
#ifdef MODE_UFS2
namelen = dirent.namelen_bsd;
#else
- namelen = grub_le_to_cpu16 (dirent.namelen);
+ namelen = grub_ufs_to_cpu16 (dirent.namelen);
#endif
{
char filename[namelen + 1];
@@ -515,7 +527,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
if (!grub_strcmp (name, filename))
{
dirino = data->ino;
- grub_ufs_read_inode (data, grub_le_to_cpu32 (dirent.ino), 0);
+ grub_ufs_read_inode (data, grub_ufs_to_cpu32 (dirent.ino), 0);
if ((INODE_MODE(data) & GRUB_UFS_ATTR_TYPE)
== GRUB_UFS_ATTR_LNK)
@@ -547,7 +559,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
}
}
- pos += grub_le_to_cpu16 (dirent.direntlen);
+ pos += grub_ufs_to_cpu16 (dirent.direntlen);
} while (pos < INODE_SIZE (data));
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
@@ -576,12 +588,12 @@ grub_ufs_mount (grub_disk_t disk)
/* No need to byteswap bsize in this check. It works the same on both
endiannesses. */
- if (grub_le_to_cpu32 (data->sblock.magic) == GRUB_UFS_MAGIC
+ if (data->sblock.magic == grub_cpu_to_ufs32_compile_time (GRUB_UFS_MAGIC)
&& data->sblock.bsize != 0
&& ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0))
{
for (data->log2_blksz = 0;
- (1U << data->log2_blksz) < grub_le_to_cpu32 (data->sblock.bsize);
+ (1U << data->log2_blksz) < grub_ufs_to_cpu32 (data->sblock.bsize);
data->log2_blksz++);
data->disk = disk;
@@ -652,7 +664,7 @@ grub_ufs_dir (grub_device_t device, const char *path,
#ifdef MODE_UFS2
namelen = dirent.namelen_bsd;
#else
- namelen = grub_le_to_cpu16 (dirent.namelen);
+ namelen = grub_ufs_to_cpu16 (dirent.namelen);
#endif
{
@@ -667,18 +679,19 @@ grub_ufs_dir (grub_device_t device, const char *path,
break;
filename[namelen] = '\0';
- grub_ufs_read_inode (data, dirent.ino, (char *) &inode);
+ grub_ufs_read_inode (data, grub_ufs_to_cpu32 (dirent.ino),
+ (char *) &inode);
- info.dir = ((grub_le_to_cpu16 (inode.mode) & GRUB_UFS_ATTR_TYPE)
+ info.dir = ((grub_ufs_to_cpu16 (inode.mode) & GRUB_UFS_ATTR_TYPE)
== GRUB_UFS_ATTR_DIR);
- info.mtime = grub_le_to_cpu64 (inode.mtime);
+ info.mtime = grub_ufs_to_cpu64 (inode.mtime);
info.mtimeset = 1;
if (hook (filename, &info))
break;
}
- pos += grub_le_to_cpu16 (dirent.direntlen);
+ pos += grub_ufs_to_cpu16 (dirent.direntlen);
}
fail:
@@ -773,8 +786,8 @@ grub_ufs_uuid (grub_device_t device, char **uuid)
data = grub_ufs_mount (disk);
if (data && (data->sblock.uuidhi != 0 || data->sblock.uuidlow != 0))
*uuid = grub_xasprintf ("%08x%08x",
- (unsigned) grub_le_to_cpu32 (data->sblock.uuidhi),
- (unsigned) grub_le_to_cpu32 (data->sblock.uuidlow));
+ (unsigned) grub_ufs_to_cpu32 (data->sblock.uuidhi),
+ (unsigned) grub_ufs_to_cpu32 (data->sblock.uuidlow));
else
*uuid = NULL;
@@ -799,10 +812,10 @@ grub_ufs_mtime (grub_device_t device, grub_int32_t *tm)
*tm = 0;
else
{
- *tm = grub_le_to_cpu32 (data->sblock.mtime);
+ *tm = grub_ufs_to_cpu32 (data->sblock.mtime);
#ifdef MODE_UFS2
- if (*tm < (grub_int64_t) grub_le_to_cpu64 (data->sblock.mtime2))
- *tm = grub_le_to_cpu64 (data->sblock.mtime2);
+ if (*tm < (grub_int64_t) grub_ufs_to_cpu64 (data->sblock.mtime2))
+ *tm = grub_ufs_to_cpu64 (data->sblock.mtime2);
#endif
}
@@ -820,8 +833,12 @@ static struct grub_fs grub_ufs_fs =
#ifdef MODE_UFS2
.name = "ufs2",
#else
+#ifdef MODE_BIGENDIAN
+ .name = "ufs1_be",
+#else
.name = "ufs1",
#endif
+#endif
.dir = grub_ufs_dir,
.open = grub_ufs_open,
.read = grub_ufs_read,
@@ -839,8 +856,12 @@ static struct grub_fs grub_ufs_fs =
#ifdef MODE_UFS2
GRUB_MOD_INIT(ufs2)
#else
+#ifdef MODE_BIGENDIAN
+GRUB_MOD_INIT(ufs1_be)
+#else
GRUB_MOD_INIT(ufs1)
#endif
+#endif
{
grub_fs_register (&grub_ufs_fs);
my_mod = mod;
@@ -849,8 +870,12 @@ GRUB_MOD_INIT(ufs1)
#ifdef MODE_UFS2
GRUB_MOD_FINI(ufs2)
#else
+#ifdef MODE_BIGENDIAN
+GRUB_MOD_FINI(ufs1_be)
+#else
GRUB_MOD_FINI(ufs1)
#endif
+#endif
{
grub_fs_unregister (&grub_ufs_fs);
}
diff --git a/grub-core/fs/ufs_be.c b/grub-core/fs/ufs_be.c
new file mode 100644
index 0000000..a58f75a
--- /dev/null
+++ b/grub-core/fs/ufs_be.c
@@ -0,0 +1,2 @@
+#define MODE_BIGENDIAN 1
+#include "ufs.c"
--
1.8.1.4

View File

@ -0,0 +1,79 @@
From 32776fea2049a8b8198fdd59d49e18b4f8916d28 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 8 Dec 2012 21:14:08 +0100
Subject: [PATCH 057/364] Fix big-endian mtime.
* grub-core/fs/ufs.c (grub_ufs_inode): Split improperly attached
together sec and usec.
(grub_ufs_dir): Use correct byteswapping for UFS time.
---
ChangeLog | 8 ++++++++
grub-core/fs/ufs.c | 19 +++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d565547..9c6dde5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-12-08 Vladimir Serbinenko <phcoder@gmail.com>
+ Fix big-endian mtime.
+
+ * grub-core/fs/ufs.c (grub_ufs_inode): Split improperly attached
+ together sec and usec.
+ (grub_ufs_dir): Use correct byteswapping for UFS time.
+
+2012-12-08 Vladimir Serbinenko <phcoder@gmail.com>
+
Support big-endian UFS1.
* Makefile.util.def (libgrubmods): Add ufs_be.c
diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c
index 3f2dba1..c862336 100644
--- a/grub-core/fs/ufs.c
+++ b/grub-core/fs/ufs.c
@@ -151,9 +151,9 @@ struct grub_ufs_inode
grub_uint64_t mtime;
grub_uint64_t ctime;
grub_uint64_t create_time;
- grub_uint32_t atime_sec;
- grub_uint32_t mtime_sec;
- grub_uint32_t ctime_sec;
+ grub_uint32_t atime_usec;
+ grub_uint32_t mtime_usec;
+ grub_uint32_t ctime_usec;
grub_uint32_t create_time_sec;
grub_uint32_t gen;
grub_uint32_t kernel_flags;
@@ -181,9 +181,12 @@ struct grub_ufs_inode
grub_uint16_t uid;
grub_uint16_t gid;
grub_uint64_t size;
- grub_uint64_t atime;
- grub_uint64_t mtime;
- grub_uint64_t ctime;
+ grub_uint32_t atime;
+ grub_uint32_t atime_usec;
+ grub_uint32_t mtime;
+ grub_uint32_t mtime_usec;
+ grub_uint32_t ctime;
+ grub_uint32_t ctime_usec;
union
{
struct
@@ -684,7 +687,11 @@ grub_ufs_dir (grub_device_t device, const char *path,
info.dir = ((grub_ufs_to_cpu16 (inode.mode) & GRUB_UFS_ATTR_TYPE)
== GRUB_UFS_ATTR_DIR);
+#ifdef MODE_UFS2
info.mtime = grub_ufs_to_cpu64 (inode.mtime);
+#else
+ info.mtime = grub_ufs_to_cpu32 (inode.mtime);
+#endif
info.mtimeset = 1;
if (hook (filename, &info))
--
1.8.1.4

View File

@ -0,0 +1,41 @@
From 5361431d3faa4ddbbd5d5c6a1fa10e0cebc60623 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 10 Dec 2012 09:22:40 +0100
Subject: [PATCH 058/364] * grub-core/fs/ufs.c (grub_ufs_dir): Stop if
direntlen is 0 to avoid infinite loop on corrupted FS.
---
ChangeLog | 5 +++++
grub-core/fs/ufs.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 9c6dde5..0b1596a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/ufs.c (grub_ufs_dir): Stop if direntlen is 0 to avoid
+ infinite loop on corrupted FS.
+
2012-12-08 Vladimir Serbinenko <phcoder@gmail.com>
Fix big-endian mtime.
diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c
index c862336..74a4a40 100644
--- a/grub-core/fs/ufs.c
+++ b/grub-core/fs/ufs.c
@@ -664,6 +664,9 @@ grub_ufs_dir (grub_device_t device, const char *path,
(char *) &dirent) < 0)
break;
+ if (dirent.direntlen == 0)
+ break;
+
#ifdef MODE_UFS2
namelen = dirent.namelen_bsd;
#else
--
1.8.1.4

View File

@ -0,0 +1,52 @@
From d2634650c732823bd304e0413f84d383c2689117 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 10 Dec 2012 11:12:38 +0100
Subject: [PATCH 059/364] * util/getroot.c
(convert_system_partition_to_system_disk): Support nbd disks.
---
ChangeLog | 5 +++++
util/getroot.c | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0b1596a..547f739 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+ * util/getroot.c (convert_system_partition_to_system_disk): Support
+ nbd disks.
+
+2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/fs/ufs.c (grub_ufs_dir): Stop if direntlen is 0 to avoid
infinite loop on corrupted FS.
diff --git a/util/getroot.c b/util/getroot.c
index c2a25c9..24ce6aa 100644
--- a/util/getroot.c
+++ b/util/getroot.c
@@ -1796,6 +1796,18 @@ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st,
return path;
}
+ if (strncmp ("nbd", p, 3) == 0
+ && p[3] >= '0' && p[3] <= '9')
+ {
+ char *ptr = p + 3;
+ while (*ptr >= '0' && *ptr <= '9')
+ ptr++;
+ if (*ptr)
+ *is_part = 1;
+ *ptr = 0;
+ return path;
+ }
+
/* If this is an IDE, SCSI or Virtio disk. */
if (strncmp ("vdisk", p, 5) == 0
&& p[5] >= 'a' && p[5] <= 'z')
--
1.8.1.4

View File

@ -0,0 +1,40 @@
From 18c470fb212991eea8749327b7baa44ebefc4215 Mon Sep 17 00:00:00 2001
From: Vladimir Testov <vladimir.testov@rosalab.ru>
Date: Mon, 10 Dec 2012 11:45:00 +0100
Subject: [PATCH 060/364] * util/grub-mkfont.c (argp_parser): Fix a typo
which prevented --asce from working.
---
ChangeLog | 5 +++++
util/grub-mkfont.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 547f739..4204678 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-10 Vladimir Testov <vladimir.testov@rosalab.ru>
+
+ * util/grub-mkfont.c (argp_parser): Fix a typo which prevented --asce
+ from working.
+
2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
* util/getroot.c (convert_system_partition_to_system_disk): Support
diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
index 4e2c5e4..83fb2d2 100644
--- a/util/grub-mkfont.c
+++ b/util/grub-mkfont.c
@@ -1101,7 +1101,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
arguments->font_info.desc = strtoul (arg, NULL, 0);
break;
- case 'e':
+ case 'c':
arguments->font_info.asce = strtoul (arg, NULL, 0);
break;
--
1.8.1.4

View File

@ -0,0 +1,148 @@
From c54df09cdb44ab19f9f7d5ece0f6568f4c19e46f Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 10 Dec 2012 16:07:33 +0100
Subject: [PATCH 061/364] * grub-core/term/gfxterm.c
(grub_virtual_screen_setup): Get font as argument rather than font
name. All users updated. (grub_gfxterm_set_window): Likewise.
---
ChangeLog | 6 ++++++
grub-core/gfxmenu/view.c | 11 ++++++++++-
grub-core/term/gfxterm.c | 18 ++++++++++--------
include/grub/gfxterm.h | 3 ++-
4 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4204678..7617678 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/term/gfxterm.c (grub_virtual_screen_setup): Get font as
+ argument rather than font name. All users updated.
+ (grub_gfxterm_set_window): Likewise.
+
2012-12-10 Vladimir Testov <vladimir.testov@rosalab.ru>
* util/grub-mkfont.c (argp_parser): Fix a typo which prevented --asce
diff --git a/grub-core/gfxmenu/view.c b/grub-core/gfxmenu/view.c
index 9023fd3..c005773 100644
--- a/grub-core/gfxmenu/view.c
+++ b/grub-core/gfxmenu/view.c
@@ -361,6 +361,15 @@ grub_gfxmenu_draw_terminal_box (void)
static void
init_terminal (grub_gfxmenu_view_t view)
{
+ grub_font_t terminal_font;
+
+ terminal_font = grub_font_get (view->terminal_font_name);
+ if (!terminal_font)
+ {
+ grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
+ return;
+ }
+
term_rect.width = view->screen.width * 7 / 10;
term_rect.height = view->screen.height * 7 / 10;
@@ -375,7 +384,7 @@ init_terminal (grub_gfxmenu_view_t view)
grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY, term_rect.x,
term_rect.y,
term_rect.width, term_rect.height,
- view->double_repaint, view->terminal_font_name, 3);
+ view->double_repaint, terminal_font, 3);
grub_gfxterm_decorator_hook = grub_gfxmenu_draw_terminal_box;
}
diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c
index c995b84..12567d1 100644
--- a/grub-core/term/gfxterm.c
+++ b/grub-core/term/gfxterm.c
@@ -201,7 +201,7 @@ grub_virtual_screen_free (void)
static grub_err_t
grub_virtual_screen_setup (unsigned int x, unsigned int y,
unsigned int width, unsigned int height,
- const char *font_name)
+ grub_font_t font)
{
unsigned int i;
@@ -209,10 +209,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
grub_virtual_screen_free ();
/* Initialize with default data. */
- virtual_screen.font = grub_font_get (font_name);
- if (!virtual_screen.font)
- return grub_error (GRUB_ERR_BAD_FONT,
- "no font loaded");
+ virtual_screen.font = font;
virtual_screen.width = width;
virtual_screen.height = height;
virtual_screen.offset_x = x;
@@ -282,7 +279,7 @@ grub_err_t
grub_gfxterm_set_window (struct grub_video_render_target *target,
int x, int y, int width, int height,
int double_repaint,
- const char *font_name, int border_width)
+ grub_font_t font, int border_width)
{
/* Clean up any prior instance. */
destroy_window ();
@@ -294,7 +291,7 @@ grub_gfxterm_set_window (struct grub_video_render_target *target,
if (grub_virtual_screen_setup (border_width, border_width,
width - 2 * border_width,
height - 2 * border_width,
- font_name)
+ font)
!= GRUB_ERR_NONE)
{
return grub_errno;
@@ -321,6 +318,7 @@ grub_gfxterm_fullscreen (void)
grub_video_color_t color;
grub_err_t err;
int double_redraw;
+ grub_font_t font;
err = grub_video_get_info (&mode_info);
/* Figure out what mode we ended up. */
@@ -346,12 +344,16 @@ grub_gfxterm_fullscreen (void)
if (! font_name)
font_name = ""; /* Allow fallback to any font. */
+ font = grub_font_get (font_name);
+ if (!font)
+ return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
+
grub_gfxterm_decorator_hook = NULL;
return grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY,
0, 0, mode_info.width, mode_info.height,
double_redraw,
- font_name, DEFAULT_BORDER_WIDTH);
+ font, DEFAULT_BORDER_WIDTH);
}
static grub_err_t
diff --git a/include/grub/gfxterm.h b/include/grub/gfxterm.h
index 3fc8d92..361f73e 100644
--- a/include/grub/gfxterm.h
+++ b/include/grub/gfxterm.h
@@ -23,12 +23,13 @@
#include <grub/types.h>
#include <grub/term.h>
#include <grub/video.h>
+#include <grub/font.h>
grub_err_t
EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
int x, int y, int width, int height,
int double_repaint,
- const char *font_name, int border_width);
+ grub_font_t font, int border_width);
typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
int width, int height);
--
1.8.1.4

View File

@ -0,0 +1,87 @@
From 592fe36daf0064866bbee740383cbf7bd2156639 Mon Sep 17 00:00:00 2001
From: "Dr. Tilmann Bubeck" <t.bubeck@reinform.de>
Date: Mon, 10 Dec 2012 16:14:12 +0100
Subject: [PATCH 062/364] * grub-core/gfxmenu/view.c (init_terminal):
Avoid making terminal window too small.
---
ChangeLog | 5 +++++
grub-core/gfxmenu/view.c | 31 +++++++++++++++++++++++++++----
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7617678..ce822ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-10 Dr. Tilmann Bubeck <t.bubeck@reinform.de>
+
+ * grub-core/gfxmenu/view.c (init_terminal): Avoid making terminal
+ window too small.
+
2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/gfxterm.c (grub_virtual_screen_setup): Get font as
diff --git a/grub-core/gfxmenu/view.c b/grub-core/gfxmenu/view.c
index c005773..1918ea4 100644
--- a/grub-core/gfxmenu/view.c
+++ b/grub-core/gfxmenu/view.c
@@ -361,8 +361,14 @@ grub_gfxmenu_draw_terminal_box (void)
static void
init_terminal (grub_gfxmenu_view_t view)
{
+ const int border_width = 3;
+
grub_font_t terminal_font;
+ unsigned int line_width;
+
+ struct grub_font_glyph *glyph;
+
terminal_font = grub_font_get (view->terminal_font_name);
if (!terminal_font)
{
@@ -370,11 +376,27 @@ init_terminal (grub_gfxmenu_view_t view)
return;
}
- term_rect.width = view->screen.width * 7 / 10;
+ glyph = grub_font_get_glyph (terminal_font, 'M');
+
+ line_width = ((glyph ? glyph->device_width : 8) * 80 + 2 * border_width);
+
+ if (view->screen.width <= line_width)
+ /* The screen is too small. Use all space, except a small border
+ to show the user, it is a window and not full screen: */
+ term_rect.width = view->screen.width - 6 * border_width;
+ else
+ {
+ /* The screen is big enough. Try 70% of the screen width: */
+ term_rect.width = view->screen.width * 7 / 10;
+ /* Make sure, that we use at least the line_width: */
+ if ( term_rect.width < line_width )
+ term_rect.width = line_width;
+ }
+
term_rect.height = view->screen.height * 7 / 10;
- term_rect.x = view->screen.x + view->screen.width * (10 - 7) / 10 / 2;
- term_rect.y = view->screen.y + view->screen.height * (10 - 7) / 10 / 2;
+ term_rect.x = view->screen.x + (view->screen.width - term_rect.width) / 2;
+ term_rect.y = view->screen.y + (view->screen.height - term_rect.height) / 2;
term_view = view;
@@ -384,7 +406,8 @@ init_terminal (grub_gfxmenu_view_t view)
grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY, term_rect.x,
term_rect.y,
term_rect.width, term_rect.height,
- view->double_repaint, terminal_font, 3);
+ view->double_repaint, terminal_font,
+ border_width);
grub_gfxterm_decorator_hook = grub_gfxmenu_draw_terminal_box;
}
--
1.8.1.4

View File

@ -0,0 +1,75 @@
From acfa4335f7ed7310e7ee2da1f68443785f7f7913 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Mon, 10 Dec 2012 16:23:16 +0100
Subject: [PATCH 063/364] * grub-core/kern/ieee1275/init.c
(grub_machine_get_bootlocation): Use dynamic allocation for the bootpath
buffer.
---
ChangeLog | 5 +++++
grub-core/kern/ieee1275/init.c | 21 +++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ce822ee..8bd581e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-10 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+
+ * grub-core/kern/ieee1275/init.c (grub_machine_get_bootlocation): Use
+ dynamic allocation for the bootpath buffer.
+
2012-12-10 Dr. Tilmann Bubeck <t.bubeck@reinform.de>
* grub-core/gfxmenu/view.c (init_terminal): Avoid making terminal
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 7d03a8a..14dcdf0 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -82,18 +82,30 @@ void (*grub_ieee1275_net_config) (const char *dev,
void
grub_machine_get_bootlocation (char **device, char **path)
{
- char bootpath[64]; /* XXX check length */
+ char *bootpath;
+ grub_ssize_t bootpath_size;
char *filename;
char *type;
-
- if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
- sizeof (bootpath), 0))
+
+ if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
+ &bootpath_size)
+ || bootpath_size <= 0)
{
/* Should never happen. */
grub_printf ("/chosen/bootpath property missing!\n");
return;
}
+ bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
+ if (! bootpath)
+ {
+ grub_print_error ();
+ return;
+ }
+ grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
+ (grub_size_t) bootpath_size + 1, 0);
+ bootpath[bootpath_size] = '\0';
+
/* Transform an OF device path to a GRUB path. */
type = grub_ieee1275_get_device_type (bootpath);
@@ -132,6 +144,7 @@ grub_machine_get_bootlocation (char **device, char **path)
*path = filename;
}
}
+ grub_free (bootpath);
}
/* Claim some available memory in the first /memory node. */
--
1.8.1.4

View File

@ -0,0 +1,38 @@
From b21a644e810f7c20844b828150d24d58ad0b776e Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Mon, 10 Dec 2012 17:00:56 +0100
Subject: [PATCH 064/364] * util/grub-install.in: Remove stale TODO.
---
ChangeLog | 4 ++++
util/grub-install.in | 2 --
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8bd581e..0b57abf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-12-10 Andrey Borzenkov <arvidjaar@gmail.com>
+
+ * util/grub-install.in: Remove stale TODO.
+
2012-12-10 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
* grub-core/kern/ieee1275/init.c (grub_machine_get_bootlocation): Use
diff --git a/util/grub-install.in b/util/grub-install.in
index 56be98f..a2cf07a 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -486,8 +486,6 @@ if [ x"$grub_modinfo_platform" = xefi ]; then
*)
efi_file=grub.efi ;;
esac
- # TODO: We should also use efibootmgr, if available, to add a Boot
- # entry for ourselves.
fi
efidir="$efidir/EFI/$efi_distributor"
mkdir -p "$efidir" || exit 1
--
1.8.1.4

View File

@ -1,19 +1,32 @@
From 9436d0324b98e71c8ab55b09b4248a617cd463a8 Mon Sep 17 00:00:00 2001
From 28e8ed1fc8a89e3d4c71be6b27166b26b4e61570 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 7 Nov 2012 16:22:33 -0200
Subject: [PATCH] Follow the symbolic link (ieee1275)
Date: Mon, 10 Dec 2012 17:07:01 +0100
Subject: [PATCH 065/364] * util/grub-install.in: Follow the symbolic
link parameter added to the file command.
If the device used is a symlink, the file command must "follow
the link" in order to check the real device.
---
util/grub-install.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
ChangeLog | 5 +++++
util/grub-install.in | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0b57abf..e522078 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-10 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+
+ * util/grub-install.in: Follow the symbolic link parameter added
+ to the file command.
+
2012-12-10 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub-install.in: Remove stale TODO.
diff --git a/util/grub-install.in b/util/grub-install.in
index 69a97ad..19dc3b4 100644
index a2cf07a..9dc4e0b 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -750,7 +750,7 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
@@ -748,7 +748,7 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
exit 1
fi
@ -23,5 +36,5 @@ index 69a97ad..19dc3b4 100644
gettext "Failed to copy Grub to the PReP partition." 1>&2
echo 1>&2
--
1.7.10.4
1.8.1.4

View File

@ -0,0 +1,54 @@
From 08a1459a9534fa2337744a32dda511d496e9d6cf Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 10 Dec 2012 19:15:51 +0100
Subject: [PATCH 066/364] * grub-core/disk/cryptodisk.c
(grub_cmd_cryptomount): Strip brackets around device name if
necessarry.
---
ChangeLog | 5 +++++
grub-core/disk/cryptodisk.c | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e522078..8d7d988 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/disk/cryptodisk.c (grub_cmd_cryptomount): Strip brackets
+ around device name if necessarry.
+
2012-12-10 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
* util/grub-install.in: Follow the symbolic link parameter added
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index 1ac906d..3de3b86 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -928,10 +928,20 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args)
grub_err_t err;
grub_disk_t disk;
grub_cryptodisk_t dev;
+ char *devname;
+ char *devlast;
search_uuid = NULL;
check_boot = state[2].set;
- disk = grub_disk_open (args[0]);
+ devname = args[0];
+ if (devname[0] == '(' && *(devlast = &devname[grub_strlen (devname) - 1]) == ')')
+ {
+ *devlast = '\0';
+ disk = grub_disk_open (devname + 1);
+ *devlast = ')';
+ }
+ else
+ disk = grub_disk_open (devname);
if (!disk)
return grub_errno;
--
1.8.1.4

View File

@ -0,0 +1,86 @@
From 80fa6c9eaeb13ed950d44bae4890c5b2da7ea6f1 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 10 Dec 2012 22:22:23 +0100
Subject: [PATCH 067/364] * docs/grub.texi (Network): Update
instructions on generating netboot image.
---
ChangeLog | 5 +++++
docs/grub.texi | 35 ++++++++++++++++++-----------------
2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8d7d988..04ffaec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+ * docs/grub.texi (Network): Update instructions on generating netboot
+ image.
+
+2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/disk/cryptodisk.c (grub_cmd_cryptomount): Strip brackets
around device name if necessarry.
diff --git a/docs/grub.texi b/docs/grub.texi
index b0e7f59..39d9614 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -2080,34 +2080,35 @@ The following properties are supported by all components:
@node Network
@chapter Booting GRUB from the network
-The following instructions only work on PC BIOS systems where the Preboot
-eXecution Environment (PXE) is available.
+The following instructions don't work for *-emu, i386-qemu, i386-coreboot,
+i386-multiboot, mips_loongson, mips-arc and mips_qemu_mips
-To generate a PXE boot image, run:
+To generate a netbootable directory, run:
@example
@group
-grub-mkimage --format=i386-pc-pxe --output=grub.pxe --prefix='(pxe)/boot/grub' pxe pxecmd
+grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/<platform>
@end group
@end example
-Copy @file{grub.pxe}, @file{/boot/grub/*.mod}, and @file{/boot/grub/*.lst}
-to the PXE (TFTP) server, ensuring that @file{*.mod} and @file{*.lst} are
-accessible via the @file{/boot/grub/} path from the TFTP server root. Set
-the DHCP server configuration to offer @file{grub.pxe} as the boot file (the
-@samp{filename} option in ISC dhcpd).
+E.g. for i386-pc:
-You can also use the @command{grub-mknetdir} utility to generate an image
-and a GRUB directory tree, rather than copying files around manually.
+@example
+@group
+grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i386-pc
+@end group
+@end example
+
+Then follow instructions printed out by grub-mknetdir on configuring your DHCP
+server.
After GRUB has started, files on the TFTP server will be accessible via the
-@samp{(pxe)} device.
+@samp{(tftp)} device.
-The server and gateway IP address can be controlled by changing the
-@samp{(pxe)} device name to @samp{(pxe:@var{server-ip})} or
-@samp{(pxe:@var{server-ip}:@var{gateway-ip})}. Note that this should be
-changed both in the prefix and in any references to the device name in the
-configuration file.
+The server IP address can be controlled by changing the
+@samp{(tftp)} device name to @samp{(tftp,@var{server-ip})}. Note that
+this should be changed both in the prefix and in any references to the
+device name in the configuration file.
GRUB provides several environment variables which may be used to inspect or
change the behaviour of the PXE device:
--
1.8.1.4

View File

@ -0,0 +1,40 @@
From 34cb801ec4d1999babf5f7fe65cd70a149746137 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Tue, 11 Dec 2012 17:40:35 +0100
Subject: [PATCH 068/364] * util/grub.d/20_linux_xen.in: Addmissing
assignment to machine. Reported by: Eriks Latosheks <foresterlv>.
---
ChangeLog | 5 +++++
util/grub.d/20_linux_xen.in | 2 ++
2 files changed, 7 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 04ffaec..9104a46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-11 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/grub.d/20_linux_xen.in: Addmissing assignment to machine.
+ Reported by: Eriks Latosheks <foresterlv>.
+
2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
* docs/grub.texi (Network): Update instructions on generating netboot
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index d4d0110..ac05ee4 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -174,6 +174,8 @@ boot_device_id=
title_correction_code=
+machine=`uname -m`
+
case "$machine" in
i?86) GENKERNEL_ARCH="x86" ;;
mips|mips64) GENKERNEL_ARCH="mips" ;;
--
1.8.1.4

View File

@ -0,0 +1,66 @@
From d09689a5a2863043d007c1acb9bf0a8d1d3b776d Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 28 Dec 2012 06:43:35 +0000
Subject: [PATCH 069/364] Backport gnulib fixes for C11. Fixes Savannah bug
#37738.
* grub-core/gnulib/stdio.in.h (gets): Warn on use only if
HAVE_RAW_DECL_GETS.
* m4/stdio_h.m4 (gl_STDIO_H): Check for gets.
---
ChangeLog | 8 ++++++++
grub-core/gnulib/stdio.in.h | 6 ++++--
m4/stdio_h.m4 | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9104a46..0f04f5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-12-28 Colin Watson <cjwatson@ubuntu.com>
+
+ Backport gnulib fixes for C11. Fixes Savannah bug #37738.
+
+ * grub-core/gnulib/stdio.in.h (gets): Warn on use only if
+ HAVE_RAW_DECL_GETS.
+ * m4/stdio_h.m4 (gl_STDIO_H): Check for gets.
+
2012-12-11 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/20_linux_xen.in: Addmissing assignment to machine.
diff --git a/grub-core/gnulib/stdio.in.h b/grub-core/gnulib/stdio.in.h
index 80b9dbf..a8b00c6 100644
--- a/grub-core/gnulib/stdio.in.h
+++ b/grub-core/gnulib/stdio.in.h
@@ -138,10 +138,12 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
#endif
/* It is very rare that the developer ever has full control of stdin,
- so any use of gets warrants an unconditional warning. Assume it is
- always declared, since it is required by C89. */
+ so any use of gets warrants an unconditional warning; besides, C11
+ removed it. */
#undef gets
+#if HAVE_RAW_DECL_GETS
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index f5650cd..8458bec 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -37,7 +37,7 @@ AC_DEFUN([gl_STDIO_H],
dnl corresponding gnulib module is not in use, and which is not
dnl guaranteed by C89.
gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
- ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
+ ]], [dprintf fpurge fseeko ftello getdelim getline gets popen renameat
snprintf tmpfile vdprintf vsnprintf])
])
--
1.8.1.4

View File

@ -0,0 +1,516 @@
From 6db544ab2cdff7e5821558d150ac848c28c3fc93 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 28 Dec 2012 06:57:17 +0000
Subject: [PATCH 070/364] Apply program name transformations at build-time
rather than at run-time. Fixes Debian bug #696465.
* acinclude.m4 (grub_TRANSFORM): New macro.
* configure.ac: Create output variables with transformed names for
most programs.
* util/bash-completion.d/grub-completion.bash.in: Use
pre-transformed variables for program names.
* util/grub-install.in: Likewise.
* util/grub-kbdcomp.in: Likewise.
* util/grub-mkconfig.in: Likewise.
* util/grub-mkconfig_lib.in: Likewise.
* util/grub-mknetdir.in: Likewise.
* util/grub-mkrescue.in: Likewise.
* util/grub-mkstandalone.in: Likewise.
* util/grub-reboot.in: Likewise.
* util/grub-set-default.in: Likewise.
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
* tests/util/grub-shell-tester.in: Remove unused assignment.
* tests/util/grub-shell.in: Likewise.
* util/grub.d/00_header.in: Likewise.
---
ChangeLog | 24 ++++++++++++++++++++++++
acinclude.m4 | 6 ++++++
configure.ac | 16 ++++++++++++++++
tests/util/grub-shell-tester.in | 2 --
tests/util/grub-shell.in | 2 --
util/bash-completion.d/grub-completion.bash.in | 24 ++++++++++++------------
util/grub-install.in | 14 ++++++--------
util/grub-kbdcomp.in | 4 +---
util/grub-mkconfig.in | 7 +++----
util/grub-mkconfig_lib.in | 6 ++----
util/grub-mknetdir.in | 4 +---
util/grub-mkrescue.in | 4 +---
util/grub-mkstandalone.in | 4 +---
util/grub-reboot.in | 4 +---
util/grub-set-default.in | 4 +---
util/grub.d/00_header.in | 2 --
util/powerpc/ieee1275/grub-mkrescue.in | 4 +---
17 files changed, 76 insertions(+), 55 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0f04f5c..b8bd215 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
2012-12-28 Colin Watson <cjwatson@ubuntu.com>
+ Apply program name transformations at build-time rather than at
+ run-time. Fixes Debian bug #696465.
+
+ * acinclude.m4 (grub_TRANSFORM): New macro.
+ * configure.ac: Create output variables with transformed names for
+ most programs.
+ * util/bash-completion.d/grub-completion.bash.in: Use
+ pre-transformed variables for program names.
+ * util/grub-install.in: Likewise.
+ * util/grub-kbdcomp.in: Likewise.
+ * util/grub-mkconfig.in: Likewise.
+ * util/grub-mkconfig_lib.in: Likewise.
+ * util/grub-mknetdir.in: Likewise.
+ * util/grub-mkrescue.in: Likewise.
+ * util/grub-mkstandalone.in: Likewise.
+ * util/grub-reboot.in: Likewise.
+ * util/grub-set-default.in: Likewise.
+ * util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
+ * tests/util/grub-shell-tester.in: Remove unused assignment.
+ * tests/util/grub-shell.in: Likewise.
+ * util/grub.d/00_header.in: Likewise.
+
+2012-12-28 Colin Watson <cjwatson@ubuntu.com>
+
Backport gnulib fixes for C11. Fixes Savannah bug #37738.
* grub-core/gnulib/stdio.in.h (gets): Warn on use only if
diff --git a/acinclude.m4 b/acinclude.m4
index 0eb2e2a..49a1a75 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -452,3 +452,9 @@ else
AC_MSG_RESULT([no])
[fi]
])
+
+dnl Create an output variable with the transformed name of a GRUB utility
+dnl program.
+AC_DEFUN([grub_TRANSFORM],[dnl
+AC_SUBST(AS_TR_SH([$1]), [`AS_ECHO([$1]) | sed "$program_transform_name"`])dnl
+])
diff --git a/configure.ac b/configure.ac
index ea3830a..a41f117 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,22 @@ AC_CONFIG_HEADER([config-util.h])
# Program name transformations
AC_ARG_PROGRAM
+grub_TRANSFORM([grub-bios-setup])
+grub_TRANSFORM([grub-editenv])
+grub_TRANSFORM([grub-install])
+grub_TRANSFORM([grub-mkconfig])
+grub_TRANSFORM([grub-mkfont])
+grub_TRANSFORM([grub-mkimage])
+grub_TRANSFORM([grub-mklayout])
+grub_TRANSFORM([grub-mkpasswd-pbkdf2])
+grub_TRANSFORM([grub-mkrelpath])
+grub_TRANSFORM([grub-mkrescue])
+grub_TRANSFORM([grub-probe])
+grub_TRANSFORM([grub-reboot])
+grub_TRANSFORM([grub-script-check])
+grub_TRANSFORM([grub-set-default])
+grub_TRANSFORM([grub-setup])
+grub_TRANSFORM([grub-sparc64-setup])
# Optimization flag. Allow user to override.
if test "x$TARGET_CFLAGS" = x; then
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in
index 80c8830..5adce0a 100644
--- a/tests/util/grub-shell-tester.in
+++ b/tests/util/grub-shell-tester.in
@@ -18,8 +18,6 @@ set -e
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index f4fa23a..04e64da 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -18,8 +18,6 @@ set -e
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 64d49fe..5f4b249 100644
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in
@@ -165,12 +165,12 @@ _grub_set_entry () {
fi
}
-__grub_set_default_program=$( echo grub-set-default | sed "@program_transform_name@" )
+__grub_set_default_program="@grub_set_default@"
have ${__grub_set_default_program} && \
complete -F _grub_set_entry -o filenames ${__grub_set_default_program}
unset __grub_set_default_program
-__grub_reboot_program=$( echo grub-reboot | sed "@program_transform_name@" )
+__grub_reboot_program="@grub_reboot@"
have ${__grub_reboot_program} && \
complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
unset __grub_reboot_program
@@ -197,7 +197,7 @@ _grub_editenv () {
create list set unset"
}
-__grub_editenv_program=$( echo grub-editenv | sed "@program_transform_name@" )
+__grub_editenv_program="@grub_editenv@"
have ${__grub_editenv_program} && \
complete -F _grub_editenv -o filenames ${__grub_editenv_program}
unset __grub_editenv_program
@@ -218,7 +218,7 @@ _grub_mkconfig () {
_filedir
fi
}
-__grub_mkconfig_program=$( echo grub-mkconfig | sed "@program_transform_name@" )
+__grub_mkconfig_program="@grub_mkconfig@"
have ${__grub_mkconfig_program} && \
complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
unset __grub_mkconfig_program
@@ -252,7 +252,7 @@ _grub_setup () {
_filedir
fi
}
-__grub_setup_program=$( echo grub-setup | sed "@program_transform_name@" )
+__grub_setup_program="@grub_setup@"
have ${__grub_setup_program} && \
complete -F _grub_setup -o filenames ${__grub_setup_program}
unset __grub_setup_program
@@ -298,7 +298,7 @@ _grub_install () {
_filedir
fi
}
-__grub_install_program=$( echo grub-install | sed "@program_transform_name@" )
+__grub_install_program="@grub_install@"
have ${__grub_install_program} && \
complete -F _grub_install -o filenames ${__grub_install_program}
unset __grub_install_program
@@ -320,7 +320,7 @@ _grub_mkfont () {
_filedir
fi
}
-__grub_mkfont_program=$( echo grub-mkfont | sed "@program_transform_name@" )
+__grub_mkfont_program="@grub_mkfont@"
have ${__grub_mkfont_program} && \
complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
unset __grub_mkfont_program
@@ -351,7 +351,7 @@ _grub_mkrescue () {
_filedir
fi
}
-__grub_mkrescue_program=$( echo grub-mkrescue | sed "@program_transform_name@" )
+__grub_mkrescue_program="@grub_mkrescue@"
have ${__grub_mkrescue_program} && \
complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
unset __grub_mkrescue_program
@@ -393,7 +393,7 @@ _grub_mkimage () {
_filedir
fi
}
-__grub_mkimage_program=$( echo grub-mkimage | sed "@program_transform_name@" )
+__grub_mkimage_program="@grub_mkimage@"
have ${__grub_mkimage_program} && \
complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
unset __grub_mkimage_program
@@ -415,7 +415,7 @@ _grub_mkpasswd_pbkdf2 () {
_filedir
fi
}
-__grub_mkpasswd_pbkdf2_program=$( echo grub-mkpasswd-pbkdf2 | sed "@program_transform_name@" )
+__grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
have ${__grub_mkpasswd_pbkdf2_program} && \
complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
unset __grub_mkpasswd_pbkdf2_program
@@ -453,7 +453,7 @@ _grub_probe () {
_filedir
fi
}
-__grub_probe_program=$( echo grub-probe | sed "@program_transform_name@" )
+__grub_probe_program="@grub_probe@"
have ${__grub_probe_program} && \
complete -F _grub_probe -o filenames ${__grub_probe_program}
unset __grub_probe_program
@@ -475,7 +475,7 @@ _grub_script_check () {
_filedir
fi
}
-__grub_script_check_program=$( echo grub-script-check | sed "@program_transform_name@" )
+__grub_script_check_program="@grub_script_check@"
have ${__grub_script_check_program} && \
complete -F _grub_script_check -o filenames ${__grub_script_check_program}
diff --git a/util/grub-install.in b/util/grub-install.in
index 9dc4e0b..218bbd9 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
@@ -44,10 +42,10 @@ localedir="@datadir@/locale"
self="`basename $0`"
-grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
-grub_probe="${sbindir}/`echo grub-probe | sed ${transform}`"
-grub_editenv="${bindir}/`echo grub-editenv | sed ${transform}`"
-grub_mkrelpath="${bindir}/`echo grub-mkrelpath | sed ${transform}`"
+grub_mkimage="${bindir}/@grub_mkimage@"
+grub_probe="${sbindir}/@grub_probe@"
+grub_editenv="${bindir}/@grub_editenv@"
+grub_mkrelpath="${bindir}/@grub_mkrelpath@"
rootdir=
bootdir=
grubdir="`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`"
@@ -347,11 +345,11 @@ else
fi
if test "x$grub_setup" = x && [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ]; then
- grub_setup="${sbindir}/`echo grub-bios-setup | sed ${transform}`"
+ grub_setup="${sbindir}/@grub_bios_setup@"
fi
if test "x$grub_setup" = x && [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ]; then
- grub_setup="${sbindir}/`echo grub-sparc64-setup | sed ${transform}`"
+ grub_setup="${sbindir}/@grub_sparc64_setup@"
fi
if test "x$install_device" = x && ([ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] \
diff --git a/util/grub-kbdcomp.in b/util/grub-kbdcomp.in
index 29f0456..715c483 100644
--- a/util/grub-kbdcomp.in
+++ b/util/grub-kbdcomp.in
@@ -1,7 +1,5 @@
#!/bin/sh
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
@@ -11,7 +9,7 @@ if [ "x$pkgdatadir" = x ]; then
pkgdatadir="${datadir}/@PACKAGE@"
fi
-grub_mklayout="${bindir}/`echo grub-mklayout | sed ${transform}`"
+grub_mklayout="${bindir}/@grub_mklayout@"
ckbcomp_options=""
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 516be86..4263367 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -17,7 +17,6 @@ set -e
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
-transform="@program_transform_name@"
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
@@ -39,9 +38,9 @@ grub_mkconfig_dir="${sysconfdir}"/grub.d
self=`basename $0`
-grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`"
-grub_editenv="${bindir}/`echo grub-editenv | sed "${transform}"`"
-grub_script_check="${bindir}/`echo grub-script-check | sed "${transform}"`"
+grub_probe="${sbindir}/@grub_probe@"
+grub_editenv="${bindir}/@grub_editenv@"
+grub_script_check="${bindir}/@grub_script_check@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 3574839..e560dd7 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
@@ -25,10 +23,10 @@ sbindir="@sbindir@"
pkgdatadir="${datadir}/@PACKAGE@"
if test "x$grub_probe" = x; then
- grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`"
+ grub_probe="${sbindir}/@grub_probe@"
fi
if test "x$grub_mkrelpath" = x; then
- grub_mkrelpath="${bindir}/`echo grub-mkrelpath | sed "${transform}"`"
+ grub_mkrelpath="${bindir}/@grub_mkrelpath@"
fi
if which gettext >/dev/null 2>/dev/null; then
diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in
index d1ad763..e235af3 100644
--- a/util/grub-mknetdir.in
+++ b/util/grub-mknetdir.in
@@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
@@ -36,7 +34,7 @@ fi
self=`basename $0`
-grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
+grub_mkimage="${bindir}/@grub_mkimage@"
rootdir=/srv/tftp
modules=
diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in
index f71099e..d279a9d 100644
--- a/util/grub-mkrescue.in
+++ b/util/grub-mkrescue.in
@@ -19,8 +19,6 @@ set -e
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
@@ -49,7 +47,7 @@ efi64_dir="${libdir}/@PACKAGE@/x86_64-efi"
ia64_dir="${libdir}/@PACKAGE@/ia64-efi"
rom_directory=
override_dir=
-grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
+grub_mkimage="${bindir}/@grub_mkimage@"
xorriso=xorriso
diff --git a/util/grub-mkstandalone.in b/util/grub-mkstandalone.in
index 87a3b42..78b83e0 100644
--- a/util/grub-mkstandalone.in
+++ b/util/grub-mkstandalone.in
@@ -19,8 +19,6 @@ set -e
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
@@ -40,7 +38,7 @@ self=`basename $0`
source_directory=
compression=auto
format=
-grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
+grub_mkimage="${bindir}/@grub_mkimage@"
source=
export TEXTDOMAIN=@PACKAGE@
diff --git a/util/grub-reboot.in b/util/grub-reboot.in
index 93dbe6c..7516a03 100644
--- a/util/grub-reboot.in
+++ b/util/grub-reboot.in
@@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
@@ -32,7 +30,7 @@ fi
self=`basename $0`
-grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
+grub_editenv=${bindir}/@grub_editenv@
rootdir=
bootdir=
grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
diff --git a/util/grub-set-default.in b/util/grub-set-default.in
index 3d890be..443e56f 100644
--- a/util/grub-set-default.in
+++ b/util/grub-set-default.in
@@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
@@ -32,7 +30,7 @@ fi
self=`basename $0`
-grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
+grub_editenv=${bindir}/@grub_editenv@
rootdir=
bootdir=
grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 765bfdc..3da5d12 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -17,8 +17,6 @@ set -e
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
diff --git a/util/powerpc/ieee1275/grub-mkrescue.in b/util/powerpc/ieee1275/grub-mkrescue.in
index b3b88f0..2615cab 100644
--- a/util/powerpc/ieee1275/grub-mkrescue.in
+++ b/util/powerpc/ieee1275/grub-mkrescue.in
@@ -18,8 +18,6 @@ set -e
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
-transform="@program_transform_name@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
@@ -36,7 +34,7 @@ fi
self=`basename $0`
-grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
+grub_mkimage="${bindir}/@grub_mkimage@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
--
1.8.1.4

View File

@ -0,0 +1,25 @@
From 25b73b33cdaafb3f21c5014b090a71f8449653c5 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 28 Dec 2012 07:13:34 +0000
Subject: [PATCH 071/364] neater gnulib backport
---
m4/stdio_h.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 8458bec..d3edb42 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -35,7 +35,7 @@ AC_DEFUN([gl_STDIO_H],
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use, and which is not
- dnl guaranteed by C89.
+ dnl guaranteed by both C89 and C11.
gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
]], [dprintf fpurge fseeko ftello getdelim getline gets popen renameat
snprintf tmpfile vdprintf vsnprintf])
--
1.8.1.4

View File

@ -0,0 +1,42 @@
From 2572b7c6ff8be58b10b3b9d13e35b50a535ee2ac Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Fri, 28 Dec 2012 07:21:17 +0000
Subject: [PATCH 072/364] * util/grub-mkconfig.in: Accept
GRUB_TERMINAL_OUTPUT=vga_text. Fixes Savannah bug #37821.
---
ChangeLog | 5 +++++
util/grub-mkconfig.in | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index b8bd215..3bca6fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-12-28 Colin Watson <cjwatson@ubuntu.com>
+ * util/grub-mkconfig.in: Accept GRUB_TERMINAL_OUTPUT=vga_text.
+ Fixes Savannah bug #37821.
+
+2012-12-28 Colin Watson <cjwatson@ubuntu.com>
+
Apply program name transformations at build-time rather than at
run-time. Fixes Debian bug #696465.
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 4263367..8decc1d 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -158,7 +158,7 @@ fi
for x in ${GRUB_TERMINAL_OUTPUT}; do
case "x${x}" in
xgfxterm) ;;
- xconsole | xserial | xofconsole)
+ xconsole | xserial | xofconsole | xvga_text)
# make sure all our children behave in conformance with ascii..
export LANG=C;;
*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
--
1.8.1.4

View File

@ -0,0 +1,126 @@
From a0e1ddf87544a8371fff110c451576016ca81fb3 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Sun, 30 Dec 2012 09:57:58 +0000
Subject: [PATCH 073/364] * grub-core/bus/usb/ehci.c (grub_ehci_pci_iter):
Remove incorrect __attribute__ ((unused)). * grub-core/video/bochs.c
(find_card): Likewise. * grub-core/video/cirrus.c (find_card): Likewise. *
grub-core/video/radeon_fuloong2e.c (find_card): Likewise. *
grub-core/video/sis315pro.c (find_card): Likewise. * grub-core/video/sm712.c
(find_card): Likewise.
---
ChangeLog | 10 ++++++++++
grub-core/bus/usb/ehci.c | 3 +--
grub-core/video/bochs.c | 2 +-
grub-core/video/cirrus.c | 2 +-
grub-core/video/radeon_fuloong2e.c | 4 ++--
grub-core/video/sis315pro.c | 4 ++--
grub-core/video/sm712.c | 4 ++--
7 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3bca6fd..36f1bff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-12-30 Colin Watson <cjwatson@ubuntu.com>
+
+ * grub-core/bus/usb/ehci.c (grub_ehci_pci_iter): Remove incorrect
+ __attribute__ ((unused)).
+ * grub-core/video/bochs.c (find_card): Likewise.
+ * grub-core/video/cirrus.c (find_card): Likewise.
+ * grub-core/video/radeon_fuloong2e.c (find_card): Likewise.
+ * grub-core/video/sis315pro.c (find_card): Likewise.
+ * grub-core/video/sm712.c (find_card): Likewise.
+
2012-12-28 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig.in: Accept GRUB_TERMINAL_OUTPUT=vga_text.
diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c
index d99a4be..dc5bf71 100644
--- a/grub-core/bus/usb/ehci.c
+++ b/grub-core/bus/usb/ehci.c
@@ -455,8 +455,7 @@ grub_ehci_reset (struct grub_ehci *e)
/* PCI iteration function... */
static int NESTED_FUNC_ATTR
-grub_ehci_pci_iter (grub_pci_device_t dev,
- grub_pci_id_t pciid __attribute__ ((unused)))
+grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
{
grub_uint8_t release;
grub_uint32_t class_code;
diff --git a/grub-core/video/bochs.c b/grub-core/video/bochs.c
index 79cae65..f6db137 100644
--- a/grub-core/video/bochs.c
+++ b/grub-core/video/bochs.c
@@ -210,7 +210,7 @@ grub_video_bochs_setup (unsigned int width, unsigned int height,
int pitch, bytes_per_pixel;
grub_size_t page_size; /* The size of a page in bytes. */
- auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)));
+ auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid);
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid)
{
grub_pci_address_t addr;
diff --git a/grub-core/video/cirrus.c b/grub-core/video/cirrus.c
index 7fad50e..e711119 100644
--- a/grub-core/video/cirrus.c
+++ b/grub-core/video/cirrus.c
@@ -245,7 +245,7 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height,
int found = 0;
int pitch, bytes_per_pixel;
- auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)));
+ auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid);
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid)
{
grub_pci_address_t addr;
diff --git a/grub-core/video/radeon_fuloong2e.c b/grub-core/video/radeon_fuloong2e.c
index 32f66c7..45a68ed 100644
--- a/grub-core/video/radeon_fuloong2e.c
+++ b/grub-core/video/radeon_fuloong2e.c
@@ -69,8 +69,8 @@ grub_video_radeon_fuloong2e_setup (unsigned int width, unsigned int height,
int found = 0;
#ifndef TEST
- auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)));
- int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)))
+ auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid);
+ int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid)
{
grub_pci_address_t addr;
grub_uint32_t class;
diff --git a/grub-core/video/sis315pro.c b/grub-core/video/sis315pro.c
index 5d06daa..d213877 100644
--- a/grub-core/video/sis315pro.c
+++ b/grub-core/video/sis315pro.c
@@ -99,8 +99,8 @@ grub_video_sis315pro_setup (unsigned int width, unsigned int height,
unsigned i;
#ifndef TEST
- auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)));
- int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)))
+ auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid);
+ int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid)
{
grub_pci_address_t addr;
grub_uint32_t class;
diff --git a/grub-core/video/sm712.c b/grub-core/video/sm712.c
index 5f22c40..d780983 100644
--- a/grub-core/video/sm712.c
+++ b/grub-core/video/sm712.c
@@ -370,8 +370,8 @@ grub_video_sm712_setup (unsigned int width, unsigned int height,
grub_err_t err;
int found = 0;
- auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)));
- int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)))
+ auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid);
+ int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid)
{
grub_pci_address_t addr;
grub_uint32_t class;
--
1.8.1.4

View File

@ -0,0 +1,817 @@
From a3564dd3f793d2677584a93284966b6b9f14ebdb Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 31 Dec 2012 17:31:38 +0000
Subject: [PATCH 074/364] Remove several trivially-unnecessary uses of nested
functions.
* grub-core/commands/i386/pc/sendkey.c
(grub_cmd_sendkey: find_key_code, find_ascii_code): Make static
instead of nested.
* grub-core/commands/legacycfg.c (legacy_file: getline): Likewise.
Rename to ...
(legacy_file_getline): ... this.
* grub-core/commands/loadenv.c (grub_cmd_load_env: set_var):
Likewise.
* grub-core/kern/corecmd.c (grub_core_cmd_set: print_env): Likewise.
* grub-core/kern/fs.c (grub_fs_probe: dummy_func): Likewise. Rename
to ...
(probe_dummy_iter): ... this.
* grub-core/kern/i386/coreboot/mmap.c
(grub_linuxbios_table_iterate: check_signature): Likewise.
* grub-core/kern/parser.c (grub_parser_split_cmdline:
check_varstate): Likewise. Mark inline.
* grub-core/lib/arg.c (find_short: fnd_short): Likewise. Pass
an additional parameter.
(find_long: fnd_long): Likewise. Pass two additional parameters.
* grub-core/lib/crc.c (init_crc32c_table: reflect): Likewise.
* grub-core/lib/crc64.c (init_crc64_table: reflect): Likewise.
* grub-core/lib/ieee1275/cmos.c (grub_cmos_find_port: hook):
Likewise. Rename to ...
(grub_cmos_find_port_iter): ... this.
* grub-core/lib/ieee1275/datetime.c (find_rtc: hook): Likewise.
Rename to ...
(find_rtc_iter): ... this.
* grub-core/normal/menu_entry.c (run): Fold nested editor_getsource
function directly into the function body, since it is only called
once.
---
ChangeLog | 36 ++++++++++++++++
grub-core/commands/i386/pc/sendkey.c | 65 ++++++++++++++--------------
grub-core/commands/legacycfg.c | 20 ++++-----
grub-core/commands/loadenv.c | 15 ++++---
grub-core/kern/corecmd.c | 16 +++----
grub-core/kern/fs.c | 20 ++++-----
grub-core/kern/i386/coreboot/mmap.c | 19 +++++----
grub-core/kern/parser.c | 20 ++++-----
grub-core/lib/arg.c | 58 +++++++++++++------------
grub-core/lib/crc.c | 31 +++++++-------
grub-core/lib/crc64.c | 31 +++++++-------
grub-core/lib/ieee1275/cmos.c | 82 ++++++++++++++++++------------------
grub-core/lib/ieee1275/datetime.c | 27 ++++++------
grub-core/normal/menu_entry.c | 50 +++++++++-------------
14 files changed, 264 insertions(+), 226 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 36f1bff..8723bfa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2012-12-31 Colin Watson <cjwatson@ubuntu.com>
+
+ Remove several trivially-unnecessary uses of nested functions.
+
+ * grub-core/commands/i386/pc/sendkey.c
+ (grub_cmd_sendkey: find_key_code, find_ascii_code): Make static
+ instead of nested.
+ * grub-core/commands/legacycfg.c (legacy_file: getline): Likewise.
+ Rename to ...
+ (legacy_file_getline): ... this.
+ * grub-core/commands/loadenv.c (grub_cmd_load_env: set_var):
+ Likewise.
+ * grub-core/kern/corecmd.c (grub_core_cmd_set: print_env): Likewise.
+ * grub-core/kern/fs.c (grub_fs_probe: dummy_func): Likewise. Rename
+ to ...
+ (probe_dummy_iter): ... this.
+ * grub-core/kern/i386/coreboot/mmap.c
+ (grub_linuxbios_table_iterate: check_signature): Likewise.
+ * grub-core/kern/parser.c (grub_parser_split_cmdline:
+ check_varstate): Likewise. Mark inline.
+ * grub-core/lib/arg.c (find_short: fnd_short): Likewise. Pass
+ an additional parameter.
+ (find_long: fnd_long): Likewise. Pass two additional parameters.
+ * grub-core/lib/crc.c (init_crc32c_table: reflect): Likewise.
+ * grub-core/lib/crc64.c (init_crc64_table: reflect): Likewise.
+ * grub-core/lib/ieee1275/cmos.c (grub_cmos_find_port: hook):
+ Likewise. Rename to ...
+ (grub_cmos_find_port_iter): ... this.
+ * grub-core/lib/ieee1275/datetime.c (find_rtc: hook): Likewise.
+ Rename to ...
+ (find_rtc_iter): ... this.
+
+ * grub-core/normal/menu_entry.c (run): Fold nested editor_getsource
+ function directly into the function body, since it is only called
+ once.
+
2012-12-30 Colin Watson <cjwatson@ubuntu.com>
* grub-core/bus/usb/ehci.c (grub_ehci_pci_iter): Remove incorrect
diff --git a/grub-core/commands/i386/pc/sendkey.c b/grub-core/commands/i386/pc/sendkey.c
index 17f648d..d985cb3 100644
--- a/grub-core/commands/i386/pc/sendkey.c
+++ b/grub-core/commands/i386/pc/sendkey.c
@@ -286,47 +286,48 @@ grub_sendkey_preboot (int noret __attribute__ ((unused)))
return GRUB_ERR_NONE;
}
-static grub_err_t
-grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
+/* Helper for grub_cmd_sendkey. */
+static int
+find_key_code (char *key)
{
- struct grub_arg_list *state = ctxt->state;
-
- auto int find_key_code (char *key);
- auto int find_ascii_code (char *key);
+ unsigned i;
- int find_key_code (char *key)
+ for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
{
- unsigned i;
+ if (keysym_table[i].unshifted_name
+ && grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
+ return keysym_table[i].keycode;
+ else if (keysym_table[i].shifted_name
+ && grub_strcmp (key, keysym_table[i].shifted_name) == 0)
+ return keysym_table[i].keycode;
+ }
- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
- {
- if (keysym_table[i].unshifted_name
- && grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
- return keysym_table[i].keycode;
- else if (keysym_table[i].shifted_name
- && grub_strcmp (key, keysym_table[i].shifted_name) == 0)
- return keysym_table[i].keycode;
- }
+ return 0;
+}
- return 0;
- }
+/* Helper for grub_cmd_sendkey. */
+static int
+find_ascii_code (char *key)
+{
+ unsigned i;
- int find_ascii_code (char *key)
+ for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
{
- unsigned i;
+ if (keysym_table[i].unshifted_name
+ && grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
+ return keysym_table[i].unshifted_ascii;
+ else if (keysym_table[i].shifted_name
+ && grub_strcmp (key, keysym_table[i].shifted_name) == 0)
+ return keysym_table[i].shifted_ascii;
+ }
- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
- {
- if (keysym_table[i].unshifted_name
- && grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
- return keysym_table[i].unshifted_ascii;
- else if (keysym_table[i].shifted_name
- && grub_strcmp (key, keysym_table[i].shifted_name) == 0)
- return keysym_table[i].shifted_ascii;
- }
+ return 0;
+}
- return 0;
- }
+static grub_err_t
+grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
+{
+ struct grub_arg_list *state = ctxt->state;
andmask = 0xffffffff;
ormask = 0;
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
index 5293acc..e34eed4 100644
--- a/grub-core/commands/legacycfg.c
+++ b/grub-core/commands/legacycfg.c
@@ -35,6 +35,14 @@
GRUB_MOD_LICENSE ("GPLv3+");
+/* Helper for legacy_file. */
+static grub_err_t
+legacy_file_getline (char **line, int cont __attribute__ ((unused)))
+{
+ *line = 0;
+ return GRUB_ERR_NONE;
+}
+
static grub_err_t
legacy_file (const char *filename)
{
@@ -43,14 +51,6 @@ legacy_file (const char *filename)
grub_menu_t menu;
char *suffix = grub_strdup ("");
- auto grub_err_t getline (char **line, int cont);
- grub_err_t getline (char **line,
- int cont __attribute__ ((unused)))
- {
- *line = 0;
- return GRUB_ERR_NONE;
- }
-
if (!suffix)
return grub_errno;
@@ -134,7 +134,7 @@ legacy_file (const char *filename)
if (parsed && !entryname)
{
- grub_normal_parse_line (parsed, getline);
+ grub_normal_parse_line (parsed, legacy_file_getline);
grub_print_error ();
grub_free (parsed);
parsed = NULL;
@@ -180,7 +180,7 @@ legacy_file (const char *filename)
grub_free (args);
}
- grub_normal_parse_line (suffix, getline);
+ grub_normal_parse_line (suffix, legacy_file_getline);
grub_print_error ();
grub_free (suffix);
grub_free (entrysrc);
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
index 18ebb7e..9a35550 100644
--- a/grub-core/commands/loadenv.c
+++ b/grub-core/commands/loadenv.c
@@ -114,6 +114,14 @@ read_envblk_file (grub_file_t file)
return envblk;
}
+/* Helper for grub_cmd_load_env. */
+static int
+set_var (const char *name, const char *value)
+{
+ grub_env_set (name, value);
+ return 0;
+}
+
static grub_err_t
grub_cmd_load_env (grub_extcmd_context_t ctxt,
int argc __attribute__ ((unused)),
@@ -123,13 +131,6 @@ grub_cmd_load_env (grub_extcmd_context_t ctxt,
grub_file_t file;
grub_envblk_t envblk;
- auto int set_var (const char *name, const char *value);
- int set_var (const char *name, const char *value)
- {
- grub_env_set (name, value);
- return 0;
- }
-
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
if (! file)
return grub_errno;
diff --git a/grub-core/kern/corecmd.c b/grub-core/kern/corecmd.c
index eec575c..43240e9 100644
--- a/grub-core/kern/corecmd.c
+++ b/grub-core/kern/corecmd.c
@@ -28,6 +28,14 @@
#include <grub/command.h>
#include <grub/i18n.h>
+/* Helper for grub_core_cmd_set. */
+static int
+print_env (struct grub_env_var *env)
+{
+ grub_printf ("%s=%s\n", env->name, env->value);
+ return 0;
+}
+
/* set ENVVAR=VALUE */
static grub_err_t
grub_core_cmd_set (struct grub_command *cmd __attribute__ ((unused)),
@@ -36,14 +44,6 @@ grub_core_cmd_set (struct grub_command *cmd __attribute__ ((unused)),
char *var;
char *val;
- auto int print_env (struct grub_env_var *env);
-
- int print_env (struct grub_env_var *env)
- {
- grub_printf ("%s=%s\n", env->name, env->value);
- return 0;
- }
-
if (argc < 1)
{
grub_env_iterate (print_env);
diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
index 51d89d1..7e150f2 100644
--- a/grub-core/kern/fs.c
+++ b/grub-core/kern/fs.c
@@ -32,18 +32,18 @@ grub_fs_t grub_fs_list = 0;
grub_fs_autoload_hook_t grub_fs_autoload_hook = 0;
+/* Helper for grub_fs_probe. */
+static int
+probe_dummy_iter (const char *filename __attribute__ ((unused)),
+ const struct grub_dirhook_info *info __attribute__ ((unused)))
+ {
+ return 1;
+ }
+
grub_fs_t
grub_fs_probe (grub_device_t device)
{
grub_fs_t p;
- auto int dummy_func (const char *filename,
- const struct grub_dirhook_info *info);
-
- int dummy_func (const char *filename __attribute__ ((unused)),
- const struct grub_dirhook_info *info __attribute__ ((unused)))
- {
- return 1;
- }
if (device->disk)
{
@@ -69,7 +69,7 @@ grub_fs_probe (grub_device_t device)
}
else
#endif
- (p->dir) (device, "/", dummy_func);
+ (p->dir) (device, "/", probe_dummy_iter);
if (grub_errno == GRUB_ERR_NONE)
return p;
@@ -93,7 +93,7 @@ grub_fs_probe (grub_device_t device)
{
p = grub_fs_list;
- (p->dir) (device, "/", dummy_func);
+ (p->dir) (device, "/", probe_dummy_iter);
if (grub_errno == GRUB_ERR_NONE)
{
count--;
diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/i386/coreboot/mmap.c
index 8b0b202..8e15683 100644
--- a/grub-core/kern/i386/coreboot/mmap.c
+++ b/grub-core/kern/i386/coreboot/mmap.c
@@ -22,21 +22,22 @@
#include <grub/err.h>
#include <grub/misc.h>
+/* Helper for grub_linuxbios_table_iterate. */
+static int
+check_signature (grub_linuxbios_table_header_t tbl_header)
+{
+ if (! grub_memcmp (tbl_header->signature, "LBIO", 4))
+ return 1;
+
+ return 0;
+}
+
static grub_err_t
grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t))
{
grub_linuxbios_table_header_t table_header;
grub_linuxbios_table_item_t table_item;
- auto int check_signature (grub_linuxbios_table_header_t);
- int check_signature (grub_linuxbios_table_header_t tbl_header)
- {
- if (! grub_memcmp (tbl_header->signature, "LBIO", 4))
- return 1;
-
- return 0;
- }
-
/* Assuming table_header is aligned to its size (8 bytes). */
for (table_header = (grub_linuxbios_table_header_t) 0x500;
diff --git a/grub-core/kern/parser.c b/grub-core/kern/parser.c
index 9213caa..d1be53e 100644
--- a/grub-core/kern/parser.c
+++ b/grub-core/kern/parser.c
@@ -96,6 +96,16 @@ grub_parser_cmdline_state (grub_parser_state_t state, char c, char *result)
}
+/* Helper for grub_parser_split_cmdline. */
+static inline int
+check_varstate (grub_parser_state_t s)
+{
+ return (s == GRUB_PARSER_STATE_VARNAME
+ || s == GRUB_PARSER_STATE_VARNAME2
+ || s == GRUB_PARSER_STATE_QVARNAME
+ || s == GRUB_PARSER_STATE_QVARNAME2);
+}
+
grub_err_t
grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
int *argc, char ***argv)
@@ -111,16 +121,6 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
char *args;
int i;
- auto int check_varstate (grub_parser_state_t s);
-
- int check_varstate (grub_parser_state_t s)
- {
- return (s == GRUB_PARSER_STATE_VARNAME
- || s == GRUB_PARSER_STATE_VARNAME2
- || s == GRUB_PARSER_STATE_QVARNAME
- || s == GRUB_PARSER_STATE_QVARNAME2);
- }
-
auto void add_var (grub_parser_state_t newstate);
void add_var (grub_parser_state_t newstate)
diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c
index b341885..a2d9416 100644
--- a/grub-core/lib/arg.c
+++ b/grub-core/lib/arg.c
@@ -34,25 +34,26 @@ static const struct grub_arg_option help_options[] =
{0, 0, 0, 0, 0, 0}
};
+/* Helper for find_short. */
static struct grub_arg_option *
-find_short (const struct grub_arg_option *options, char c)
+fnd_short (const struct grub_arg_option *opt, char c)
{
- struct grub_arg_option *found = 0;
- auto struct grub_arg_option *fnd_short (const struct grub_arg_option *opt);
-
- struct grub_arg_option *fnd_short (const struct grub_arg_option *opt)
+ while (opt->doc)
{
- while (opt->doc)
- {
- if (opt->shortarg == c)
- return (struct grub_arg_option *) opt;
- opt++;
- }
- return 0;
+ if (opt->shortarg == c)
+ return (struct grub_arg_option *) opt;
+ opt++;
}
+ return 0;
+}
+
+static struct grub_arg_option *
+find_short (const struct grub_arg_option *options, char c)
+{
+ struct grub_arg_option *found = 0;
if (options)
- found = fnd_short (options);
+ found = fnd_short (options, c);
if (! found)
{
@@ -74,29 +75,30 @@ find_short (const struct grub_arg_option *options, char c)
return found;
}
+/* Helper for find_long. */
static struct grub_arg_option *
-find_long (const struct grub_arg_option *options, const char *s, int len)
+fnd_long (const struct grub_arg_option *opt, const char *s, int len)
{
- struct grub_arg_option *found = 0;
- auto struct grub_arg_option *fnd_long (const struct grub_arg_option *opt);
-
- struct grub_arg_option *fnd_long (const struct grub_arg_option *opt)
+ while (opt->doc)
{
- while (opt->doc)
- {
- if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) &&
- opt->longarg[len] == '\0')
- return (struct grub_arg_option *) opt;
- opt++;
- }
- return 0;
+ if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) &&
+ opt->longarg[len] == '\0')
+ return (struct grub_arg_option *) opt;
+ opt++;
}
+ return 0;
+}
+
+static struct grub_arg_option *
+find_long (const struct grub_arg_option *options, const char *s, int len)
+{
+ struct grub_arg_option *found = 0;
if (options)
- found = fnd_long (options);
+ found = fnd_long (options, s, len);
if (! found)
- found = fnd_long (help_options);
+ found = fnd_long (help_options, s, len);
return found;
}
diff --git a/grub-core/lib/crc.c b/grub-core/lib/crc.c
index ffc3ef3..bf97cc6 100644
--- a/grub-core/lib/crc.c
+++ b/grub-core/lib/crc.c
@@ -22,25 +22,26 @@
static grub_uint32_t crc32c_table [256];
-static void
-init_crc32c_table (void)
+/* Helper for init_crc32c_table. */
+static grub_uint32_t
+reflect (grub_uint32_t ref, int len)
{
- auto grub_uint32_t reflect (grub_uint32_t ref, int len);
- grub_uint32_t reflect (grub_uint32_t ref, int len)
- {
- grub_uint32_t result = 0;
- int i;
-
- for (i = 1; i <= len; i++)
- {
- if (ref & 1)
- result |= 1 << (len - i);
- ref >>= 1;
- }
+ grub_uint32_t result = 0;
+ int i;
- return result;
+ for (i = 1; i <= len; i++)
+ {
+ if (ref & 1)
+ result |= 1 << (len - i);
+ ref >>= 1;
}
+ return result;
+}
+
+static void
+init_crc32c_table (void)
+{
grub_uint32_t polynomial = 0x1edc6f41;
int i, j;
diff --git a/grub-core/lib/crc64.c b/grub-core/lib/crc64.c
index 4b1c92c..4960f3f 100644
--- a/grub-core/lib/crc64.c
+++ b/grub-core/lib/crc64.c
@@ -25,25 +25,26 @@ GRUB_MOD_LICENSE ("GPLv3+");
static grub_uint64_t crc64_table [256];
-static void
-init_crc64_table (void)
+/* Helper for init_crc64_table. */
+static grub_uint64_t
+reflect (grub_uint64_t ref, int len)
{
- auto grub_uint64_t reflect (grub_uint64_t ref, int len);
- grub_uint64_t reflect (grub_uint64_t ref, int len)
- {
- grub_uint64_t result = 0;
- int i;
+ grub_uint64_t result = 0;
+ int i;
- for (i = 1; i <= len; i++)
- {
- if (ref & 1)
- result |= 1ULL << (len - i);
- ref >>= 1;
- }
-
- return result;
+ for (i = 1; i <= len; i++)
+ {
+ if (ref & 1)
+ result |= 1ULL << (len - i);
+ ref >>= 1;
}
+ return result;
+}
+
+static void
+init_crc64_table (void)
+{
grub_uint64_t polynomial = 0x42f0e1eba9ea3693ULL;
int i, j;
diff --git a/grub-core/lib/ieee1275/cmos.c b/grub-core/lib/ieee1275/cmos.c
index fa57db9..328d70a 100644
--- a/grub-core/lib/ieee1275/cmos.c
+++ b/grub-core/lib/ieee1275/cmos.c
@@ -23,51 +23,53 @@
#include <grub/misc.h>
volatile grub_uint8_t *grub_cmos_port = 0;
-grub_err_t
-grub_cmos_find_port (void)
+
+/* Helper for grub_cmos_find_port. */
+static int
+grub_cmos_find_port_iter (struct grub_ieee1275_devalias *alias)
{
- auto int hook (struct grub_ieee1275_devalias *alias);
- int hook (struct grub_ieee1275_devalias *alias)
- {
- grub_ieee1275_phandle_t dev;
- grub_uint32_t addr[2];
- grub_ssize_t actual;
- /* Enough to check if it's "m5819" */
- char compat[100];
- if (grub_ieee1275_finddevice (alias->path, &dev))
- return 0;
- if (grub_ieee1275_get_property (dev, "compatible", compat, sizeof (compat),
- 0))
- return 0;
- if (grub_strcmp (compat, "m5819") != 0)
- return 0;
- if (grub_ieee1275_get_integer_property (dev, "address",
- addr, sizeof (addr), &actual))
- return 0;
- if (actual == 4)
- {
- grub_cmos_port = (volatile grub_uint8_t *) (grub_addr_t) addr[0];
- return 1;
- }
+ grub_ieee1275_phandle_t dev;
+ grub_uint32_t addr[2];
+ grub_ssize_t actual;
+ /* Enough to check if it's "m5819" */
+ char compat[100];
+ if (grub_ieee1275_finddevice (alias->path, &dev))
+ return 0;
+ if (grub_ieee1275_get_property (dev, "compatible", compat, sizeof (compat),
+ 0))
+ return 0;
+ if (grub_strcmp (compat, "m5819") != 0)
+ return 0;
+ if (grub_ieee1275_get_integer_property (dev, "address",
+ addr, sizeof (addr), &actual))
+ return 0;
+ if (actual == 4)
+ {
+ grub_cmos_port = (volatile grub_uint8_t *) (grub_addr_t) addr[0];
+ return 1;
+ }
#if GRUB_CPU_SIZEOF_VOID_P == 8
- if (actual == 8)
- {
- grub_cmos_port = (volatile grub_uint8_t *)
- ((((grub_addr_t) addr[0]) << 32) | addr[1]);
- return 1;
- }
+ if (actual == 8)
+ {
+ grub_cmos_port = (volatile grub_uint8_t *)
+ ((((grub_addr_t) addr[0]) << 32) | addr[1]);
+ return 1;
+ }
#else
- if (actual == 8 && addr[0] == 0)
- {
- grub_cmos_port = (volatile grub_uint8_t *) addr[1];
- return 1;
- }
+ if (actual == 8 && addr[0] == 0)
+ {
+ grub_cmos_port = (volatile grub_uint8_t *) addr[1];
+ return 1;
+ }
#endif
- return 0;
- }
-
- grub_ieee1275_devices_iterate (hook);
+ return 0;
+}
+
+grub_err_t
+grub_cmos_find_port (void)
+{
+ grub_ieee1275_devices_iterate (grub_cmos_find_port_iter);
if (!grub_cmos_port)
return grub_error (GRUB_ERR_IO, "no cmos found");
diff --git a/grub-core/lib/ieee1275/datetime.c b/grub-core/lib/ieee1275/datetime.c
index 8792429..74578f1 100644
--- a/grub-core/lib/ieee1275/datetime.c
+++ b/grub-core/lib/ieee1275/datetime.c
@@ -30,22 +30,23 @@ GRUB_MOD_LICENSE ("GPLv3+");
static char *rtc = 0;
static int no_ieee1275_rtc = 0;
+/* Helper for find_rtc. */
+static int
+find_rtc_iter (struct grub_ieee1275_devalias *alias)
+{
+ if (grub_strcmp (alias->type, "rtc") == 0)
+ {
+ grub_dprintf ("datetime", "Found RTC %s\n", alias->path);
+ rtc = grub_strdup (alias->path);
+ return 1;
+ }
+ return 0;
+}
+
static void
find_rtc (void)
{
- auto int hook (struct grub_ieee1275_devalias *alias);
- int hook (struct grub_ieee1275_devalias *alias)
- {
- if (grub_strcmp (alias->type, "rtc") == 0)
- {
- grub_dprintf ("datetime", "Found RTC %s\n", alias->path);
- rtc = grub_strdup (alias->path);
- return 1;
- }
- return 0;
- }
-
- grub_ieee1275_devices_iterate (hook);
+ grub_ieee1275_devices_iterate (find_rtc_iter);
if (!rtc)
no_ieee1275_rtc = 1;
}
diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
index 8e2b4da..33b644b 100644
--- a/grub-core/normal/menu_entry.c
+++ b/grub-core/normal/menu_entry.c
@@ -1205,32 +1205,6 @@ run (struct screen *screen)
grub_menu_t menu = NULL;
char *dummy[1] = { NULL };
- auto char * editor_getsource (void);
- char * editor_getsource (void)
- {
- int i;
- grub_size_t size = 0, tot_size = 0;
- char *source;
-
- for (i = 0; i < screen->num_lines; i++)
- tot_size += grub_get_num_of_utf8_bytes (screen->lines[i].buf,
- screen->lines[i].len) + 1;
-
- source = grub_malloc (tot_size + 1);
- if (! source)
- return NULL;
-
- for (i = 0; i < screen->num_lines; i++)
- {
- size += grub_ucs4_to_utf8 (screen->lines[i].buf, screen->lines[i].len,
- (grub_uint8_t *) source + size,
- tot_size - size);
- source[size++] = '\n';
- }
- source[size] = '\0';
- return source;
- }
-
grub_cls ();
grub_printf (" ");
grub_printf_ (N_("Booting a command list"));
@@ -1248,9 +1222,27 @@ run (struct screen *screen)
}
/* Execute the script, line for line. */
- script = editor_getsource ();
- if (! script)
- return 0;
+ {
+ int i;
+ grub_size_t size = 0, tot_size = 0;
+
+ for (i = 0; i < screen->num_lines; i++)
+ tot_size += grub_get_num_of_utf8_bytes (screen->lines[i].buf,
+ screen->lines[i].len) + 1;
+
+ script = grub_malloc (tot_size + 1);
+ if (! script)
+ return 0;
+
+ for (i = 0; i < screen->num_lines; i++)
+ {
+ size += grub_ucs4_to_utf8 (screen->lines[i].buf, screen->lines[i].len,
+ (grub_uint8_t *) script + size,
+ tot_size - size);
+ script[size++] = '\n';
+ }
+ script[size] = '\0';
+ }
grub_script_execute_sourcecode (script, 0, dummy);
grub_free (script);
--
1.8.1.4

View File

@ -0,0 +1,73 @@
From bf9d0c7cfcc093b873d6d4c594cd407dc6bca69c Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 2 Jan 2013 09:29:48 +0000
Subject: [PATCH 075/364] * docs/grub.texi (configfile): Explain environment
variable handling. (source): New section. Reported by: Arbiel Perlacremaz.
Fixes Savannah bug #35564.
---
ChangeLog | 7 +++++++
docs/grub.texi | 18 +++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 8723bfa..68920bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-02 Colin Watson <cjwatson@ubuntu.com>
+
+ * docs/grub.texi (configfile): Explain environment variable
+ handling.
+ (source): New section.
+ Reported by: Arbiel Perlacremaz. Fixes Savannah bug #35564.
+
2012-12-31 Colin Watson <cjwatson@ubuntu.com>
Remove several trivially-unnecessary uses of nested functions.
diff --git a/docs/grub.texi b/docs/grub.texi
index 39d9614..e9af377 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -3303,6 +3303,7 @@ you forget a command, you can run the command @command{help}
* search:: Search devices by file, label, or UUID
* sendkey:: Emulate keystrokes
* set:: Set an environment variable
+* source:: Read a configuration file in same context
* true:: Do nothing, successfully
* unset:: Unset an environment variable
* uppermem:: Set the upper memory size
@@ -3429,7 +3430,9 @@ If they are completely identical, nothing will be printed.
@deffn Command configfile file
Load @var{file} as a configuration file. If @var{file} defines any menu
-entries, then show a menu containing them immediately.
+entries, then show a menu containing them immediately. Any environment
+variable changes made by the commands in @var{file} will not be preserved
+after @command{configfile} returns.
@end deffn
@@ -4069,6 +4072,19 @@ arguments, print all environment variables with their values.
@end deffn
+@node source
+@subsection source
+
+@deffn Command source file
+Read @var{file} as a configuration file, as if its contents had been
+incorporated directly into the sourcing file. Unlike @command{configfile}
+(@pxref{configfile}), this executes the contents of @var{file} without
+changing context: any environment variable changes made by the commands in
+@var{file} will be preserved after @command{source} returns, and the menu
+will not be shown immediately.
+@end deffn
+
+
@node true
@subsection true
--
1.8.1.4

View File

@ -0,0 +1,70 @@
From bd0f06eea6be3f3e2efb07069f853741867a320f Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 2 Jan 2013 12:48:31 +0000
Subject: [PATCH 076/364] Fix failing printf test.
* grub-core/kern/misc.c (grub_vsnprintf_real): Parse '-', '.', and
'$' in the correct order when collecting type information.
---
ChangeLog | 7 +++++++
grub-core/kern/misc.c | 17 ++++++++++-------
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 68920bf..bb263f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2013-01-02 Colin Watson <cjwatson@ubuntu.com>
+ Fix failing printf test.
+
+ * grub-core/kern/misc.c (grub_vsnprintf_real): Parse '-', '.', and
+ '$' in the correct order when collecting type information.
+
+2013-01-02 Colin Watson <cjwatson@ubuntu.com>
+
* docs/grub.texi (configfile): Explain environment variable
handling.
(source): New section.
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 95d4624..c3203a0 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -741,23 +741,26 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
if (*fmt && *fmt =='-')
fmt++;
- while (*fmt && grub_isdigit (*fmt))
- fmt++;
-
- if (*fmt && *fmt =='.')
- fmt++;
+ p = fmt;
while (*fmt && grub_isdigit (*fmt))
fmt++;
- p = fmt;
-
if (*fmt && *fmt == '$')
{
curn = grub_strtoull (p, 0, 10) - 1;
fmt++;
}
+ if (*fmt && *fmt =='-')
+ fmt++;
+
+ while (*fmt && grub_isdigit (*fmt))
+ fmt++;
+
+ if (*fmt && *fmt =='.')
+ fmt++;
+
while (*fmt && grub_isdigit (*fmt))
fmt++;
--
1.8.1.4

View File

@ -0,0 +1,55 @@
From 1fb2a38cdc4278a0c65e9b0cbca6fdaae3343564 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 2 Jan 2013 16:42:48 +0000
Subject: [PATCH 077/364] * grub-core/tests/lib/test.c (grub_test_run): Return
non-zero on test failures, so that a failing unit test correctly causes 'make
check' to fail.
---
ChangeLog | 6 ++++++
grub-core/tests/lib/test.c | 14 +++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bb263f2..0585437 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-01-02 Colin Watson <cjwatson@ubuntu.com>
+ * grub-core/tests/lib/test.c (grub_test_run): Return non-zero on
+ test failures, so that a failing unit test correctly causes 'make
+ check' to fail.
+
+2013-01-02 Colin Watson <cjwatson@ubuntu.com>
+
Fix failing printf test.
* grub-core/kern/misc.c (grub_vsnprintf_real): Parse '-', '.', and
diff --git a/grub-core/tests/lib/test.c b/grub-core/tests/lib/test.c
index aac77e9..1d2cb8c 100644
--- a/grub-core/tests/lib/test.c
+++ b/grub-core/tests/lib/test.c
@@ -225,10 +225,14 @@ grub_test_run (grub_test_t test)
failure->line, (failure->message ? : "<no message>"));
if (!failure_list)
- grub_printf ("%s: PASS\n", test->name);
+ {
+ grub_printf ("%s: PASS\n", test->name);
+ return GRUB_ERR_NONE;
+ }
else
- grub_printf ("%s: FAIL\n", test->name);
-
- free_failures ();
- return GRUB_ERR_NONE;
+ {
+ grub_printf ("%s: FAIL\n", test->name);
+ free_failures ();
+ return GRUB_ERR_TEST_FAILURE;
+ }
}
--
1.8.1.4

View File

@ -0,0 +1,150 @@
From 9a3cdbccd18ddda45d3e69de75d6c4865da72aae Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Thu, 3 Jan 2013 10:32:57 +0000
Subject: [PATCH 078/364] * docs/grub.texi (Invoking grub-mount): New section.
Reported by: Filipus Klutiero. Fixes Debian bug #666427.
---
ChangeLog | 5 ++++
docs/grub.texi | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 95 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0585437..c91fe35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-03 Colin Watson <cjwatson@ubuntu.com>
+
+ * docs/grub.texi (Invoking grub-mount): New section.
+ Reported by: Filipus Klutiero. Fixes Debian bug #666427.
+
2013-01-02 Colin Watson <cjwatson@ubuntu.com>
* grub-core/tests/lib/test.c (grub_test_run): Return non-zero on
diff --git a/docs/grub.texi b/docs/grub.texi
index e9af377..60b18b5 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -20,7 +20,7 @@
This manual is for GNU GRUB (version @value{VERSION},
@value{UPDATED}).
-Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010,2011,2012 Free Software Foundation, Inc.
+Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010,2011,2012,2013 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -37,6 +37,7 @@ Invariant Sections.
* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
* grub-mkrescue: (grub)Invoking grub-mkrescue. Make a GRUB rescue image
+* grub-mount: (grub)Invoking grub-mount. Mount a file system using GRUB
* grub-probe: (grub)Invoking grub-probe. Probe device information
@end direntry
@@ -101,6 +102,7 @@ This edition documents version @value{VERSION}.
* Invoking grub-mkpasswd-pbkdf2::
Generate GRUB password hashes
* Invoking grub-mkrescue:: Make a GRUB rescue image
+* Invoking grub-mount:: Mount a file system using GRUB
* Invoking grub-probe:: Probe device information for GRUB
* Obtaining and Building GRUB:: How to obtain and build GRUB
* Reporting bugs:: Where you should send a bug report
@@ -4830,6 +4832,93 @@ built-in default.
@end table
+@node Invoking grub-mount
+@chapter Invoking grub-mount
+
+The program @command{grub-mount} performs a read-only mount of any file
+system or file system image that GRUB understands, using GRUB's file system
+drivers via FUSE. (It is only available if FUSE development files were
+present when GRUB was built.) This has a number of uses:
+
+@itemize @bullet
+@item
+It provides a convenient way to check how GRUB will view a file system at
+boot time. You can use normal command-line tools to compare that view with
+that of your operating system, making it easy to find bugs.
+
+@item
+It offers true read-only mounts. Linux does not have these for journalling
+file systems, because it will always attempt to replay the journal at mount
+time; while you can temporarily mark the block device read-only to avoid
+this, that causes the mount to fail. Since GRUB intentionally contains no
+code for writing to file systems, it can easily provide a guaranteed
+read-only mount mechanism.
+
+@item
+It allows you to examine any file system that GRUB understands without
+needing to load additional modules into your running kernel, which may be
+useful in constrained environments such as installers.
+
+@item
+Since it can examine file system images (contained in regular files) just as
+easily as file systems on block devices, you can use it to inspect any file
+system image that GRUB understands with only enough privileges to use FUSE,
+even if nobody has yet written a FUSE module specifically for that file
+system type.
+@end itemize
+
+Using @command{grub-mount} is normally as simple as:
+
+@example
+grub-mount /dev/sda1 /mnt
+@end example
+
+@command{grub-mount} must be given one or more images and a mount point as
+non-option arguments (if it is given more than one image, it will treat them
+as a RAID set), and also accepts the following options:
+
+@table @option
+@item --help
+Print a summary of the command-line options and exit.
+
+@item --version
+Print the version number of GRUB and exit.
+
+@item -C
+@itemx --crypto
+Mount encrypted devices, prompting for a passphrase if necessary.
+
+@item -d @var{string}
+@itemx --debug=@var{string}
+Show debugging output for conditions matching @var{string}.
+
+@item -K prompt|@var{file}
+@itemx --zfs-key=prompt|@var{file}
+Load a ZFS encryption key. If you use @samp{prompt} as the argument,
+@command{grub-mount} will read a passphrase from the terminal; otherwise, it
+will read key material from the specified file.
+
+@item -r @var{device}
+@itemx --root=@var{device}
+Set the GRUB root device to @var{device}. You do not normally need to set
+this; @command{grub-mount} will automatically set the root device to the
+root of the supplied file system.
+
+If @var{device} is just a number, then it will be treated as a partition
+number within the supplied image. This means that, if you have an image of
+an entire disk in @file{disk.img}, then you can use this command to mount
+its second partition:
+
+@example
+grub-mount -r 2 disk.img mount-point
+@end example
+
+@item -v
+@itemx --verbose
+Print verbose messages.
+@end table
+
+
@node Invoking grub-probe
@chapter Invoking grub-probe
--
1.8.1.4

View File

@ -0,0 +1,125 @@
From 3d109c87aec982045fd78e0937589af98eb0ad38 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Thu, 3 Jan 2013 10:53:53 +0000
Subject: [PATCH 079/364] * docs/grub.texi (Invoking grub-mkrelpath): New
section. (Invoking grub-script-check): Likewise.
---
ChangeLog | 5 +++++
docs/grub.texi | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index c91fe35..e530ac3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-01-03 Colin Watson <cjwatson@ubuntu.com>
+ * docs/grub.texi (Invoking grub-mkrelpath): New section.
+ (Invoking grub-script-check): Likewise.
+
+2013-01-03 Colin Watson <cjwatson@ubuntu.com>
+
* docs/grub.texi (Invoking grub-mount): New section.
Reported by: Filipus Klutiero. Fixes Debian bug #666427.
diff --git a/docs/grub.texi b/docs/grub.texi
index 60b18b5..e23cecc 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -36,9 +36,11 @@ Invariant Sections.
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
+* grub-mkrelpath: (grub)Invoking grub-mkrelpath.
* grub-mkrescue: (grub)Invoking grub-mkrescue. Make a GRUB rescue image
* grub-mount: (grub)Invoking grub-mount. Mount a file system using GRUB
* grub-probe: (grub)Invoking grub-probe. Probe device information
+* grub-script-check: (grub)Invoking grub-script-check.
@end direntry
@setchapternewpage odd
@@ -101,9 +103,11 @@ This edition documents version @value{VERSION}.
* Invoking grub-mkconfig:: Generate a GRUB configuration file
* Invoking grub-mkpasswd-pbkdf2::
Generate GRUB password hashes
+* Invoking grub-mkrelpath:: Make system path relative to its root
* Invoking grub-mkrescue:: Make a GRUB rescue image
* Invoking grub-mount:: Mount a file system using GRUB
* Invoking grub-probe:: Probe device information for GRUB
+* Invoking grub-script-check:: Check GRUB script file for syntax errors
* Obtaining and Building GRUB:: How to obtain and build GRUB
* Reporting bugs:: Where you should send a bug report
* Future:: Some future plans on GRUB
@@ -4774,6 +4778,33 @@ Length of the salt. Defaults to 64.
@end table
+@node Invoking grub-mkrelpath
+@chapter Invoking grub-mkrelpath
+
+The program @command{grub-mkrelpath} makes a file system path relative to
+the root of its containing file system. For instance, if @file{/usr} is a
+mount point, then:
+
+@example
+$ @kbd{grub-mkrelpath /usr/share/grub/unicode.pf2}
+@samp{/share/grub/unicode.pf2}
+@end example
+
+This is mainly used internally by other GRUB utilities such as
+@command{grub-mkconfig} (@pxref{Invoking grub-mkconfig}), but may
+occasionally also be useful for debugging.
+
+@command{grub-mkrelpath} accepts the following options:
+
+@table @option
+@item --help
+Print a summary of the command-line options and exit.
+
+@item --version
+Print the version number of GRUB and exit.
+@end table
+
+
@node Invoking grub-mkrescue
@chapter Invoking grub-mkrescue
@@ -5005,6 +5036,33 @@ Print verbose messages.
@end table
+@node Invoking grub-script-check
+@chapter Invoking grub-script-check
+
+The program @command{grub-script-check} takes a GRUB script file
+(@pxref{Shell-like scripting}) and checks it for syntax errors, similar to
+commands such as @command{sh -n}. It may take a @var{path} as a non-option
+argument; if none is supplied, it will read from standard input.
+
+@example
+grub-script-check /boot/grub/grub.cfg
+@end example
+
+@command{grub-script-check} accepts the following options:
+
+@table @option
+@item --help
+Print a summary of the command-line options and exit.
+
+@item --version
+Print the version number of GRUB and exit.
+
+@item -v
+@itemx --verbose
+Print each line of input after reading it.
+@end table
+
+
@node Obtaining and Building GRUB
@appendix How to obtain and build GRUB
--
1.8.1.4

View File

@ -0,0 +1,40 @@
From 7adc96e903f5581b38ba397a6d4d93f923b2fc5e Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 3 Jan 2013 21:27:00 +0100
Subject: [PATCH 080/364] * grub-core/fs/iso9660.c
(grub_iso9660_susp_iterate): Avoid hang if entry->len = 0.
---
ChangeLog | 5 +++++
grub-core/fs/iso9660.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e530ac3..2717f8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-03 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/iso9660.c (grub_iso9660_susp_iterate): Avoid hang if
+ entry->len = 0.
+
2013-01-03 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Invoking grub-mkrelpath): New section.
diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c
index cd4acc8..547e156 100644
--- a/grub-core/fs/iso9660.c
+++ b/grub-core/fs/iso9660.c
@@ -295,7 +295,7 @@ grub_iso9660_susp_iterate (grub_fshelp_node_t node, grub_off_t off,
if (load_sua ())
return grub_errno;
- for (; (char *) entry < (char *) sua + sua_size - 1;
+ for (; (char *) entry < (char *) sua + sua_size - 1 && entry->len > 0;
entry = (struct grub_iso9660_susp_entry *)
((char *) entry + entry->len))
{
--
1.8.1.4

View File

@ -0,0 +1,56 @@
From 242ce139276b9de1e5f960070e433111a3ab5194 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 3 Jan 2013 21:34:34 +0100
Subject: [PATCH 081/364] * configure.ac: Extend -Wno-trampolines to
host.
---
ChangeLog | 4 ++++
configure.ac | 17 +++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 2717f8a..087b5c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-01-03 Vladimir Serbinenko <phcoder@gmail.com>
+ * configure.ac: Extend -Wno-trampolines to host.
+
+2013-01-03 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/fs/iso9660.c (grub_iso9660_susp_iterate): Avoid hang if
entry->len = 0.
diff --git a/configure.ac b/configure.ac
index a41f117..dde954e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -358,6 +358,23 @@ AC_CHECK_HEADER([util.h], [
])
AC_SUBST([LIBUTIL])
+AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_host_cc_wnotrampolines], [
+ SAVED_CFLAGS="$CFLAGS"
+ # Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
+ # in the event of later failures (since -Wno-* is always accepted, but
+ # produces a diagnostic if something else is wrong).
+ CFLAGS="$HOST_CFLAGS -Wtrampolines"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
+int va_arg_func (int fixed, va_list args);]], [[]])],
+ [grub_cv_host_cc_wnotrampolines=yes],
+ [grub_cv_host_cc_wnotrampolines=no])
+ CFLAGS="$SAVED_CFLAGS"
+])
+
+if test x"$grub_host_cv_cc_wnotrampolines" = xyes ; then
+ HOST_CFLAGS="$HOST_CFLAGS -Wno-trampolines"
+fi
+
#
# Check for host and build compilers.
#
--
1.8.1.4

View File

@ -0,0 +1,58 @@
From 98701532f45165422f45b8cdf405a7f0abf03fba Mon Sep 17 00:00:00 2001
From: Yuta Satoh <nigoro>
Date: Thu, 3 Jan 2013 23:06:07 +0100
Subject: [PATCH 082/364] * util/grub.d/10_kfreebsd.in: Fix improper
references to grub-probe by ${grub_probe}
---
ChangeLog | 5 +++++
util/grub.d/10_kfreebsd.in | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 087b5c3..936af2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-03 Yuta Satoh <nigoro>
+
+ * util/grub.d/10_kfreebsd.in: Fix improper references to grub-probe by
+ ${grub_probe}
+
2013-01-03 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Extend -Wno-trampolines to host.
diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in
index 260dda8..2a48b52 100644
--- a/util/grub.d/10_kfreebsd.in
+++ b/util/grub.d/10_kfreebsd.in
@@ -54,7 +54,7 @@ load_kfreebsd_module ()
fi
if [ -z "${prepare_module_dir_cache}" ]; then
- prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | grub_add_tab)"
+ prepare_module_dir_cache="$(prepare_grub_to_access_device $(${grub_probe} -t device "${module_dir}") | grub_add_tab)"
fi
printf '%s\n' "${prepare_module_dir_cache}"
@@ -112,7 +112,7 @@ EOF
load_kfreebsd_module acpi true
- for abstraction in dummy $(grub-probe -t abstraction --device ${GRUB_DEVICE}) ; do
+ for abstraction in dummy $(${grub_probe} -t abstraction --device ${GRUB_DEVICE}) ; do
case $abstraction in
lvm) load_kfreebsd_module geom_linux_lvm false ;;
esac
@@ -179,7 +179,7 @@ while [ "x$list" != "x" ] ; do
case ${GRUB_FS} in
zfs)
# zpool name
- kfreebsd_device=$(grub-probe -t fs_label --device ${GRUB_DEVICE})
+ kfreebsd_device=$(${grub_probe} -t fs_label --device ${GRUB_DEVICE})
# filesystem name (empty string for the main filesystem)
kfreebsd_device="${kfreebsd_device}$(${grub_mkrelpath} / | sed -e "s,/*@$,,")"
;;
--
1.8.1.4

View File

@ -0,0 +1,46 @@
From 40951063e5fd8c4ae34b942039d38bfe69ffecb3 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 3 Jan 2013 23:19:19 +0100
Subject: [PATCH 083/364] * util/grub.d/10_kfreebsd.in: Correct the
patch to zpool.cache as it's always in /boot/zfs. Reported by: Yuta
Satoh.
---
ChangeLog | 6 ++++++
util/grub.d/10_kfreebsd.in | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 936af2f..a28a1f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-03 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/grub.d/10_kfreebsd.in: Correct the patch to zpool.cache as it's
+ always in /boot/zfs.
+ Reported by: Yuta Satoh.
+
2013-01-03 Yuta Satoh <nigoro>
* util/grub.d/10_kfreebsd.in: Fix improper references to grub-probe by
diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in
index 2a48b52..c123ceb 100644
--- a/util/grub.d/10_kfreebsd.in
+++ b/util/grub.d/10_kfreebsd.in
@@ -122,10 +122,10 @@ EOF
zfs)
load_kfreebsd_module opensolaris false
- ls "${dirname}/zfs/zpool.cache" > /dev/null
+ ls "/boot/zfs/zpool.cache" > /dev/null
printf '%s\n' "${prepare_boot_cache}"
sed "s/^/$submenu_indentation/" << EOF
- kfreebsd_module ${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache
+ kfreebsd_module $(make_system_path_relative_to_its_root /boot)/zfs/zpool.cache type=/boot/zfs/zpool.cache
EOF
;;
esac
--
1.8.1.4

View File

@ -0,0 +1,75 @@
From d064a7c4f3cc8a5faba4d4bc4f4ba82677c7b1d7 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 5 Jan 2013 15:10:46 +0100
Subject: [PATCH 084/364] * grub-core/disk/diskfilter.c
(grub_diskfilter_write): Call grub_error properly. *
grub-core/disk/ieee1275/nand.c (grub_nand_write): Likewise. *
grub-core/disk/loopback.c (grub_loopback_write): Likewise.
---
ChangeLog | 7 +++++++
grub-core/disk/diskfilter.c | 3 ++-
grub-core/disk/ieee1275/nand.c | 3 ++-
grub-core/disk/loopback.c | 3 ++-
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a28a1f7..f15e098 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/disk/diskfilter.c (grub_diskfilter_write): Call
+ grub_error properly.
+ * grub-core/disk/ieee1275/nand.c (grub_nand_write): Likewise.
+ * grub-core/disk/loopback.c (grub_loopback_write): Likewise.
+
2013-01-03 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/10_kfreebsd.in: Correct the patch to zpool.cache as it's
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
index ce4c706..4117b20 100644
--- a/grub-core/disk/diskfilter.c
+++ b/grub-core/disk/diskfilter.c
@@ -831,7 +831,8 @@ grub_diskfilter_write (grub_disk_t disk __attribute ((unused)),
grub_size_t size __attribute ((unused)),
const char *buf __attribute ((unused)))
{
- return GRUB_ERR_NOT_IMPLEMENTED_YET;
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "diskfilter writes are not supported");
}
struct grub_diskfilter_vg *
diff --git a/grub-core/disk/ieee1275/nand.c b/grub-core/disk/ieee1275/nand.c
index ad30852..3474b3e 100644
--- a/grub-core/disk/ieee1275/nand.c
+++ b/grub-core/disk/ieee1275/nand.c
@@ -203,7 +203,8 @@ grub_nand_write (grub_disk_t disk __attribute ((unused)),
grub_size_t size __attribute ((unused)),
const char *buf __attribute ((unused)))
{
- return GRUB_ERR_NOT_IMPLEMENTED_YET;
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "nand write is not supported");
}
static struct grub_disk_dev grub_nand_dev =
diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c
index f3b19ef..fffd1bb 100644
--- a/grub-core/disk/loopback.c
+++ b/grub-core/disk/loopback.c
@@ -206,7 +206,8 @@ grub_loopback_write (grub_disk_t disk __attribute ((unused)),
grub_size_t size __attribute ((unused)),
const char *buf __attribute ((unused)))
{
- return GRUB_ERR_NOT_IMPLEMENTED_YET;
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "loopback write is not supported");
}
static struct grub_disk_dev grub_loopback_dev =
--
1.8.1.4

View File

@ -0,0 +1,93 @@
From 3ba196532002293027a6a3e96f8eb1960c70e00c Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 5 Jan 2013 16:53:04 +0100
Subject: [PATCH 085/364] * grub-core/fs/nilfs2.c
(-grub_nilfs2_palloc_groups_per_desc_block): Rename to ...
(grub_nilfs2_palloc_log_groups_per_desc_block): ... this. Return log of
groups_per_block. All users updated.
---
ChangeLog | 7 +++++++
grub-core/fs/nilfs2.c | 20 ++++++++++++--------
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f15e098..ea191b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/fs/nilfs2.c (-grub_nilfs2_palloc_groups_per_desc_block):
+ Rename to ...
+ (grub_nilfs2_palloc_log_groups_per_desc_block): ... this. Return log
+ of groups_per_block. All users updated.
+
+2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/disk/diskfilter.c (grub_diskfilter_write): Call
grub_error properly.
* grub-core/disk/ieee1275/nand.c (grub_nand_write): Likewise.
diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c
index f36c513..5b34486 100644
--- a/grub-core/fs/nilfs2.c
+++ b/grub-core/fs/nilfs2.c
@@ -214,6 +214,8 @@ struct grub_nilfs2_palloc_group_desc
grub_uint32_t pg_nfrees;
};
+#define LOG_SIZE_GROUP_DESC 2
+
#define LOG_NILFS_DAT_ENTRY_SIZE 5
struct grub_nilfs2_dat_entry
{
@@ -311,10 +313,12 @@ grub_nilfs2_palloc_group (struct grub_nilfs2_data *data,
}
static inline grub_uint32_t
-grub_nilfs2_palloc_groups_per_desc_block (struct grub_nilfs2_data *data)
+grub_nilfs2_palloc_log_groups_per_desc_block (struct grub_nilfs2_data *data)
{
- return NILFS2_BLOCK_SIZE (data) /
- sizeof (struct grub_nilfs2_palloc_group_desc);
+ return LOG2_BLOCK_SIZE (data) - LOG_SIZE_GROUP_DESC;
+
+ COMPILE_TIME_ASSERT (sizeof (struct grub_nilfs2_palloc_group_desc)
+ == (1 << LOG_SIZE_GROUP_DESC));
}
static inline grub_uint32_t
@@ -338,8 +342,8 @@ static inline grub_uint32_t
grub_nilfs2_blocks_per_desc_block_log (struct grub_nilfs2_data *data,
unsigned long log_entry_size)
{
- return grub_nilfs2_palloc_groups_per_desc_block (data) *
- grub_nilfs2_blocks_per_group_log (data, log_entry_size) + 1;
+ return(grub_nilfs2_blocks_per_group_log (data, log_entry_size)
+ << grub_nilfs2_palloc_log_groups_per_desc_block (data)) + 1;
}
static inline grub_uint32_t
@@ -348,7 +352,7 @@ grub_nilfs2_palloc_desc_block_offset_log (struct grub_nilfs2_data *data,
unsigned long log_entry_size)
{
grub_uint32_t desc_block =
- group / grub_nilfs2_palloc_groups_per_desc_block (data);
+ group >> grub_nilfs2_palloc_log_groups_per_desc_block (data);
return desc_block * grub_nilfs2_blocks_per_desc_block_log (data,
log_entry_size);
}
@@ -358,8 +362,8 @@ grub_nilfs2_palloc_bitmap_block_offset (struct grub_nilfs2_data *data,
unsigned long group,
unsigned long log_entry_size)
{
- unsigned long desc_offset = group %
- grub_nilfs2_palloc_groups_per_desc_block (data);
+ unsigned long desc_offset = group
+ & ((1 << grub_nilfs2_palloc_log_groups_per_desc_block (data)) - 1);
return grub_nilfs2_palloc_desc_block_offset_log (data, group, log_entry_size)
+ 1
--
1.8.1.4

View File

@ -0,0 +1,330 @@
From aa380d4323bcc4dae0f8bafdd074466f8bc5bcf5 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 5 Jan 2013 17:36:04 +0100
Subject: [PATCH 086/364] * grub-core/fs/ntfs.c: Eliminate useless
divisions in favor of shifts. * grub-core/fs/ntfscomp.c: Likewise. *
include/grub/ntfs.h (grub_ntfs_data): Replace spc with log_spc.
(grub_ntfs_comp): Likewise.
---
ChangeLog | 7 +++++++
grub-core/fs/ntfs.c | 47 ++++++++++++++++++++++++-----------------------
grub-core/fs/ntfscomp.c | 39 ++++++++++++++++++++-------------------
include/grub/ntfs.h | 6 ++++--
4 files changed, 55 insertions(+), 44 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ea191b3..88fd763 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/fs/ntfs.c: Eliminate useless divisions in favor of shifts.
+ * grub-core/fs/ntfscomp.c: Likewise.
+ * include/grub/ntfs.h (grub_ntfs_data): Replace spc with log_spc.
+ (grub_ntfs_comp): Likewise.
+
+2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/fs/nilfs2.c (-grub_nilfs2_palloc_groups_per_desc_block):
Rename to ...
(grub_nilfs2_palloc_log_groups_per_desc_block): ... this. Return log
diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c
index b9762b6..6004e1f 100644
--- a/grub-core/fs/ntfs.c
+++ b/grub-core/fs/ntfs.c
@@ -391,7 +391,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
grub_memset (&cc, 0, sizeof (cc));
ctx = &cc;
ctx->attr = at;
- ctx->comp.spc = at->mft->data->spc;
+ ctx->comp.log_spc = at->mft->data->log_spc;
ctx->comp.disk = at->mft->data->disk;
if (pa[8] == 0)
@@ -440,11 +440,11 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
at->save_pos = 1;
}
- vcn = ctx->target_vcn = (ofs >> GRUB_NTFS_COM_LOG_LEN) * (GRUB_NTFS_COM_SEC / ctx->comp.spc);
+ vcn = ctx->target_vcn = (ofs >> GRUB_NTFS_COM_LOG_LEN) * (GRUB_NTFS_COM_SEC >> ctx->comp.log_spc);
ctx->target_vcn &= ~0xFULL;
}
else
- vcn = ctx->target_vcn = grub_divmod64 (ofs >> GRUB_NTFS_BLK_SHR, ctx->comp.spc, 0);
+ vcn = ctx->target_vcn = ofs >> (GRUB_NTFS_BLK_SHR + ctx->comp.log_spc);
ctx->next_vcn = u32at (pa, 0x10);
ctx->curr_lcn = 0;
@@ -459,17 +459,17 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
grub_disk_addr_t st0, st1;
grub_uint64_t m;
- grub_divmod64 (ofs >> GRUB_NTFS_BLK_SHR, ctx->comp.spc, &m);
+ m = (ofs >> GRUB_NTFS_BLK_SHR) & ((1 << ctx->comp.log_spc) - 1);
st0 =
- (ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc + m;
+ ((ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) << ctx->comp.log_spc) + m;
st1 = st0 + 1;
if (st1 ==
- (ctx->next_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc)
+ (ctx->next_vcn - ctx->curr_vcn + ctx->curr_lcn) << ctx->comp.log_spc)
{
if (grub_ntfs_read_run_list (ctx))
return grub_errno;
- st1 = ctx->curr_lcn * ctx->comp.spc;
+ st1 = ctx->curr_lcn << ctx->comp.log_spc;
}
grub_set_unaligned32 (dest, grub_cpu_to_le32 (st0));
grub_set_unaligned32 (dest + 4, grub_cpu_to_le32 (st1));
@@ -478,12 +478,10 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
if (!(ctx->flags & GRUB_NTFS_RF_COMP))
{
- unsigned int pow;
-
- if (!grub_fshelp_log2blksize (ctx->comp.spc, &pow))
- grub_fshelp_read_file (ctx->comp.disk, (grub_fshelp_node_t) ctx,
- read_hook, ofs, len, dest,
- grub_ntfs_read_block, ofs + len, pow, 0);
+ grub_fshelp_read_file (ctx->comp.disk, (grub_fshelp_node_t) ctx,
+ read_hook, ofs, len, dest,
+ grub_ntfs_read_block, ofs + len,
+ ctx->comp.log_spc, 0);
return grub_errno;
}
@@ -515,11 +513,11 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
/* If compression is possible make sure that we include possible
compressed block size. */
- if (GRUB_NTFS_COM_SEC >= at->mft->data->spc)
+ if (GRUB_NTFS_LOG_COM_SEC >= at->mft->data->log_spc)
vcn = ((ofs >> GRUB_NTFS_COM_LOG_LEN)
- * (GRUB_NTFS_COM_SEC / at->mft->data->spc)) & ~0xFULL;
+ << (GRUB_NTFS_LOG_COM_SEC - at->mft->data->log_spc)) & ~0xFULL;
else
- vcn = grub_divmod64 (ofs, at->mft->data->spc << GRUB_NTFS_BLK_SHR, 0);
+ vcn = ofs >> (at->mft->data->log_spc + GRUB_NTFS_BLK_SHR);
pa = at->attr_nxt + u16at (at->attr_nxt, 4);
while (pa < at->attr_end)
{
@@ -934,6 +932,7 @@ grub_ntfs_mount (grub_disk_t disk)
{
struct grub_ntfs_bpb bpb;
struct grub_ntfs_data *data = 0;
+ grub_uint32_t spc;
if (!disk)
goto fail;
@@ -955,23 +954,25 @@ grub_ntfs_mount (grub_disk_t disk)
|| (bpb.bytes_per_sector & (bpb.bytes_per_sector - 1)) != 0)
goto fail;
- data->spc = (((grub_uint32_t) bpb.sectors_per_cluster
- * (grub_uint32_t) grub_le_to_cpu16 (bpb.bytes_per_sector))
- >> GRUB_NTFS_BLK_SHR);
- if (!data->spc)
+ spc = (((grub_uint32_t) bpb.sectors_per_cluster
+ * (grub_uint32_t) grub_le_to_cpu16 (bpb.bytes_per_sector))
+ >> GRUB_NTFS_BLK_SHR);
+ if (spc == 0 || (spc & (spc - 1)))
goto fail;
+ for (data->log_spc = 0; (1U << data->log_spc) < spc; data->log_spc++);
+
if (bpb.clusters_per_mft > 0)
- data->mft_size = data->spc * bpb.clusters_per_mft;
+ data->mft_size = bpb.clusters_per_mft << data->log_spc;
else
data->mft_size = 1 << (-bpb.clusters_per_mft - GRUB_NTFS_BLK_SHR);
if (bpb.clusters_per_index > 0)
- data->idx_size = data->spc * bpb.clusters_per_index;
+ data->idx_size = bpb.clusters_per_index << data->log_spc;
else
data->idx_size = 1 << (-bpb.clusters_per_index - GRUB_NTFS_BLK_SHR);
- data->mft_start = grub_le_to_cpu64 (bpb.mft_lcn) * data->spc;
+ data->mft_start = grub_le_to_cpu64 (bpb.mft_lcn) << data->log_spc;
if ((data->mft_size > GRUB_NTFS_MAX_MFT) || (data->idx_size > GRUB_NTFS_MAX_IDX))
goto fail;
diff --git a/grub-core/fs/ntfscomp.c b/grub-core/fs/ntfscomp.c
index ec359fa..9b3b75d 100644
--- a/grub-core/fs/ntfscomp.c
+++ b/grub-core/fs/ntfscomp.c
@@ -33,8 +33,9 @@ decomp_nextvcn (struct grub_ntfs_comp *cc)
if (grub_disk_read
(cc->disk,
(cc->comp_table[cc->comp_head].next_lcn -
- (cc->comp_table[cc->comp_head].next_vcn - cc->cbuf_vcn)) * cc->spc, 0,
- cc->spc << GRUB_NTFS_BLK_SHR, cc->cbuf))
+ (cc->comp_table[cc->comp_head].next_vcn - cc->cbuf_vcn)) << cc->log_spc,
+ 0,
+ 1 << (cc->log_spc + GRUB_NTFS_BLK_SHR), cc->cbuf))
return grub_errno;
cc->cbuf_vcn++;
if ((cc->cbuf_vcn >= cc->comp_table[cc->comp_head].next_vcn))
@@ -46,7 +47,7 @@ decomp_nextvcn (struct grub_ntfs_comp *cc)
static grub_err_t
decomp_getch (struct grub_ntfs_comp *cc, unsigned char *res)
{
- if (cc->cbuf_ofs >= (cc->spc << GRUB_NTFS_BLK_SHR))
+ if (cc->cbuf_ofs >= (1U << (cc->log_spc + GRUB_NTFS_BLK_SHR)))
{
if (decomp_nextvcn (cc))
return grub_errno;
@@ -159,7 +160,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
{
int n;
- n = (cc->spc << GRUB_NTFS_BLK_SHR) - cc->cbuf_ofs;
+ n = (1 << (cc->log_spc + GRUB_NTFS_BLK_SHR)) - cc->cbuf_ofs;
if (n > cnt)
n = cnt;
if ((dest) && (n))
@@ -178,7 +179,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
static grub_err_t
read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
{
- int cpb = GRUB_NTFS_COM_SEC / ctx->comp.spc;
+ int log_cpb = GRUB_NTFS_LOG_COM_SEC - ctx->comp.log_spc;
while (num)
{
@@ -192,7 +193,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
return grub_error (GRUB_ERR_BAD_FS, "invalid compression block");
ctx->comp.comp_head = ctx->comp.comp_tail = 0;
ctx->comp.cbuf_vcn = ctx->target_vcn;
- ctx->comp.cbuf_ofs = (ctx->comp.spc << GRUB_NTFS_BLK_SHR);
+ ctx->comp.cbuf_ofs = (1 << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR));
if (ctx->target_vcn >= ctx->next_vcn)
{
if (grub_ntfs_read_run_list (ctx))
@@ -211,14 +212,14 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
}
}
- nn = (16 - (unsigned) (ctx->target_vcn & 0xF)) / cpb;
+ nn = (16 - (unsigned) (ctx->target_vcn & 0xF)) >> log_cpb;
if (nn > num)
nn = num;
num -= nn;
if (ctx->flags & GRUB_NTFS_RF_BLNK)
{
- ctx->target_vcn += nn * cpb;
+ ctx->target_vcn += nn << log_cpb;
if (ctx->comp.comp_tail == 0)
{
if (buf)
@@ -241,7 +242,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
}
else
{
- nn *= cpb;
+ nn <<= log_cpb;
while ((ctx->comp.comp_head < ctx->comp.comp_tail) && (nn))
{
grub_disk_addr_t tt;
@@ -258,10 +259,10 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
(ctx->comp.disk,
(ctx->comp.comp_table[ctx->comp.comp_head].next_lcn -
(ctx->comp.comp_table[ctx->comp.comp_head].next_vcn -
- ctx->target_vcn)) * ctx->comp.spc, 0,
- tt * (ctx->comp.spc << GRUB_NTFS_BLK_SHR), buf))
+ ctx->target_vcn)) << ctx->comp.log_spc, 0,
+ tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
return grub_errno;
- buf += tt * (ctx->comp.spc << GRUB_NTFS_BLK_SHR);
+ buf += tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
}
nn -= tt;
if (ctx->target_vcn >=
@@ -275,10 +276,10 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
if (grub_disk_read
(ctx->comp.disk,
(ctx->target_vcn - ctx->curr_vcn +
- ctx->curr_lcn) * ctx->comp.spc, 0,
- nn * (ctx->comp.spc << GRUB_NTFS_BLK_SHR), buf))
+ ctx->curr_lcn) << ctx->comp.log_spc, 0,
+ nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
return grub_errno;
- buf += nn * (ctx->comp.spc << GRUB_NTFS_BLK_SHR);
+ buf += nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
}
ctx->target_vcn += nn;
}
@@ -294,7 +295,7 @@ ntfscomp (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
grub_err_t ret;
ctx->comp.comp_head = ctx->comp.comp_tail = 0;
- ctx->comp.cbuf = grub_malloc ((ctx->comp.spc) << GRUB_NTFS_BLK_SHR);
+ ctx->comp.cbuf = grub_malloc (1 << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR));
if (!ctx->comp.cbuf)
return 0;
@@ -304,7 +305,7 @@ ntfscomp (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
if ((vcn > ctx->target_vcn) &&
(read_block
- (ctx, NULL, ((vcn - ctx->target_vcn) * ctx->comp.spc) / GRUB_NTFS_COM_SEC)))
+ (ctx, NULL, (vcn - ctx->target_vcn) >> (GRUB_NTFS_LOG_COM_SEC - ctx->comp.log_spc))))
{
ret = grub_errno;
goto quit;
@@ -314,7 +315,7 @@ ntfscomp (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
{
grub_uint32_t t, n, o;
- t = ctx->target_vcn * (ctx->comp.spc << GRUB_NTFS_BLK_SHR);
+ t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
if (read_block (ctx, at->sbuf, 1))
{
ret = grub_errno;
@@ -346,7 +347,7 @@ ntfscomp (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
{
grub_uint32_t t;
- t = ctx->target_vcn * (ctx->comp.spc << GRUB_NTFS_BLK_SHR);
+ t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
if (read_block (ctx, at->sbuf, 1))
{
ret = grub_errno;
diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h
index 0935342..cc28a01 100644
--- a/include/grub/ntfs.h
+++ b/include/grub/ntfs.h
@@ -87,6 +87,7 @@ enum
#define GRUB_NTFS_COM_LEN 4096
#define GRUB_NTFS_COM_LOG_LEN 12
#define GRUB_NTFS_COM_SEC (GRUB_NTFS_COM_LEN >> GRUB_NTFS_BLK_SHR)
+#define GRUB_NTFS_LOG_COM_SEC (GRUB_NTFS_COM_LOG_LEN - GRUB_NTFS_BLK_SHR)
enum
{
@@ -156,7 +157,7 @@ struct grub_ntfs_data
grub_disk_t disk;
grub_uint32_t mft_size;
grub_uint32_t idx_size;
- grub_uint32_t spc;
+ int log_spc;
grub_uint32_t mft_start;
grub_uint64_t uuid;
};
@@ -172,7 +173,8 @@ struct grub_ntfs_comp
grub_disk_t disk;
int comp_head, comp_tail;
struct grub_ntfs_comp_table_element comp_table[16];
- grub_uint32_t cbuf_ofs, cbuf_vcn, spc;
+ grub_uint32_t cbuf_ofs, cbuf_vcn;
+ int log_spc;
char *cbuf;
};
--
1.8.1.4

View File

@ -0,0 +1,103 @@
From af8a6a082c9ac9fab22f3eff9e81b5e7085debc4 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 5 Jan 2013 18:37:34 +0100
Subject: [PATCH 087/364] * grub-core/fs/ext2.c (grub_ext2_read_block):
Use shifts rather than divisions.
---
ChangeLog | 5 +++++
grub-core/fs/ext2.c | 30 ++++++++++++++++--------------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 88fd763..af29161 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/fs/ext2.c (grub_ext2_read_block): Use shifts rather than
+ divisions.
+
+2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/fs/ntfs.c: Eliminate useless divisions in favor of shifts.
* grub-core/fs/ntfscomp.c: Likewise.
* include/grub/ntfs.h (grub_ntfs_data): Replace spc with log_spc.
diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c
index bd1ab24..cf2e2f4 100644
--- a/grub-core/fs/ext2.c
+++ b/grub-core/fs/ext2.c
@@ -454,11 +454,12 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
blknr = grub_le_to_cpu32 (indir[fileblock - INDIRECT_BLOCKS]);
}
/* Double indirect. */
- else if (fileblock < INDIRECT_BLOCKS + blksz / 4 * (blksz / 4 + 1))
+ else if (fileblock < INDIRECT_BLOCKS
+ + blksz / 4 * ((grub_disk_addr_t) blksz / 4 + 1))
{
- unsigned int perblock = blksz / 4;
- unsigned int rblock = fileblock - (INDIRECT_BLOCKS
- + blksz / 4);
+ int log_perblock = log2_blksz + 9 - 2;
+ grub_disk_addr_t rblock = fileblock - (INDIRECT_BLOCKS
+ + blksz / 4);
grub_uint32_t indir[blksz / 4];
if (grub_disk_read (data->disk,
@@ -470,21 +471,22 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_disk_read (data->disk,
((grub_disk_addr_t)
- grub_le_to_cpu32 (indir[rblock / perblock]))
+ grub_le_to_cpu32 (indir[rblock >> log_perblock]))
<< log2_blksz,
0, blksz, indir))
return grub_errno;
- blknr = grub_le_to_cpu32 (indir[rblock % perblock]);
+ blknr = grub_le_to_cpu32 (indir[rblock & ((1 << log_perblock) - 1)]);
}
/* triple indirect. */
- else if (fileblock < INDIRECT_BLOCKS + blksz / 4 * (blksz / 4 + 1)
- + (blksz / 4) * (blksz / 4) * (blksz / 4 + 1))
+ else if (fileblock < INDIRECT_BLOCKS + blksz / 4 * ((grub_disk_addr_t) blksz / 4 + 1)
+ + ((grub_disk_addr_t) blksz / 4) * ((grub_disk_addr_t) blksz / 4)
+ * ((grub_disk_addr_t) blksz / 4 + 1))
{
- unsigned int perblock = blksz / 4;
- unsigned int rblock = fileblock - (INDIRECT_BLOCKS + blksz / 4
- * (blksz / 4 + 1));
+ int log_perblock = log2_blksz + 9 - 2;
+ grub_disk_addr_t rblock = fileblock - (INDIRECT_BLOCKS + blksz / 4
+ * (blksz / 4 + 1));
grub_uint32_t indir[blksz / 4];
if (grub_disk_read (data->disk,
@@ -496,19 +498,19 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_disk_read (data->disk,
((grub_disk_addr_t)
- grub_le_to_cpu32 (indir[(rblock / perblock) / perblock]))
+ grub_le_to_cpu32 (indir[(rblock >> log_perblock) >> log_perblock]))
<< log2_blksz,
0, blksz, indir))
return grub_errno;
if (grub_disk_read (data->disk,
((grub_disk_addr_t)
- grub_le_to_cpu32 (indir[(rblock / perblock) % perblock]))
+ grub_le_to_cpu32 (indir[(rblock >> log_perblock) & ((1 << log_perblock) - 1)]))
<< log2_blksz,
0, blksz, indir))
return grub_errno;
- blknr = grub_le_to_cpu32 (indir[rblock % perblock]);
+ blknr = grub_le_to_cpu32 (indir[rblock & ((1 << log_perblock) - 1)]);
}
else
{
--
1.8.1.4

View File

@ -0,0 +1,47 @@
From 8c3fd8eea724a1490d29937b1d23cde259bf63cb Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 7 Jan 2013 11:27:18 +0100
Subject: [PATCH 088/364] * grub-core/fs/minix.c (grub_minix_read_file):
Simplify arithmetics.
---
ChangeLog | 4 ++++
grub-core/fs/minix.c | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index af29161..cdb3f3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-07 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/minix.c (grub_minix_read_file): Simplify arithmetics.
+
2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/ext2.c (grub_ext2_read_block): Use shifts rather than
diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c
index 1e1c13b..a622533 100644
--- a/grub-core/fs/minix.c
+++ b/grub-core/fs/minix.c
@@ -261,12 +261,12 @@ grub_minix_read_file (struct grub_minix_data *data,
/* Adjust len so it we can't read past the end of the file. */
if (len + pos > GRUB_MINIX_INODE_SIZE (data))
len = GRUB_MINIX_INODE_SIZE (data) - pos;
+ if (len == 0)
+ return 0;
/* Files are at most 2G/4G - 1 bytes on minixfs. Avoid 64-bit division. */
- blockcnt = ((grub_uint32_t) ((len + pos
- + (data->block_size << GRUB_DISK_SECTOR_BITS)
- - 1)
- >> GRUB_DISK_SECTOR_BITS)) / data->block_size;
+ blockcnt = ((grub_uint32_t) ((len + pos - 1)
+ >> GRUB_DISK_SECTOR_BITS)) / data->block_size + 1;
posblock = (((grub_uint32_t) pos)
/ (data->block_size << GRUB_DISK_SECTOR_BITS));
blockoff = (((grub_uint32_t) pos)
--
1.8.1.4

View File

@ -0,0 +1,61 @@
From 05f5634a5c5a66d535962a96635a9c153cf67e8f Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 7 Jan 2013 10:43:00 +0000
Subject: [PATCH 089/364] * docs/grub.texi (grub_cpu): New subsection.
(grub_platform): Likewise.
---
ChangeLog | 5 +++++
docs/grub.texi | 16 ++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index cdb3f3d..097ef0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-07 Colin Watson <cjwatson@ubuntu.com>
+
+ * docs/grub.texi (grub_cpu): New subsection.
+ (grub_platform): Likewise.
+
2013-01-07 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/minix.c (grub_minix_read_file): Simplify arithmetics.
diff --git a/docs/grub.texi b/docs/grub.texi
index e23cecc..a92bd96 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -2674,6 +2674,8 @@ These variables have special meaning to GRUB.
* gfxmode::
* gfxpayload::
* gfxterm_font::
+* grub_cpu::
+* grub_platform::
* icondir::
* lang::
* locale_dir::
@@ -2857,6 +2859,20 @@ If this variable is set, it names a font to use for text on the
available font.
+@node grub_cpu
+@subsection grub_cpu
+
+In normal mode (@pxref{normal}), GRUB sets the @samp{grub_cpu} variable to
+the CPU type for which GRUB was built (e.g. @samp{i386} or @samp{powerpc}).
+
+
+@node grub_platform
+@subsection grub_platform
+
+In normal mode (@pxref{normal}), GRUB sets the @samp{grub_platform} variable
+to the platform for which GRUB was built (e.g. @samp{pc} or @samp{efi}).
+
+
@node icondir
@subsection icondir
--
1.8.1.4

View File

@ -0,0 +1,141 @@
From c86f86069fd8d600ebc4ffbd8a786c58fccff886 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 7 Jan 2013 10:45:05 +0000
Subject: [PATCH 090/364] * grub-core/io/bufio.c (grub_bufio_open): Use
grub_zalloc instead of explicitly zeroing elements. * grub-core/io/gzio.c
(grub_gzio_open): Likewise. * grub-core/io/lzopio.c (grub_lzopio_open):
Remove explicit zeroing of elements in a structure already allocated using
grub_zalloc. * grub-core/io/xzio.c (grub_xzio_open): Likewise.
---
ChangeLog | 9 +++++++++
grub-core/io/bufio.c | 8 ++------
grub-core/io/gzio.c | 4 +---
grub-core/io/lzopio.c | 2 --
grub-core/io/xzio.c | 6 ------
5 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 097ef0d..75fb85a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2013-01-07 Colin Watson <cjwatson@ubuntu.com>
+ * grub-core/io/bufio.c (grub_bufio_open): Use grub_zalloc instead of
+ explicitly zeroing elements.
+ * grub-core/io/gzio.c (grub_gzio_open): Likewise.
+ * grub-core/io/lzopio.c (grub_lzopio_open): Remove explicit zeroing
+ of elements in a structure already allocated using grub_zalloc.
+ * grub-core/io/xzio.c (grub_xzio_open): Likewise.
+
+2013-01-07 Colin Watson <cjwatson@ubuntu.com>
+
* docs/grub.texi (grub_cpu): New subsection.
(grub_platform): Likewise.
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c
index 2a315e2..2243827 100644
--- a/grub-core/io/bufio.c
+++ b/grub-core/io/bufio.c
@@ -48,7 +48,7 @@ grub_bufio_open (grub_file_t io, int size)
grub_file_t file;
grub_bufio_t bufio = 0;
- file = (grub_file_t) grub_malloc (sizeof (*file));
+ file = (grub_file_t) grub_zalloc (sizeof (*file));
if (! file)
return 0;
@@ -61,7 +61,7 @@ grub_bufio_open (grub_file_t io, int size)
size = ((io->size > GRUB_BUFIO_MAX_SIZE) ? GRUB_BUFIO_MAX_SIZE :
io->size);
- bufio = grub_malloc (sizeof (struct grub_bufio) + size);
+ bufio = grub_zalloc (sizeof (struct grub_bufio) + size);
if (! bufio)
{
grub_free (file);
@@ -70,14 +70,10 @@ grub_bufio_open (grub_file_t io, int size)
bufio->file = io;
bufio->block_size = size;
- bufio->buffer_len = 0;
- bufio->buffer_at = 0;
file->device = io->device;
- file->offset = 0;
file->size = io->size;
file->data = bufio;
- file->read_hook = 0;
file->fs = &grub_bufio_fs;
file->not_easily_seekable = io->not_easily_seekable;
diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c
index 83c0b64..59f2206 100644
--- a/grub-core/io/gzio.c
+++ b/grub-core/io/gzio.c
@@ -1130,7 +1130,7 @@ grub_gzio_open (grub_file_t io)
grub_file_t file;
grub_gzio_t gzio = 0;
- file = (grub_file_t) grub_malloc (sizeof (*file));
+ file = (grub_file_t) grub_zalloc (sizeof (*file));
if (! file)
return 0;
@@ -1144,9 +1144,7 @@ grub_gzio_open (grub_file_t io)
gzio->file = io;
file->device = io->device;
- file->offset = 0;
file->data = gzio;
- file->read_hook = 0;
file->fs = &grub_gzio_fs;
file->not_easily_seekable = 1;
diff --git a/grub-core/io/lzopio.c b/grub-core/io/lzopio.c
index 77291d0..7fdb6d4 100644
--- a/grub-core/io/lzopio.c
+++ b/grub-core/io/lzopio.c
@@ -428,9 +428,7 @@ grub_lzopio_open (grub_file_t io)
lzopio->file = io;
file->device = io->device;
- file->offset = 0;
file->data = lzopio;
- file->read_hook = 0;
file->fs = &grub_lzopio_fs;
file->size = GRUB_FILE_SIZE_UNKNOWN;
file->not_easily_seekable = 1;
diff --git a/grub-core/io/xzio.c b/grub-core/io/xzio.c
index ae30e6f..27657d8 100644
--- a/grub-core/io/xzio.c
+++ b/grub-core/io/xzio.c
@@ -186,12 +186,9 @@ grub_xzio_open (grub_file_t io)
}
xzio->file = io;
- xzio->saved_offset = 0;
file->device = io->device;
- file->offset = 0;
file->data = xzio;
- file->read_hook = 0;
file->fs = &grub_xzio_fs;
file->size = GRUB_FILE_SIZE_UNKNOWN;
file->not_easily_seekable = 1;
@@ -210,10 +207,7 @@ grub_xzio_open (grub_file_t io)
}
xzio->buf.in = xzio->inbuf;
- xzio->buf.in_pos = 0;
- xzio->buf.in_size = 0;
xzio->buf.out = xzio->outbuf;
- xzio->buf.out_pos = 0;
xzio->buf.out_size = XZBUFSIZ;
/* FIXME: don't test footer on not easily seekable files. */
--
1.8.1.4

View File

@ -0,0 +1,59 @@
From 1ed52ffd389d28a8c1711fedcd9a841258c30e28 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 10 Jan 2013 08:09:26 +0100
Subject: [PATCH 091/364] * grub-core/kern/disk.c (grub_disk_write): Fix
sector number on 4K sector devices.
---
ChangeLog | 5 +++++
grub-core/kern/disk.c | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 75fb85a..48d297d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-10 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/kern/disk.c (grub_disk_write): Fix sector number on 4K
+ sector devices.
+
2013-01-07 Colin Watson <cjwatson@ubuntu.com>
* grub-core/io/bufio.c (grub_bufio_open): Use grub_zalloc instead of
diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c
index 1f55f90..94318af 100644
--- a/grub-core/kern/disk.c
+++ b/grub-core/kern/disk.c
@@ -658,7 +658,8 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
- if ((disk->dev->write) (disk, sector, 1, tmp_buf) != GRUB_ERR_NONE)
+ if ((disk->dev->write) (disk, transform_sector (disk, sector),
+ 1, tmp_buf) != GRUB_ERR_NONE)
goto finish;
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
@@ -674,11 +675,15 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
len = size & ~((1 << disk->log_sector_size) - 1);
n = size >> disk->log_sector_size;
- if ((disk->dev->write) (disk, sector, n, buf) != GRUB_ERR_NONE)
+ if ((disk->dev->write) (disk, transform_sector (disk, sector),
+ n, buf) != GRUB_ERR_NONE)
goto finish;
while (n--)
- grub_disk_cache_invalidate (disk->dev->id, disk->id, sector++);
+ {
+ grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
+ sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
+ }
buf = (const char *) buf + len;
size -= len;
--
1.8.1.4

View File

@ -0,0 +1,150 @@
From 474f5d13721ed87fde38bdad282164ee84c1be0a Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 10 Jan 2013 12:50:01 +0100
Subject: [PATCH 092/364] Support Apple FAT binaries on non-Apple
platforms.
* include/grub/macho.h (GRUB_MACHO_FAT_EFI_MAGIC): New define.
* include/grub/i386/macho.h (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT):
Likewise.
* grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Parse
Apple FAT binaries.
---
ChangeLog | 10 ++++++++
grub-core/loader/efi/chainloader.c | 48 +++++++++++++++++++++++++++++++++++---
include/grub/i386/macho.h | 5 ++++
include/grub/macho.h | 1 +
4 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 48d297d..4567cae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2013-01-10 Vladimir Serbinenko <phcoder@gmail.com>
+ Support Apple FAT binaries on non-Apple platforms.
+
+ * include/grub/macho.h (GRUB_MACHO_FAT_EFI_MAGIC): New define.
+ * include/grub/i386/macho.h (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT):
+ Likewise.
+ * grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Parse
+ Apple FAT binaries.
+
+2013-01-10 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/kern/disk.c (grub_disk_write): Fix sector number on 4K
sector devices.
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 3f3e6e3..c0fed80 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -35,6 +35,10 @@
#include <grub/command.h>
#include <grub/i18n.h>
#include <grub/net.h>
+#if defined (__i386__) || defined (__x86_64__)
+#include <grub/macho.h>
+#include <grub/i386/macho.h>
+#endif
GRUB_MOD_LICENSE ("GPLv3+");
@@ -198,6 +202,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_efi_device_path_t *dp = 0;
grub_efi_loaded_image_t *loaded_image;
char *filename;
+ void *boot_image = 0;
grub_efi_handle_t dev_handle = 0;
if (argc == 0)
@@ -278,7 +283,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
- if (grub_file_read (file, (void *) ((grub_addr_t) address), size) != size)
+ boot_image = (void *) ((grub_addr_t) address);
+ if (grub_file_read (file, boot_image, size) != size)
{
if (grub_errno == GRUB_ERR_NONE)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
@@ -287,9 +293,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
+#if defined (__i386__) || defined (__x86_64__)
+ if (size >= (grub_ssize_t) sizeof (struct grub_macho_fat_header))
+ {
+ struct grub_macho_fat_header *head = boot_image;
+ if (head->magic
+ == grub_cpu_to_le32_compile_time (GRUB_MACHO_FAT_EFI_MAGIC))
+ {
+ grub_uint32_t i;
+ struct grub_macho_fat_arch *archs
+ = (struct grub_macho_fat_arch *) (head + 1);
+ for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++)
+ {
+ if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype))
+ break;
+ }
+ if (i == grub_cpu_to_le32 (head->nfat_arch))
+ {
+ grub_error (GRUB_ERR_BAD_OS, "no compatible arch found");
+ goto fail;
+ }
+ if (grub_cpu_to_le32 (archs[i].offset)
+ > ~grub_cpu_to_le32 (archs[i].size)
+ || grub_cpu_to_le32 (archs[i].offset)
+ + grub_cpu_to_le32 (archs[i].size)
+ > (grub_size_t) size)
+ {
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
+ goto fail;
+ }
+ boot_image = (char *) boot_image + grub_cpu_to_le32 (archs[i].offset);
+ size = grub_cpu_to_le32 (archs[i].size);
+ }
+ }
+#endif
+
status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
- (void *) ((grub_addr_t) address), size,
- &image_handle);
+ boot_image, size,
+ &image_handle);
if (status != GRUB_EFI_SUCCESS)
{
if (status == GRUB_EFI_OUT_OF_RESOURCES)
diff --git a/include/grub/i386/macho.h b/include/grub/i386/macho.h
index f22c211..5ee9f9e 100644
--- a/include/grub/i386/macho.h
+++ b/include/grub/i386/macho.h
@@ -23,6 +23,11 @@
#define GRUB_MACHO_CPUTYPE_IS_HOST32(x) ((x)==0x00000007)
#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x)==0x01000007)
+#ifdef __x86_64__
+#define GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT(x) ((x)==0x01000007)
+#else
+#define GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT(x) ((x)==0x00000007)
+#endif
struct grub_macho_thread32
{
diff --git a/include/grub/macho.h b/include/grub/macho.h
index 6a98b6e..21f0714 100644
--- a/include/grub/macho.h
+++ b/include/grub/macho.h
@@ -27,6 +27,7 @@ struct grub_macho_fat_header
grub_uint32_t nfat_arch;
} __attribute__ ((packed));
#define GRUB_MACHO_FAT_MAGIC 0xcafebabe
+#define GRUB_MACHO_FAT_EFI_MAGIC 0x0ef1fab9
typedef grub_uint32_t grub_macho_cpu_type_t;
typedef grub_uint32_t grub_macho_cpu_subtype_t;
--
1.8.1.4

View File

@ -0,0 +1,628 @@
From 75bd81540fab6830213d51e024b53d51f3fe6dcb Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Fri, 11 Jan 2013 07:41:05 +0100
Subject: [PATCH 093/364] * grub-core/fs/ntfs.c: Ue more appropriate
types. * grub-core/fs/ntfscomp.c: Likewise. * include/grub/ntfs.h:
Likewise.
---
ChangeLog | 6 +++
grub-core/fs/ntfs.c | 140 +++++++++++++++++++++++++-----------------------
grub-core/fs/ntfscomp.c | 16 +++---
include/grub/ntfs.h | 20 +++----
4 files changed, 96 insertions(+), 86 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4567cae..41dbadd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-01-10 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/fs/ntfs.c: Ue more appropriate types.
+ * grub-core/fs/ntfscomp.c: Likewise.
+ * include/grub/ntfs.h: Likewise.
+
+2013-01-10 Vladimir Serbinenko <phcoder@gmail.com>
+
Support Apple FAT binaries on non-Apple platforms.
* include/grub/macho.h (GRUB_MACHO_FAT_EFI_MAGIC): New define.
diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c
index 6004e1f..e7861d8 100644
--- a/grub-core/fs/ntfs.c
+++ b/grub-core/fs/ntfs.c
@@ -55,10 +55,10 @@ u64at (void *ptr, grub_size_t ofs)
grub_ntfscomp_func_t grub_ntfscomp_func;
static grub_err_t
-fixup (char *buf, int len, const char *magic)
+fixup (grub_uint8_t *buf, grub_size_t len, const grub_uint8_t *magic)
{
- int ss;
- char *pu;
+ grub_uint16_t ss;
+ grub_uint8_t *pu;
grub_uint16_t us;
COMPILE_TIME_ASSERT ((1 << GRUB_NTFS_BLK_SHR) == GRUB_DISK_SECTOR_SIZE);
@@ -86,9 +86,9 @@ fixup (char *buf, int len, const char *magic)
return 0;
}
-static grub_err_t read_mft (struct grub_ntfs_data *data, char *buf,
+static grub_err_t read_mft (struct grub_ntfs_data *data, grub_uint8_t *buf,
grub_uint32_t mftno);
-static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
+static grub_err_t read_attr (struct grub_ntfs_attr *at, grub_uint8_t *dest,
grub_disk_addr_t ofs, grub_size_t len,
int cached,
void
@@ -97,7 +97,8 @@ static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
unsigned offset,
unsigned length));
-static grub_err_t read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
+static grub_err_t read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa,
+ grub_uint8_t *dest,
grub_disk_addr_t ofs, grub_size_t len,
int cached,
void
@@ -123,8 +124,8 @@ free_attr (struct grub_ntfs_attr *at)
grub_free (at->sbuf);
}
-static char *
-find_attr (struct grub_ntfs_attr *at, unsigned char attr)
+static grub_uint8_t *
+find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr)
{
if (at->flags & GRUB_NTFS_AF_ALST)
{
@@ -133,9 +134,9 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
{
at->attr_cur = at->attr_nxt;
at->attr_nxt += u16at (at->attr_cur, 4);
- if (((unsigned char) *at->attr_cur == attr) || (attr == 0))
+ if ((*at->attr_cur == attr) || (attr == 0))
{
- char *new_pos;
+ grub_uint8_t *new_pos;
if (at->flags & GRUB_NTFS_AF_MMFT)
{
@@ -148,7 +149,8 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
512, at->emft_buf + 512)))
return NULL;
- if (fixup (at->emft_buf, at->mft->data->mft_size, "FILE"))
+ if (fixup (at->emft_buf, at->mft->data->mft_size,
+ (const grub_uint8_t *) "FILE"))
return NULL;
}
else
@@ -159,10 +161,9 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
}
new_pos = &at->emft_buf[u16at (at->emft_buf, 0x14)];
- while ((unsigned char) *new_pos != 0xFF)
+ while (*new_pos != 0xFF)
{
- if (((unsigned char) *new_pos ==
- (unsigned char) *at->attr_cur)
+ if ((*new_pos == *at->attr_cur)
&& (u16at (new_pos, 0xE) == u16at (at->attr_cur, 0x18)))
{
return new_pos;
@@ -178,18 +179,18 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
return NULL;
}
at->attr_cur = at->attr_nxt;
- while ((unsigned char) *at->attr_cur != 0xFF)
+ while (*at->attr_cur != 0xFF)
{
at->attr_nxt += u16at (at->attr_cur, 4);
- if ((unsigned char) *at->attr_cur == GRUB_NTFS_AT_ATTRIBUTE_LIST)
+ if (*at->attr_cur == GRUB_NTFS_AT_ATTRIBUTE_LIST)
at->attr_end = at->attr_cur;
- if (((unsigned char) *at->attr_cur == attr) || (attr == 0))
+ if ((*at->attr_cur == attr) || (attr == 0))
return at->attr_cur;
at->attr_cur = at->attr_nxt;
}
if (at->attr_end)
{
- char *pa;
+ grub_uint8_t *pa;
at->emft_buf = grub_malloc (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR);
if (at->emft_buf == NULL)
@@ -198,7 +199,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
pa = at->attr_end;
if (pa[8])
{
- int n;
+ grub_uint32_t n;
n = ((u32at (pa, 0x30) + GRUB_DISK_SECTOR_SIZE - 1)
& (~(GRUB_DISK_SECTOR_SIZE - 1)));
@@ -223,7 +224,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
at->flags |= GRUB_NTFS_AF_ALST;
while (at->attr_nxt < at->attr_end)
{
- if (((unsigned char) *at->attr_nxt == attr) || (attr == 0))
+ if ((*at->attr_nxt == attr) || (attr == 0))
break;
at->attr_nxt += u16at (at->attr_nxt, 4);
}
@@ -243,7 +244,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
pa = at->attr_nxt + u16at (pa, 4);
while (pa < at->attr_end)
{
- if ((unsigned char) *pa != attr)
+ if (*pa != attr)
break;
if (read_attr
(at, pa + 0x10,
@@ -260,11 +261,11 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
return NULL;
}
-static char *
+static grub_uint8_t *
locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft,
- unsigned char attr)
+ grub_uint8_t attr)
{
- char *pa;
+ grub_uint8_t *pa;
init_attr (at, mft);
pa = find_attr (at, attr);
@@ -288,8 +289,8 @@ locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft,
return pa;
}
-static char *
-read_run_data (char *run, int nn, grub_disk_addr_t * val, int sig)
+static grub_uint8_t *
+read_run_data (grub_uint8_t *run, int nn, grub_disk_addr_t * val, int sig)
{
grub_disk_addr_t r, v;
@@ -298,7 +299,7 @@ read_run_data (char *run, int nn, grub_disk_addr_t * val, int sig)
while (nn--)
{
- r += v * (*(unsigned char *) (run++));
+ r += v * (*(run++));
v <<= 8;
}
@@ -312,14 +313,14 @@ read_run_data (char *run, int nn, grub_disk_addr_t * val, int sig)
grub_err_t
grub_ntfs_read_run_list (struct grub_ntfs_rlst * ctx)
{
- int c1, c2;
+ grub_uint8_t c1, c2;
grub_disk_addr_t val;
- char *run;
+ grub_uint8_t *run;
run = ctx->cur_run;
retry:
- c1 = ((unsigned char) (*run) & 0xF);
- c2 = ((unsigned char) (*run) >> 4);
+ c1 = ((*run) & 0xF);
+ c2 = ((*run) >> 4);
if (!c1)
{
if ((ctx->attr) && (ctx->attr->flags & GRUB_NTFS_AF_ALST))
@@ -330,7 +331,7 @@ retry:
save_hook = ctx->comp.disk->read_hook;
ctx->comp.disk->read_hook = 0;
- run = find_attr (ctx->attr, (unsigned char) *ctx->attr->attr_cur);
+ run = find_attr (ctx->attr, *ctx->attr->attr_cur);
ctx->comp.disk->read_hook = save_hook;
if (run)
{
@@ -376,7 +377,7 @@ grub_ntfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t block)
}
static grub_err_t
-read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
+read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest,
grub_disk_addr_t ofs, grub_size_t len, int cached,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
@@ -479,7 +480,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
if (!(ctx->flags & GRUB_NTFS_RF_COMP))
{
grub_fshelp_read_file (ctx->comp.disk, (grub_fshelp_node_t) ctx,
- read_hook, ofs, len, dest,
+ read_hook, ofs, len, (char *) dest,
grub_ntfs_read_block, ofs + len,
ctx->comp.log_spc, 0);
return grub_errno;
@@ -492,23 +493,23 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
}
static grub_err_t
-read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
+read_attr (struct grub_ntfs_attr *at, grub_uint8_t *dest, grub_disk_addr_t ofs,
grub_size_t len, int cached,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
unsigned length))
{
- char *save_cur;
- unsigned char attr;
- char *pp;
+ grub_uint8_t *save_cur;
+ grub_uint8_t attr;
+ grub_uint8_t *pp;
grub_err_t ret;
save_cur = at->attr_cur;
at->attr_nxt = at->attr_cur;
- attr = (unsigned char) *at->attr_nxt;
+ attr = *at->attr_nxt;
if (at->flags & GRUB_NTFS_AF_ALST)
{
- char *pa;
+ grub_uint8_t *pa;
grub_disk_addr_t vcn;
/* If compression is possible make sure that we include possible
@@ -521,7 +522,7 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
pa = at->attr_nxt + u16at (at->attr_nxt, 4);
while (pa < at->attr_end)
{
- if ((unsigned char) *pa != attr)
+ if (*pa != attr)
break;
if (u32at (pa, 8) > vcn)
break;
@@ -541,13 +542,13 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
}
static grub_err_t
-read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
+read_mft (struct grub_ntfs_data *data, grub_uint8_t *buf, grub_uint32_t mftno)
{
if (read_attr
(&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << GRUB_NTFS_BLK_SHR),
data->mft_size << GRUB_NTFS_BLK_SHR, 0, 0))
return grub_error (GRUB_ERR_BAD_FS, "read MFT 0x%X fails", mftno);
- return fixup (buf, data->mft_size, "FILE");
+ return fixup (buf, data->mft_size, (const grub_uint8_t *) "FILE");
}
static grub_err_t
@@ -570,7 +571,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
if ((flag & 2) == 0)
{
- char *pa;
+ grub_uint8_t *pa;
pa = locate_attr (&mft->attr, mft, GRUB_NTFS_AT_DATA);
if (pa == NULL)
@@ -598,24 +599,25 @@ free_file (struct grub_ntfs_file *mft)
}
static int
-list_file (struct grub_ntfs_file *diro, char *pos,
+list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos,
int NESTED_FUNC_ATTR
(*hook) (const char *filename,
enum grub_fshelp_filetype filetype,
grub_fshelp_node_t node))
{
- char *np;
+ grub_uint8_t *np;
int ns;
while (1)
{
- char *ustr, namespace;
+ grub_uint8_t namespace;
+ char *ustr;
if (pos[0xC] & 2) /* end signature */
break;
np = pos + 0x50;
- ns = (unsigned char) *(np++);
+ ns = *(np++);
namespace = *(np++);
/*
@@ -698,7 +700,7 @@ grub_ntfs_read_symlink (grub_fshelp_node_t node)
char *buf, *end;
grub_size_t len;
grub_size_t i;
- char *pa;
+ grub_uint8_t *pa;
grub_size_t off;
mft = (struct grub_ntfs_file *) node;
@@ -717,7 +719,7 @@ grub_ntfs_read_symlink (grub_fshelp_node_t node)
return NULL;
}
- err = read_attr (&mft->attr, (char *) &symdesc, 0,
+ err = read_attr (&mft->attr, (grub_uint8_t *) &symdesc, 0,
sizeof (struct symlink_descriptor), 1, 0);
if (err)
return NULL;
@@ -744,7 +746,7 @@ grub_ntfs_read_symlink (grub_fshelp_node_t node)
if (!buf16)
return NULL;
- err = read_attr (&mft->attr, (char *) buf16, off, len, 1, 0);
+ err = read_attr (&mft->attr, (grub_uint8_t *) buf16, off, len, 1, 0);
if (err)
return NULL;
@@ -781,9 +783,9 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
enum grub_fshelp_filetype filetype,
grub_fshelp_node_t node))
{
- unsigned char *bitmap;
+ grub_uint8_t *bitmap;
struct grub_ntfs_attr attr, *at;
- char *cur_pos, *indx, *bmp;
+ grub_uint8_t *cur_pos, *indx, *bmp;
int ret = 0;
grub_size_t bitmap_len;
struct grub_ntfs_file *mft;
@@ -834,7 +836,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
{
int ofs;
- ofs = (unsigned char) cur_pos[0xA];
+ ofs = cur_pos[0xA];
/* Namelen=4, Name="$I30" */
if ((cur_pos[9] == 4) &&
(u32at (cur_pos, ofs) == 0x490024) &&
@@ -851,7 +853,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
if (is_resident)
{
- grub_memcpy (bmp, (char *) (cur_pos + u16at (cur_pos, 0x14)),
+ grub_memcpy (bmp, cur_pos + u16at (cur_pos, 0x14),
bitmap_len);
}
else
@@ -865,7 +867,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
bitmap_len = u32at (cur_pos, 0x30);
}
- bitmap = (unsigned char *) bmp;
+ bitmap = bmp;
break;
}
}
@@ -904,7 +906,8 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
if ((read_attr
(at, indx, i * (mft->data->idx_size << GRUB_NTFS_BLK_SHR),
(mft->data->idx_size << GRUB_NTFS_BLK_SHR), 0, 0))
- || (fixup (indx, mft->data->idx_size, "INDX")))
+ || (fixup (indx, mft->data->idx_size,
+ (const grub_uint8_t *) "INDX")))
goto done;
ret = list_file (mft, &indx[0x18 + u16at (indx, 0x18)], hook);
if (ret)
@@ -963,14 +966,15 @@ grub_ntfs_mount (grub_disk_t disk)
for (data->log_spc = 0; (1U << data->log_spc) < spc; data->log_spc++);
if (bpb.clusters_per_mft > 0)
- data->mft_size = bpb.clusters_per_mft << data->log_spc;
+ data->mft_size = ((grub_disk_addr_t) bpb.clusters_per_mft) << data->log_spc;
else
- data->mft_size = 1 << (-bpb.clusters_per_mft - GRUB_NTFS_BLK_SHR);
+ data->mft_size = 1ULL << (-bpb.clusters_per_mft - GRUB_NTFS_BLK_SHR);
if (bpb.clusters_per_index > 0)
- data->idx_size = bpb.clusters_per_index << data->log_spc;
+ data->idx_size = (((grub_disk_addr_t) bpb.clusters_per_index)
+ << data->log_spc);
else
- data->idx_size = 1 << (-bpb.clusters_per_index - GRUB_NTFS_BLK_SHR);
+ data->idx_size = 1ULL << (-bpb.clusters_per_index - GRUB_NTFS_BLK_SHR);
data->mft_start = grub_le_to_cpu64 (bpb.mft_lcn) << data->log_spc;
@@ -990,7 +994,7 @@ grub_ntfs_mount (grub_disk_t disk)
data->uuid = grub_le_to_cpu64 (bpb.num_serial);
- if (fixup (data->mmft.buf, data->mft_size, "FILE"))
+ if (fixup (data->mmft.buf, data->mft_size, (const grub_uint8_t *) "FILE"))
goto fail;
if (!locate_attr (&data->mmft.attr, &data->mmft, GRUB_NTFS_AT_DATA))
@@ -1130,7 +1134,8 @@ grub_ntfs_read (grub_file_t file, char *buf, grub_size_t len)
if (file->read_hook)
mft->attr.save_pos = 1;
- read_attr (&mft->attr, buf, file->offset, len, 1, file->read_hook);
+ read_attr (&mft->attr, (grub_uint8_t *) buf, file->offset, len, 1,
+ file->read_hook);
return (grub_errno) ? -1 : (grub_ssize_t) len;
}
@@ -1158,7 +1163,7 @@ grub_ntfs_label (grub_device_t device, char **label)
{
struct grub_ntfs_data *data = 0;
struct grub_fshelp_node *mft = 0;
- char *pa;
+ grub_uint8_t *pa;
grub_dl_ref (my_mod);
@@ -1188,7 +1193,7 @@ grub_ntfs_label (grub_device_t device, char **label)
pa = find_attr (&mft->attr, GRUB_NTFS_AT_VOLUME_NAME);
if ((pa) && (pa[8] == 0) && (u32at (pa, 0x10)))
{
- char *buf;
+ grub_uint8_t *buf;
int len;
len = u32at (pa, 0x10) / 2;
@@ -1199,10 +1204,9 @@ grub_ntfs_label (grub_device_t device, char **label)
int i;
for (i = 0; i < len; i++)
tmp[i] = grub_le_to_cpu16 (grub_get_unaligned16 (pa + 2 * i));
- *grub_utf16_to_utf8 ((grub_uint8_t *) buf, tmp, len) =
- '\0';
+ *grub_utf16_to_utf8 (buf, tmp, len) = '\0';
}
- *label = buf;
+ *label = (char *) buf;
}
fail:
diff --git a/grub-core/fs/ntfscomp.c b/grub-core/fs/ntfscomp.c
index 9b3b75d..02ea9fd 100644
--- a/grub-core/fs/ntfscomp.c
+++ b/grub-core/fs/ntfscomp.c
@@ -45,21 +45,21 @@ decomp_nextvcn (struct grub_ntfs_comp *cc)
}
static grub_err_t
-decomp_getch (struct grub_ntfs_comp *cc, unsigned char *res)
+decomp_getch (struct grub_ntfs_comp *cc, grub_uint8_t *res)
{
if (cc->cbuf_ofs >= (1U << (cc->log_spc + GRUB_NTFS_BLK_SHR)))
{
if (decomp_nextvcn (cc))
return grub_errno;
}
- *res = (unsigned char) cc->cbuf[cc->cbuf_ofs++];
+ *res = cc->cbuf[cc->cbuf_ofs++];
return 0;
}
static grub_err_t
decomp_get16 (struct grub_ntfs_comp *cc, grub_uint16_t * res)
{
- unsigned char c1 = 0, c2 = 0;
+ grub_uint8_t c1 = 0, c2 = 0;
if ((decomp_getch (cc, &c1)) || (decomp_getch (cc, &c2)))
return grub_errno;
@@ -69,7 +69,7 @@ decomp_get16 (struct grub_ntfs_comp *cc, grub_uint16_t * res)
/* Decompress a block (4096 bytes) */
static grub_err_t
-decomp_block (struct grub_ntfs_comp *cc, char *dest)
+decomp_block (struct grub_ntfs_comp *cc, grub_uint8_t *dest)
{
grub_uint16_t flg, cnt;
@@ -81,7 +81,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
{
if (flg & 0x8000)
{
- unsigned char tag;
+ grub_uint8_t tag;
grub_uint32_t bits, copied;
bits = copied = tag = 0;
@@ -136,7 +136,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
}
else
{
- unsigned char ch = 0;
+ grub_uint8_t ch = 0;
if (decomp_getch (cc, &ch))
return grub_errno;
@@ -177,7 +177,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
}
static grub_err_t
-read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
+read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
{
int log_cpb = GRUB_NTFS_LOG_COM_SEC - ctx->comp.log_spc;
@@ -289,7 +289,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
}
static grub_err_t
-ntfscomp (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
+ntfscomp (struct grub_ntfs_attr *at, grub_uint8_t *dest, grub_disk_addr_t ofs,
grub_size_t len, struct grub_ntfs_rlst *ctx, grub_disk_addr_t vcn)
{
grub_err_t ret;
diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h
index cc28a01..37983c4 100644
--- a/include/grub/ntfs.h
+++ b/include/grub/ntfs.h
@@ -132,17 +132,17 @@ struct grub_ntfs_bpb
struct grub_ntfs_attr
{
int flags;
- char *emft_buf, *edat_buf;
- char *attr_cur, *attr_nxt, *attr_end;
+ grub_uint8_t *emft_buf, *edat_buf;
+ grub_uint8_t *attr_cur, *attr_nxt, *attr_end;
grub_uint32_t save_pos;
- char *sbuf;
+ grub_uint8_t *sbuf;
struct grub_ntfs_file *mft;
};
struct grub_ntfs_file
{
struct grub_ntfs_data *data;
- char *buf;
+ grub_uint8_t *buf;
grub_uint64_t size;
grub_uint64_t mtime;
grub_uint32_t ino;
@@ -155,10 +155,10 @@ struct grub_ntfs_data
struct grub_ntfs_file cmft;
struct grub_ntfs_file mmft;
grub_disk_t disk;
- grub_uint32_t mft_size;
- grub_uint32_t idx_size;
+ grub_uint64_t mft_size;
+ grub_uint64_t idx_size;
int log_spc;
- grub_uint32_t mft_start;
+ grub_uint64_t mft_start;
grub_uint64_t uuid;
};
@@ -175,20 +175,20 @@ struct grub_ntfs_comp
struct grub_ntfs_comp_table_element comp_table[16];
grub_uint32_t cbuf_ofs, cbuf_vcn;
int log_spc;
- char *cbuf;
+ grub_uint8_t *cbuf;
};
struct grub_ntfs_rlst
{
int flags;
grub_disk_addr_t target_vcn, curr_vcn, next_vcn, curr_lcn;
- char *cur_run;
+ grub_uint8_t *cur_run;
struct grub_ntfs_attr *attr;
struct grub_ntfs_comp comp;
};
typedef grub_err_t (*grub_ntfscomp_func_t) (struct grub_ntfs_attr * at,
- char *dest,
+ grub_uint8_t *dest,
grub_disk_addr_t ofs,
grub_size_t len,
struct grub_ntfs_rlst * ctx,
--
1.8.1.4

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,224 @@
From d803dd359dd431cad08e95952f90c3f4f5acc9b7 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Sat, 12 Jan 2013 13:30:37 +0000
Subject: [PATCH 095/364] Clean up dangling references to grub-setup. Fixes
Ubuntu bug #1082045.
* docs/grub.texi (Images): Refer generally to grub-install rather
than directly to grub-setup.
(Installing GRUB using grub-install): Remove direct reference to
grub-setup.
(Device map) Likewise.
(Invoking grub-install): Likewise.
* docs/man/grub-install.h2m (SEE ALSO): Likewise.
* docs/man/grub-mkimage.h2m (SEE ALSO): Likewise.
* util/grub-install.in (usage): Likewise.
* util/bash-completion.d/grub-completion.bash.in (_grub_setup):
Apply to grub-bios-setup and grub-sparc64-setup rather than to
grub-setup.
* configure.ac: Remove grub_setup output variable.
* docs/man/grub-bios-setup.h2m (NAME): Change name from grub-setup
to grub-bios-setup.
* docs/man/grub-sparc64-setup.h2m (NAME): Change name from
grub-setup to grub-sparc64-setup.
---
ChangeLog | 25 +++++++++++++++++++++++++
configure.ac | 1 -
docs/grub.texi | 24 ++++++++++++------------
docs/man/grub-bios-setup.h2m | 2 +-
docs/man/grub-install.h2m | 1 -
docs/man/grub-mkimage.h2m | 1 -
docs/man/grub-sparc64-setup.h2m | 2 +-
util/bash-completion.d/grub-completion.bash.in | 14 ++++++++++----
util/grub-install.in | 4 ++--
9 files changed, 51 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 22b18b1..61bf8e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2013-01-12 Colin Watson <cjwatson@ubuntu.com>
+
+ Clean up dangling references to grub-setup.
+ Fixes Ubuntu bug #1082045.
+
+ * docs/grub.texi (Images): Refer generally to grub-install rather
+ than directly to grub-setup.
+ (Installing GRUB using grub-install): Remove direct reference to
+ grub-setup.
+ (Device map) Likewise.
+ (Invoking grub-install): Likewise.
+ * docs/man/grub-install.h2m (SEE ALSO): Likewise.
+ * docs/man/grub-mkimage.h2m (SEE ALSO): Likewise.
+ * util/grub-install.in (usage): Likewise.
+
+ * util/bash-completion.d/grub-completion.bash.in (_grub_setup):
+ Apply to grub-bios-setup and grub-sparc64-setup rather than to
+ grub-setup.
+ * configure.ac: Remove grub_setup output variable.
+
+ * docs/man/grub-bios-setup.h2m (NAME): Change name from grub-setup
+ to grub-bios-setup.
+ * docs/man/grub-sparc64-setup.h2m (NAME): Change name from
+ grub-setup to grub-sparc64-setup.
+
2013-01-11 Vladimir Serbinenko <phcoder@gmail.com>
Import gcrypt public-key cryptography and implement signature checking.
diff --git a/configure.ac b/configure.ac
index dde954e..92b550a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,7 +64,6 @@ grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot])
grub_TRANSFORM([grub-script-check])
grub_TRANSFORM([grub-set-default])
-grub_TRANSFORM([grub-setup])
grub_TRANSFORM([grub-sparc64-setup])
# Optimization flag. Allow user to override.
diff --git a/docs/grub.texi b/docs/grub.texi
index a92bd96..e75bae9 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -622,11 +622,11 @@ This install doesn't conflict with standard install as long as they are in
separate directories.
Note that @command{grub-install} is actually just a shell script and the
-real task is done by @command{grub-mkimage} and @command{grub-setup}.
-Therefore, you may run those commands directly to install GRUB, without
-using @command{grub-install}. Don't do that, however, unless you are very
-familiar with the internals of GRUB. Installing a boot loader on a running
-OS may be extremely dangerous.
+real task is done by other tools such as @command{grub-mkimage}. Therefore,
+you may run those commands directly to install GRUB, without using
+@command{grub-install}. Don't do that, however, unless you are very familiar
+with the internals of GRUB. Installing a boot loader on a running OS may be
+extremely dangerous.
@node Making a GRUB bootable CD-ROM
@section Making a GRUB bootable CD-ROM
@@ -688,8 +688,8 @@ storage devices.
@section The map between BIOS drives and OS devices
If the device map file exists, the GRUB utilities (@command{grub-probe},
-@command{grub-setup}, etc.) read it to map BIOS drives to OS devices. This
-file consists of lines like this:
+etc.) read it to map BIOS drives to OS devices. This file consists of lines
+like this:
@example
(@var{device}) @var{file}
@@ -2283,8 +2283,8 @@ bytes.
The sole function of @file{boot.img} is to read the first sector of the core
image from a local disk and jump to it. Because of the size restriction,
@file{boot.img} cannot understand any file system structure, so
-@command{grub-setup} hardcodes the location of the first sector of the core
-image into @file{boot.img} when installing GRUB.
+@command{grub-install} hardcodes the location of the first sector of the
+core image into @file{boot.img} when installing GRUB.
@item diskboot.img
This image is used as the first sector of the core image when booting from a
@@ -4689,9 +4689,9 @@ GRUB.
@node Invoking grub-install
@chapter Invoking grub-install
-The program @command{grub-install} installs GRUB on your drive using
-@command{grub-mkimage} and (on some platforms) @command{grub-setup}. You
-must specify the device name on which you want to install GRUB, like this:
+The program @command{grub-install} generates a GRUB core image using
+@command{grub-mkimage} and installs it on your system. You must specify the
+device name on which you want to install GRUB, like this:
@example
grub-install @var{install_device}
diff --git a/docs/man/grub-bios-setup.h2m b/docs/man/grub-bios-setup.h2m
index eebe3ef..ac6ede3 100644
--- a/docs/man/grub-bios-setup.h2m
+++ b/docs/man/grub-bios-setup.h2m
@@ -1,5 +1,5 @@
[NAME]
-grub-setup \- set up a device to boot using GRUB
+grub-bios-setup \- set up a device to boot using GRUB
[SEE ALSO]
.BR grub-install (8),
.BR grub-mkimage (1),
diff --git a/docs/man/grub-install.h2m b/docs/man/grub-install.h2m
index 2de371a..8cbbc87 100644
--- a/docs/man/grub-install.h2m
+++ b/docs/man/grub-install.h2m
@@ -3,5 +3,4 @@ grub-install \- install GRUB to a device
[SEE ALSO]
.BR grub-mkconfig (8),
.BR grub-mkimage (1),
-.BR grub-setup (8),
.BR grub-mkrescue (1)
diff --git a/docs/man/grub-mkimage.h2m b/docs/man/grub-mkimage.h2m
index ca08b0c..f0fbc2b 100644
--- a/docs/man/grub-mkimage.h2m
+++ b/docs/man/grub-mkimage.h2m
@@ -2,6 +2,5 @@
grub-mkimage \- make a bootable image of GRUB
[SEE ALSO]
.BR grub-install (8),
-.BR grub-setup (8),
.BR grub-mkrescue (1),
.BR grub-mknetdir (8)
diff --git a/docs/man/grub-sparc64-setup.h2m b/docs/man/grub-sparc64-setup.h2m
index eebe3ef..18f803a 100644
--- a/docs/man/grub-sparc64-setup.h2m
+++ b/docs/man/grub-sparc64-setup.h2m
@@ -1,5 +1,5 @@
[NAME]
-grub-setup \- set up a device to boot using GRUB
+grub-sparc64-setup \- set up a device to boot using GRUB
[SEE ALSO]
.BR grub-install (8),
.BR grub-mkimage (1),
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 5f4b249..44bf135 100644
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in
@@ -252,10 +252,16 @@ _grub_setup () {
_filedir
fi
}
-__grub_setup_program="@grub_setup@"
-have ${__grub_setup_program} && \
- complete -F _grub_setup -o filenames ${__grub_setup_program}
-unset __grub_setup_program
+
+__grub_bios_setup_program="@grub_bios_setup@"
+have ${__grub_bios_setup_program} && \
+ complete -F _grub_setup -o filenames ${__grub_bios_setup_program}
+unset __grub_bios_setup_program
+
+__grub_sparc64_setup_program="@grub_sparc64_setup@"
+have ${__grub_sparc64_setup_program} && \
+ complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program}
+unset __grub_sparc64_setup_program
#
diff --git a/util/grub-install.in b/util/grub-install.in
index 218bbd9..aac27c7 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -114,8 +114,8 @@ echo
gettext "INSTALL_DEVICE must be system device filename.";echo
echo
-gettext_printf "%s copies GRUB images into %s, and uses grub-setup
-to install grub into the boot sector.\n" "$self" "$grubdir";echo
+gettext_printf "%s copies GRUB images into %s. On some platforms, it
+may also install GRUB into the boot sector.\n" "$self" "$grubdir";echo
echo
gettext "Report bugs to <bug-grub@gnu.org>."; echo
}
--
1.8.1.4

View File

@ -0,0 +1,76 @@
From dc00947d8ca3b793b23cf0c3c3c3af24ae57e043 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 12 Jan 2013 16:14:09 +0100
Subject: [PATCH 096/364] * autogen.sh: Do not try to delete nonexistant
files. * util/import_gcrypth.sed: Add some missing header removals.
---
ChangeLog | 5 +++++
autogen.sh | 12 +++++++++---
util/import_gcrypth.sed | 11 ++++++++---
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 61bf8e7..d83d10a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-11 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * autogen.sh: Do not try to delete nonexistant files.
+ * util/import_gcrypth.sed: Add some missing header removals.
+
2013-01-12 Colin Watson <cjwatson@ubuntu.com>
Clean up dangling references to grub-setup.
diff --git a/autogen.sh b/autogen.sh
index 5524083..7a4b5c8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -14,13 +14,19 @@ python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt
echo "Importing libgcrypt..."
python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
-rm include/grub/gcrypt/g10lib.h
-rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
+if [ -f include/grub/gcrypt/g10lib.h ]; then
+ rm include/grub/gcrypt/g10lib.h
+fi
+if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then
+ rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
+fi
ln -s ../../../grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic
for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c mpih-lshift.c mpih-rshift.c; do
- rm grub-core/lib/libgcrypt-grub/mpi/"$x"
+ if [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
+ rm grub-core/lib/libgcrypt-grub/mpi/"$x"
+ fi
ln -s generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
done
diff --git a/util/import_gcrypth.sed b/util/import_gcrypth.sed
index 1cf31bd..dead8e6 100644
--- a/util/import_gcrypth.sed
+++ b/util/import_gcrypth.sed
@@ -1,7 +1,12 @@
/^#@INSERT_SYS_SELECT_H@/ d
/^@FALLBACK_SOCKLEN_T@/ d
-/^#include <stdlib\.h>/ d
-/^#include <string\.h>/ d
-/^#include <gpg-error\.h>/ s,#include <gpg-error.h>,#include <grub/gcrypt/gpg-error.h>,
+/^# *include <stdlib\.h>/ d
+/^# *include <string\.h>/ d
+/^# *include <winsock2\.h>/ d
+/^# *include <ws2tcpip\.h>/ d
+/^# *include <time\.h>/ d
+/^# *include <sys\/socket\.h>/ d
+/^# *include <sys\/time\.h>/ d
+/^# *include <gpg-error\.h>/ s,#include <gpg-error.h>,#include <grub/gcrypt/gpg-error.h>,
s,_gcry_mpi_invm,gcry_mpi_invm,g
p
\ No newline at end of file
--
1.8.1.4

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
From a718c4254f78dd96e9fa1c1e704ba337f8e009e0 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 12 Jan 2013 16:21:06 +0100
Subject: [PATCH 098/364] * grub-core/lib/libgcrypt_wrap/mem.c
(_gcry_log_bug): Make gcrypt bugs fatal.
---
ChangeLog | 7 ++++++-
grub-core/lib/libgcrypt_wrap/mem.c | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index d83d10a..8a16591 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2013-01-11 Vladimir Serbinenko <phcoder@gmail.com>
+2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/lib/libgcrypt_wrap/mem.c (_gcry_log_bug): Make gcrypt bugs
+ fatal.
+
+2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* autogen.sh: Do not try to delete nonexistant files.
* util/import_gcrypth.sed: Add some missing header removals.
diff --git a/grub-core/lib/libgcrypt_wrap/mem.c b/grub-core/lib/libgcrypt_wrap/mem.c
index a9f0aff..64e8b62 100644
--- a/grub-core/lib/libgcrypt_wrap/mem.c
+++ b/grub-core/lib/libgcrypt_wrap/mem.c
@@ -95,6 +95,7 @@ void _gcry_log_bug (const char *fmt, ...)
grub_vprintf (fmt, args);
va_end (args);
grub_refresh ();
+ grub_abort ();
}
gcry_err_code_t
--
1.8.1.4

View File

@ -0,0 +1,90 @@
From 076ad04668ff689b023166931edca6fa03530bf9 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 12 Jan 2013 16:27:37 +0100
Subject: [PATCH 099/364] * grub-core/lib/libgcrypt_wrap/mem.c
(gcry_x*alloc): Make out of memory fatal.
---
ChangeLog | 5 +++++
grub-core/lib/libgcrypt_wrap/mem.c | 30 +++++++++++++++++++++++++-----
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8a16591..4ac0aa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/lib/libgcrypt_wrap/mem.c (gcry_x*alloc): Make out of memory
+ fatal.
+
+2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/lib/libgcrypt_wrap/mem.c (_gcry_log_bug): Make gcrypt bugs
fatal.
diff --git a/grub-core/lib/libgcrypt_wrap/mem.c b/grub-core/lib/libgcrypt_wrap/mem.c
index 64e8b62..94f9d65 100644
--- a/grub-core/lib/libgcrypt_wrap/mem.c
+++ b/grub-core/lib/libgcrypt_wrap/mem.c
@@ -35,31 +35,51 @@ gcry_is_secure (const void *a __attribute__ ((unused)))
void *
gcry_xcalloc (size_t n, size_t m)
{
- return grub_zalloc (n * m);
+ void *ret;
+ ret = grub_zalloc (n * m);
+ if (!ret)
+ grub_fatal ("gcry_xcalloc failed");
+ return ret;
}
void *
gcry_xmalloc_secure (size_t n)
{
- return grub_malloc (n);
+ void *ret;
+ ret = grub_malloc (n);
+ if (!ret)
+ grub_fatal ("gcry_xmalloc failed");
+ return ret;
}
void *
gcry_xcalloc_secure (size_t n, size_t m)
{
- return grub_zalloc (n * m);
+ void *ret;
+ ret = grub_zalloc (n * m);
+ if (!ret)
+ grub_fatal ("gcry_xcalloc failed");
+ return ret;
}
void *
gcry_xmalloc (size_t n)
{
- return grub_malloc (n);
+ void *ret;
+ ret = grub_malloc (n);
+ if (!ret)
+ grub_fatal ("gcry_xmalloc failed");
+ return ret;
}
void *
gcry_xrealloc (void *a, size_t n)
{
- return grub_realloc (a, n);
+ void *ret;
+ ret = grub_realloc (a, n);
+ if (!ret)
+ grub_fatal ("gcry_xrealloc failed");
+ return ret;
}
void
--
1.8.1.4

View File

@ -0,0 +1,351 @@
From 3db3ccbf0ad7a5c4593f94ea9660552ab82f6f08 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 12 Jan 2013 16:31:17 +0100
Subject: [PATCH 100/364] * grub-core/commands/verify.c: Mark messages
for translating.
---
ChangeLog | 4 ++
grub-core/commands/verify.c | 93 +++++++++++++++++++++++----------------------
2 files changed, 52 insertions(+), 45 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4ac0aa6..b527f7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/commands/verify.c: Mark messages for translating.
+
+2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/lib/libgcrypt_wrap/mem.c (gcry_x*alloc): Make out of memory
fatal.
diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c
index 415e4bf..66a027f 100644
--- a/grub-core/commands/verify.c
+++ b/grub-core/commands/verify.c
@@ -53,7 +53,8 @@ read_packet_header (grub_file_t sig, grub_uint8_t *out_type, grub_size_t *len)
default:
if (grub_errno)
return grub_errno;
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ /* TRANSLATORS: it's about GNUPG signatures. */
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
}
if (type == 0)
@@ -63,12 +64,12 @@ read_packet_header (grub_file_t sig, grub_uint8_t *out_type, grub_size_t *len)
}
if (!(type & 0x80))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (type & 0x40)
{
*out_type = (type & 0x3f);
if (grub_file_read (sig, &l, sizeof (l)) != 1)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (l < 192)
{
*len = l;
@@ -78,39 +79,39 @@ read_packet_header (grub_file_t sig, grub_uint8_t *out_type, grub_size_t *len)
{
*len = (l - 192) << 8;
if (grub_file_read (sig, &l, sizeof (l)) != 1)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
*len |= l;
return 0;
}
if (l == 255)
{
if (grub_file_read (sig, &l32, sizeof (l32)) != sizeof (l32))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
*len = grub_be_to_cpu32 (l32);
return 0;
}
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
}
*out_type = ((type >> 2) & 0xf);
switch (type & 0x3)
{
case 0:
if (grub_file_read (sig, &l, sizeof (l)) != sizeof (l))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
*len = l;
return 0;
case 1:
if (grub_file_read (sig, &l16, sizeof (l16)) != sizeof (l16))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
*len = grub_be_to_cpu16 (l16);
return 0;
case 2:
if (grub_file_read (sig, &l32, sizeof (l32)) != sizeof (l32))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
*len = grub_be_to_cpu32 (l32);
return 0;
}
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
}
struct signature_v4_header
@@ -210,7 +211,7 @@ grub_load_public_key (grub_file_t f)
if (grub_file_read (f, &v, sizeof (v)) != sizeof (v))
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
@@ -218,12 +219,12 @@ grub_load_public_key (grub_file_t f)
if (v != 4)
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
if (grub_file_read (f, &creation_time, sizeof (creation_time)) != sizeof (creation_time))
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
@@ -231,7 +232,7 @@ grub_load_public_key (grub_file_t f)
if (grub_file_read (f, &pk, sizeof (pk)) != sizeof (pk))
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
@@ -263,19 +264,19 @@ grub_load_public_key (grub_file_t f)
grub_uint8_t buffer[4096];
if (grub_file_read (f, &l, sizeof (l)) != sizeof (l))
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
lb = (grub_be_to_cpu16 (l) + 7) / 8;
if (lb > sizeof (buffer) - sizeof (grub_uint16_t))
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
if (grub_file_read (f, buffer + sizeof (grub_uint16_t), lb) != (grub_ssize_t) lb)
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
grub_memcpy (buffer, &l, sizeof (l));
@@ -285,7 +286,7 @@ grub_load_public_key (grub_file_t f)
if (gcry_mpi_scan (&sk->mpis[i], GCRYMPI_FMT_PGP,
buffer, lb + sizeof (grub_uint16_t), 0))
{
- grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
}
}
@@ -357,29 +358,29 @@ grub_verify_signature (grub_file_t f, grub_file_t sig,
return err;
if (type != 0x2)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (grub_file_read (sig, &v, sizeof (v)) != sizeof (v))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (v != 4)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (grub_file_read (sig, &v4, sizeof (v4)) != sizeof (v4))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
h = v4.hash;
t = v4.type;
pk = v4.pkeyalgo;
if (t != 0)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (h >= ARRAY_SIZE (hashes) || hashes[h] == NULL)
return grub_error (GRUB_ERR_BAD_SIGNATURE, "unknown hash");
if (pk >= ARRAY_SIZE (pkalgos) || pkalgos[pk].name == NULL)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
hash = grub_crypto_lookup_md_by_name (hashes[h]);
if (!hash)
@@ -420,7 +421,7 @@ grub_verify_signature (grub_file_t f, grub_file_t sig,
grub_uint8_t readbuf[4096];
r = grub_file_read (sig, readbuf, rem < (grub_ssize_t) sizeof (readbuf) ? rem : (grub_ssize_t) sizeof (readbuf));
if (r < 0)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (r == 0)
break;
hash->write (context, readbuf, r);
@@ -432,17 +433,17 @@ grub_verify_signature (grub_file_t f, grub_file_t sig,
hash->write (context, &headlen, sizeof (headlen));
r = grub_file_read (sig, &unhashed_sub, sizeof (unhashed_sub));
if (r != sizeof (unhashed_sub))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
{
grub_uint8_t readbuf[4096];
grub_uint8_t *ptr;
grub_uint32_t l;
rem = grub_be_to_cpu16 (unhashed_sub);
if (rem > (int) sizeof (readbuf))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
r = grub_file_read (sig, readbuf, rem);
if (r != rem)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
for (ptr = readbuf; ptr < readbuf + rem; ptr += l)
{
if (*ptr < 192)
@@ -473,9 +474,9 @@ grub_verify_signature (grub_file_t f, grub_file_t sig,
hval = hash->read (context);
if (grub_file_read (sig, hash_start, sizeof (hash_start)) != sizeof (hash_start))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (grub_memcmp (hval, hash_start, sizeof (hash_start)) != 0)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
grub_dprintf ("crypt", "@ %x\n", (int)grub_file_tell (sig));
@@ -486,22 +487,22 @@ grub_verify_signature (grub_file_t f, grub_file_t sig,
grub_uint8_t buffer[4096];
grub_dprintf ("crypt", "alive\n");
if (grub_file_read (sig, &l, sizeof (l)) != sizeof (l))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
grub_dprintf ("crypt", "alive\n");
lb = (grub_be_to_cpu16 (l) + 7) / 8;
grub_dprintf ("crypt", "l = 0x%04x\n", grub_be_to_cpu16 (l));
if (lb > sizeof (buffer) - sizeof (grub_uint16_t))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
grub_dprintf ("crypt", "alive\n");
if (grub_file_read (sig, buffer + sizeof (grub_uint16_t), lb) != (grub_ssize_t) lb)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
grub_dprintf ("crypt", "alive\n");
grub_memcpy (buffer, &l, sizeof (l));
grub_dprintf ("crypt", "alive\n");
if (gcry_mpi_scan (&mpis[i], GCRYMPI_FMT_PGP,
buffer, lb + sizeof (grub_uint16_t), 0))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
grub_dprintf ("crypt", "alive\n");
}
@@ -510,17 +511,18 @@ grub_verify_signature (grub_file_t f, grub_file_t sig,
else
sk = grub_crypto_pk_locate_subkey_in_trustdb (keyid);
if (!sk)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "key not found");
+ /* TRANSLATORS: %08x is 32-bit key id. */
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08x not found"), keyid);
int nbits = gcry_mpi_get_nbits (sk->mpis[1]);
grub_dprintf ("crypt", "must be %d bits got %d bits\n", (int)nbits, (int)(8 * hash->mdlen));
if (gcry_mpi_scan (&hmpi, GCRYMPI_FMT_USG, hval, nbits / 8 < (int) hash->mdlen ? nbits / 8 : (int) hash->mdlen, 0))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
if (!grub_crypto_pk_dsa)
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "DSA module is not loaded");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("module `%s' isn't loaded"), "gcry_dsa");
if (grub_crypto_pk_dsa->verify (0, hmpi, mpis, sk->mpis, 0, 0))
- return grub_error (GRUB_ERR_BAD_SIGNATURE, "bad signature");
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
}
return GRUB_ERR_NONE;
@@ -534,7 +536,7 @@ grub_cmd_trust (grub_command_t cmd __attribute__ ((unused)),
struct grub_public_key *pk = NULL;
if (argc < 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "one argument required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
grub_file_filter_disable_all ();
pkf = grub_file_open (args[0]);
@@ -563,7 +565,7 @@ grub_cmd_distrust (grub_command_t cmd __attribute__ ((unused)),
struct grub_public_subkey *sk;
if (argc < 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "one argument required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
keyid = grub_strtoull (args[0], 0, 16);
if (grub_errno)
return grub_errno;
@@ -582,7 +584,8 @@ grub_cmd_distrust (grub_command_t cmd __attribute__ ((unused)),
*pkey = next;
return GRUB_ERR_NONE;
}
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "key %08x not found", keyid);
+ /* TRANSLATORS: %08x is 32-bit key id. */
+ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08x not found"), keyid);
}
static grub_err_t
@@ -596,7 +599,7 @@ grub_cmd_verify_signature (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("crypt", "alive\n");
if (argc < 2)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
grub_dprintf ("crypt", "alive\n");
@@ -744,13 +747,13 @@ GRUB_MOD_INIT(verify)
grub_env_set ("check_signatures", grub_pk_trusted ? "enforce" : "no");
cmd = grub_register_command ("verify_detached", grub_cmd_verify_signature,
- "FILE SIGFILE [PKFILE]",
+ N_("FILE SIGNATURE_FILE [PUBKEY_FILE]"),
N_("Verify detached signature."));
cmd_trust = grub_register_command ("trust", grub_cmd_trust,
- "PKFILE",
+ N_("PUBKEY_FILE"),
N_("Add PKFILE to trusted keys."));
cmd_distrust = grub_register_command ("distrust", grub_cmd_distrust,
- "KEYID",
+ N_("PUBKEY_ID"),
N_("Remove KEYID from trusted keys."));
}
--
1.8.1.4

Some files were not shown because too many files have changed in this diff Show More