merge mainline into mips

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-05 18:37:15 +01:00
commit df2e3593f3
12 changed files with 249 additions and 50 deletions

View file

@ -1,3 +1,63 @@
2009-12-05 Vladimir Serbinenko <phcoder@gmail.com>
Rename kernel.mod to kernel.img.
* conf/i386-efi.rmk (pkglib_MODULES): Change kernel.mod to kernel.img.
(kernel_mod_EXPORTS): Rename to ...
(kernel_img_EXPORTS): ... this.
(kernel_mod_SOURCES): Rename to ...
(kernel_img_SOURCES): ... this.
(kernel_mod_HEADERS): Rename to ...
(kernel_img_HEADERS): ... this. All users updated.
(kernel_mod_CFLAGS): Rename to ...
(kernel_img_CFLAGS): ... this.
(kernel_mod_ASFLAGS): Rename to ...
(kernel_img_ASFLAGS): ... this.
(kernel_mod_LDFLAGS): Rename to ...
(kernel_img_LDFLAGS): ... this.
* conf/x86_64-efi.rmk: Likewise.
* util/i386/efi/grub-mkimage.c (read_kernel_module): Rename to ...
(read_kernel_image): ... this. All users updated.
(read_kernel_image): Read "kernel.img" instead of "kernel.mod".
2009-12-05 Carles Pina i Estany <carles@pina.cat>
* normal/menu_text.c (grub_color_menu_high): Gettexttize string.
(print_spaces): New function.
(grub_print_ucs4): New function.
(getstringwidth): New function.
(print_message_indented): New function.
(print_message): Gettexttize strings using print_message_indented.
(run_menu): Replaces grub_printf by print_spaces and dynamic terminal
width.
(get_entry_number): Gettextize and uses dynamic terminal width.
(notify_booting, notify_fallback, notify_execution_failure):
Gettextize.
* normal/menu_entry.c (store_completion): Cleanup the gettextized
string.
(run): Likewise.
(grub_menu_entry_run): Likewise.
* PO/POTFILES: Add normal/menu_entry.c.
2009-12-05 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac (TARGET_ASFLAGS): Add "-D<MACHINE>".
2009-12-05 Carles Pina i Estany <carles@pina.cat>
* util/grub-install.in: Install gettext .mo files.
* util/grub-mkrescue.in (process_input_dir): Copy gettext .mo files.
2009-12-05 Carles Pina i Estany <carles@pina.cat>
* gettext/gettext.c (grub_gettext_init_ext): Replace grub_printf with
grub_dprintf.
2009-12-05 Robert Millan <rmh.grub@aybabtu.com>
* kern/ieee1275/openfw.c (grub_reboot): Disable for i386. The
non-firmware-dependant one in realmode.S takes precedence.
2009-12-04 Robert Millan <rmh.grub@aybabtu.com>
* commands/halt.c: Replace misc arch-specific headers with

View file

@ -30,14 +30,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules.
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod
# For kernel.mod.
kernel_mod_EXPORTS = no
kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
# For kernel.img.
kernel_img_EXPORTS = no
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
@ -48,22 +48,22 @@ kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kern/i386/tsc.c kern/i386/pit.c \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
MOSTLYCLEANFILES += symlist.c
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.

View file

@ -29,14 +29,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules.
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod ata.mod
# For kernel.mod.
kernel_mod_EXPORTS = no
kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
# For kernel.img.
kernel_img_EXPORTS = no
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -47,23 +47,23 @@ kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/i386/tsc.c kern/i386/pit.c \
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c \
term/efi/console.c disk/efi/efidisk.c
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
handler.h command.h i18n.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
MOSTLYCLEANFILES += symlist.c
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.

View file

@ -137,6 +137,7 @@ case "$platform" in
qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
esac
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
AC_SUBST(host_cpu)

View file

@ -222,7 +222,7 @@ grub_gettext_init_ext (const char *lang)
locale_dir = grub_env_get ("locale_dir");
if (locale_dir == NULL)
{
grub_printf ("locale_dir variable is not set up.");
grub_dprintf ("gettext", "locale_dir variable is not set up.");
return;
}

View file

@ -1,7 +1,7 @@
/* openfw.c -- Open firmware support functions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2003,2004,2005,2007,2008,2009 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
@ -399,11 +399,14 @@ grub_ieee1275_encode_devname (const char *path)
return encoding;
}
/* On i386, a firmware-independant grub_reboot() is provided by realmode.S. */
#ifndef __i386__
void
grub_reboot (void)
{
grub_ieee1275_interpret ("reset-all", 0);
}
#endif
void
grub_halt (void)

View file

@ -836,7 +836,9 @@ store_completion (const char *item, grub_completion_type_t type, int count)
}
grub_gotoxy (0, GRUB_TERM_HEIGHT - 3);
grub_printf (" Possible %s are:\n ", what);
grub_printf (" ");
grub_printf (_("Possible %s are:"), what);
grub_printf ("\n ");
}
/* Make sure that the completion buffer has enough room. */
@ -997,7 +999,9 @@ run (struct screen *screen)
}
grub_cls ();
grub_printf (_(" Booting a command list\n\n"));
grub_printf (" ");
grub_printf (_("Booting a command list"));
grub_printf ("\n\n");
/* Execute the script, line for line. */
@ -1177,6 +1181,7 @@ grub_menu_entry_run (grub_menu_entry_t entry)
grub_cls ();
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
grub_printf (_("\nPress any key to continue..."));
grub_putchar ('\n');
grub_printf (_("Press any key to continue..."));
(void) grub_getkey ();
}

View file

@ -39,11 +39,105 @@ static grub_uint8_t grub_color_menu_highlight;
void
grub_wait_after_message (void)
{
grub_printf ("\nPress any key to continue...");
grub_putchar ('\n');
grub_printf (_("Press any key to continue..."));
(void) grub_getkey ();
grub_putchar ('\n');
}
static void
print_spaces (int number_spaces)
{
int i;
for (i = 0; i < number_spaces; i++)
grub_putchar (' ');
}
static void
grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position)
{
while (str < last_position)
{
grub_putcode (*str);
str++;
}
}
static grub_ssize_t
getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position)
{
grub_ssize_t width = 0;
while (str < last_position)
{
width += grub_getcharwidth (*str);
str++;
}
return width;
}
static void
print_message_indented (const char *msg)
{
const int line_len = GRUB_TERM_WIDTH - grub_getcharwidth ('m') * 15;
grub_uint32_t *unicode_msg;
grub_ssize_t msg_len = grub_strlen (msg);
unicode_msg = grub_malloc (msg_len * sizeof (*unicode_msg));
msg_len = grub_utf8_to_ucs4 (unicode_msg, msg_len,
(grub_uint8_t *) msg, -1, 0);
if (!unicode_msg)
{
grub_printf ("print_message_indented ERROR1: %s", msg);
return;
}
if (msg_len < 0)
{
grub_printf ("print_message_indented ERROR2: %s", msg);
grub_free (unicode_msg);
return;
}
const grub_uint32_t *last_position = unicode_msg + msg_len;
grub_uint32_t *current_position = unicode_msg;
grub_uint32_t *next_new_line = unicode_msg;
while (current_position < last_position)
{
next_new_line = (grub_uint32_t *) last_position;
while (getstringwidth (current_position, next_new_line) > line_len
|| (*next_new_line != ' ' && next_new_line > current_position &&
next_new_line != last_position))
{
next_new_line--;
}
if (next_new_line == current_position)
{
next_new_line = (next_new_line + line_len > last_position) ?
(grub_uint32_t *) last_position : next_new_line + line_len;
}
print_spaces (6);
grub_print_ucs4 (current_position, next_new_line);
grub_putchar ('\n');
next_new_line++;
current_position = next_new_line;
}
grub_free (unicode_msg);
}
static void
draw_border (void)
{
@ -87,22 +181,33 @@ print_message (int nested, int edit)
if (edit)
{
grub_printf ("\n\
Minimum Emacs-like screen editing is supported. TAB lists\n\
completions. Press Ctrl-x to boot, Ctrl-c for a command-line\n\
or ESC to return menu.");
grub_putchar ('\n');
print_message_indented (_("Minimum Emacs-like screen editing is \
supported. TAB lists completions. Press Ctrl-x to boot, Ctrl-c for a \
command-line or ESC to return menu."));
}
else
{
grub_printf (_("\n\
Use the %C and %C keys to select which entry is highlighted.\n"),
(grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN);
grub_printf ("\
Press enter to boot the selected OS, \'e\' to edit the\n\
commands before booting or \'c\' for a command-line.");
const char *msg = _("Use the %C and %C keys to select which \
entry is highlighted.");
char *msg_translated =
grub_malloc (sizeof (char) * grub_strlen (msg) + 1);
grub_sprintf (msg_translated, msg, (grub_uint32_t) GRUB_TERM_DISP_UP,
(grub_uint32_t) GRUB_TERM_DISP_DOWN);
grub_putchar ('\n');
print_message_indented (msg_translated);
grub_free (msg_translated);
print_message_indented (_("Press enter to boot the selected OS, \
\'e\' to edit the commands before booting or \'c\' for a command-line."));
if (nested)
grub_printf ("\n\
ESC to return previous menu.");
{
grub_printf ("\n ");
grub_printf (_("ESC to return previous menu."));
}
}
}
@ -265,13 +370,17 @@ get_entry_number (const char *name)
static void
print_timeout (int timeout, int offset, int second_stage)
{
/* NOTE: Do not remove the trailing space characters.
They are required to clear the line. */
char *msg = " The highlighted entry will be booted automatically in %ds. ";
const char *msg =
_("The highlighted entry will be booted automatically in %ds.");
const int msg_localized_len = grub_strlen (msg);
const int number_spaces = GRUB_TERM_WIDTH - msg_localized_len - 3;
char *msg_end = grub_strchr (msg, '%');
grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3);
grub_gotoxy (second_stage ? (msg_end - msg + 3) : 3, GRUB_TERM_HEIGHT - 3);
grub_printf (second_stage ? msg_end : msg, timeout);
print_spaces (second_stage ? number_spaces : 0);
grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
grub_refresh ();
};
@ -360,8 +469,8 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
if (timeout >= 0)
{
grub_gotoxy (0, GRUB_TERM_HEIGHT - 3);
grub_printf ("\
");
print_spaces (GRUB_TERM_WIDTH - 1);
grub_env_unset ("timeout");
grub_env_unset ("fallback");
grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
@ -517,7 +626,9 @@ static void
notify_booting (grub_menu_entry_t entry,
void *userdata __attribute__((unused)))
{
grub_printf (" Booting \'%s\'\n\n", entry->title);
grub_printf (" ");
grub_printf (_("Booting \'%s\'"), entry->title);
grub_printf ("\n\n");
}
/* Callback invoked when a default menu entry executed because of a timeout
@ -527,7 +638,9 @@ static void
notify_fallback (grub_menu_entry_t entry,
void *userdata __attribute__((unused)))
{
grub_printf ("\n Falling back to \'%s\'\n\n", entry->title);
grub_printf ("\n ");
grub_printf (_("Falling back to \'%s\'"), entry->title);
grub_printf ("\n\n");
grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS);
}
@ -541,7 +654,8 @@ notify_execution_failure (void *userdata __attribute__((unused)))
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
}
grub_printf ("\n Failed to boot default entries.\n");
grub_printf ("\n ");
grub_printf (_("Failed to boot default entries.\n"));
grub_wait_after_message ();
}

View file

@ -11,4 +11,5 @@ util/mkisofs/rock.c
util/mkisofs/tree.c
util/mkisofs/write.c
normal/menu_entry.c
normal/menu_text.c

View file

@ -247,6 +247,14 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
done
fi
# Copy gettext files
mkdir -p ${grubdir}/locale/
for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
if test -f "$file"; then
cp -f "$file" ${grubdir}/locale/
fi
done
# Write device to a variable so we don't have to traverse /dev every time.
grub_device=`$grub_probe --target=device ${grubdir}`

View file

@ -100,6 +100,13 @@ process_input_dir ()
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
done
mkdir -p ${iso9660_dir}/boot/grub/locale
for file in ${input_dir}/po/*.mo; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/locale/
fi
done
}
if [ "${override_dir}" = "" ] ; then

View file

@ -55,12 +55,12 @@ align_pe32_section (Elf_Addr addr)
/* Read the whole kernel image. Return the pointer to a read image,
and store the size in bytes in *SIZE. */
static char *
read_kernel_module (const char *dir, size_t *size)
read_kernel_image (const char *dir, size_t *size)
{
char *kernel_image;
char *kernel_path;
kernel_path = grub_util_get_path (dir, "kernel.mod");
kernel_path = grub_util_get_path (dir, "kernel.img");
*size = grub_util_get_image_size (kernel_path);
kernel_image = grub_util_read_image (kernel_path);
free (kernel_path);
@ -945,7 +945,7 @@ convert_elf (const char *dir, char *prefix, FILE *out, char *mods[])
int i;
/* Get the kernel image and check the format. */
kernel_image = read_kernel_module (dir, &kernel_size);
kernel_image = read_kernel_image (dir, &kernel_size);
e = (Elf_Ehdr *) kernel_image;
if (! check_elf_header (e, kernel_size))
grub_util_error ("invalid ELF header");