From 203ffbfa31729f828a0564538499613e07561861 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Fri, 13 Nov 2009 20:39:33 +0000 Subject: [PATCH 01/41] Adds gettext support in Grub. Building system needs to be improved and maybe userland utilites improved. YYYY-MM-DD Carles Pina i Estany * Makefile.in: Add uptrans target to help to update .pot file * conf/common.rmk: Add grub-gettext_lib target, dependency and SOURCES, CFLAGS, LDFLAGS * kern/misc.c: Define grub_gettext symbol and add implement grub_gettext_dummy function * po/TODO: Temporary file with instructions of what Makefile.in will do * po/ca.po: Catalan translation stub * include/grub/misc.h: Define macro _(char *s). Declare grub_gettext_dummy and grub_gettext * gettext/gettext.c: New file with gettext implementation * normal/menu.c (print_message): add _( ) to some strings * util/grub.d/10_linux.in: include grub-gettext_lib file. For the Linux menuentry, call eval_gettext * util/grub.d/00_header.in: add locale_prefix and gettext locale detection and setting up the access to the mo directory * util/grub-mkconfig_lib.in: add get_locale_lang * util/grub-gettext_lib.in: new file --- conf/common.rmk | 13 +- gettext/gettext.c | 285 ++++++++++++++++++++++++++++++++++++++ include/grub/misc.h | 7 +- kern/misc.c | 9 ++ normal/menu_text.c | 4 +- util/grub-gettext_lib.in | 23 +++ util/grub-mkconfig_lib.in | 11 ++ util/grub.d/00_header.in | 16 +++ util/grub.d/10_linux.in | 8 +- 9 files changed, 368 insertions(+), 8 deletions(-) create mode 100644 gettext/gettext.c create mode 100644 util/grub-gettext_lib.in diff --git a/conf/common.rmk b/conf/common.rmk index a66bd97fd..deb18372b 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -162,6 +162,12 @@ update-grub_lib: util/update-grub_lib.in config.status lib_SCRIPTS += update-grub_lib CLEANFILES += update-grub_lib +grub-gettext_lib: util/grub-gettext_lib.in config.status + ./config.status --file=$@:$< + chmod +x $@ +lib_DATA += grub-gettext_lib +CLEANFILES += grub-gettext_lib + %: util/grub.d/%.in config.status ./config.status --file=$@:$< chmod +x $@ @@ -178,7 +184,7 @@ grub-mkconfig_DATA += util/grub.d/README pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \ ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \ affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \ - udf.mod afs.mod afs_be.mod befs.mod befs_be.mod + udf.mod afs.mod afs_be.mod befs.mod befs_be.mod gettext.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -609,6 +615,11 @@ bufio_mod_SOURCES = io/bufio.c bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For gettext.mod. +gettext_mod_SOURCES = gettext/gettext.c +gettext_mod_CFLAGS = $(COMMON_CFLAGS) +gettext_mod_LDFLAGS = $(COMMON_LDFLAGS) + # Misc. pkglib_MODULES += xnu_uuid.mod diff --git a/gettext/gettext.c b/gettext/gettext.c new file mode 100644 index 000000000..089f59db4 --- /dev/null +++ b/gettext/gettext.c @@ -0,0 +1,285 @@ +/* gettext.c - gettext module */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + .mo file information from: + http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html . +*/ + + +static grub_file_t grub_mofile_open (const char *name); +static grub_file_t fd_mo; + +static int grub_gettext_offsetoriginal; +static int grub_gettext_max; + +static const char* (*grub_gettext_original) (const char *s); + +#define GETTEXT_MAGIC_NUMBER 0 +#define GETTEXT_FILE_FORMAT 4 +#define GETTEXT_NUMBER_OF_STRINGS 8 +#define GETTEXT_OFFSET_ORIGINAL 12 +#define GETTEXT_OFFSET_TRANSLATION 16 + +#define MO_MAGIC_NUMBER 0x950412de + +static grub_uint32_t +grub_gettext_get_info (int offset) +{ + grub_uint32_t value; + + grub_file_seek (fd_mo, offset); + grub_file_read (fd_mo, (char*) &value, 4); + value = grub_cpu_to_le32 (value); + return value; +} + +static void +grub_gettext_getstring_from_offset (grub_uint32_t offset, grub_uint32_t length, char *translation) +{ + grub_file_seek (fd_mo, offset); + grub_file_read (fd_mo, translation, length); + translation[length] = '\0'; +} + +static char* +grub_gettext_gettranslation_from_position (int position) +{ + int offsettranslation; + int internal_position; + grub_uint32_t length, offset; + char *translation; + + offsettranslation = grub_gettext_get_info (GETTEXT_OFFSET_TRANSLATION); + + internal_position = offsettranslation + position * 8; + + grub_file_seek (fd_mo, internal_position); + grub_file_read (fd_mo, (char*) &length, 4); + length = grub_cpu_to_le32 (length); + + grub_file_seek (fd_mo, internal_position + 4), + grub_file_read (fd_mo, (char*) &offset, 4); + offset = grub_cpu_to_le32 (offset); + + translation = grub_malloc(length + 1); + grub_gettext_getstring_from_offset (offset, length, translation); + + return translation; +} + +static char* +grub_gettext_getstring_from_position (int position) +{ + int internal_position; + int length, offset; + char *original; + + /* Get position for string i. */ + internal_position = grub_gettext_offsetoriginal + (position * 8); + + /* Get the length of the string i. */ + grub_file_seek (fd_mo, internal_position); + grub_file_read (fd_mo, (char *) &length, 4); + + /* Get the offset of the string i. */ + grub_file_seek (fd_mo, internal_position + 4); + grub_file_read (fd_mo, (char *) &offset, 4); + + /* Get the string i. */ + original = grub_malloc (length + 1); + grub_gettext_getstring_from_offset (offset, length, original); + + return original; +} + +static const char* +grub_gettext_translate (const char *orig) +{ + char *current_string; + char *ret; + + int min,max,current; + + if (fd_mo == 0) + return orig; + + min = 0; + max = grub_gettext_max; + + current = (max + min) / 2; + + while (current != min && current != max) + { + current_string = grub_gettext_getstring_from_position (current); + + /* Search by bisection. */ + if (grub_strcmp (current_string, orig) < 0) + { + grub_free(current_string); + min=current; + } + else if (grub_strcmp (current_string, orig) > 0) + { + grub_free(current_string); + max=current; + } + else if (grub_strcmp (current_string, orig) == 0) + { + grub_free(current_string); + return grub_gettext_gettranslation_from_position (current); + } + current = (max+min)/2; + } + + ret = grub_malloc(grub_strlen(orig) + 1); + grub_strcpy(ret,orig); + return ret; +} + +/* This is similar to grub_gzfile_open. */ +static grub_file_t +grub_mofile_open (const char *filename) +{ + int unsigned magic; + int version; + + /* Using fd_mo and not another variable because + it's needed for grub_gettext_get_info. */ + + fd_mo = grub_file_open (filename); + if (! fd_mo) + { + grub_error (GRUB_ERR_FILE_READ_ERROR, "Cannot read %s",filename); + return 0; + } + + magic = grub_gettext_get_info (GETTEXT_MAGIC_NUMBER); + + if (magic != MO_MAGIC_NUMBER) + { + grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo file: %s", filename); + grub_file_close (fd_mo); + fd_mo = 0; + return 0; + } + + version = grub_gettext_get_info (GETTEXT_FILE_FORMAT); + + if (version != 0) + { + grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo version in file: %s", filename); + fd_mo = 0; + return 0; + } + + /* + Do we want .mo.gz files? Then, the code: + file = grub_gzio_open (io, 0); // 0: transparent + if (! file) + { + grub_printf("Problems opening the file\n"); + grub_file_close (io); + return 0; + } + */ + + return fd_mo; +} + +static void +grub_gettext_init_ext (const char *lang) +{ + char *mo_file; + char *grub_prefix; + + grub_prefix = grub_env_get ("prefix"); + + fd_mo = 0; + + // mo_file e.g.: /boot/grub/locale/ca.mo + + mo_file = grub_malloc (grub_strlen (grub_prefix) + sizeof ("/locale/") + grub_strlen (lang) + sizeof(".mo")); + + // Warning: if changing some paths in the below line, change the grub_malloc + // contents below + + grub_sprintf (mo_file, "%s/locale/%s.mo", grub_prefix, lang); + grub_dprintf(" -------------- %s ",mo_file); + + fd_mo = grub_mofile_open(mo_file); + grub_free (mo_file); + + if (fd_mo) + { + grub_gettext_offsetoriginal = grub_gettext_get_info(GETTEXT_OFFSET_ORIGINAL); + grub_gettext_max = grub_gettext_get_info(GETTEXT_NUMBER_OF_STRINGS); + + grub_gettext_original = grub_gettext; + grub_gettext = grub_gettext_translate; + } +} + +static char* +grub_gettext_env_write_lang (struct grub_env_var *var __attribute__ ((unused)), + const char *val) +{ + grub_gettext_init_ext (val); + + return grub_strdup (val); +} + +GRUB_MOD_INIT(gettext) +{ + (void)mod; /* To stop warning. */ + + const char *lang; + + lang = grub_env_get ("lang"); + + grub_gettext_init_ext (lang); + + /* Testing: + grub_register_command ("_", grub_cmd_translate, GRUB_COMMAND_FLAG_BOTH, + "_", "internalization support trans", 0); + */ + + /* Reload .mo file information if lang changes. */ + grub_register_variable_hook ("lang", NULL, grub_gettext_env_write_lang); + + /* Preserve hooks after context changes. */ + grub_env_export ("lang"); +} + +GRUB_MOD_FINI(gettext) +{ + if (fd_mo != 0) + grub_file_close(fd_mo); + + grub_gettext = grub_gettext_original; +} diff --git a/include/grub/misc.h b/include/grub/misc.h index faa2d5c42..0a3406737 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -1,7 +1,7 @@ /* misc.h - prototypes for misc functions */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,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 @@ -34,6 +34,8 @@ /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ #define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n)) +#define _(s) grub_gettext(s) + void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src); char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c); @@ -191,6 +193,9 @@ grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest, grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, grub_uint32_t d, grub_uint32_t *r); +const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s); +extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);// = grub_gettext_dummy; + #ifdef NEED_ENABLE_EXECUTE_STACK void EXPORT_FUNC(__enable_execute_stack) (void *addr); #endif diff --git a/kern/misc.c b/kern/misc.c index cacfbc753..827f864c4 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -30,6 +30,8 @@ grub_iswordseparator (int c) return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&'); } +const char* (*grub_gettext) (const char *s) = grub_gettext_dummy; + void * grub_memmove (void *dest, const void *src, grub_size_t n) { @@ -984,6 +986,13 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize, return p - dest; } +/* grub_gettext_dummy is not translating anything. */ +const char * +grub_gettext_dummy (const char *s) +{ + return s; +} + /* Abort GRUB. This function does not return. */ void grub_abort (void) diff --git a/normal/menu_text.c b/normal/menu_text.c index e0d96c47f..e757110c0 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -93,8 +93,8 @@ print_message (int nested, int edit) } else { - grub_printf ("\n\ - Use the %C and %C keys to select which entry is highlighted.\n", + 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\ diff --git a/util/grub-gettext_lib.in b/util/grub-gettext_lib.in new file mode 100644 index 000000000..00d1bdd98 --- /dev/null +++ b/util/grub-gettext_lib.in @@ -0,0 +1,23 @@ +# Configuration of grub-gettext +# Copyright (C) 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 +# 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 . + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ + +TEXTDOMAINDIR=@prefix@/share/locale +TEXTDOMAIN=grub +. gettext.sh diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index bb30cc475..47e37f265 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -215,3 +215,14 @@ version_find_latest () done echo "$a" } + +get_locale_lang () +{ + lang="`echo ${LANG} | cut -d _ -f 1`" + if [ "x${lang}" = "x" ] ; then + return 1 + else + echo "${lang}" + return 0 + fi +} diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index 9f421dc1c..fe1352883 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -22,6 +22,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ grub_prefix=`echo /boot/grub | sed ${transform}` +locale_prefix="/usr/share/locale" # TODO: dynamic with exec_prefix ? . ${libdir}/grub/grub-mkconfig_lib @@ -100,6 +101,21 @@ EOF ;; esac +if test -e ${grub_prefix}/gettext.mod -a -d /usr/share/locale; then + # Make the locales accesible + prepare_grub_to_access_device `${grub_probe} --target=device ${locale_prefix}` + lang=`get_locale_lang` + grub_locale_prefix=`make_system_path_relative_to_its_root ${locale_prefix}` + cat << EOF +# Gettext variables and module +set locale_prefix=${grub_locale_prefix} +set lang=${lang} +insmod gettext +EOF +else + echo "gettext module or /usr/share/locale is not available" +fi + if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then verbose= diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index f17955846..9cb39e41c 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -95,11 +95,11 @@ while [ "x$list" != "x" ] ; do linux_root_device_thisversion=${GRUB_DEVICE} fi - linux_entry "${OS}, with Linux ${version}" \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + linux_entry $eval_gettext ("${OS}, with Linux ${version}" \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}") if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then - linux_entry "${OS}, with Linux ${version} (recovery mode)" \ - "single ${GRUB_CMDLINE_LINUX}" + linux_entry $eval_gettext ("${OS}, with Linux ${version} (recovery mode)" \ + "single ${GRUB_CMDLINE_LINUX}") fi list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` From 44883dfbd5d05c159cba64e903de5b3afb593123 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Thu, 19 Nov 2009 21:43:09 +0000 Subject: [PATCH 02/41] 2009-11-19 Carles Pina i Estany * include/grb/i18n_grub.h: same than i18n.h but for Grub Kernel. * include/grub/misc.h: includes i18n_grub.h. * normal/menu_text.c: gettize more strings. * po/POTFILES: Update with new file. * po/ca.po: New strings. --- include/grub/i18n_grub.h | 24 ++++++++++++++++++++++++ include/grub/misc.h | 2 -- normal/menu_text.c | 1 + po/POTFILES | 2 ++ po/ca.po | 11 ++++++++++- 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 include/grub/i18n_grub.h diff --git a/include/grub/i18n_grub.h b/include/grub/i18n_grub.h new file mode 100644 index 000000000..ed3382568 --- /dev/null +++ b/include/grub/i18n_grub.h @@ -0,0 +1,24 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 + * 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 . + */ + +#ifndef GRUB_I18N_GRUB_H +#define GRUB_I18N_GRUB_H 1 + +# define _(str) grub_gettext(str) + +#endif /* GRUB_I18N_GRUB_H */ diff --git a/include/grub/misc.h b/include/grub/misc.h index 0a3406737..bc725f9ca 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -34,8 +34,6 @@ /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ #define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n)) -#define _(s) grub_gettext(s) - void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src); char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c); diff --git a/normal/menu_text.c b/normal/menu_text.c index e757110c0..66a0bcfb4 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -25,6 +25,7 @@ #include #include #include +#include /* Time to delay after displaying an error message about a default/fallback entry failing to boot. */ diff --git a/po/POTFILES b/po/POTFILES index 5b1239a5e..c0fc40c30 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -10,3 +10,5 @@ util/mkisofs/multi.c util/mkisofs/rock.c util/mkisofs/tree.c util/mkisofs/write.c + +normal/menu_text.c diff --git a/po/ca.po b/po/ca.po index 3f9b0ac32..02cfe3751 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 00:16+0100\n" +"POT-Creation-Date: 2009-11-19 21:37+0000\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan \n" "Language-Team: None \n" @@ -882,6 +882,15 @@ msgstr "" msgid "Path table size(bytes): %d\n" msgstr "" +#: normal/menu_text.c:97 +#, c-format +msgid "" +"\n" +" Use the %C and %C keys to select which entry is highlighted.\n" +msgstr "" +"\n" +" Utilitzeu les tecles %C i %C per a seleccionar l'entrada.\n" + #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" msgstr "" From a797824f1236786ab3104f92a05baea579beef9a Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Fri, 20 Nov 2009 21:08:29 +0100 Subject: [PATCH 03/41] 2009-11-20 Felix Zielcke * configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz' to the list of unifont files to look for. --- ChangeLog | 5 +++++ configure.ac | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2aaa65eaa..acd740fd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-20 Felix Zielcke + + * configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz' + to the list of unifont files to look for. + 2009-11-19 Robert Millan Patch from Joe Auricchio diff --git a/configure.ac b/configure.ac index 587f2118d..2ffb548c0 100644 --- a/configure.ac +++ b/configure.ac @@ -136,9 +136,9 @@ if test "x$YACC" = x; then AC_MSG_ERROR([bison is not found]) fi -for file in /usr/src/unifont.bdf ; do +for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do if test -e $file ; then - AC_SUBST([UNIFONT_BDF], [$file]) + AC_SUBST([UNIFONT_INPUTFILE], [$file]) break fi done From 68b44b1d2d455a238e4e1bf4085fd6cab15354b0 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Fri, 20 Nov 2009 21:13:50 +0100 Subject: [PATCH 04/41] Revert accidently renaming of UNIFONT_BDF in configure.ac --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2ffb548c0..a5f1d60a5 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ fi for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do if test -e $file ; then - AC_SUBST([UNIFONT_INPUTFILE], [$file]) + AC_SUBST([UNIFONT_BDF], [$file]) break fi done From 6c09890c87a9dd3426e3be1bf7f93e7dd48bc008 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Fri, 20 Nov 2009 22:39:07 +0100 Subject: [PATCH 05/41] 2009-11-20 Felix Zielcke * configure.ac (UNIFONT_BDF): Rename to ... (FONT_SOURCE): ... this. Update all users. --- ChangeLog | 5 +++++ Makefile.in | 12 ++++++------ configure.ac | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index acd740fd1..61bcfc1fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-20 Felix Zielcke + + * configure.ac (UNIFONT_BDF): Rename to ... + (FONT_SOURCE): ... this. Update all users. + 2009-11-20 Felix Zielcke * configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz' diff --git a/Makefile.in b/Makefile.in index 7706cd26b..43528c534 100644 --- a/Makefile.in +++ b/Makefile.in @@ -108,7 +108,7 @@ AWK = @AWK@ LIBCURSES = @LIBCURSES@ LIBUSB = @LIBUSB@ YACC = @YACC@ -UNIFONT_BDF = @UNIFONT_BDF@ +FONT_SOURCE = @FONT_SOURCE@ # Options. enable_grub_emu = @enable_grub_emu@ @@ -207,7 +207,7 @@ docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi $(MKDIR_P) docs -$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@ -ifeq (, $(UNIFONT_BDF)) +ifeq (, $(FONT_SOURCE)) else ifeq ($(enable_grub_mkfont),yes) @@ -218,11 +218,11 @@ pkgdata_DATA += unicode.pf2 ascii.pf2 UNICODE_ARROWS=0x2190-0x2193 UNICODE_LINES=0x2501-0x251B -unicode.pf2: $(UNIFONT_BDF) grub-mkfont - $(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF) +unicode.pf2: $(FONT_SOURCE) grub-mkfont + $(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -ascii.pf2: $(UNIFONT_BDF) grub-mkfont - $(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) +ascii.pf2: $(FONT_SOURCE) grub-mkfont + $(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) endif endif diff --git a/configure.ac b/configure.ac index a5f1d60a5..383cb67a3 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ fi for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do if test -e $file ; then - AC_SUBST([UNIFONT_BDF], [$file]) + AC_SUBST([FONT_SOURCE], [$file]) break fi done From efda854e68b1736b623bfd27dd6297bf6a1f8c64 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 21 Nov 2009 13:11:38 +0000 Subject: [PATCH 06/41] 2009-11-21 Carles Pina i Estany 2009-11-21 Robert Millan * util/grub-mkrescue.in: Recognize `--override-directory' option. (process_input_dir): New function. Process an arbitrary input directory. Misc adjustments to support both "override mode" and system-wide mode. --- ChangeLog | 8 ++++++ util/grub-mkrescue.in | 61 ++++++++++++++++++++++++++++++------------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61bcfc1fc..34518b011 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-11-21 Carles Pina i Estany +2009-11-21 Robert Millan + + * util/grub-mkrescue.in: Recognize `--override-directory' option. + (process_input_dir): New function. Process an arbitrary input + directory. + Misc adjustments to support both "override mode" and system-wide mode. + 2009-11-20 Felix Zielcke * configure.ac (UNIFONT_BDF): Rename to ... diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 5db287a38..23ac4e1e8 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -27,10 +27,10 @@ PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_TARNAME=@PACKAGE_TARNAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ target_cpu=@target_cpu@ +native_platform=@platform@ coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc -grub_mkisofs="grub-mkisofs" # Usage: usage # Print the usage. @@ -63,6 +63,12 @@ for option in "$@"; do modules=`echo "$option" | sed 's/--modules=//'` ;; --output=*) output_image=`echo "$option" | sed 's/--output=//'` ;; + # Intentionally undocumented + --override-directory=*) + override_dir=`echo "${option}/" | sed 's/--override-directory=//'` + PATH=${override_dir}:$PATH + export PATH + ;; -*) echo "Unrecognized option \`$option'" 1>&2 usage @@ -76,22 +82,40 @@ done iso9660_dir=`mktemp -d` mkdir -p ${iso9660_dir}/boot/grub -for platform in pc coreboot ; do - input_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-${platform} - if test -e ${input_dir} ; then - mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform} - for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \ - ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \ - ${input_dir}/handler.lst ${input_dir}/parttool.lst; do - if test -f "$file"; then - cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/ - fi - done +process_input_dir () +{ + input_dir="$1" + platform="$2" + mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform} + for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \ + ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \ + ${input_dir}/handler.lst ${input_dir}/parttool.lst; do + if test -f "$file"; then + cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/ + fi + done +} + +if [ "${override_dir}" = "" ] ; then + if test -e "${coreboot_dir}" ; then + process_input_dir ${coreboot_dir} coreboot fi -done + if test -e "${pc_dir}" ; then + process_input_dir ${pc_dir} pc + fi +else + process_input_dir ${override_dir} ${native_platform} + coreboot_dir= + pc_dir= + case "${native_platform}" in + coreboot) coreboot_dir=${override_dir} ;; + pc) pc_dir=${override_dir} ;; + esac +fi # build coreboot core.img -if test -e ${coreboot_dir} ; then +if test -e "${coreboot_dir}" ; then + echo "Generates coreboot" memdisk_img=`mktemp` memdisk_dir=`mktemp -d` mkdir -p ${memdisk_dir}/boot/grub @@ -115,7 +139,7 @@ EOF memdisk tar search iso9660 configfile sh \ ata at_keyboard rm -f ${memdisk_img} - grub_mkisofs="${grub_mkisofs} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)" + grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)" fi if [ "${source}" != "" ] ; then @@ -126,7 +150,8 @@ if [ "${source}" != "" ] ; then fi # build eltorito core.img -if test -e ${pc_dir} ; then +if test -e "${pc_dir}" ; then + echo "Generates eltorito" core_img=`mktemp` grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \ memdisk tar search iso9660 configfile sh \ @@ -141,11 +166,11 @@ if test -e ${pc_dir} ; then echo "source /boot/grub/grub.cfg") \ > ${iso9660_dir}/boot/grub/i386-pc/grub.cfg - grub_mkisofs="${grub_mkisofs} -b boot/grub/i386-pc/eltorito.img -boot-info-table" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table" fi # build iso image -${grub_mkisofs} -o ${output_image} -r -J ${iso9660_dir} +grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r -J ${iso9660_dir} rm -rf ${iso9660_dir} exit 0 From 13774a2f941452fe3bf15fd3e202373df08a1fd7 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 21 Nov 2009 13:22:41 +0000 Subject: [PATCH 07/41] 2009-11-21 Robert Millan * util/grub-mkrescue.in: Use source directory direcly (without copiing or hardlinking it). Remove -J option, Joliet is not compatible with multiple source directories. --- ChangeLog | 6 ++++++ util/grub-mkrescue.in | 9 +-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34518b011..64ea5f7b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-21 Robert Millan + + * util/grub-mkrescue.in: Use source directory direcly (without copiing + or hardlinking it). Remove -J option, Joliet is not compatible with + multiple source directories. + 2009-11-21 Carles Pina i Estany 2009-11-21 Robert Millan diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 23ac4e1e8..6f7d3338c 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -142,13 +142,6 @@ EOF grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)" fi -if [ "${source}" != "" ] ; then - for d in ${source}; do - echo "Processing $d" - cp -dpRl "${d}" ${iso9660_dir}/ - done -fi - # build eltorito core.img if test -e "${pc_dir}" ; then echo "Generates eltorito" @@ -170,7 +163,7 @@ if test -e "${pc_dir}" ; then fi # build iso image -grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r -J ${iso9660_dir} +grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r ${iso9660_dir} ${source} rm -rf ${iso9660_dir} exit 0 From 1164b2708e11564acd8b1e372b49dbd021930b31 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 21 Nov 2009 13:48:15 +0000 Subject: [PATCH 08/41] 2009-11-21 Robert Millan Fix build for srcdir != objdir. * Makefile.in (po/$(PACKAGE).pot): Rename to ... ($(srcdir)/po/$(PACKAGE).pot): ... this. Run $(XGETTEXT) from $(srcdir). ($(foreach lang, $(LINGUAS), po/$(lang).po)): Rename to ... ($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): ... this. Use $^ reference for input. --- ChangeLog | 11 +++++++++++ Makefile.in | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64ea5f7b8..42ab8b8b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-11-21 Robert Millan + + Fix build for srcdir != objdir. + + * Makefile.in (po/$(PACKAGE).pot): Rename to ... + ($(srcdir)/po/$(PACKAGE).pot): ... this. Run $(XGETTEXT) from + $(srcdir). + ($(foreach lang, $(LINGUAS), po/$(lang).po)): Rename to ... + ($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): ... this. Use $^ + reference for input. + 2009-11-21 Robert Millan * util/grub-mkrescue.in: Use source directory direcly (without copiing diff --git a/Makefile.in b/Makefile.in index 43528c534..edc6c3853 100644 --- a/Makefile.in +++ b/Makefile.in @@ -472,12 +472,12 @@ gensymlist.sh: gensymlist.sh.in config.status genkernsyms.sh: genkernsyms.sh.in config.status $(SHELL) ./config.status -po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell - $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ - $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell +$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell + cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ + cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell -$(foreach lang, $(LINGUAS), po/$(lang).po): po/$(PACKAGE).pot - $(MSGMERGE) -U $@ po/$(PACKAGE).pot +$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot + $(MSGMERGE) -U $@ $^ po/%.mo: po/%.po $(MKDIR_P) $$(dirname $@) From 0b787d0e99c7835d401d1f4af2a8fd161763922b Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Sat, 21 Nov 2009 15:41:46 +0100 Subject: [PATCH 09/41] 2009-11-21 Felix Zielcke MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch from Loïc Minier . * util/grub.d/30_os-prober.in: Cope with Linux entries where root and /boot are on different devices. --- ChangeLog | 6 ++++++ util/grub.d/30_os-prober.in | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34518b011..345ea8ae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-21 Felix Zielcke + + Patch from Loïc Minier . + * util/grub.d/30_os-prober.in: Cope with Linux entries where + root and /boot are on different devices. + 2009-11-21 Carles Pina i Estany 2009-11-21 Robert Millan diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index c5728866c..7301bbedb 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -88,11 +88,16 @@ EOF LLABEL="${LONGNAME}" fi + if [ "${LROOT}" != "${LBOOT}" ]; then + LKERNEL="${LKERNEL#/boot}" + LINITRD="${LINITRD#/boot}" + fi + cat << EOF menuentry "${LLABEL} (on ${DEVICE})" { EOF if [ -z "${prepare_boot_cache}" ]; then - prepare_boot_cache="$(prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/")" + prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")" fi printf '%s\n' "${prepare_boot_cache}" cat << EOF From 74ff1dd52bb2f6f79b73898d50c26009ef25176c Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Sat, 21 Nov 2009 17:40:55 +0100 Subject: [PATCH 10/41] 2009-11-21 Felix Zielcke * util/grub-mkrescue.in: Print an error and usage if output option has not been given. --- ChangeLog | 5 +++++ util/grub-mkrescue.in | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 868fd5c13..2e6ab2bdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-21 Felix Zielcke + + * util/grub-mkrescue.in: Print an error and usage if output option + has not been given. + 2009-11-21 Felix Zielcke Patch from Loïc Minier . diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 6f7d3338c..51639ccb1 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -42,7 +42,7 @@ Make GRUB rescue image. -h, --help print this message and exit -v, --version print the version information and exit --modules=MODULES pre-load specified modules MODULES - --output=FILE save output in FILE + --output=FILE save output in FILE [required] $0 generates a bootable rescue image with specified source files or directories. @@ -79,6 +79,12 @@ for option in "$@"; do esac done +if [ "x${output_image}" = x ] ; then + echo "output file must be given" >&2 + usage + exit 1 +fi + iso9660_dir=`mktemp -d` mkdir -p ${iso9660_dir}/boot/grub From 994cc3a308a4451ef3b6db289a7a7dc1e298c90a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 21 Nov 2009 18:00:23 +0100 Subject: [PATCH 11/41] 2009-11-21 Samuel Thibault * util/getroot.c [__GNU__]: Include , , and [__GNU__] (grub_guess_root_device): Call file_name_lookup and file_get_storage_info to implement grub_guess_root_device. --- ChangeLog | 7 ++++++ util/getroot.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2e6ab2bdc..243a92c4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-11-21 Samuel Thibault + + * util/getroot.c [__GNU__]: Include , , and + + [__GNU__] (grub_guess_root_device): Call file_name_lookup and + file_get_storage_info to implement grub_guess_root_device. + 2009-11-21 Felix Zielcke * util/grub-mkrescue.in: Print an error and usage if output option diff --git a/util/getroot.c b/util/getroot.c index 120ab13b1..2915ab4f2 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -30,6 +30,12 @@ # define DEV_CYGDRIVE_MAJOR 98 #endif +#ifdef __GNU__ +#include +#include +#include +#endif + #include #include #include @@ -378,8 +384,65 @@ find_cygwin_root_device (const char *path, dev_t dev) char * grub_guess_root_device (const char *dir) { - struct stat st; char *os_dev; +#ifdef __GNU__ + file_t file; + mach_port_t *ports; + int *ints; + loff_t *offsets; + char *data; + error_t err; + mach_msg_type_number_t num_ports = 0, num_ints = 0, num_offsets = 0, data_len = 0; + size_t name_len; + + file = file_name_lookup (dir, 0, 0); + if (file == MACH_PORT_NULL) + return 0; + + err = file_get_storage_info (file, + &ports, &num_ports, + &ints, &num_ints, + &offsets, &num_offsets, + &data, &data_len); + + if (num_ints < 1) + grub_util_error ("Storage info for `%s' does not include type", dir); + if (ints[0] != STORAGE_DEVICE) + grub_util_error ("Filesystem of `%s' is not stored on local disk", dir); + + if (num_ints < 5) + grub_util_error ("Storage info for `%s' does not include name", dir); + name_len = ints[4]; + if (name_len < data_len) + grub_util_error ("Bogus name length for storage info for `%s'", dir); + if (data[name_len - 1] != '\0') + grub_util_error ("Storage name for `%s' not NUL-terminated", dir); + + os_dev = xmalloc (strlen ("/dev/") + data_len); + memcpy (os_dev, "/dev/", strlen ("/dev/")); + memcpy (os_dev + strlen ("/dev/"), data, data_len); + + if (ports && num_ports > 0) + { + mach_msg_type_number_t i; + for (i = 0; i < num_ports; i++) + { + mach_port_t port = ports[i]; + if (port != MACH_PORT_NULL) + mach_port_deallocate (mach_task_self(), port); + } + munmap ((caddr_t) ports, num_ports * sizeof (*ports)); + } + + if (ints && num_ints > 0) + munmap ((caddr_t) ints, num_ints * sizeof (*ints)); + if (offsets && num_offsets > 0) + munmap ((caddr_t) offsets, num_offsets * sizeof (*offsets)); + if (data && data_len > 0) + munmap (data, data_len); + mach_port_deallocate (mach_task_self (), file); +#else /* !__GNU__ */ + struct stat st; if (stat (dir, &st) < 0) grub_util_error ("Cannot stat `%s'", dir); @@ -393,6 +456,7 @@ grub_guess_root_device (const char *dir) /* This might be truly slow, but is there any better way? */ os_dev = find_root_device ("/dev", st.st_dev); #endif +#endif /* !__GNU__ */ return os_dev; } From cb681ffd7af8aac37c2718eedb041c9b5330abcb Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sat, 21 Nov 2009 21:18:12 +0000 Subject: [PATCH 12/41] Deletes grub-gettext_lib.in (not needed after Robert's changes) --- util/grub-gettext_lib.in | 23 ----------------------- util/grub-mkconfig_lib.in | 11 ----------- 2 files changed, 34 deletions(-) delete mode 100644 util/grub-gettext_lib.in diff --git a/util/grub-gettext_lib.in b/util/grub-gettext_lib.in deleted file mode 100644 index 00d1bdd98..000000000 --- a/util/grub-gettext_lib.in +++ /dev/null @@ -1,23 +0,0 @@ -# Configuration of grub-gettext -# Copyright (C) 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 -# 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 . - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ - -TEXTDOMAINDIR=@prefix@/share/locale -TEXTDOMAIN=grub -. gettext.sh diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index 47e37f265..bb30cc475 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -215,14 +215,3 @@ version_find_latest () done echo "$a" } - -get_locale_lang () -{ - lang="`echo ${LANG} | cut -d _ -f 1`" - if [ "x${lang}" = "x" ] ; then - return 1 - else - echo "${lang}" - return 0 - fi -} From 414092d75a54ad4b6c86c2131fe61778d93ce79f Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sat, 21 Nov 2009 22:19:16 +0000 Subject: [PATCH 13/41] Adds the ChangeLog.gettext file --- ChangeLog.gettext | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ChangeLog.gettext diff --git a/ChangeLog.gettext b/ChangeLog.gettext new file mode 100644 index 000000000..6bce3f38b --- /dev/null +++ b/ChangeLog.gettext @@ -0,0 +1,15 @@ +YYYY-MM-DD Carles Pina i Estany + + * conf/common.rmk: Add grub-gettext_lib target, dependency and + SOURCES, CFLAGS, LDFLAGS + * gettext/gettext.c: New file with gettext implementation + * include/grub/i18n_grub.h: New file with grub_gettext macros + * include/grub/misc.h: Define macro _(char *s). Declare + grub_gettext_dummy and grub_gettext + * kern/misc.c: Define grub_gettext symbol implementation of the + grub_gettext_dummy function + * normal/menu_text.c: Gettextize one message in print_message + * po/POTFILES: Adds normal/menu_text.c + * po/ca.po: Adds the new string + * util/grub.d/00_header.in: defines gettext variables and loads + the module From 26a61d6a59d60e1a97b344dbc3a0aa87d08ee0d0 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Sat, 21 Nov 2009 23:23:35 +0100 Subject: [PATCH 14/41] 2009-11-21 Felix Zielcke * Makefile.in (target): Use make's builtin $(shell) function instead of calling directly $(SHELL) to create the locale directories, inside the $(foreach) function. --- ChangeLog | 6 ++++++ Makefile.in | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2e6ab2bdc..e9b054d0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-21 Felix Zielcke + + * Makefile.in (target): Use make's builtin $(shell) function + instead of calling directly $(SHELL) to create the locale directories, + inside the $(foreach) function. + 2009-11-21 Felix Zielcke * util/grub-mkrescue.in: Print an error and usage if output option diff --git a/Makefile.in b/Makefile.in index edc6c3853..d9f107bef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -309,7 +309,7 @@ install-local: all $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \ done $(foreach lang, $(LINGUAS), \ - $(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES \ + $(shell $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES) \ @list='po/$(lang).mo'; \ for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ From 43fa69467ceb2a55eb8176c474159a4806f05614 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sat, 21 Nov 2009 23:06:37 +0000 Subject: [PATCH 15/41] Moves where pkglib_MODULS += gettext.mod is defined --- conf/common.rmk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/common.rmk b/conf/common.rmk index da56015ba..a4c3c80e8 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -185,7 +185,7 @@ grub-mkconfig_DATA += util/grub.d/README pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \ ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \ affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \ - udf.mod afs.mod afs_be.mod befs.mod befs_be.mod gettext.mod + udf.mod afs.mod afs_be.mod befs.mod befs_be.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -617,6 +617,7 @@ bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) # For gettext.mod. +pkglib_MODULES += gettext.mod gettext_mod_SOURCES = gettext/gettext.c gettext_mod_CFLAGS = $(COMMON_CFLAGS) gettext_mod_LDFLAGS = $(COMMON_LDFLAGS) From ee99edc8099de8e47355dbdb8b6d27d8c9f13594 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sat, 21 Nov 2009 23:11:14 +0000 Subject: [PATCH 16/41] Some comments following Grub standard of code. --- gettext/gettext.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gettext/gettext.c b/gettext/gettext.c index 9a658f5db..ca00a86b7 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -222,12 +222,12 @@ grub_gettext_init_ext (const char *lang) fd_mo = 0; - // mo_file e.g.: /boot/grub/locale/ca.mo + /* mo_file e.g.: /boot/grub/locale/ca.mo */ mo_file = grub_malloc (grub_strlen (locale_dir) + sizeof ("/") + grub_strlen (lang) + sizeof(".mo")); - // Warning: if changing some paths in the below line, change the grub_malloc - // contents below + /* Warning: if changing some paths in the below line, change the grub_malloc + contents below. */ grub_sprintf (mo_file, "%s/%s.mo", locale_dir, lang); From 87d58298fdfab712ab008ff5b2006578cafbcf97 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 22 Nov 2009 10:20:14 +0000 Subject: [PATCH 17/41] 2009-11-22 Robert Millan * util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings. * util/i386/pc/grub-setup.c: Likewise. --- ChangeLog | 5 +++++ util/i386/pc/grub-mkimage.c | 8 ++++---- util/i386/pc/grub-setup.c | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79978d307..4a26413d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-22 Robert Millan + + * util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings. + * util/i386/pc/grub-setup.c: Likewise. + 2009-11-21 Samuel Thibault * util/getroot.c [__GNU__]: Include , , and diff --git a/util/i386/pc/grub-mkimage.c b/util/i386/pc/grub-mkimage.c index d675e4f01..785ea8c71 100644 --- a/util/i386/pc/grub-mkimage.c +++ b/util/i386/pc/grub-mkimage.c @@ -114,14 +114,14 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], if (memdisk_path) { memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512); - grub_util_info (_("the size of memory disk is 0x%x"), memdisk_size); + grub_util_info ("the size of memory disk is 0x%x", memdisk_size); total_module_size += memdisk_size + sizeof (struct grub_module_header); } if (config_path) { config_size = grub_util_get_image_size (config_path) + 1; - grub_util_info (_("the size of config file is 0x%x"), config_size); + grub_util_info ("the size of config file is 0x%x", config_size); total_module_size += config_size + sizeof (struct grub_module_header); } @@ -129,7 +129,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], total_module_size += (grub_util_get_image_size (p->name) + sizeof (struct grub_module_header)); - grub_util_info (_("the total module size is 0x%x"), total_module_size); + grub_util_info ("the total module size is 0x%x", total_module_size); kernel_img = xmalloc (kernel_size + total_module_size); grub_util_load_image (kernel_path, kernel_img); @@ -196,7 +196,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], compress_kernel (kernel_img, kernel_size + total_module_size, &core_img, &core_size); - grub_util_info (_("the core size is 0x%x"), core_size); + grub_util_info ("the core size is 0x%x", core_size); #if defined(GRUB_MACHINE_PCBIOS) { diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index 43762c2e4..f20db1e9a 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -159,7 +159,7 @@ setup (const char *dir, void NESTED_FUNC_ATTR save_first_sector (grub_disk_addr_t sector, unsigned offset, unsigned length) { - grub_util_info (_("the first sector is <%llu,%u,%u>"), + grub_util_info ("the first sector is <%llu,%u,%u>", sector, offset, length); if (offset != 0 || length != GRUB_DISK_SECTOR_SIZE) @@ -173,7 +173,7 @@ setup (const char *dir, { struct boot_blocklist *prev = block + 1; - grub_util_info (_("saving <%llu,%u,%u> with the segment 0x%x"), + grub_util_info ("saving <%llu,%u,%u> with the segment 0x%x", sector, offset, length, (unsigned) current_segment); if (offset != 0 || last_length != GRUB_DISK_SECTOR_SIZE) @@ -244,7 +244,7 @@ setup (const char *dir, if (! dest_dev) grub_util_error ("%s", grub_errmsg); - grub_util_info (_("setting the root device to `%s'"), root); + grub_util_info ("setting the root device to `%s'", root); if (grub_env_set ("root", root) != GRUB_ERR_NONE) grub_util_error ("%s", grub_errmsg); @@ -322,7 +322,7 @@ setup (const char *dir, bsd_part = grub_le_to_cpu32 (*install_bsd_part); } - grub_util_info (_("dos partition is %d, bsd partition is %d"), + grub_util_info ("dos partition is %d, bsd partition is %d", dos_part, bsd_part); if (! dest_dev->disk->has_partitions) @@ -378,7 +378,7 @@ setup (const char *dir, } - grub_util_info (_("the core image will be embedded at sector 0x%llx"), embed_region.start); + grub_util_info ("the core image will be embedded at sector 0x%llx", embed_region.start); *install_dos_part = grub_cpu_to_le32 (dos_part); *install_bsd_part = grub_cpu_to_le32 (bsd_part); @@ -446,11 +446,11 @@ unable_to_embed: if (file) { if (grub_file_size (file) != core_size) - grub_util_info (_("succeeded in opening the core image but the size is different (%d != %d)"), + grub_util_info ("succeeded in opening the core image but the size is different (%d != %d)", (int) grub_file_size (file), (int) core_size); else if (grub_file_read (file, tmp_img, core_size) != (grub_ssize_t) core_size) - grub_util_info (_("succeeded in opening the core image but cannot read %d bytes"), + grub_util_info ("succeeded in opening the core image but cannot read %d bytes", (int) core_size); else if (memcmp (core_img, tmp_img, core_size) != 0) { @@ -473,7 +473,7 @@ unable_to_embed: } #endif - grub_util_info (_("succeeded in opening the core image but the data is different")); + grub_util_info ("succeeded in opening the core image but the data is different"); } else { @@ -484,10 +484,10 @@ unable_to_embed: grub_file_close (file); } else - grub_util_info (_("couldn't open the core image")); + grub_util_info ("couldn't open the core image"); if (grub_errno) - grub_util_info (_("error message = %s"), grub_errmsg); + grub_util_info ("error message = %s", grub_errmsg); grub_errno = GRUB_ERR_NONE; sync (); @@ -541,7 +541,7 @@ unable_to_embed: *install_bsd_part = grub_cpu_to_le32 (bsd_part); /* Write the first two sectors of the core image onto the disk. */ - grub_util_info (_("opening the core image `%s'"), core_path); + grub_util_info ("opening the core image `%s'", core_path); fp = fopen (core_path, "r+b"); if (! fp) grub_util_error (_("Cannot open `%s'"), core_path); @@ -763,7 +763,7 @@ main (int argc, char *argv[]) root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY)); if (! root_dev) { - grub_util_info (_("guessing the root device failed, because of `%s'"), + grub_util_info ("guessing the root device failed, because of `%s'", grub_errmsg); grub_util_error (_("Cannot guess the root device. Specify the option ``--root-device''.")); } From 0648f857eade0c094b08baab277de4d9e74bbe90 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 11:49:54 +0000 Subject: [PATCH 18/41] Different changes following Robert's email 20091121230904.GA29740@thorin --- gettext/gettext.c | 167 +++++++++++++++++++-------------------- include/grub/file.h | 2 + include/grub/i18n.h | 2 +- include/grub/i18n_grub.h | 24 ------ kern/file.c | 10 +++ normal/menu_text.c | 4 +- po/ca.po | 7 +- util/grub.d/00_header.in | 4 +- 8 files changed, 107 insertions(+), 113 deletions(-) delete mode 100644 include/grub/i18n_grub.h diff --git a/gettext/gettext.c b/gettext/gettext.c index ca00a86b7..c488f0e50 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -25,6 +25,7 @@ #include #include #include +#include /* .mo file information from: @@ -32,42 +33,41 @@ */ -static grub_file_t grub_mofile_open (const char *name); static grub_file_t fd_mo; static int grub_gettext_offsetoriginal; static int grub_gettext_max; -static const char* (*grub_gettext_original) (const char *s); +static const char *(*grub_gettext_original) (const char *s); -#define GETTEXT_MAGIC_NUMBER 0 -#define GETTEXT_FILE_FORMAT 4 -#define GETTEXT_NUMBER_OF_STRINGS 8 -#define GETTEXT_OFFSET_ORIGINAL 12 -#define GETTEXT_OFFSET_TRANSLATION 16 +#define GETTEXT_MAGIC_NUMBER 0 +#define GETTEXT_FILE_FORMAT 4 +#define GETTEXT_NUMBER_OF_STRINGS 8 +#define GETTEXT_OFFSET_ORIGINAL 12 +#define GETTEXT_OFFSET_TRANSLATION 16 -#define MO_MAGIC_NUMBER 0x950412de +#define MO_MAGIC_NUMBER 0x950412de static grub_uint32_t grub_gettext_get_info (int offset) { grub_uint32_t value; - grub_file_seek (fd_mo, offset); - grub_file_read (fd_mo, (char*) &value, 4); + grub_file_pread (fd_mo, (char *) &value, 4, offset); + value = grub_cpu_to_le32 (value); return value; } static void -grub_gettext_getstring_from_offset (grub_uint32_t offset, grub_uint32_t length, char *translation) +grub_gettext_getstring_from_offset (grub_uint32_t offset, + grub_uint32_t length, char *translation) { - grub_file_seek (fd_mo, offset); - grub_file_read (fd_mo, translation, length); + grub_file_pread (fd_mo, translation, length, offset); translation[length] = '\0'; } -static char* +static char * grub_gettext_gettranslation_from_position (int position) { int offsettranslation; @@ -79,21 +79,19 @@ grub_gettext_gettranslation_from_position (int position) internal_position = offsettranslation + position * 8; - grub_file_seek (fd_mo, internal_position); - grub_file_read (fd_mo, (char*) &length, 4); + grub_file_pread (fd_mo, (char *) &length, 4, internal_position); length = grub_cpu_to_le32 (length); - - grub_file_seek (fd_mo, internal_position + 4), - grub_file_read (fd_mo, (char*) &offset, 4); + + grub_file_pread (fd_mo, (char *) &offset, 4, internal_position + 4); offset = grub_cpu_to_le32 (offset); - translation = grub_malloc(length + 1); + translation = grub_malloc (length + 1); grub_gettext_getstring_from_offset (offset, length, translation); return translation; } -static char* +static char * grub_gettext_getstring_from_position (int position) { int internal_position; @@ -104,12 +102,10 @@ grub_gettext_getstring_from_position (int position) internal_position = grub_gettext_offsetoriginal + (position * 8); /* Get the length of the string i. */ - grub_file_seek (fd_mo, internal_position); - grub_file_read (fd_mo, (char *) &length, 4); + grub_file_pread (fd_mo, (char *) &length, 4, internal_position); /* Get the offset of the string i. */ - grub_file_seek (fd_mo, internal_position + 4); - grub_file_read (fd_mo, (char *) &offset, 4); + grub_file_pread (fd_mo, (char *) &offset, 4, internal_position + 4); /* Get the string i. */ original = grub_malloc (length + 1); @@ -118,13 +114,13 @@ grub_gettext_getstring_from_position (int position) return original; } -static const char* +static const char * grub_gettext_translate (const char *orig) { char *current_string; char *ret; - int min,max,current; + int min, max, current; if (fd_mo == 0) return orig; @@ -140,25 +136,25 @@ grub_gettext_translate (const char *orig) /* Search by bisection. */ if (grub_strcmp (current_string, orig) < 0) - { - grub_free(current_string); - min=current; - } + { + grub_free (current_string); + min = current; + } else if (grub_strcmp (current_string, orig) > 0) - { - grub_free(current_string); - max=current; - } + { + grub_free (current_string); + max = current; + } else if (grub_strcmp (current_string, orig) == 0) - { - grub_free(current_string); - return grub_gettext_gettranslation_from_position (current); - } - current = (max+min)/2; + { + grub_free (current_string); + return grub_gettext_gettranslation_from_position (current); + } + current = (max + min) / 2; } - ret = grub_malloc(grub_strlen(orig) + 1); - grub_strcpy(ret,orig); + ret = grub_malloc (grub_strlen (orig) + 1); + grub_strcpy (ret, orig); return ret; } @@ -168,46 +164,42 @@ grub_mofile_open (const char *filename) { int unsigned magic; int version; + grub_file_t new_fd; /* Using fd_mo and not another variable because it's needed for grub_gettext_get_info. */ - fd_mo = grub_file_open (filename); - if (! fd_mo) + new_fd = grub_gzfile_open (filename, 1); + grub_errno = GRUB_ERR_NONE; + + if (!new_fd) { - grub_error (GRUB_ERR_FILE_READ_ERROR, "Cannot read %s",filename); + grub_dprintf ("gettext: Cannot read %s", filename); return 0; } + fd_mo = new_fd; + magic = grub_gettext_get_info (GETTEXT_MAGIC_NUMBER); if (magic != MO_MAGIC_NUMBER) { - grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo file: %s", filename); + grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo file: %s", + filename); grub_file_close (fd_mo); fd_mo = 0; return 0; } - + version = grub_gettext_get_info (GETTEXT_FILE_FORMAT); if (version != 0) { - grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo version in file: %s", filename); + grub_error (GRUB_ERR_BAD_FILE_TYPE, + "mo: invalid mo version in file: %s", filename); fd_mo = 0; return 0; } - - /* - Do we want .mo.gz files? Then, the code: - file = grub_gzio_open (io, 0); // 0: transparent - if (! file) - { - grub_printf("Problems opening the file\n"); - grub_file_close (io); - return 0; - } - */ return fd_mo; } @@ -219,57 +211,64 @@ grub_gettext_init_ext (const char *lang) char *locale_dir; locale_dir = grub_env_get ("locale_dir"); - - fd_mo = 0; - + if (locale_dir == NULL) + { + grub_printf ("locale_dir variable is not setted up."); + return; + } + + fd_mo = NULL; + /* mo_file e.g.: /boot/grub/locale/ca.mo */ - mo_file = grub_malloc (grub_strlen (locale_dir) + sizeof ("/") + grub_strlen (lang) + sizeof(".mo")); - + mo_file = + grub_malloc (grub_strlen (locale_dir) + grub_strlen ("/") + + grub_strlen (lang) + grub_strlen (".mo") + 1); + /* Warning: if changing some paths in the below line, change the grub_malloc contents below. */ - + grub_sprintf (mo_file, "%s/%s.mo", locale_dir, lang); - grub_dprintf("gettext", "Will try to open file: %s " ,mo_file); + fd_mo = grub_mofile_open (mo_file); - fd_mo = grub_mofile_open(mo_file); - grub_free (mo_file); + /* Will try adding .gz as well. */ + if (fd_mo == NULL) + { + grub_sprintf (mo_file, "%s.gz", mo_file); + fd_mo = grub_mofile_open (mo_file); + } if (fd_mo) { - grub_gettext_offsetoriginal = grub_gettext_get_info(GETTEXT_OFFSET_ORIGINAL); - grub_gettext_max = grub_gettext_get_info(GETTEXT_NUMBER_OF_STRINGS); + grub_gettext_offsetoriginal = + grub_gettext_get_info (GETTEXT_OFFSET_ORIGINAL); + grub_gettext_max = grub_gettext_get_info (GETTEXT_NUMBER_OF_STRINGS); grub_gettext_original = grub_gettext; grub_gettext = grub_gettext_translate; } } -static char* -grub_gettext_env_write_lang (struct grub_env_var *var __attribute__ ((unused)), - const char *val) +static char * +grub_gettext_env_write_lang (struct grub_env_var *var + __attribute__ ((unused)), const char *val) { grub_gettext_init_ext (val); return grub_strdup (val); } -GRUB_MOD_INIT(gettext) +GRUB_MOD_INIT (gettext) { - (void)mod; /* To stop warning. */ - + (void) mod; /* To stop warning. */ + const char *lang; - lang = grub_env_get ("lang"); + lang = grub_env_get ("lang"); grub_gettext_init_ext (lang); - /* Testing: - grub_register_command ("_", grub_cmd_translate, GRUB_COMMAND_FLAG_BOTH, - "_", "internalization support trans", 0); - */ - /* Reload .mo file information if lang changes. */ grub_register_variable_hook ("lang", NULL, grub_gettext_env_write_lang); @@ -277,10 +276,10 @@ GRUB_MOD_INIT(gettext) grub_env_export ("lang"); } -GRUB_MOD_FINI(gettext) +GRUB_MOD_FINI (gettext) { if (fd_mo != 0) - grub_file_close(fd_mo); + grub_file_close (fd_mo); grub_gettext = grub_gettext_original; } diff --git a/include/grub/file.h b/include/grub/file.h index 2aacf936f..6625e045d 100644 --- a/include/grub/file.h +++ b/include/grub/file.h @@ -55,6 +55,8 @@ grub_file_t EXPORT_FUNC(grub_file_open) (const char *name); grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, void *buf, grub_size_t len); grub_off_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, grub_off_t offset); +grub_ssize_t EXPORT_FUNC(grub_file_pread) (grub_file_t file, void *buf, grub_size_t len, grub_off_t offset); + grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file); static inline grub_off_t diff --git a/include/grub/i18n.h b/include/grub/i18n.h index e436f6e28..96317fd33 100644 --- a/include/grub/i18n.h +++ b/include/grub/i18n.h @@ -24,7 +24,7 @@ # include # define _(str) gettext(str) #else -# define _(str) str +# define _(str) grub_gettext(str) #endif #endif /* GRUB_I18N_H */ diff --git a/include/grub/i18n_grub.h b/include/grub/i18n_grub.h deleted file mode 100644 index ed3382568..000000000 --- a/include/grub/i18n_grub.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 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 - * 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 . - */ - -#ifndef GRUB_I18N_GRUB_H -#define GRUB_I18N_GRUB_H 1 - -# define _(str) grub_gettext(str) - -#endif /* GRUB_I18N_GRUB_H */ diff --git a/kern/file.c b/kern/file.c index f713acbca..00f69f05d 100644 --- a/kern/file.c +++ b/kern/file.c @@ -164,3 +164,13 @@ grub_file_seek (grub_file_t file, grub_off_t offset) file->offset = offset; return old; } + +grub_ssize_t +grub_file_pread (grub_file_t file, void *buf, grub_size_t len, grub_off_t offset) +{ + if (grub_file_seek (file, offset) == (grub_off_t)-1) + { + return -1; + } + return grub_file_read (file, buf, len); +} diff --git a/normal/menu_text.c b/normal/menu_text.c index 66a0bcfb4..fe86195dc 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include /* Time to delay after displaying an error message about a default/fallback entry failing to boot. */ @@ -267,7 +267,7 @@ 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. "); char *msg_end = grub_strchr (msg, '%'); grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3); diff --git a/po/ca.po b/po/ca.po index 02cfe3751..bf4f89c30 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 21:37+0000\n" +"POT-Creation-Date: 2009-11-22 11:45+0000\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan \n" "Language-Team: None \n" @@ -891,6 +891,11 @@ msgstr "" "\n" " Utilitzeu les tecles %C i %C per a seleccionar l'entrada.\n" +#: normal/menu_text.c:270 +#, c-format +msgid " The highlighted entry will be booted automatically in %ds. " +msgstr " L entrada seleccionada sera arrancada automaticament en %ds. " + #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" msgstr "" diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index d1e25dfe3..96352cdae 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -103,11 +103,13 @@ EOF esac # Gettext variables and module -cat << EOF +if [ "x${LANG}" != "xC" ] ; then + cat << EOF set locale_dir=${locale_dir} set lang=${grub_lang} insmod gettext EOF +fi if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then From e5fb78c684240e2db5e38dac1b93d1c19b142dfe Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 12:50:46 +0000 Subject: [PATCH 19/41] This commit is the same than gettext08.patch (see mailing list) --- ChangeLog.gettext | 29 ++++++++++++++++------------- conf/common.rmk | 2 +- gettext/gettext.c | 23 +++++++++++++++++------ include/grub/file.h | 2 -- include/grub/misc.h | 2 +- kern/file.c | 10 ---------- 6 files changed, 35 insertions(+), 33 deletions(-) diff --git a/ChangeLog.gettext b/ChangeLog.gettext index 6bce3f38b..a62869861 100644 --- a/ChangeLog.gettext +++ b/ChangeLog.gettext @@ -1,15 +1,18 @@ YYYY-MM-DD Carles Pina i Estany - * conf/common.rmk: Add grub-gettext_lib target, dependency and - SOURCES, CFLAGS, LDFLAGS - * gettext/gettext.c: New file with gettext implementation - * include/grub/i18n_grub.h: New file with grub_gettext macros - * include/grub/misc.h: Define macro _(char *s). Declare - grub_gettext_dummy and grub_gettext - * kern/misc.c: Define grub_gettext symbol implementation of the - grub_gettext_dummy function - * normal/menu_text.c: Gettextize one message in print_message - * po/POTFILES: Adds normal/menu_text.c - * po/ca.po: Adds the new string - * util/grub.d/00_header.in: defines gettext variables and loads - the module + * conf/common.rmk: Add grub-gettext_lib target and updates + lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS, + LDFLAGS. + * gettext/gettext.c: New file. (Reads mo files). + * include/grub/file.h (grub_file_pread): New prototype. + * include/grub/i18n.h (_): New prototype. + * include/grub/misc.h (grub_gettext_dummy, grub_gettext): New + prototypes. + * kern/misc.c (grub_gettext_dummy): New function. + * menu/menu_text.c: Include . + * menu/menu_text.c (print_timeout): Gettexttize string. + * menu/menu_text.c (print_message): Gettexttize string. + * po/POTFILES: Add `normal/menu_text.c'. + * po/ca.po: Add new translations. + * util/grub.d/00_header.in: Define locale_dir and lang. insmod + gettext module and defines locale_dir and lang in grub.cfg. diff --git a/conf/common.rmk b/conf/common.rmk index a4c3c80e8..be0543d83 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -185,7 +185,7 @@ grub-mkconfig_DATA += util/grub.d/README pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \ ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \ affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \ - udf.mod afs.mod afs_be.mod befs.mod befs_be.mod + udf.mod afs.mod afs_be.mod befs.mod befs_be.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c diff --git a/gettext/gettext.c b/gettext/gettext.c index c488f0e50..799d8a037 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -48,12 +48,23 @@ static const char *(*grub_gettext_original) (const char *s); #define MO_MAGIC_NUMBER 0x950412de +static grub_ssize_t +grub_gettext_pread (grub_file_t file, void *buf, grub_size_t len, + grub_off_t offset) +{ + if (grub_file_seek (file, offset) == (grub_off_t) - 1) + { + return -1; + } + return grub_file_read (file, buf, len); +} + static grub_uint32_t grub_gettext_get_info (int offset) { grub_uint32_t value; - grub_file_pread (fd_mo, (char *) &value, 4, offset); + grub_gettext_pread (fd_mo, (char *) &value, 4, offset); value = grub_cpu_to_le32 (value); return value; @@ -63,7 +74,7 @@ static void grub_gettext_getstring_from_offset (grub_uint32_t offset, grub_uint32_t length, char *translation) { - grub_file_pread (fd_mo, translation, length, offset); + grub_gettext_pread (fd_mo, translation, length, offset); translation[length] = '\0'; } @@ -79,10 +90,10 @@ grub_gettext_gettranslation_from_position (int position) internal_position = offsettranslation + position * 8; - grub_file_pread (fd_mo, (char *) &length, 4, internal_position); + grub_gettext_pread (fd_mo, (char *) &length, 4, internal_position); length = grub_cpu_to_le32 (length); - grub_file_pread (fd_mo, (char *) &offset, 4, internal_position + 4); + grub_gettext_pread (fd_mo, (char *) &offset, 4, internal_position + 4); offset = grub_cpu_to_le32 (offset); translation = grub_malloc (length + 1); @@ -102,10 +113,10 @@ grub_gettext_getstring_from_position (int position) internal_position = grub_gettext_offsetoriginal + (position * 8); /* Get the length of the string i. */ - grub_file_pread (fd_mo, (char *) &length, 4, internal_position); + grub_gettext_pread (fd_mo, (char *) &length, 4, internal_position); /* Get the offset of the string i. */ - grub_file_pread (fd_mo, (char *) &offset, 4, internal_position + 4); + grub_gettext_pread (fd_mo, (char *) &offset, 4, internal_position + 4); /* Get the string i. */ original = grub_malloc (length + 1); diff --git a/include/grub/file.h b/include/grub/file.h index 6625e045d..2aacf936f 100644 --- a/include/grub/file.h +++ b/include/grub/file.h @@ -55,8 +55,6 @@ grub_file_t EXPORT_FUNC(grub_file_open) (const char *name); grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, void *buf, grub_size_t len); grub_off_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, grub_off_t offset); -grub_ssize_t EXPORT_FUNC(grub_file_pread) (grub_file_t file, void *buf, grub_size_t len, grub_off_t offset); - grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file); static inline grub_off_t diff --git a/include/grub/misc.h b/include/grub/misc.h index bc725f9ca..8ec8ad822 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -192,7 +192,7 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, grub_uint32_t d, grub_uint32_t *r); const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s); -extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);// = grub_gettext_dummy; +extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s); #ifdef NEED_ENABLE_EXECUTE_STACK void EXPORT_FUNC(__enable_execute_stack) (void *addr); diff --git a/kern/file.c b/kern/file.c index 00f69f05d..f713acbca 100644 --- a/kern/file.c +++ b/kern/file.c @@ -164,13 +164,3 @@ grub_file_seek (grub_file_t file, grub_off_t offset) file->offset = offset; return old; } - -grub_ssize_t -grub_file_pread (grub_file_t file, void *buf, grub_size_t len, grub_off_t offset) -{ - if (grub_file_seek (file, offset) == (grub_off_t)-1) - { - return -1; - } - return grub_file_read (file, buf, len); -} From 938d89c04d905b185eed012b7813839acacec52e Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 13:01:49 +0000 Subject: [PATCH 20/41] Corrects Catalan translation --- po/ca.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/ca.po b/po/ca.po index bf4f89c30..750574847 100644 --- a/po/ca.po +++ b/po/ca.po @@ -63,7 +63,7 @@ msgstr "" #: util/i386/pc/grub-mkimage.c:321 util/i386/pc/grub-setup.c:587 #, c-format msgid "Try ``%s --help'' for more information.\n" -msgstr "Proveu «%s --help» per a obtenir més informació.\n" +msgstr "Proveu «%s --help» per a obtenir més informació.\n" #: util/i386/pc/grub-mkimage.c:323 #, c-format @@ -894,7 +894,7 @@ msgstr "" #: normal/menu_text.c:270 #, c-format msgid " The highlighted entry will be booted automatically in %ds. " -msgstr " L entrada seleccionada sera arrancada automaticament en %ds. " +msgstr " L' entrada seleccionada serà arrancada automàticament en %ds. " #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" From c505aa627f4e9cc43d72d7f2516d91c1f6c25b2d Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 16:57:17 +0000 Subject: [PATCH 21/41] Removes a debug variable (new_fd) --- gettext/gettext.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gettext/gettext.c b/gettext/gettext.c index 799d8a037..355bb75a0 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -175,22 +175,19 @@ grub_mofile_open (const char *filename) { int unsigned magic; int version; - grub_file_t new_fd; /* Using fd_mo and not another variable because it's needed for grub_gettext_get_info. */ - new_fd = grub_gzfile_open (filename, 1); + fd_mo = grub_gzfile_open (filename, 1); grub_errno = GRUB_ERR_NONE; - if (!new_fd) + if (!fd_mo) { - grub_dprintf ("gettext: Cannot read %s", filename); + grub_dprintf ("gettext", "Cannot read %s", filename); return 0; } - fd_mo = new_fd; - magic = grub_gettext_get_info (GETTEXT_MAGIC_NUMBER); if (magic != MO_MAGIC_NUMBER) From 30144059239f9e3475349e2d0e9a5e5092faf0f1 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 16:59:20 +0000 Subject: [PATCH 22/41] Changes catalan strings like it was before (test) --- po/ca.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/ca.po b/po/ca.po index 750574847..e0e6e4d06 100644 --- a/po/ca.po +++ b/po/ca.po @@ -894,7 +894,7 @@ msgstr "" #: normal/menu_text.c:270 #, c-format msgid " The highlighted entry will be booted automatically in %ds. " -msgstr " L' entrada seleccionada serà arrancada automàticament en %ds. " +msgstr " L' entrada seleccionada sera arrancada automaticament en %ds. " #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" From b6c871b0d7879f1848d70ebde302e453a6ca50a2 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 18:58:19 +0000 Subject: [PATCH 23/41] Some more changes... --- gettext/gettext.c | 21 +++++++++++++++++++-- po/ca.po | 6 +++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/gettext/gettext.c b/gettext/gettext.c index 355bb75a0..46ceb3432 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -184,7 +184,7 @@ grub_mofile_open (const char *filename) if (!fd_mo) { - grub_dprintf ("gettext", "Cannot read %s", filename); + grub_dprintf ("gettext", "Cannot read %s\n", filename); return 0; } @@ -204,7 +204,7 @@ grub_mofile_open (const char *filename) if (version != 0) { grub_error (GRUB_ERR_BAD_FILE_TYPE, - "mo: invalid mo version in file: %s", filename); + "mo: invalid mo version in file: %s\n", filename); fd_mo = 0; return 0; } @@ -267,6 +267,19 @@ grub_gettext_env_write_lang (struct grub_env_var *var return grub_strdup (val); } +static grub_err_t +grub_cmd_translate (grub_command_t cmd __attribute__ ((unused)), + int argc, char **args) +{ + if (argc != 1) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "text to translate required"); + + const char *translation; + translation = grub_gettext_translate (args[0]); + grub_printf ("%s\n", translation); + return 0; +} + GRUB_MOD_INIT (gettext) { (void) mod; /* To stop warning. */ @@ -277,6 +290,10 @@ GRUB_MOD_INIT (gettext) grub_gettext_init_ext (lang); + grub_register_command_p1 ("gettext", grub_cmd_translate, + "gettext STRING", + "Translates the string with the current settings."); + /* Reload .mo file information if lang changes. */ grub_register_variable_hook ("lang", NULL, grub_gettext_env_write_lang); diff --git a/po/ca.po b/po/ca.po index e0e6e4d06..12d57b0af 100644 --- a/po/ca.po +++ b/po/ca.po @@ -63,7 +63,7 @@ msgstr "" #: util/i386/pc/grub-mkimage.c:321 util/i386/pc/grub-setup.c:587 #, c-format msgid "Try ``%s --help'' for more information.\n" -msgstr "Proveu «%s --help» per a obtenir més informació.\n" +msgstr "Proveu «%s --help» per a obtenir més informació.\n" #: util/i386/pc/grub-mkimage.c:323 #, c-format @@ -889,12 +889,12 @@ msgid "" " Use the %C and %C keys to select which entry is highlighted.\n" msgstr "" "\n" -" Utilitzeu les tecles %C i %C per a seleccionar l'entrada.\n" +" Utilitzeu les tecles %C i %C per a seleccionar l'entrada ressaltada.\n" #: normal/menu_text.c:270 #, c-format msgid " The highlighted entry will be booted automatically in %ds. " -msgstr " L' entrada seleccionada sera arrancada automaticament en %ds. " +msgstr " L' entrada seleccionada arrencarà automàticament en %ds. " #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" From 6e2621b9ffc088b54a859337d463b01de607c662 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 21:41:33 +0000 Subject: [PATCH 24/41] Final touches (don't gettextize a string, chang setted by set) --- gettext/gettext.c | 2 +- normal/menu_text.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gettext/gettext.c b/gettext/gettext.c index 46ceb3432..5c1279dc3 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -221,7 +221,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 setted up."); + grub_printf ("locale_dir variable is not set up."); return; } diff --git a/normal/menu_text.c b/normal/menu_text.c index fe86195dc..4ff22e928 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -267,7 +267,7 @@ print_timeout (int timeout, int offset, int second_stage) { /* NOTE: Do not remove the trailing space characters. They are required to clear the line. */ - const char *msg = _(" The highlighted entry will be booted automatically in %ds. "); + char *msg = " The highlighted entry will be booted automatically in %ds. "; char *msg_end = grub_strchr (msg, '%'); grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3); From 347687cf6e51c424c26a71ccff87b1019f4cab3c Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 21:42:28 +0000 Subject: [PATCH 25/41] Removes the non-gettext string --- po/ca.po | 5 ----- 1 file changed, 5 deletions(-) diff --git a/po/ca.po b/po/ca.po index 12d57b0af..509ea3c7d 100644 --- a/po/ca.po +++ b/po/ca.po @@ -891,11 +891,6 @@ msgstr "" "\n" " Utilitzeu les tecles %C i %C per a seleccionar l'entrada ressaltada.\n" -#: normal/menu_text.c:270 -#, c-format -msgid " The highlighted entry will be booted automatically in %ds. " -msgstr " L' entrada seleccionada arrencarà automàticament en %ds. " - #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" msgstr "" From 4baf87d9e44f10c3ab1fb287f77edf7d681734b6 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 21:45:40 +0000 Subject: [PATCH 26/41] merging to trunk... --- ChangeLog | 19 +++++++++++++++++++ ChangeLog.gettext | 18 ------------------ 2 files changed, 19 insertions(+), 18 deletions(-) delete mode 100644 ChangeLog.gettext diff --git a/ChangeLog b/ChangeLog index 4a26413d4..d9f2cee2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2009-11-22 Carles Pina i Estany + + * conf/common.rmk: Add grub-gettext_lib target and updates + lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS, + LDFLAGS. + * gettext/gettext.c: New file. (Reads mo files). + * include/grub/file.h (grub_file_pread): New prototype. + * include/grub/i18n.h (_): New prototype. + * include/grub/misc.h (grub_gettext_dummy, grub_gettext): New + prototypes. + * kern/misc.c (grub_gettext_dummy): New function. + * menu/menu_text.c: Include . + * menu/menu_text.c (print_timeout): Gettexttize string. + * menu/menu_text.c (print_message): Gettexttize string. + * po/POTFILES: Add `normal/menu_text.c'. + * po/ca.po: Add new translations. + * util/grub.d/00_header.in: Define locale_dir and lang. insmod + gettext module and defines locale_dir and lang in grub.cfg. + 2009-11-22 Robert Millan * util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings. diff --git a/ChangeLog.gettext b/ChangeLog.gettext deleted file mode 100644 index a62869861..000000000 --- a/ChangeLog.gettext +++ /dev/null @@ -1,18 +0,0 @@ -YYYY-MM-DD Carles Pina i Estany - - * conf/common.rmk: Add grub-gettext_lib target and updates - lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS, - LDFLAGS. - * gettext/gettext.c: New file. (Reads mo files). - * include/grub/file.h (grub_file_pread): New prototype. - * include/grub/i18n.h (_): New prototype. - * include/grub/misc.h (grub_gettext_dummy, grub_gettext): New - prototypes. - * kern/misc.c (grub_gettext_dummy): New function. - * menu/menu_text.c: Include . - * menu/menu_text.c (print_timeout): Gettexttize string. - * menu/menu_text.c (print_message): Gettexttize string. - * po/POTFILES: Add `normal/menu_text.c'. - * po/ca.po: Add new translations. - * util/grub.d/00_header.in: Define locale_dir and lang. insmod - gettext module and defines locale_dir and lang in grub.cfg. From 4d1f668fd9be725d9a5cac6209505ca9b113e1f9 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 22:24:54 +0000 Subject: [PATCH 27/41] 2009-11-22 Carles Pina i Estany * normal/menu_text.c: Gettexttize but not print_timeout function. * normal/main.c: Gettexttize. * normal/menu_entry.c: Likewise. --- ChangeLog.gettext2 | 5 +++++ normal/main.c | 5 +++-- normal/menu_entry.c | 5 +++-- normal/menu_text.c | 20 ++++++++++---------- 4 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 ChangeLog.gettext2 diff --git a/ChangeLog.gettext2 b/ChangeLog.gettext2 new file mode 100644 index 000000000..0aee7e2e4 --- /dev/null +++ b/ChangeLog.gettext2 @@ -0,0 +1,5 @@ +2009-11-22 Carles Pina i Estany + + * normal/menu_text.c: Gettexttize but not print_timeout function. + * normal/main.c: Gettexttize. + * normal/menu_entry.c: Likewise. diff --git a/normal/main.c b/normal/main.c index 748eef805..afe3667f3 100644 --- a/normal/main.c +++ b/normal/main.c @@ -29,6 +29,7 @@ #include #include #include +#include #define GRUB_DEFAULT_HISTORY_SIZE 50 @@ -508,10 +509,10 @@ grub_normal_reader_init (void) grub_normal_init_page (); grub_setcursor (1); - grub_printf ("\ + grub_printf (_("\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\ lists possible command completions. Anywhere else TAB lists possible\n\ - device/file completions.%s ]\n\n", + device/file completions.%s ]\n\n"), reader_nested ? " ESC at any time exits." : ""); return 0; diff --git a/normal/menu_entry.c b/normal/menu_entry.c index 75a63779f..7478c33ae 100644 --- a/normal/menu_entry.c +++ b/normal/menu_entry.c @@ -24,6 +24,7 @@ #include #include #include +#include enum update_mode { @@ -996,7 +997,7 @@ run (struct screen *screen) } grub_cls (); - grub_printf (" Booting a command list\n\n"); + grub_printf (_(" Booting a command list\n\n")); /* Execute the script, line for line. */ @@ -1176,6 +1177,6 @@ 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_printf (_("\nPress any key to continue...")); (void) grub_getkey (); } diff --git a/normal/menu_text.c b/normal/menu_text.c index 4ff22e928..de28205de 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -39,7 +39,7 @@ static grub_uint8_t grub_color_menu_highlight; void grub_wait_after_message (void) { - grub_printf ("\nPress any key to continue..."); + grub_printf (_("\nPress any key to continue...")); (void) grub_getkey (); grub_putchar ('\n'); } @@ -87,22 +87,22 @@ print_message (int nested, int edit) if (edit) { - grub_printf ("\n\ + 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."); + 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 ("\ + grub_printf (_("\ Press enter to boot the selected OS, \'e\' to edit the\n\ - commands before booting or \'c\' for a command-line."); + commands before booting or \'c\' for a command-line.")); if (nested) - grub_printf ("\n\ - ESC to return previous menu."); + grub_printf (_("\n\ + ESC to return previous menu.")); } } @@ -517,7 +517,7 @@ static void notify_booting (grub_menu_entry_t entry, void *userdata __attribute__((unused))) { - grub_printf (" Booting \'%s\'\n\n", entry->title); + grub_printf (_(" Booting \'%s\'\n\n"), entry->title); } /* Callback invoked when a default menu entry executed because of a timeout @@ -527,7 +527,7 @@ 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 Falling back to \'%s\'\n\n"), entry->title); grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS); } @@ -541,7 +541,7 @@ 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 Failed to boot default entries.\n")); grub_wait_after_message (); } From 9874f057590a90c39fbafd6faae768157da70200 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sun, 22 Nov 2009 23:41:06 +0000 Subject: [PATCH 28/41] 2009-11-22 Carles Pina i Estany * normal/menu_text.c (get_spaces): New function. (print_timeout): Gettextize, add spaces to the localized string. --- normal/menu_text.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/normal/menu_text.c b/normal/menu_text.c index de28205de..524b6a7e9 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -262,12 +262,34 @@ get_entry_number (const char *name) return entry; } +static char* +get_spaces (int number_spaces) +{ + char* spaces = grub_malloc(number_spaces + 1); + int i; + + spaces[0] = '\0'; + + for (i=0;i Date: Mon, 23 Nov 2009 11:17:50 +0000 Subject: [PATCH 29/41] 2009-11-23 Robert Millan Based on patch from Bean (http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00384.html) * video/efi_fb.c: New file. * conf/i386-efi.rmk (pkglib_MODULES): Add `efi_fb.mod'. (efi_fb_mod_SOURCES, efi_fb_mod_CFLAGS, efi_fb_mod_LDFLAGS): New variables. * conf/x86_64-efi.rmk: Likewise. --- ChangeLog | 11 ++ conf/i386-efi.rmk | 5 + conf/x86_64-efi.rmk | 5 + video/efi_fb.c | 337 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 358 insertions(+) create mode 100644 video/efi_fb.c diff --git a/ChangeLog b/ChangeLog index 4a26413d4..21f891553 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-11-23 Robert Millan + + Based on patch from Bean + (http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00384.html) + + * video/efi_fb.c: New file. + * conf/i386-efi.rmk (pkglib_MODULES): Add `efi_fb.mod'. + (efi_fb_mod_SOURCES, efi_fb_mod_CFLAGS, efi_fb_mod_LDFLAGS): New + variables. + * conf/x86_64-efi.rmk: Likewise. + 2009-11-22 Robert Millan * util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings. diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index 99ab06f64..39613d186 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -196,6 +196,11 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) +pkglib_MODULES += efi_fb.mod +efi_fb_mod_SOURCES = video/efi_fb.c +efi_fb_mod_CFLAGS = $(COMMON_CFLAGS) +efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) + pkglib_MODULES += xnu.mod xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\ loader/macho.c loader/xnu.c loader/i386/xnu_helper.S diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index f536746ef..2e90dc428 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -201,6 +201,11 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) +pkglib_MODULES += efi_fb.mod +efi_fb_mod_SOURCES = video/efi_fb.c +efi_fb_mod_CFLAGS = $(COMMON_CFLAGS) +efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) + pkglib_MODULES += xnu.mod xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\ loader/macho.c loader/xnu.c loader/i386/xnu_helper.S diff --git a/video/efi_fb.c b/video/efi_fb.c new file mode 100644 index 000000000..2faff12f9 --- /dev/null +++ b/video/efi_fb.c @@ -0,0 +1,337 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2005,2006,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 + * 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 . + */ + +#define grub_video_render_target grub_video_fbrender_target + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID; +static struct grub_efi_uga_draw_protocol *uga; +static grub_uint32_t uga_fb; +static grub_uint32_t uga_pitch; + +static struct +{ + struct grub_video_mode_info mode_info; + struct grub_video_render_target *render_target; + grub_uint8_t *ptr; +} framebuffer; + +#define RGB_MASK 0xffffff +#define RGB_MAGIC 0x121314 +#define LINE_MIN 800 +#define LINE_MAX 4096 +#define FBTEST_STEP (0x10000 >> 2) +#define FBTEST_COUNT 8 + +static int +find_line_len (grub_uint32_t *fb_base, grub_uint32_t *line_len) +{ + grub_uint32_t *base = (grub_uint32_t *) (grub_target_addr_t) *fb_base; + int i; + + for (i = 0; i < FBTEST_COUNT; i++, base += FBTEST_STEP) + { + if ((*base & RGB_MASK) == RGB_MAGIC) + { + int j; + + for (j = LINE_MIN; j <= LINE_MAX; j++) + { + if ((base[j] & RGB_MASK) == RGB_MAGIC) + { + *fb_base = (grub_uint32_t) (grub_target_addr_t) base; + *line_len = j << 2; + + return 1; + } + } + + break; + } + } + + return 0; +} + +static int +find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len) +{ + int found = 0; + + auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func, + grub_pci_id_t pciid); + + int NESTED_FUNC_ATTR find_card (int bus, int dev, int func, + grub_pci_id_t pciid) + { + grub_pci_address_t addr; + + addr = grub_pci_make_address (bus, dev, func, 2); + if (grub_pci_read (addr) >> 24 == 0x3) + { + int i; + + grub_dprintf ("fb", "Display controller: %d:%d.%d\nDevice id: %x\n", + bus, dev, func, pciid); + addr += 8; + for (i = 0; i < 6; i++, addr += 4) + { + grub_uint32_t old_bar1, old_bar2, type; + grub_uint64_t base64; + + old_bar1 = grub_pci_read (addr); + if ((! old_bar1) || (old_bar1 & GRUB_PCI_ADDR_SPACE_IO)) + continue; + + type = old_bar1 & GRUB_PCI_ADDR_MEM_TYPE_MASK; + if (type == GRUB_PCI_ADDR_MEM_TYPE_64) + { + if (i == 5) + break; + + old_bar2 = grub_pci_read (addr + 4); + } + else + old_bar2 = 0; + + base64 = old_bar2; + base64 <<= 32; + base64 |= (old_bar1 & GRUB_PCI_ADDR_MEM_MASK); + + grub_dprintf ("fb", "%s(%d): 0x%llx\n", + ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) ? + "VMEM" : "MMIO"), i, + (unsigned long long) base64); + + if ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) && (! found)) + { + *fb_base = base64; + if (find_line_len (fb_base, line_len)) + found++; + } + + if (type == GRUB_PCI_ADDR_MEM_TYPE_64) + { + i++; + addr += 4; + } + } + } + + return found; + } + + grub_pci_iterate (find_card); + return found; +} + +static int +check_protocol (void) +{ + grub_efi_uga_draw_protocol_t *c; + + c = grub_efi_locate_protocol (&uga_draw_guid, 0); + if (c) + { + grub_uint32_t width, height, depth, rate, pixel; + int ret; + + if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate)) + return 0; + + grub_efi_set_text_mode (0); + pixel = RGB_MAGIC; + efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel, + GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0); + ret = find_framebuf (&uga_fb, &uga_pitch); + grub_efi_set_text_mode (1); + + if (ret) + { + uga = c; + return 1; + } + } + + return 0; +} + +static grub_err_t +grub_video_efi_init (void) +{ + grub_memset (&framebuffer, 0, sizeof(framebuffer)); + return grub_video_fb_init (); +} + +static grub_err_t +grub_video_efi_fini (void) +{ + return grub_video_fb_fini (); +} + +static grub_err_t +grub_video_efi_setup (unsigned int width, unsigned int height, + unsigned int mode_type) +{ + unsigned int depth; + int found = 0; + + depth = (mode_type & GRUB_VIDEO_MODE_TYPE_DEPTH_MASK) + >> GRUB_VIDEO_MODE_TYPE_DEPTH_POS; + + { + grub_uint32_t w; + grub_uint32_t h; + grub_uint32_t d; + grub_uint32_t r; + + if ((! efi_call_5 (uga->get_mode, uga, &w, &h, &d, &r)) && + ((! width) || (width == w)) && + ((! height) || (height == h)) && + ((! depth) || (depth == d))) + { + framebuffer.mode_info.width = w; + framebuffer.mode_info.height = h; + framebuffer.mode_info.pitch = uga_pitch; + framebuffer.ptr = (grub_uint8_t *) (grub_target_addr_t) uga_fb; + + found = 1; + } + } + + if (found) + { + grub_err_t err; + + framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB; + framebuffer.mode_info.bpp = 32; + framebuffer.mode_info.bytes_per_pixel = 4; + framebuffer.mode_info.number_of_colors = 256; /* TODO: fix me. */ + framebuffer.mode_info.red_mask_size = 8; + framebuffer.mode_info.red_field_pos = 16; + framebuffer.mode_info.green_mask_size = 8; + framebuffer.mode_info.green_field_pos = 8; + framebuffer.mode_info.blue_mask_size = 8; + framebuffer.mode_info.blue_field_pos = 0; + framebuffer.mode_info.reserved_mask_size = 8; + framebuffer.mode_info.reserved_field_pos = 24; + + framebuffer.mode_info.blit_format = + grub_video_get_blit_format (&framebuffer.mode_info); + + err = grub_video_fb_create_render_target_from_pointer + (&framebuffer.render_target, + &framebuffer.mode_info, + framebuffer.ptr); + + if (err) + return err; + + err = grub_video_fb_set_active_render_target + (framebuffer.render_target); + + if (err) + return err; + + err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS, + grub_video_fbstd_colors); + + return err; + } + + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found."); +} + +static grub_err_t +grub_video_efi_swap_buffers (void) +{ + /* TODO: Implement buffer swapping. */ + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_video_efi_set_active_render_target (struct grub_video_render_target *target) +{ + if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY) + target = framebuffer.render_target; + + return grub_video_fb_set_active_render_target (target); +} + +static grub_err_t +grub_video_efi_get_info_and_fini (struct grub_video_mode_info *mode_info, + void **framebuf) +{ + grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info)); + *framebuf = (char *) framebuffer.ptr; + + grub_video_fb_fini (); + + return GRUB_ERR_NONE; +} + +static struct grub_video_adapter grub_video_efi_adapter = + { + .name = "EFI frame buffer driver", + + .init = grub_video_efi_init, + .fini = grub_video_efi_fini, + .setup = grub_video_efi_setup, + .get_info = grub_video_fb_get_info, + .get_info_and_fini = grub_video_efi_get_info_and_fini, + .set_palette = grub_video_fb_set_palette, + .get_palette = grub_video_fb_get_palette, + .set_viewport = grub_video_fb_set_viewport, + .get_viewport = grub_video_fb_get_viewport, + .map_color = grub_video_fb_map_color, + .map_rgb = grub_video_fb_map_rgb, + .map_rgba = grub_video_fb_map_rgba, + .unmap_color = grub_video_fb_unmap_color, + .fill_rect = grub_video_fb_fill_rect, + .blit_bitmap = grub_video_fb_blit_bitmap, + .blit_render_target = grub_video_fb_blit_render_target, + .scroll = grub_video_fb_scroll, + .swap_buffers = grub_video_efi_swap_buffers, + .create_render_target = grub_video_fb_create_render_target, + .delete_render_target = grub_video_fb_delete_render_target, + .set_active_render_target = grub_video_efi_set_active_render_target, + .get_active_render_target = grub_video_fb_get_active_render_target, + }; + +GRUB_MOD_INIT(efi_fb) +{ + if (check_protocol ()) + grub_video_register (&grub_video_efi_adapter); +} + +GRUB_MOD_FINI(efi_fb) +{ + if (uga) + grub_video_unregister (&grub_video_efi_adapter); +} From 57082942dd0afc122e65720e9961d1da883450cb Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 12:18:37 +0000 Subject: [PATCH 30/41] Add auto-generated gcrypt files. --- .bzrignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bzrignore b/.bzrignore index 999e44c95..0cb0cb457 100644 --- a/.bzrignore +++ b/.bzrignore @@ -13,6 +13,7 @@ config.log config.status configure conf/*.mk +conf/gcry.rmk *.d DISTLIST docs/*.info @@ -44,6 +45,7 @@ grub_setup_init.h *.img include/grub/cpu include/grub/machine +lib/libgcrypt-grub *.lst Makefile *.mod From ea1dd8bf0a3e4969af0e2685186b3932582ff1ad Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 13:18:07 +0000 Subject: [PATCH 31/41] 2009-11-23 Robert Millan * Makefile.in ($(srcdir)/po/$(PACKAGE).pot): Pass --keyword=N_ to `$(XGETTEXT)'. * include/grub/i18n.h (N_): New macro. * util/mkisofs/mkisofs.h: Likewise. * util/mkisofs/mkisofs.c (ld_options): Wrap all translatable strings around N_(). (usage): Use gettext() to translate help strings when printing them. --- ChangeLog | 10 +++++ Makefile.in | 2 +- include/grub/i18n.h | 2 + util/mkisofs/mkisofs.c | 100 ++++++++++++++++++++--------------------- util/mkisofs/mkisofs.h | 1 + 5 files changed, 64 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21f891553..1952e6d42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-11-23 Robert Millan + + * Makefile.in ($(srcdir)/po/$(PACKAGE).pot): Pass --keyword=N_ to + `$(XGETTEXT)'. + * include/grub/i18n.h (N_): New macro. + * util/mkisofs/mkisofs.h: Likewise. + * util/mkisofs/mkisofs.c (ld_options): Wrap all translatable strings + around N_(). + (usage): Use gettext() to translate help strings when printing them. + 2009-11-23 Robert Millan Based on patch from Bean diff --git a/Makefile.in b/Makefile.in index d9f107bef..17cf6209f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -473,7 +473,7 @@ genkernsyms.sh: genkernsyms.sh.in config.status $(SHELL) ./config.status $(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell - cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ + cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_ cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell $(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot diff --git a/include/grub/i18n.h b/include/grub/i18n.h index e436f6e28..99efb819a 100644 --- a/include/grub/i18n.h +++ b/include/grub/i18n.h @@ -27,4 +27,6 @@ # define _(str) str #endif +#define N_(str) str + #endif /* GRUB_I18N_H */ diff --git a/util/mkisofs/mkisofs.c b/util/mkisofs/mkisofs.c index 4ce69e035..4b43ba63b 100644 --- a/util/mkisofs/mkisofs.c +++ b/util/mkisofs/mkisofs.c @@ -200,107 +200,107 @@ struct ld_option static const struct ld_option ld_options[] = { { {"all-files", no_argument, NULL, 'a'}, - 'a', NULL, "Process all files (don't skip backup files)", ONE_DASH }, + 'a', NULL, N_("Process all files (don't skip backup files)"), ONE_DASH }, { {"abstract", required_argument, NULL, OPTION_ABSTRACT}, - '\0', "FILE", "Set Abstract filename" , ONE_DASH }, + '\0', "FILE", N_("Set Abstract filename"), ONE_DASH }, { {"appid", required_argument, NULL, 'A'}, - 'A', "ID", "Set Application ID" , ONE_DASH }, + 'A', "ID", N_("Set Application ID"), ONE_DASH }, { {"biblio", required_argument, NULL, OPTION_BIBLIO}, - '\0', "FILE", "Set Bibliographic filename" , ONE_DASH }, + '\0', "FILE", N_("Set Bibliographic filename"), ONE_DASH }, { {"copyright", required_argument, NULL, OPTION_COPYRIGHT}, - '\0', "FILE", "Set Copyright filename" , ONE_DASH }, + '\0', "FILE", N_("Set Copyright filename"), ONE_DASH }, { {"eltorito-boot", required_argument, NULL, 'b'}, - 'b', "FILE", "Set El Torito boot image name" , ONE_DASH }, + 'b', "FILE", N_("Set El Torito boot image name"), ONE_DASH }, { {"eltorito-catalog", required_argument, NULL, 'c'}, - 'c', "FILE", "Set El Torito boot catalog name" , ONE_DASH }, + 'c', "FILE", N_("Set El Torito boot catalog name"), ONE_DASH }, { {"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE }, - '\0', NULL, "Patch Boot Info Table in El Torito boot image" , ONE_DASH }, + '\0', NULL, N_("Patch Boot Info Table in El Torito boot image"), ONE_DASH }, { {"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT }, - '\0', NULL, "Dummy option for backward compatibility" , ONE_DASH }, + '\0', NULL, N_("Dummy option for backward compatibility"), ONE_DASH }, { {"eltorito-emul-floppy", no_argument, NULL, OPTION_ELTORITO_EMUL_FLOPPY }, - '\0', NULL, "Enable floppy drive emulation for El Torito" , TWO_DASHES }, + '\0', NULL, N_("Enable floppy drive emulation for El Torito"), TWO_DASHES }, { {"cdwrite-params", required_argument, NULL, 'C'}, - 'C', "PARAMS", "Magic parameters from cdrecord" , ONE_DASH }, + 'C', "PARAMS", N_("Magic parameters from cdrecord"), ONE_DASH }, { {"omit-period", no_argument, NULL, 'd'}, - 'd', NULL, "Omit trailing periods from filenames", ONE_DASH }, + 'd', NULL, N_("Omit trailing periods from filenames"), ONE_DASH }, { {"disable-deep-relocation", no_argument, NULL, 'D'}, - 'D', NULL, "Disable deep directory relocation", ONE_DASH }, + 'D', NULL, N_("Disable deep directory relocation"), ONE_DASH }, { {"follow-links", no_argument, NULL, 'f'}, - 'f', NULL, "Follow symbolic links", ONE_DASH }, + 'f', NULL, N_("Follow symbolic links"), ONE_DASH }, { {"help", no_argument, NULL, OPTION_HELP}, - '\0', NULL, "Print option help", ONE_DASH }, + '\0', NULL, N_("Print option help"), ONE_DASH }, { {"help", no_argument, NULL, OPTION_HELP}, - '\0', NULL, "Print option help", TWO_DASHES }, + '\0', NULL, N_("Print option help"), TWO_DASHES }, { {"version", no_argument, NULL, OPTION_VERSION}, - '\0', NULL, "Print version information and exit", TWO_DASHES }, + '\0', NULL, N_("Print version information and exit"), TWO_DASHES }, { {"hide", required_argument, NULL, OPTION_I_HIDE}, - '\0', "GLOBFILE", "Hide ISO9660/RR file" , ONE_DASH }, + '\0', "GLOBFILE", N_("Hide ISO9660/RR file"), ONE_DASH }, { {"hide-joliet", required_argument, NULL, OPTION_J_HIDE}, - '\0', "GLOBFILE", "Hide Joliet file" , ONE_DASH }, + '\0', "GLOBFILE", N_("Hide Joliet file"), ONE_DASH }, { {NULL, required_argument, NULL, 'i'}, - 'i', "ADD_FILES", "No longer supported" , TWO_DASHES }, + 'i', "ADD_FILES", N_("No longer supported"), TWO_DASHES }, { {"joliet", no_argument, NULL, 'J'}, - 'J', NULL, "Generate Joliet directory information", ONE_DASH }, + 'J', NULL, N_("Generate Joliet directory information"), ONE_DASH }, { {"full-iso9660-filenames", no_argument, NULL, 'l'}, - 'l', NULL, "Allow full 32 character filenames for iso9660 names", ONE_DASH }, + 'l', NULL, N_("Allow full 32 character filenames for iso9660 names"), ONE_DASH }, { {"allow-leading-dots", no_argument, NULL, 'L'}, - 'L', NULL, "Allow iso9660 filenames to start with '.'", ONE_DASH }, + 'L', NULL, N_("Allow iso9660 filenames to start with '.'"), ONE_DASH }, { {"log-file", required_argument, NULL, OPTION_LOG_FILE}, - '\0', "LOG_FILE", "Re-direct messages to LOG_FILE", ONE_DASH }, + '\0', "LOG_FILE", N_("Re-direct messages to LOG_FILE"), ONE_DASH }, { {"exclude", required_argument, NULL, 'm'}, - 'm', "GLOBFILE", "Exclude file name" , ONE_DASH }, + 'm', "GLOBFILE", N_("Exclude file name"), ONE_DASH }, { {"prev-session", required_argument, NULL, 'M'}, - 'M', "FILE", "Set path to previous session to merge" , ONE_DASH }, + 'M', "FILE", N_("Set path to previous session to merge"), ONE_DASH }, { {"omit-version-number", no_argument, NULL, 'N'}, - 'N', NULL, "Omit version number from iso9660 filename", ONE_DASH }, + 'N', NULL, N_("Omit version number from iso9660 filename"), ONE_DASH }, { {"no-split-symlink-components", no_argument, NULL, 0}, - 0, NULL, "Inhibit splitting symlink components" , ONE_DASH }, + 0, NULL, N_("Inhibit splitting symlink components"), ONE_DASH }, { {"no-split-symlink-fields", no_argument, NULL, 0}, - 0, NULL, "Inhibit splitting symlink fields" , ONE_DASH }, + 0, NULL, N_("Inhibit splitting symlink fields"), ONE_DASH }, { {"output", required_argument, NULL, 'o'}, - 'o', "FILE", "Set output file name" , ONE_DASH }, + 'o', "FILE", N_("Set output file name"), ONE_DASH }, { {"preparer", required_argument, NULL, 'p'}, - 'p', "PREP", "Set Volume preparer" , ONE_DASH }, + 'p', "PREP", N_("Set Volume preparer"), ONE_DASH }, { {"print-size", no_argument, NULL, OPTION_PRINT_SIZE}, - '\0', NULL, "Print estimated filesystem size and exit", ONE_DASH }, + '\0', NULL, N_("Print estimated filesystem size and exit"), ONE_DASH }, { {"publisher", required_argument, NULL, 'P'}, - 'P', "PUB", "Set Volume publisher" , ONE_DASH }, + 'P', "PUB", N_("Set Volume publisher"), ONE_DASH }, { {"quiet", no_argument, NULL, OPTION_QUIET}, - '\0', NULL, "Run quietly", ONE_DASH }, + '\0', NULL, N_("Run quietly"), ONE_DASH }, { {"rational-rock", no_argument, NULL, 'r'}, - 'r', NULL, "Generate rationalized Rock Ridge directory information", ONE_DASH }, + 'r', NULL, N_("Generate rationalized Rock Ridge directory information"), ONE_DASH }, { {"rock", no_argument, NULL, 'R'}, - 'R', NULL, "Generate Rock Ridge directory information", ONE_DASH }, + 'R', NULL, N_("Generate Rock Ridge directory information"), ONE_DASH }, { {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT}, - '\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH }, + '\0', NULL, N_("Split output into files of approx. 1GB size"), ONE_DASH }, { {"sysid", required_argument, NULL, OPTION_SYSID}, - '\0', "ID", "Set System ID" , ONE_DASH }, + '\0', "ID", N_("Set System ID"), ONE_DASH }, { {"translation-table", no_argument, NULL, 'T'}, - 'T', NULL, "Generate translation tables for systems that don't understand long filenames", ONE_DASH }, + 'T', NULL, N_("Generate translation tables for systems that don't understand long filenames"), ONE_DASH }, { {"verbose", no_argument, NULL, 'v'}, - 'v', NULL, "Verbose", ONE_DASH }, + 'v', NULL, N_("Verbose"), ONE_DASH }, { {"volid", required_argument, NULL, 'V'}, - 'V', "ID", "Set Volume ID" , ONE_DASH }, + 'V', "ID", N_("Set Volume ID"), ONE_DASH }, { {"volset", required_argument, NULL, OPTION_VOLSET}, - '\0', "ID", "Set Volume set ID" , ONE_DASH }, + '\0', "ID", N_("Set Volume set ID"), ONE_DASH }, { {"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE}, - '\0', "#", "Set Volume set size" , ONE_DASH }, + '\0', "#", N_("Set Volume set size"), ONE_DASH }, { {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM}, - '\0', "#", "Set Volume set sequence number" , ONE_DASH }, + '\0', "#", N_("Set Volume set sequence number"), ONE_DASH }, { {"old-exclude", required_argument, NULL, 'x'}, - 'x', "FILE", "Exclude file name(depreciated)" , ONE_DASH }, + 'x', "FILE", N_("Exclude file name (deprecated)"), ONE_DASH }, #ifdef ERIC_neverdef { {"transparent-compression", no_argument, NULL, 'z'}, 'z', NULL, "Enable transparent compression of files", ONE_DASH }, #endif { {"creation-date", required_argument, NULL, OPTION_CREAT_DATE }, - '\0', NULL, "Override creation date", TWO_DASHES }, + '\0', NULL, N_("Override creation date"), TWO_DASHES }, { {"modification-date", required_argument, NULL, OPTION_MODIF_DATE }, - '\0', NULL, "Override modification date", TWO_DASHES }, + '\0', NULL, N_("Override modification date"), TWO_DASHES }, { {"expiration-date", required_argument, NULL, OPTION_EXPIR_DATE }, - '\0', NULL, "Override expiration date", TWO_DASHES }, + '\0', NULL, N_("Override expiration date"), TWO_DASHES }, { {"effective-date", required_argument, NULL, OPTION_EFFEC_DATE }, - '\0', NULL, "Override effective date", TWO_DASHES }, + '\0', NULL, N_("Override effective date"), TWO_DASHES }, }; #define OPTION_COUNT (sizeof ld_options / sizeof ld_options[0]) @@ -545,7 +545,7 @@ void usage(){ for (; len < 30; len++) putchar (' '); - printf ("%s\n", ld_options[i].doc); + printf ("%s\n", gettext (ld_options[i].doc)); } } exit(1); diff --git a/util/mkisofs/mkisofs.h b/util/mkisofs/mkisofs.h index 720baa7e6..a1638d80e 100644 --- a/util/mkisofs/mkisofs.h +++ b/util/mkisofs/mkisofs.h @@ -33,6 +33,7 @@ #include #include #define _(str) gettext(str) +#define N_(str) str /* This symbol is used to indicate that we do not have things like symlinks, devices, and so forth available. Just files and dirs */ From 26743e871b6c4707a0332ca72c0eb77e22a5ca14 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 15:19:43 +0000 Subject: [PATCH 32/41] Resync. --- po/ca.po | 274 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 194 insertions(+), 80 deletions(-) diff --git a/po/ca.po b/po/ca.po index 3f9b0ac32..a66c49f2e 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 00:16+0100\n" +"POT-Creation-Date: 2009-11-23 14:14+0100\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan \n" "Language-Team: None \n" @@ -22,30 +22,10 @@ msgstr "" msgid "cannot compress the kernel image" msgstr "" -#: util/i386/pc/grub-mkimage.c:117 -#, c-format -msgid "the size of memory disk is 0x%x" -msgstr "" - -#: util/i386/pc/grub-mkimage.c:124 -#, c-format -msgid "the size of config file is 0x%x" -msgstr "" - -#: util/i386/pc/grub-mkimage.c:132 -#, c-format -msgid "the total module size is 0x%x" -msgstr "" - #: util/i386/pc/grub-mkimage.c:138 msgid "prefix is too long" msgstr "" -#: util/i386/pc/grub-mkimage.c:199 -#, c-format -msgid "the core size is 0x%x" -msgstr "" - #: util/i386/pc/grub-mkimage.c:206 msgid "the core image is too big" msgstr "" @@ -89,20 +69,10 @@ msgstr "" msgid "cannot open %s" msgstr "" -#: util/i386/pc/grub-setup.c:162 -#, c-format -msgid "the first sector is <%llu,%u,%u>" -msgstr "" - #: util/i386/pc/grub-setup.c:166 msgid "The first sector of the core file is not sector-aligned" msgstr "" -#: util/i386/pc/grub-setup.c:176 -#, c-format -msgid "saving <%llu,%u,%u> with the segment 0x%x" -msgstr "" - #: util/i386/pc/grub-setup.c:180 msgid "Non-sector-aligned data is found in the core file" msgstr "" @@ -126,11 +96,6 @@ msgstr "" msgid "The size of `%s' is too large" msgstr "" -#: util/i386/pc/grub-setup.c:247 -#, c-format -msgid "setting the root device to `%s'" -msgstr "" - #: util/i386/pc/grub-setup.c:261 #, c-format msgid "Unable to identify a filesystem in %s; safety check can't be performed" @@ -149,11 +114,6 @@ msgstr "" msgid "No DOS-style partitions found" msgstr "" -#: util/i386/pc/grub-setup.c:325 -#, c-format -msgid "dos partition is %d, bsd partition is %d" -msgstr "" - #: util/i386/pc/grub-setup.c:330 util/i386/pc/grub-setup.c:355 msgid "" "Attempting to install GRUB to a partitionless disk. This is a BAD idea." @@ -185,11 +145,6 @@ msgstr "" msgid "Your embedding area is unusually small. core.img won't fit in it." msgstr "" -#: util/i386/pc/grub-setup.c:381 -#, c-format -msgid "the core image will be embedded at sector 0x%llx" -msgstr "" - #: util/i386/pc/grub-setup.c:418 msgid "" "Embedding is not possible, but this is required when the root device is on a " @@ -217,30 +172,6 @@ msgstr "" msgid "attempting to read the core image `%s' from GRUB again" msgstr "" -#: util/i386/pc/grub-setup.c:449 -#, c-format -msgid "" -"succeeded in opening the core image but the size is different (%d != %d)" -msgstr "" - -#: util/i386/pc/grub-setup.c:453 -#, c-format -msgid "succeeded in opening the core image but cannot read %d bytes" -msgstr "" - -#: util/i386/pc/grub-setup.c:476 -msgid "succeeded in opening the core image but the data is different" -msgstr "" - -#: util/i386/pc/grub-setup.c:487 -msgid "couldn't open the core image" -msgstr "" - -#: util/i386/pc/grub-setup.c:490 -#, c-format -msgid "error message = %s" -msgstr "" - #: util/i386/pc/grub-setup.c:498 #, c-format msgid "Cannot read `%s' correctly" @@ -258,11 +189,6 @@ msgstr "" msgid "Failed to read the rest sectors of the core image" msgstr "" -#: util/i386/pc/grub-setup.c:544 -#, c-format -msgid "opening the core image `%s'" -msgstr "" - #: util/i386/pc/grub-setup.c:547 #, c-format msgid "Cannot open `%s'" @@ -310,11 +236,6 @@ msgstr "" msgid "Invalid root device `%s'" msgstr "" -#: util/i386/pc/grub-setup.c:766 -#, c-format -msgid "guessing the root device failed, because of `%s'" -msgstr "" - #: util/i386/pc/grub-setup.c:768 msgid "Cannot guess the root device. Specify the option ``--root-device''." msgstr "" @@ -451,6 +372,199 @@ msgstr "" msgid "Unexpected joliet directory length %d %d %s\n" msgstr "" +#: util/mkisofs/mkisofs.c:203 +msgid "Process all files (don't skip backup files)" +msgstr "" + +#: util/mkisofs/mkisofs.c:205 +msgid "Set Abstract filename" +msgstr "" + +#: util/mkisofs/mkisofs.c:207 +msgid "Set Application ID" +msgstr "" + +#: util/mkisofs/mkisofs.c:209 +msgid "Set Bibliographic filename" +msgstr "" + +#: util/mkisofs/mkisofs.c:211 +msgid "Set Copyright filename" +msgstr "" + +#: util/mkisofs/mkisofs.c:213 +msgid "Set El Torito boot image name" +msgstr "" + +#: util/mkisofs/mkisofs.c:215 +msgid "Set El Torito boot catalog name" +msgstr "" + +#: util/mkisofs/mkisofs.c:217 +msgid "Patch Boot Info Table in El Torito boot image" +msgstr "" + +#: util/mkisofs/mkisofs.c:219 +msgid "Dummy option for backward compatibility" +msgstr "" + +#: util/mkisofs/mkisofs.c:221 +msgid "Enable floppy drive emulation for El Torito" +msgstr "" + +#: util/mkisofs/mkisofs.c:223 +msgid "Magic parameters from cdrecord" +msgstr "" + +#: util/mkisofs/mkisofs.c:225 +msgid "Omit trailing periods from filenames" +msgstr "" + +#: util/mkisofs/mkisofs.c:227 +msgid "Disable deep directory relocation" +msgstr "" + +#: util/mkisofs/mkisofs.c:229 +msgid "Follow symbolic links" +msgstr "" + +#: util/mkisofs/mkisofs.c:231 util/mkisofs/mkisofs.c:233 +msgid "Print option help" +msgstr "" + +#: util/mkisofs/mkisofs.c:235 +msgid "Print version information and exit" +msgstr "" + +#: util/mkisofs/mkisofs.c:237 +msgid "Hide ISO9660/RR file" +msgstr "" + +#: util/mkisofs/mkisofs.c:239 +msgid "Hide Joliet file" +msgstr "" + +#: util/mkisofs/mkisofs.c:241 +msgid "No longer supported" +msgstr "" + +#: util/mkisofs/mkisofs.c:243 +msgid "Generate Joliet directory information" +msgstr "" + +#: util/mkisofs/mkisofs.c:245 +msgid "Allow full 32 character filenames for iso9660 names" +msgstr "" + +#: util/mkisofs/mkisofs.c:247 +msgid "Allow iso9660 filenames to start with '.'" +msgstr "" + +#: util/mkisofs/mkisofs.c:249 +msgid "Re-direct messages to LOG_FILE" +msgstr "" + +#: util/mkisofs/mkisofs.c:251 +msgid "Exclude file name" +msgstr "" + +#: util/mkisofs/mkisofs.c:253 +msgid "Set path to previous session to merge" +msgstr "" + +#: util/mkisofs/mkisofs.c:255 +msgid "Omit version number from iso9660 filename" +msgstr "" + +#: util/mkisofs/mkisofs.c:257 +msgid "Inhibit splitting symlink components" +msgstr "" + +#: util/mkisofs/mkisofs.c:259 +msgid "Inhibit splitting symlink fields" +msgstr "" + +#: util/mkisofs/mkisofs.c:261 +msgid "Set output file name" +msgstr "" + +#: util/mkisofs/mkisofs.c:263 +msgid "Set Volume preparer" +msgstr "" + +#: util/mkisofs/mkisofs.c:265 +msgid "Print estimated filesystem size and exit" +msgstr "" + +#: util/mkisofs/mkisofs.c:267 +msgid "Set Volume publisher" +msgstr "" + +#: util/mkisofs/mkisofs.c:269 +msgid "Run quietly" +msgstr "" + +#: util/mkisofs/mkisofs.c:271 +msgid "Generate rationalized Rock Ridge directory information" +msgstr "" + +#: util/mkisofs/mkisofs.c:273 +msgid "Generate Rock Ridge directory information" +msgstr "" + +#: util/mkisofs/mkisofs.c:275 +msgid "Split output into files of approx. 1GB size" +msgstr "" + +#: util/mkisofs/mkisofs.c:277 +msgid "Set System ID" +msgstr "" + +#: util/mkisofs/mkisofs.c:279 +msgid "" +"Generate translation tables for systems that don't understand long filenames" +msgstr "" + +#: util/mkisofs/mkisofs.c:281 +msgid "Verbose" +msgstr "" + +#: util/mkisofs/mkisofs.c:283 +msgid "Set Volume ID" +msgstr "" + +#: util/mkisofs/mkisofs.c:285 +msgid "Set Volume set ID" +msgstr "" + +#: util/mkisofs/mkisofs.c:287 +msgid "Set Volume set size" +msgstr "" + +#: util/mkisofs/mkisofs.c:289 +msgid "Set Volume set sequence number" +msgstr "" + +#: util/mkisofs/mkisofs.c:291 +msgid "Exclude file name (deprecated)" +msgstr "" + +#: util/mkisofs/mkisofs.c:297 +msgid "Override creation date" +msgstr "" + +#: util/mkisofs/mkisofs.c:299 +msgid "Override modification date" +msgstr "" + +#: util/mkisofs/mkisofs.c:301 +msgid "Override expiration date" +msgstr "" + +#: util/mkisofs/mkisofs.c:303 +msgid "Override effective date" +msgstr "" + #: util/mkisofs/mkisofs.c:373 #, c-format msgid "Using \"%s\"\n" From 4efeab03dca5a95c7ae7cd4f46ff3d5bba53ae68 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 15:23:55 +0000 Subject: [PATCH 33/41] 2009-11-23 Robert Millan * include/grub/parser.h (grub_parser_register): Document need of `name' parameter. * normal/main.c (grub_normal_read_line): Simplify prompt string. * script/sh/main.c (grub_sh_parser, GRUB_MOD_INIT(sh)): Rename "sh" to "grub". --- ChangeLog | 8 ++++++++ include/grub/parser.h | 1 + normal/main.c | 4 ++-- script/sh/main.c | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1952e6d42..dc9b160ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-11-23 Robert Millan + + * include/grub/parser.h (grub_parser_register): Document need + of `name' parameter. + * normal/main.c (grub_normal_read_line): Simplify prompt string. + * script/sh/main.c (grub_sh_parser, GRUB_MOD_INIT(sh)): Rename + "sh" to "grub". + 2009-11-23 Robert Millan * Makefile.in ($(srcdir)/po/$(PACKAGE).pot): Pass --keyword=N_ to diff --git a/include/grub/parser.h b/include/grub/parser.h index 4ee0e8389..41f768bba 100644 --- a/include/grub/parser.h +++ b/include/grub/parser.h @@ -88,6 +88,7 @@ grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source); static inline void grub_parser_register (const char *name __attribute__ ((unused)), + /* `name' is ignored here, but used by genhandlerlist.sh. */ grub_parser_t parser) { grub_handler_register (&grub_parser_class, GRUB_AS_HANDLER (parser)); diff --git a/normal/main.c b/normal/main.c index 748eef805..2f19542e8 100644 --- a/normal/main.c +++ b/normal/main.c @@ -523,9 +523,9 @@ static grub_err_t grub_normal_read_line (char **line, int cont) { grub_parser_t parser = grub_parser_get_current (); - char prompt[8 + grub_strlen (parser->name)]; + char prompt[sizeof("> ") - 1 + grub_strlen (parser->name)]; - grub_sprintf (prompt, "%s:%s> ", parser->name, (cont) ? "" : "grub"); + grub_sprintf (prompt, "%s> ", parser->name); while (1) { diff --git a/script/sh/main.c b/script/sh/main.c index 4eefafa18..b5159dc7d 100644 --- a/script/sh/main.c +++ b/script/sh/main.c @@ -42,13 +42,13 @@ grub_normal_parse_line (char *line, grub_reader_getline_t getline) static struct grub_parser grub_sh_parser = { - .name = "sh", + .name = "grub", .parse_line = grub_normal_parse_line }; GRUB_MOD_INIT(sh) { - grub_parser_register ("sh", &grub_sh_parser); + grub_parser_register ("grub", &grub_sh_parser); } GRUB_MOD_FINI(sh) From f84b481b3510ed2292603b6f163e68f497ffc29b Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 15:31:54 +0000 Subject: [PATCH 34/41] Cheery-pick grub-emu split from experimental (rev 1361) 2009-11-23 Robert Millan * configure.ac: Detect all `emu' platforms. Define GRUB_MACHINE_* macros in TARGET_CFLAGS. Remove --enable-grub-emu logic. Disable include/grub/machine symlink on `emu' platforms. * genkernsyms.sh.in: Use @TARGET_CFLAGS@ during symbol generation. * gensymlist.sh.in: Likewise. * include/grub/i386/coreboot/machine.h: Remove file. * include/grub/i386/efi/machine.h: Likewise. * include/grub/i386/ieee1275/machine.h: Likewise. * include/grub/i386/pc/machine.h: Likewise. * include/grub/i386/qemu/machine.h: Likewise. * include/grub/powerpc/ieee1275/machine.h: Likewise. * include/grub/sparc64/ieee1275/machine.h: Likewise. * include/grub/x86_64/efi/machine.h: Likewise. * commands/acpi.c: Remove `'. * commands/halt.c: Likewise. * commands/reboot.c: Likewise. * include/grub/autoefi.h: Likewise. * include/grub/i386/at_keyboard.h: Likewise. * include/grub/i386/kernel.h: Likewise. * include/grub/i386/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * kern/dl.c: Likewise. * kern/i386/coreboot/init.c: Likewise. * loader/i386/bsd.c: Likewise. * loader/i386/linux.c: Likewise. * loader/multiboot_loader.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/usb_keyboard.c: Likewise. * include/grub/time.h [!GRUB_MACHINE_EMU]: Remove `' [!GRUB_MACHINE_EMU] (GRUB_TICKS_PER_SECOND): New macro. * util/misc.c: Remove `' and `'. * Makefile.in (enable_grub_emu): Remove variable. Include $(srcdir)/conf/any-emu.mk for the `emu' platform. * conf/any-emu.rmk: New file. * conf/common.rmk (grub_emu_init.lst, grub_emu_init.h) (grub_emu_init.c): Move from here ... * conf/any-emu.rmk: ... to here. * conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-emu'. (grub_emu_SOURCES, grub_emu_LDFLAGS): Move from here ... * conf/any-emu.rmk: ... to here. --- ChangeLog | 53 +++++++++++++++ Makefile.in | 5 +- commands/acpi.c | 1 - commands/halt.c | 1 - commands/reboot.c | 1 - conf/any-emu.rmk | 89 +++++++++++++++++++++++++ conf/common.rmk | 13 ---- conf/i386-coreboot.rmk | 49 -------------- conf/i386-efi.rmk | 48 ------------- conf/i386-ieee1275.rmk | 48 ------------- conf/i386-pc.rmk | 56 ---------------- conf/powerpc-ieee1275.rmk | 49 -------------- conf/sparc64-ieee1275.rmk | 49 -------------- conf/x86_64-efi.rmk | 47 ------------- configure.ac | 64 +++++++++--------- genkernsyms.sh.in | 2 +- gensymlist.sh.in | 2 +- include/grub/autoefi.h | 1 - include/grub/i386/at_keyboard.h | 1 - include/grub/i386/coreboot/machine.h | 24 ------- include/grub/i386/efi/machine.h | 24 ------- include/grub/i386/ieee1275/machine.h | 24 ------- include/grub/i386/kernel.h | 1 - include/grub/i386/loader.h | 1 - include/grub/i386/pc/machine.h | 24 ------- include/grub/i386/pc/memory.h | 1 - include/grub/i386/qemu/machine.h | 24 ------- include/grub/powerpc/ieee1275/machine.h | 24 ------- include/grub/sparc64/ieee1275/machine.h | 24 ------- include/grub/time.h | 7 +- include/grub/x86_64/efi/machine.h | 24 ------- kern/dl.c | 1 - kern/i386/coreboot/init.c | 1 - loader/i386/bsd.c | 1 - loader/i386/linux.c | 1 - loader/multiboot_loader.c | 1 - term/i386/pc/serial.c | 1 - term/usb_keyboard.c | 1 - util/misc.c | 2 - 39 files changed, 186 insertions(+), 604 deletions(-) create mode 100644 conf/any-emu.rmk delete mode 100644 include/grub/i386/coreboot/machine.h delete mode 100644 include/grub/i386/efi/machine.h delete mode 100644 include/grub/i386/ieee1275/machine.h delete mode 100644 include/grub/i386/pc/machine.h delete mode 100644 include/grub/i386/qemu/machine.h delete mode 100644 include/grub/powerpc/ieee1275/machine.h delete mode 100644 include/grub/sparc64/ieee1275/machine.h delete mode 100644 include/grub/x86_64/efi/machine.h diff --git a/ChangeLog b/ChangeLog index dc9b160ac..555a702b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,56 @@ +2009-11-23 Robert Millan + + * configure.ac: Detect all `emu' platforms. Define + GRUB_MACHINE_* macros in TARGET_CFLAGS. Remove + --enable-grub-emu logic. Disable include/grub/machine + symlink on `emu' platforms. + + * genkernsyms.sh.in: Use @TARGET_CFLAGS@ during symbol generation. + * gensymlist.sh.in: Likewise. + + * include/grub/i386/coreboot/machine.h: Remove file. + * include/grub/i386/efi/machine.h: Likewise. + * include/grub/i386/ieee1275/machine.h: Likewise. + * include/grub/i386/pc/machine.h: Likewise. + * include/grub/i386/qemu/machine.h: Likewise. + * include/grub/powerpc/ieee1275/machine.h: Likewise. + * include/grub/sparc64/ieee1275/machine.h: Likewise. + * include/grub/x86_64/efi/machine.h: Likewise. + + * commands/acpi.c: Remove `'. + * commands/halt.c: Likewise. + * commands/reboot.c: Likewise. + * include/grub/autoefi.h: Likewise. + * include/grub/i386/at_keyboard.h: Likewise. + * include/grub/i386/kernel.h: Likewise. + * include/grub/i386/loader.h: Likewise. + * include/grub/i386/pc/memory.h: Likewise. + * kern/dl.c: Likewise. + * kern/i386/coreboot/init.c: Likewise. + * loader/i386/bsd.c: Likewise. + * loader/i386/linux.c: Likewise. + * loader/multiboot_loader.c: Likewise. + * term/i386/pc/serial.c: Likewise. + * term/usb_keyboard.c: Likewise. + + * include/grub/time.h [!GRUB_MACHINE_EMU]: Remove + `' + [!GRUB_MACHINE_EMU] (GRUB_TICKS_PER_SECOND): New macro. + * util/misc.c: Remove `' and + `'. + + * Makefile.in (enable_grub_emu): Remove variable. + Include $(srcdir)/conf/any-emu.mk for the `emu' platform. + + * conf/any-emu.rmk: New file. + * conf/common.rmk (grub_emu_init.lst, grub_emu_init.h) + (grub_emu_init.c): Move from here ... + * conf/any-emu.rmk: ... to here. + + * conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-emu'. + (grub_emu_SOURCES, grub_emu_LDFLAGS): Move from here ... + * conf/any-emu.rmk: ... to here. + 2009-11-23 Robert Millan * include/grub/parser.h (grub_parser_register): Document need diff --git a/Makefile.in b/Makefile.in index 17cf6209f..adab7ec0a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -111,7 +111,6 @@ YACC = @YACC@ FONT_SOURCE = @FONT_SOURCE@ # Options. -enable_grub_emu = @enable_grub_emu@ enable_grub_emu_usb = @enable_grub_emu_usb@ enable_grub_fstest = @enable_grub_fstest@ enable_grub_pe2elf = @enable_grub_pe2elf@ @@ -153,7 +152,11 @@ $(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb $(RUBY) $(srcdir)/genmk.rb < $< > $@; \ fi +ifeq ($(platform), emu) +include $(srcdir)/conf/any-emu.mk +else include $(srcdir)/conf/$(target_cpu)-$(platform).mk +endif # For external modules. -include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk) diff --git a/commands/acpi.c b/commands/acpi.c index 9cfd8ef10..1a7bf8018 100644 --- a/commands/acpi.c +++ b/commands/acpi.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/commands/halt.c b/commands/halt.c index b902418a8..9a42938b4 100644 --- a/commands/halt.c +++ b/commands/halt.c @@ -18,7 +18,6 @@ */ #include -#include #include #if defined(GRUB_MACHINE_IEEE1275) diff --git a/commands/reboot.c b/commands/reboot.c index 11bceeb31..0b553b710 100644 --- a/commands/reboot.c +++ b/commands/reboot.c @@ -18,7 +18,6 @@ */ #include -#include #include #if defined(GRUB_MACHINE_IEEE1275) diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk new file mode 100644 index 000000000..e8172b00d --- /dev/null +++ b/conf/any-emu.rmk @@ -0,0 +1,89 @@ +# -*- makefile -*- + +# Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h + +sbin_UTILITIES += grub-emu +util/grub-emu.c_DEPENDENCIES = grub_emu_init.h +grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ + commands/configfile.c commands/echo.c commands/help.c \ + commands/handler.c commands/ls.c commands/test.c \ + commands/search.c commands/blocklist.c commands/hexdump.c \ + lib/hexdump.c commands/halt.c commands/reboot.c \ + lib/envblk.c commands/loadenv.c \ + commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ + commands/password.c commands/keystatus.c \ + disk/host.c disk/loopback.c disk/scsi.c \ + fs/fshelp.c \ + \ + io/gzio.c \ + kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ + kern/err.c kern/list.c kern/handler.c \ + kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \ + kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \ + kern/partition.c kern/reader.c kern/term.c \ + kern/rescue_reader.c kern/rescue_parser.c \ + lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \ + normal/handler.c normal/auth.c normal/autofs.c \ + normal/completion.c normal/main.c normal/color.c \ + normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ + normal/menu_text.c \ + script/sh/main.c script/sh/execute.c script/sh/function.c \ + script/sh/lexer.c script/sh/script.c grub_script.tab.c \ + partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ + partmap/acorn.c partmap/gpt.c \ + \ + fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ + fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ + fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ + fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ + fs/befs.c fs/befs_be.c fs/tar.c \ + \ + util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ + util/hostdisk.c util/getroot.c \ + \ + disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ + disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ + commands/parttool.c parttool/msdospart.c \ + grub_emu_init.c + +ifeq ($(target_cpu), i386) +grub_emu_SOURCES += commands/i386/cpuid.c +endif + +grub_emu_LDFLAGS = $(LIBCURSES) + +ifeq ($(enable_grub_emu_usb), yes) +grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \ + commands/usbtest.c +grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB) +endif + +grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) + rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ +DISTCLEANFILES += grub_emu_init.lst + +grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh + rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@ +DISTCLEANFILES += grub_emu_init.h + +grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h + rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@ +DISTCLEANFILES += grub_emu_init.c + + + + +# FIXME: this could be shared with common.rmk + +# For grub-mkfont. +ifeq ($(enable_grub_mkfont), yes) +bin_UTILITIES += grub-mkfont +grub_mkfont_SOURCES = util/grub-mkfont.c util/misc.c +grub_mkfont_CFLAGS = $(freetype_cflags) +grub_mkfont_LDFLAGS = $(freetype_libs) +endif + +grub_script.tab.c grub_script.tab.h: script/sh/parser.y + $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y +DISTCLEANFILES += grub_script.tab.c grub_script.tab.h diff --git a/conf/common.rmk b/conf/common.rmk index 173f24b62..dc6d44d65 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -76,19 +76,6 @@ grub_script.tab.c grub_script.tab.h: script/sh/parser.y $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y DISTCLEANFILES += grub_script.tab.c grub_script.tab.h -# For grub-emu. -grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) - rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ -DISTCLEANFILES += grub_emu_init.lst - -grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh - rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@ -DISTCLEANFILES += grub_emu_init.h - -grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h - rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@ -DISTCLEANFILES += grub_emu_init.c - # For grub-probe. grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index c506e4153..74a7cc9c8 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -95,60 +95,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke # Utilities. sbin_UTILITIES = grub-mkdevicemap -ifeq ($(enable_grub_emu), yes) -sbin_UTILITIES += grub-emu -endif # For grub-mkdevicemap. grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ util/devicemap.c util/misc.c -# For grub-emu. -util/grub-emu.c_DEPENDENCIES = grub_emu_init.h -grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ - commands/configfile.c commands/echo.c commands/help.c \ - commands/handler.c commands/ls.c commands/test.c \ - commands/search.c commands/blocklist.c commands/hexdump.c \ - commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ - commands/password.c commands/keystatus.c \ - lib/hexdump.c commands/i386/cpuid.c \ - lib/envblk.c commands/loadenv.c \ - disk/host.c disk/loopback.c \ - \ - fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ - fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ - \ - fs/fshelp.c \ - io/gzio.c \ - kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ - kern/err.c kern/list.c kern/handler.c \ - kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \ - kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \ - kern/partition.c kern/reader.c kern/term.c \ - kern/rescue_reader.c kern/rescue_parser.c \ - lib/arg.c normal/cmdline.c normal/misc.c \ - normal/handler.c normal/auth.c normal/autofs.c \ - normal/completion.c normal/datetime.c normal/main.c \ - normal/menu_text.c \ - normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ - normal/color.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c grub_script.tab.c \ - partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ - partmap/acorn.c partmap/gpt.c \ - util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ - util/hostdisk.c util/getroot.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/msdospart.c \ - grub_emu_init.c - -grub_emu_LDFLAGS = $(LIBCURSES) - sbin_SCRIPTS += grub-install grub_install_SOURCES = util/grub-install.in diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index 39613d186..13c3a5731 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -10,9 +10,6 @@ script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage sbin_UTILITIES = grub-mkdevicemap -#ifeq ($(enable_grub_emu), yes) -#sbin_UTILITIES += grub-emu -#endif # For grub-mkimage. grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ @@ -31,51 +28,6 @@ util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ util/devicemap.c util/misc.c -# For grub-emu. -util/grub-emu.c_DEPENDENCIES = grub_emu_init.h -grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ - commands/configfile.c commands/help.c \ - commands/handler.c commands/ls.c commands/test.c \ - commands/search.c commands/hexdump.c lib/hexdump.c \ - commands/halt.c commands/reboot.c commands/keystatus.c \ - commands/i386/cpuid.c \ - commands/password.c \ - lib/envblk.c commands/loadenv.c \ - disk/loopback.c \ - \ - fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ - fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ - \ - io/gzio.c \ - kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ - kern/err.c kern/list.c kern/handler.c \ - kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \ - kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \ - kern/partition.c kern/reader.c kern/term.c \ - kern/rescue_reader.c kern/rescue_parser.c \ - lib/arg.c normal/cmdline.c normal/command.c normal/datetime.c \ - normal/auth.c normal/autofs.c \ - normal/completion.c normal/context.c normal/main.c \ - normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ - normal/menu_text.c \ - normal/color.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c grub_script.tab.c \ - partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ - partmap/acorn.c partmap/gpt.c \ - util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ - util/hostdisk.c util/getroot.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/msdospart.c \ - grub_emu_init.c - -grub_emu_LDFLAGS = $(LIBCURSES) - # Scripts. sbin_SCRIPTS = grub-install diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index 1eeba3af5..2d9532380 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -49,59 +49,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke # Utilities. sbin_UTILITIES = grub-mkdevicemap -ifeq ($(enable_grub_emu), yes) -sbin_UTILITIES += grub-emu -endif # For grub-mkdevicemap. grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ util/devicemap.c util/misc.c -# For grub-emu. -util/grub-emu.c_DEPENDENCIES = grub_emu_init.h -grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ - commands/configfile.c commands/echo.c commands/help.c \ - commands/handler.c commands/ls.c commands/test.c \ - commands/search.c commands/blocklist.c commands/hexdump.c \ - lib/hexdump.c commands/halt.c commands/reboot.c \ - lib/envblk.c commands/loadenv.c \ - commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ - commands/i386/cpuid.c \ - commands/password.c commands/keystatus.c \ - disk/host.c disk/loopback.c \ - \ - fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ - fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \ - fs/befs_be.c fs/tar.c \ - \ - fs/fshelp.c \ - io/gzio.c \ - kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ - kern/err.c kern/list.c kern/handler.c \ - kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \ - kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \ - kern/partition.c kern/reader.c kern/term.c \ - kern/rescue_reader.c kern/rescue_parser.c \ - lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \ - normal/handler.c normal/auth.c normal/autofs.c \ - normal/completion.c normal/main.c normal/menu_text.c \ - normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ - normal/color.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c grub_script.tab.c \ - partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ - partmap/acorn.c partmap/gpt.c \ - util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ - util/hostdisk.c util/getroot.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - grub_emu_init.c - -grub_emu_LDFLAGS = $(LIBCURSES) - # Scripts. sbin_SCRIPTS = grub-install diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index e1688ccd5..d4118526b 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -82,9 +82,6 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke # Utilities. bin_UTILITIES = grub-mkimage sbin_UTILITIES = grub-setup grub-mkdevicemap -ifeq ($(enable_grub_emu), yes) -sbin_UTILITIES += grub-emu -endif # For grub-mkimage. grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \ @@ -116,59 +113,6 @@ grub_setup_SOURCES = gnulib/progname.c \ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ util/devicemap.c util/misc.c -# For grub-emu. -util/grub-emu.c_DEPENDENCIES = grub_emu_init.h -grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ - commands/configfile.c commands/echo.c commands/help.c \ - commands/handler.c commands/ls.c commands/test.c \ - commands/search.c commands/blocklist.c commands/hexdump.c \ - lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \ - lib/envblk.c commands/loadenv.c \ - commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ - commands/i386/cpuid.c \ - commands/password.c commands/keystatus.c \ - disk/host.c disk/loopback.c disk/scsi.c \ - fs/fshelp.c \ - \ - io/gzio.c \ - kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ - kern/err.c kern/list.c kern/handler.c \ - kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \ - kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \ - kern/partition.c kern/reader.c kern/term.c \ - kern/rescue_reader.c kern/rescue_parser.c \ - lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \ - normal/handler.c normal/auth.c normal/autofs.c \ - normal/completion.c normal/main.c normal/color.c \ - normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ - normal/menu_text.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c grub_script.tab.c \ - partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ - partmap/acorn.c partmap/gpt.c \ - \ - fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ - fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ - \ - util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ - util/hostdisk.c util/getroot.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/msdospart.c \ - grub_emu_init.c - -grub_emu_LDFLAGS = $(LIBCURSES) - -ifeq ($(enable_grub_emu_usb), yes) -grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \ - commands/usbtest.c -grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB) -endif - sbin_SCRIPTS += grub-install grub_install_SOURCES = util/grub-install.in diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index ee7f9ec27..b8c62711b 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -30,60 +30,11 @@ pkglib_PROGRAMS = kernel.img # Utilities. sbin_UTILITIES = grub-mkdevicemap -ifeq ($(enable_grub_emu), yes) -sbin_UTILITIES += grub-emu -endif # For grub-mkdevicemap. grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ util/devicemap.c util/misc.c -# For grub-emu -util/grub-emu.c_DEPENDENCIES = grub_emu_init.h -grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ - commands/configfile.c commands/help.c \ - commands/search.c commands/handler.c commands/test.c \ - commands/ls.c commands/blocklist.c commands/hexdump.c \ - lib/hexdump.c commands/halt.c commands/reboot.c \ - lib/envblk.c commands/loadenv.c \ - commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ - commands/password.c commands/keystatus.c \ - disk/loopback.c \ - \ - fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ - fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ - \ - io/gzio.c \ - kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ - kern/err.c kern/file.c kern/fs.c commands/boot.c kern/main.c \ - kern/misc.c kern/parser.c kern/partition.c kern/reader.c \ - kern/rescue_reader.c kern/rescue_parser.c \ - kern/term.c kern/list.c kern/handler.c fs/fshelp.c \ - kern/command.c kern/corecmd.c commands/extcmd.c \ - lib/arg.c normal/cmdline.c normal/datetime.c \ - normal/completion.c normal/misc.c \ - normal/handler.c normal/auth.c normal/autofs.c normal/main.c \ - normal/menu.c \ - normal/menu_text.c \ - normal/menu_entry.c normal/menu_viewer.c \ - normal/color.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c \ - partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ - partmap/acorn.c \ - util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ - util/hostdisk.c util/getroot.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/msdospart.c \ - grub_script.tab.c grub_emu_init.c - -grub_emu_LDFLAGS = $(LIBCURSES) - kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \ kern/ieee1275/ieee1275.c kern/main.c kern/device.c \ kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index 62e951a5e..945a33d3f 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -60,9 +60,6 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke # Utilities. bin_UTILITIES = grub-mkimage sbin_UTILITIES = grub-setup grub-mkdevicemap grub-ofpathname -ifeq ($(enable_grub_emu), yes) -sbin_UTILITIES += grub-emu -endif # For grub-mkimage. grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \ @@ -96,52 +93,6 @@ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \ util/ieee1275/ofpath.c util/misc.c -# For grub-emu -util/grub-emu.c_DEPENDENCIES = grub_emu_init.h -grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ - commands/configfile.c commands/help.c \ - commands/search.c commands/handler.c commands/test.c \ - commands/ls.c commands/blocklist.c commands/hexdump.c \ - lib/hexdump.c commands/halt.c commands/reboot.c \ - lib/envblk.c commands/loadenv.c \ - commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ - commands/password.c commands/keystatus.c \ - disk/loopback.c \ - \ - fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ - fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ - \ - io/gzio.c \ - kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ - kern/err.c kern/file.c kern/fs.c commands/boot.c kern/main.c \ - kern/misc.c kern/parser.c kern/partition.c kern/reader.c \ - kern/rescue_reader.c kern/rescue_parser.c \ - kern/term.c kern/list.c kern/handler.c fs/fshelp.c \ - kern/command.c kern/corecmd.c commands/extcmd.c \ - lib/arg.c normal/cmdline.c normal/datetime.c \ - normal/completion.c normal/misc.c \ - normal/handler.c normal/auth.c normal/autofs.c normal/main.c \ - normal/menu.c \ - normal/menu_text.c \ - normal/menu_entry.c normal/menu_viewer.c \ - normal/color.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c \ - partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ - partmap/acorn.c \ - util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ - util/hostdisk.c util/getroot.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/msdospart.c \ - grub_script.tab.c grub_emu_init.c - -grub_emu_LDFLAGS = $(LIBCURSES) - # Scripts. sbin_SCRIPTS = grub-install diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index 2e90dc428..df32b0a5f 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -10,9 +10,6 @@ script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage sbin_UTILITIES = grub-mkdevicemap -#ifeq ($(enable_grub_emu), yes) -#sbin_UTILITIES += grub-emu -#endif # For grub-mkimage. grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ @@ -30,50 +27,6 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ util/devicemap.c util/misc.c -# For grub-emu. -util/grub-emu.c_DEPENDENCIES = grub_emu_init.h -grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ - commands/configfile.c commands/help.c \ - commands/handler.c commands/ls.c commands/test.c \ - commands/search.c commands/hexdump.c lib/hexdump.c \ - commands/halt.c commands/reboot.c \ - commands/i386/cpuid.c \ - commands/password.c commands/keystatus.c \ - lib/envblk.c commands/loadenv.c \ - disk/loopback.c \ - \ - fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ - fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - \ - io/gzio.c \ - kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ - kern/err.c kern/list.c kern/handler.c \ - kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \ - kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \ - kern/partition.c kern/readerescue.c kern/term.c \ - lib/arg.c normal/cmdline.c normal/misc.c normal/auth.c \ - normal/autofs.c \ - normal/completion.c normal/datetime.c normal/context.c \ - normal/main.c \ - normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ - normal/menu_text.c \ - normal/color.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c grub_script.tab.c \ - partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ - partmap/acorn.c partmap/gpt.c \ - util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ - util/hostdisk.c util/getroot.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/msdospart.c \ - grub_emu_init.c - -grub_emu_LDFLAGS = $(LIBCURSES) - # Scripts. sbin_SCRIPTS = grub-install diff --git a/configure.ac b/configure.ac index 383cb67a3..58b291d4f 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,7 @@ case "$target_cpu"-"$platform" in i386-qemu) ;; powerpc-ieee1275) ;; sparc64-ieee1275) ;; + *-emu) ;; *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; esac @@ -113,6 +114,17 @@ case "$host_os" in cygwin) host_kernel=windows ;; esac +case "$platform" in + coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; + efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; + ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; + qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; + pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; + emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; +esac +CFLAGS="$CFLAGS $machine_CFLAGS" +TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS" + AC_SUBST(host_cpu) AC_SUBST(host_os) AC_SUBST(host_kernel) @@ -509,40 +521,28 @@ AC_ARG_ENABLE([mm-debug], [AC_DEFINE([MM_DEBUG], [1], [Define to 1 if you enable memory manager debugging.])]) -AC_ARG_ENABLE([grub-emu], - [AS_HELP_STRING([--enable-grub-emu], - [build and install the `grub-emu' debugging utility (default=guessed)])]) AC_ARG_ENABLE([grub-emu-usb], [AS_HELP_STRING([--enable-grub-emu-usb], [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) -if test x"$enable_grub_emu" = xno ; then - grub_emu_excuse="explicitly disabled" -fi - [# Check for curses libraries.] -[if [ x"$grub_emu_excuse" = x ]; then ] +if test "$platform" = emu; then + missing_ncurses= +[# Check for curses libraries.] AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], - [grub_emu_excuse=["need (n)curses libraries"]])]) + [missing_ncurses=[true]])]) AC_SUBST([LIBCURSES]) -[fi] -[if [ x"$grub_emu_excuse" = x ]; then ] +[if [ x"$missing_ncurses" = x ]; then ] [# Check for headers.] AC_CHECK_HEADERS([ncurses/curses.h], [], [AC_CHECK_HEADERS([ncurses.h], [], [AC_CHECK_HEADERS([curses.h], [], - [grub_emu_excuse=["need (n)curses headers"]])])]) + [missing_ncurses=[true]])])]) [fi] +if test x"$missing_ncurses" = xtrue ; then + AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) +fi -if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then - AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled]) -fi -if test x"$grub_emu_excuse" = x ; then -enable_grub_emu=yes -else -enable_grub_emu=no -grub_emu_usb_excuse="grub-emu isn't built" -fi if test x"$enable_grub_emu_usb" = xno ; then grub_emu_usb_excuse="explicitly disabled" fi @@ -565,9 +565,8 @@ enable_grub_emu_usb=yes else enable_grub_emu_usb=no fi - -AC_SUBST([enable_grub_emu]) AC_SUBST([enable_grub_emu_usb]) +fi AC_ARG_ENABLE([grub-fstest], [AS_HELP_STRING([--enable-grub-fstest], @@ -615,14 +614,18 @@ AC_SUBST(ASFLAGS) # Output files. grub_CHECK_LINK_DIR if test x"$link_dir" = xyes ; then - AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu - include/grub/machine:include/grub/$target_cpu/$platform]) + AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) + if test "$platform" != emu ; then + AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) + fi else mkdir -p include/grub 2>/dev/null rm -rf include/grub/cpu cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null - rm -rf include/grub/machine - cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null + if test "$platform" != emu ; then + rm -rf include/grub/machine + cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null + fi fi AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh]) AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) @@ -631,16 +634,13 @@ AC_OUTPUT echo "*******************************************************" echo GRUB2 will be compiled with following components: echo Platform: "$target_cpu"-"$platform" -if [ x"$grub_emu_excuse" = x ]; then -echo grub-emu: Yes -else -echo grub-emu: No "($grub_emu_excuse)" -fi +if [ x"$platform" = xemu ]; then if [ x"$grub_emu_usb_excuse" = x ]; then echo USB support for grub-emu: Yes else echo USB support for grub-emu: No "($grub_emu_usb_excuse)" fi +fi if [ x"$enable_mm_debug" = xyes ]; then echo With memory debugging: Yes else diff --git a/genkernsyms.sh.in b/genkernsyms.sh.in index 3dec5828d..b2f3f7af9 100644 --- a/genkernsyms.sh.in +++ b/genkernsyms.sh.in @@ -19,7 +19,7 @@ u= grep "^#define HAVE_ASM_USCORE" config.h >/dev/null 2>&1 && u="_" -$CC -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \ +$CC @TARGET_CFLAGS@ -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \ | grep -v '^#' \ | sed -n \ -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$u"'\1 kernel/;p;}' \ diff --git a/gensymlist.sh.in b/gensymlist.sh.in index 8f50b99ea..27fc5e61a 100644 --- a/gensymlist.sh.in +++ b/gensymlist.sh.in @@ -59,7 +59,7 @@ cat < #ifdef GRUB_MACHINE_EFI # include diff --git a/include/grub/i386/at_keyboard.h b/include/grub/i386/at_keyboard.h index 96b21627f..12d61608e 100644 --- a/include/grub/i386/at_keyboard.h +++ b/include/grub/i386/at_keyboard.h @@ -19,7 +19,6 @@ #ifndef GRUB_CPU_AT_KEYBOARD_HEADER #define GRUB_CPU_AT_KEYBOARD_HEADER 1 -#include #define SHIFT_L 0x2a #define SHIFT_R 0x36 diff --git a/include/grub/i386/coreboot/machine.h b/include/grub/i386/coreboot/machine.h deleted file mode 100644 index 8b7059005..000000000 --- a/include/grub/i386/coreboot/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_COREBOOT 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/i386/efi/machine.h b/include/grub/i386/efi/machine.h deleted file mode 100644 index 160076859..000000000 --- a/include/grub/i386/efi/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_EFI 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/i386/ieee1275/machine.h b/include/grub/i386/ieee1275/machine.h deleted file mode 100644 index 755eb33ae..000000000 --- a/include/grub/i386/ieee1275/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_IEEE1275 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/i386/kernel.h b/include/grub/i386/kernel.h index 74715e178..5514c8ccf 100644 --- a/include/grub/i386/kernel.h +++ b/include/grub/i386/kernel.h @@ -19,7 +19,6 @@ #ifndef GRUB_KERNEL_CPU_HEADER #define GRUB_KERNEL_CPU_HEADER 1 -#include #ifdef GRUB_MACHINE_IEEE1275 #define GRUB_MOD_ALIGN 0x1000 diff --git a/include/grub/i386/loader.h b/include/grub/i386/loader.h index b7fa413f1..0df5f757f 100644 --- a/include/grub/i386/loader.h +++ b/include/grub/i386/loader.h @@ -22,7 +22,6 @@ #include #include #include -#include extern grub_addr_t EXPORT_VAR(grub_os_area_addr); extern grub_size_t EXPORT_VAR(grub_os_area_size); diff --git a/include/grub/i386/pc/machine.h b/include/grub/i386/pc/machine.h deleted file mode 100644 index e6de7281a..000000000 --- a/include/grub/i386/pc/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_PCBIOS 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/memory.h b/include/grub/i386/pc/memory.h index 815390482..4ce3a6283 100644 --- a/include/grub/i386/pc/memory.h +++ b/include/grub/i386/pc/memory.h @@ -21,7 +21,6 @@ #define GRUB_MEMORY_MACHINE_HEADER 1 #include -#include #ifndef ASM_FILE #include #include diff --git a/include/grub/i386/qemu/machine.h b/include/grub/i386/qemu/machine.h deleted file mode 100644 index b57932b49..000000000 --- a/include/grub/i386/qemu/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 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 - * 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_QEMU 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/machine.h b/include/grub/powerpc/ieee1275/machine.h deleted file mode 100644 index 66da1d9e8..000000000 --- a/include/grub/powerpc/ieee1275/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_IEEE1275 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/sparc64/ieee1275/machine.h b/include/grub/sparc64/ieee1275/machine.h deleted file mode 100644 index 66da1d9e8..000000000 --- a/include/grub/sparc64/ieee1275/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_IEEE1275 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/time.h b/include/grub/time.h index 4dcd843de..115fbd95e 100644 --- a/include/grub/time.h +++ b/include/grub/time.h @@ -21,9 +21,14 @@ #include #include -#include #include +#ifdef GRUB_MACHINE_EMU +#define GRUB_TICKS_PER_SECOND 100000 +#else +#include +#endif + void EXPORT_FUNC(grub_millisleep) (grub_uint32_t ms); grub_uint64_t EXPORT_FUNC(grub_get_time_ms) (void); diff --git a/include/grub/x86_64/efi/machine.h b/include/grub/x86_64/efi/machine.h deleted file mode 100644 index 160076859..000000000 --- a/include/grub/x86_64/efi/machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 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 . - */ - -#ifndef GRUB_MACHINE_MACHINE_HEADER -#define GRUB_MACHINE_MACHINE_HEADER 1 - -#define GRUB_MACHINE_EFI 1 - -#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/kern/dl.c b/kern/dl.c index 78ebc1e38..20ab1c5c2 100644 --- a/kern/dl.c +++ b/kern/dl.c @@ -31,7 +31,6 @@ #include #include #include -#include /* Platforms where modules are in a readonly area of memory. */ #if defined(GRUB_MACHINE_QEMU) diff --git a/kern/i386/coreboot/init.c b/kern/i386/coreboot/init.c index 0bf4934fb..550a2a60a 100644 --- a/kern/i386/coreboot/init.c +++ b/kern/i386/coreboot/init.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c index acc653c9e..6f2202a67 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/loader/i386/linux.c b/loader/i386/linux.c index 4bdb09b24..82bfd6b95 100644 --- a/loader/i386/linux.c +++ b/loader/i386/linux.c @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/loader/multiboot_loader.c b/loader/multiboot_loader.c index 168e821c7..9078d0622 100644 --- a/loader/multiboot_loader.c +++ b/loader/multiboot_loader.c @@ -17,7 +17,6 @@ * along with GRUB. If not, see . */ -#include #include #include #include diff --git a/term/i386/pc/serial.c b/term/i386/pc/serial.c index 1d74dbbc8..3f1c6d062 100644 --- a/term/i386/pc/serial.c +++ b/term/i386/pc/serial.c @@ -16,7 +16,6 @@ * along with GRUB. If not, see . */ -#include #include #include #include diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index 76b9bc3d4..5d76c5e02 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -18,7 +18,6 @@ */ #include -#include #include #include #include diff --git a/util/misc.c b/util/misc.c index 37e75311e..799ffbf85 100644 --- a/util/misc.c +++ b/util/misc.c @@ -36,8 +36,6 @@ #include #include #include -#include -#include /* Include malloc.h, only if memalign is available. It is known that memalign is declared in malloc.h in all systems, if present. */ From f515aa622438fb461435efb078922d475f548838 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 15:37:33 +0000 Subject: [PATCH 35/41] 2009-11-23 Robert Millan * script/sh/execute.c: Move from here ... * script/execute.c: ... to here. Update all users. * script/sh/function.c: Move from here ... * script/function.c: ... to here. Update all users. * script/sh/lexer.c: Move from here ... * script/lexer.c: ... to here. Update all users. * script/sh/main.c: Move from here ... * script/main.c: ... to here. Update all users. * script/sh/parser.y: Move from here ... * script/parser.y: ... to here. Update all users. * script/sh/script.c: Move from here ... * script/script.c: ... to here. Update all users. --- ChangeLog | 15 +++++++++++++++ conf/any-emu.rmk | 10 +++++----- conf/common.rmk | 8 ++++---- conf/i386-coreboot.rmk | 2 +- conf/i386-efi.rmk | 2 +- conf/i386-ieee1275.rmk | 2 +- conf/i386-pc.rmk | 2 +- conf/powerpc-ieee1275.rmk | 2 +- conf/sparc64-ieee1275.rmk | 2 +- conf/x86_64-efi.rmk | 2 +- script/{sh => }/execute.c | 0 script/{sh => }/function.c | 0 script/{sh => }/lexer.c | 0 script/{sh => }/main.c | 0 script/{sh => }/parser.y | 0 script/{sh => }/script.c | 0 16 files changed, 31 insertions(+), 16 deletions(-) rename script/{sh => }/execute.c (100%) rename script/{sh => }/function.c (100%) rename script/{sh => }/lexer.c (100%) rename script/{sh => }/main.c (100%) rename script/{sh => }/parser.y (100%) rename script/{sh => }/script.c (100%) diff --git a/ChangeLog b/ChangeLog index 555a702b0..ceeb1081b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2009-11-23 Robert Millan + + * script/sh/execute.c: Move from here ... + * script/execute.c: ... to here. Update all users. + * script/sh/function.c: Move from here ... + * script/function.c: ... to here. Update all users. + * script/sh/lexer.c: Move from here ... + * script/lexer.c: ... to here. Update all users. + * script/sh/main.c: Move from here ... + * script/main.c: ... to here. Update all users. + * script/sh/parser.y: Move from here ... + * script/parser.y: ... to here. Update all users. + * script/sh/script.c: Move from here ... + * script/script.c: ... to here. Update all users. + 2009-11-23 Robert Millan * configure.ac: Detect all `emu' platforms. Define diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index e8172b00d..268d9743e 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -1,7 +1,7 @@ # -*- makefile -*- # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h sbin_UTILITIES += grub-emu util/grub-emu.c_DEPENDENCIES = grub_emu_init.h @@ -28,8 +28,8 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ normal/completion.c normal/main.c normal/color.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ - script/sh/main.c script/sh/execute.c script/sh/function.c \ - script/sh/lexer.c script/sh/script.c grub_script.tab.c \ + script/main.c script/execute.c script/function.c \ + script/lexer.c script/script.c grub_script.tab.c \ partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ partmap/acorn.c partmap/gpt.c \ \ @@ -84,6 +84,6 @@ grub_mkfont_CFLAGS = $(freetype_cflags) grub_mkfont_LDFLAGS = $(freetype_libs) endif -grub_script.tab.c grub_script.tab.h: script/sh/parser.y - $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y +grub_script.tab.c grub_script.tab.h: script/parser.y + $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y DISTCLEANFILES += grub_script.tab.c grub_script.tab.h diff --git a/conf/common.rmk b/conf/common.rmk index dc6d44d65..00d579600 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -72,8 +72,8 @@ grub_mkfont_LDFLAGS = $(freetype_libs) endif # For the parser. -grub_script.tab.c grub_script.tab.h: script/sh/parser.y - $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y +grub_script.tab.c grub_script.tab.h: script/parser.y + $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y DISTCLEANFILES += grub_script.tab.c grub_script.tab.h # For grub-probe. @@ -525,8 +525,8 @@ normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For sh.mod. -sh_mod_SOURCES = script/sh/main.c script/sh/script.c script/sh/execute.c \ - script/sh/function.c script/sh/lexer.c grub_script.tab.c +sh_mod_SOURCES = script/main.c script/script.c script/execute.c \ + script/function.c script/lexer.c grub_script.tab.c sh_mod_CFLAGS = $(COMMON_CFLAGS) sh_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index 74a7cc9c8..5ab392a4d 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -5,7 +5,7 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 COMMON_LDFLAGS = -m32 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index 13c3a5731..ac88ebd42 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -5,7 +5,7 @@ COMMON_CFLAGS = -fno-builtin -m32 COMMON_LDFLAGS = -melf_i386 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index 2d9532380..2df3421f7 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -5,7 +5,7 @@ COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3 COMMON_LDFLAGS = -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_PROGRAMS = kernel.img diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index d4118526b..b100d94e2 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -7,7 +7,7 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 COMMON_LDFLAGS = -m32 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \ diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index b8c62711b..0a87a6a5d 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -6,7 +6,7 @@ COMMON_CFLAGS = -ffreestanding COMMON_LDFLAGS += -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index 945a33d3f..3abddf511 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -6,7 +6,7 @@ COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_IMAGES = boot.img diskboot.img kernel.img diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index df32b0a5f..3d519e955 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -5,7 +5,7 @@ COMMON_CFLAGS = -fno-builtin -m64 COMMON_LDFLAGS = -melf_x86_64 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h +script/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage diff --git a/script/sh/execute.c b/script/execute.c similarity index 100% rename from script/sh/execute.c rename to script/execute.c diff --git a/script/sh/function.c b/script/function.c similarity index 100% rename from script/sh/function.c rename to script/function.c diff --git a/script/sh/lexer.c b/script/lexer.c similarity index 100% rename from script/sh/lexer.c rename to script/lexer.c diff --git a/script/sh/main.c b/script/main.c similarity index 100% rename from script/sh/main.c rename to script/main.c diff --git a/script/sh/parser.y b/script/parser.y similarity index 100% rename from script/sh/parser.y rename to script/parser.y diff --git a/script/sh/script.c b/script/script.c similarity index 100% rename from script/sh/script.c rename to script/script.c From e2c37719a6c8277bdfa39bfc397f6e424750dedd Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Mon, 23 Nov 2009 20:22:36 +0000 Subject: [PATCH 36/41] Uncommits the last commits (to make the new merge with trunk easier) --- ChangeLog | 19 ------------------ normal/main.c | 5 +++-- normal/menu_entry.c | 5 +++-- normal/menu_text.c | 48 +++++++++++++++++++++++++++++++++------------ 4 files changed, 41 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9f2cee2a..4a26413d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,22 +1,3 @@ -2009-11-22 Carles Pina i Estany - - * conf/common.rmk: Add grub-gettext_lib target and updates - lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS, - LDFLAGS. - * gettext/gettext.c: New file. (Reads mo files). - * include/grub/file.h (grub_file_pread): New prototype. - * include/grub/i18n.h (_): New prototype. - * include/grub/misc.h (grub_gettext_dummy, grub_gettext): New - prototypes. - * kern/misc.c (grub_gettext_dummy): New function. - * menu/menu_text.c: Include . - * menu/menu_text.c (print_timeout): Gettexttize string. - * menu/menu_text.c (print_message): Gettexttize string. - * po/POTFILES: Add `normal/menu_text.c'. - * po/ca.po: Add new translations. - * util/grub.d/00_header.in: Define locale_dir and lang. insmod - gettext module and defines locale_dir and lang in grub.cfg. - 2009-11-22 Robert Millan * util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings. diff --git a/normal/main.c b/normal/main.c index 748eef805..afe3667f3 100644 --- a/normal/main.c +++ b/normal/main.c @@ -29,6 +29,7 @@ #include #include #include +#include #define GRUB_DEFAULT_HISTORY_SIZE 50 @@ -508,10 +509,10 @@ grub_normal_reader_init (void) grub_normal_init_page (); grub_setcursor (1); - grub_printf ("\ + grub_printf (_("\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\ lists possible command completions. Anywhere else TAB lists possible\n\ - device/file completions.%s ]\n\n", + device/file completions.%s ]\n\n"), reader_nested ? " ESC at any time exits." : ""); return 0; diff --git a/normal/menu_entry.c b/normal/menu_entry.c index 75a63779f..7478c33ae 100644 --- a/normal/menu_entry.c +++ b/normal/menu_entry.c @@ -24,6 +24,7 @@ #include #include #include +#include enum update_mode { @@ -996,7 +997,7 @@ run (struct screen *screen) } grub_cls (); - grub_printf (" Booting a command list\n\n"); + grub_printf (_(" Booting a command list\n\n")); /* Execute the script, line for line. */ @@ -1176,6 +1177,6 @@ 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_printf (_("\nPress any key to continue...")); (void) grub_getkey (); } diff --git a/normal/menu_text.c b/normal/menu_text.c index 4ff22e928..524b6a7e9 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -39,7 +39,7 @@ static grub_uint8_t grub_color_menu_highlight; void grub_wait_after_message (void) { - grub_printf ("\nPress any key to continue..."); + grub_printf (_("\nPress any key to continue...")); (void) grub_getkey (); grub_putchar ('\n'); } @@ -87,22 +87,22 @@ print_message (int nested, int edit) if (edit) { - grub_printf ("\n\ + 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."); + 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 ("\ + grub_printf (_("\ Press enter to boot the selected OS, \'e\' to edit the\n\ - commands before booting or \'c\' for a command-line."); + commands before booting or \'c\' for a command-line.")); if (nested) - grub_printf ("\n\ - ESC to return previous menu."); + grub_printf (_("\n\ + ESC to return previous menu.")); } } @@ -262,12 +262,34 @@ get_entry_number (const char *name) return entry; } +static char* +get_spaces (int number_spaces) +{ + char* spaces = grub_malloc(number_spaces + 1); + int i; + + spaces[0] = '\0'; + + for (i=0;ititle); + grub_printf (_(" Booting \'%s\'\n\n"), entry->title); } /* Callback invoked when a default menu entry executed because of a timeout @@ -527,7 +549,7 @@ 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 Falling back to \'%s\'\n\n"), entry->title); grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS); } @@ -541,7 +563,7 @@ 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 Failed to boot default entries.\n")); grub_wait_after_message (); } From 0fdb256813f47935bcd421efef6148fc45fddba6 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 20:30:56 +0000 Subject: [PATCH 37/41] 2009-11-23 Robert Millan * util/hostdisk.c: Include `'. (find_grub_drive): Use ARRAY_SIZE for map size calculation. (make_device_name): Rewrite using asprintf. (convert_system_partition_to_system_disk): Replace 0 with NULL. (find_system_device): If a device is not found, generate one just by reusing the OS path name. (read_device_map): Make it permissible for device.map not to exist. --- ChangeLog | 10 ++++++++ util/hostdisk.c | 66 ++++++++++++++++++++++++++----------------------- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index ceeb1081b..17b770968 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-11-23 Robert Millan + + * util/hostdisk.c: Include `'. + (find_grub_drive): Use ARRAY_SIZE for map size calculation. + (make_device_name): Rewrite using asprintf. + (convert_system_partition_to_system_disk): Replace 0 with NULL. + (find_system_device): If a device is not found, generate one just + by reusing the OS path name. + (read_device_map): Make it permissible for device.map not to exist. + 2009-11-23 Robert Millan * script/sh/execute.c: Move from here ... diff --git a/util/hostdisk.c b/util/hostdisk.c index e1058a100..04c412300 100644 --- a/util/hostdisk.c +++ b/util/hostdisk.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -127,7 +128,7 @@ find_grub_drive (const char *name) if (name) { - for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) + for (i = 0; i < ARRAY_SIZE (map); i++) if (map[i].drive && ! strcmp (map[i].drive, name)) return i; } @@ -565,7 +566,10 @@ read_device_map (const char *dev_map) fp = fopen (dev_map, "r"); if (! fp) - grub_util_error ("Cannot open `%s'", dev_map); + { + grub_util_info (_("Cannot open `%s'"), dev_map); + return; + } while (fgets (buf, sizeof (buf), fp)) { @@ -670,34 +674,27 @@ grub_util_biosdisk_fini (void) static char * make_device_name (int drive, int dos_part, int bsd_part) { - int len = strlen(map[drive].drive); - char *p; + char *ret; + char *dos_part_str = NULL; + char *bsd_part_str = NULL; if (dos_part >= 0) - { - /* Add in char length of dos_part+1 */ - int tmp = dos_part + 1; - len++; - while ((tmp /= 10) != 0) - len++; - } - if (bsd_part >= 0) - len += 2; - - /* Length to alloc is: char length of map[drive].drive, plus - * char length of (dos_part+1) or of bsd_part, plus - * 2 for the comma and a null/end of string (\0) - */ - p = xmalloc (len + 2); - sprintf (p, "%s", map[drive].drive); - - if (dos_part >= 0) - sprintf (p + strlen (p), ",%d", dos_part + 1); + asprintf (&dos_part_str, ",%d", dos_part + 1); if (bsd_part >= 0) - sprintf (p + strlen (p), ",%c", bsd_part + 'a'); + asprintf (&bsd_part_str, ",%c", dos_part + 'a'); - return p; + asprintf (&ret, "%s%s%s", map[drive].drive, + dos_part_str ? : "", + bsd_part_str ? : ""); + + if (dos_part_str) + free (dos_part_str); + + if (bsd_part_str) + free (bsd_part_str); + + return ret; } static char * @@ -706,7 +703,7 @@ convert_system_partition_to_system_disk (const char *os_dev) #if defined(__linux__) char *path = xmalloc (PATH_MAX); if (! realpath (os_dev, path)) - return 0; + return NULL; if (strncmp ("/dev/", path, 5) == 0) { @@ -876,22 +873,29 @@ device_is_wholedisk (const char *os_dev) static int find_system_device (const char *os_dev) { - int i; + unsigned int i; char *os_disk; os_disk = convert_system_partition_to_system_disk (os_dev); if (! os_disk) return -1; - for (i = 0; i < (int) (sizeof (map) / sizeof (map[0])); i++) - if (map[i].device && strcmp (map[i].device, os_disk) == 0) + for (i = 0; i < ARRAY_SIZE (map); i++) + if (! map[i].device) + break; + else if (strcmp (map[i].device, os_disk) == 0) { free (os_disk); return i; } - free (os_disk); - return -1; + if (i == ARRAY_SIZE (map)) + grub_util_error (_("device count exceeds limit")); + + map[i].device = os_disk; + map[i].drive = xstrdup (os_disk); + + return i; } char * From 3db5183c2caf9135bc623ae7ff1239fbb11f6df7 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Mon, 23 Nov 2009 20:47:25 +0000 Subject: [PATCH 38/41] Adds gettext note in NEWS. --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 7c29cc948..bf7492c6d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ New in 1.97 - : +* Add support for gettext. + * Add support for loading XNU (MacOS X kernel). * ACPI override support. From c3ea6bd46624d1724bab4528330d5f27f4b692c4 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Mon, 23 Nov 2009 20:59:24 +0000 Subject: [PATCH 39/41] Final touches before merging --- ChangeLog | 20 +++++++++++++++++++ normal/menu_text.c | 48 +++++++++++++--------------------------------- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17b770968..da59ff5da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2009-11-22 Carles Pina i Estany + + * conf/common.rmk: Add grub-gettext_lib target and updates + lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS, + LDFLAGS. + * gettext/gettext.c: New file. (Reads mo files). + * include/grub/file.h (grub_file_pread): New prototype. + * include/grub/i18n.h (_): New prototype. + * include/grub/misc.h (grub_gettext_dummy, grub_gettext): New + prototypes. + * kern/misc.c (grub_gettext_dummy): New function. + * normal/menu_text.c: Include . + * normal/menu_text.c (print_timeout): Gettexttize string. + * normal/menu_text.c (print_message): Gettexttize string. + * po/POTFILES: Add `normal/menu_text.c'. + * po/ca.po: Add new translations. + * util/grub.d/00_header.in: Define locale_dir and lang. insmod + gettext module and defines locale_dir and lang in grub.cfg. + * NEWS: Add gettext support. + 2009-11-23 Robert Millan * util/hostdisk.c: Include `'. diff --git a/normal/menu_text.c b/normal/menu_text.c index 524b6a7e9..4ff22e928 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -39,7 +39,7 @@ static grub_uint8_t grub_color_menu_highlight; void grub_wait_after_message (void) { - grub_printf (_("\nPress any key to continue...")); + grub_printf ("\nPress any key to continue..."); (void) grub_getkey (); grub_putchar ('\n'); } @@ -87,22 +87,22 @@ print_message (int nested, int edit) if (edit) { - grub_printf (_("\n\ + 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.")); + 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 (_("\ + grub_printf ("\ Press enter to boot the selected OS, \'e\' to edit the\n\ - commands before booting or \'c\' for a command-line.")); + commands before booting or \'c\' for a command-line."); if (nested) - grub_printf (_("\n\ - ESC to return previous menu.")); + grub_printf ("\n\ + ESC to return previous menu."); } } @@ -262,34 +262,12 @@ get_entry_number (const char *name) return entry; } -static char* -get_spaces (int number_spaces) -{ - char* spaces = grub_malloc(number_spaces + 1); - int i; - - spaces[0] = '\0'; - - for (i=0;ititle); + grub_printf (" Booting \'%s\'\n\n", entry->title); } /* Callback invoked when a default menu entry executed because of a timeout @@ -549,7 +527,7 @@ 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 Falling back to \'%s\'\n\n", entry->title); grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS); } @@ -563,7 +541,7 @@ 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 Failed to boot default entries.\n"); grub_wait_after_message (); } From 1eafb9b92bd65a1c0dbb64feca3d3bcbbf1304d4 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Mon, 23 Nov 2009 21:29:39 +0000 Subject: [PATCH 40/41] * Fixes date in the ChangeLog entry --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index da59ff5da..b9df15f84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2009-11-22 Carles Pina i Estany +2009-11-23 Carles Pina i Estany * conf/common.rmk: Add grub-gettext_lib target and updates lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS, From 662290ce76653df6164f52acf9bccb6df1e477e9 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 23 Nov 2009 22:41:37 +0000 Subject: [PATCH 41/41] 2009-11-23 Robert Millan * po/id.po: New file. * LINGUAS: Add `id'. --- ChangeLog | 5 + po/LINGUAS | 1 + po/id.po | 880 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 886 insertions(+) create mode 100644 po/id.po diff --git a/ChangeLog b/ChangeLog index b9df15f84..decef53b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-23 Robert Millan + + * po/id.po: New file. + * LINGUAS: Add `id'. + 2009-11-23 Carles Pina i Estany * conf/common.rmk: Add grub-gettext_lib target and updates diff --git a/po/LINGUAS b/po/LINGUAS index 16fc6795f..2f4478d98 100644 --- a/po/LINGUAS +++ b/po/LINGUAS @@ -1 +1,2 @@ ca +id diff --git a/po/id.po b/po/id.po new file mode 100644 index 000000000..d97cfb9e7 --- /dev/null +++ b/po/id.po @@ -0,0 +1,880 @@ +# Pesan Bahasa Indonesia untuk grub. +# Copyright (C) 2009 Free Software Foundation, Inc. +# This file is distributed under the same license as the grub package. +# Arif E. Nugroho , 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: grub 1.97+20091122\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-11-22 11:48+0100\n" +"PO-Revision-Date: 2009-11-22 20:00+0700\n" +"Last-Translator: Arif E. Nugroho \n" +"Language-Team: Indonesian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: util/i386/pc/grub-mkimage.c:65 +msgid "the core image is too small" +msgstr "image core terlalu kecil" + +#: util/i386/pc/grub-mkimage.c:77 +msgid "cannot compress the kernel image" +msgstr "tidak dapat mengkompress image kernel" + +#: util/i386/pc/grub-mkimage.c:138 +msgid "prefix is too long" +msgstr "awalan terlalu panjang" + +#: util/i386/pc/grub-mkimage.c:206 +msgid "the core image is too big" +msgstr "image core terlalu besar" + +#: util/i386/pc/grub-mkimage.c:211 +#, c-format +msgid "diskboot.img size must be %u bytes" +msgstr "besar diskboot.img seharusnya %u bytes" + +#: util/i386/pc/grub-mkimage.c:284 +#, c-format +msgid "Core image is too big (%p > %p)\n" +msgstr "Image core terlalu besar (%p >%p)\n" + +#: util/i386/pc/grub-mkimage.c:321 util/i386/pc/grub-setup.c:587 +#, c-format +msgid "Try ``%s --help'' for more information.\n" +msgstr "Coba ``%s --help'' untuk informasi lebih lanjut.\n" + +#: util/i386/pc/grub-mkimage.c:323 +#, c-format +msgid "" +"Usage: grub-mkimage [OPTION]... [MODULES]\n" +"\n" +"Make a bootable image of GRUB.\n" +"\n" +" -d, --directory=DIR use images and modules under DIR [default=%s]\n" +" -p, --prefix=DIR set grub_prefix directory [default=%s]\n" +" -m, --memdisk=FILE embed FILE as a memdisk image\n" +" -c, --config=FILE embed FILE as boot config\n" +" -o, --output=FILE output a generated image to FILE [default=stdout]\n" +" -h, --help display this message and exit\n" +" -V, --version print version information and exit\n" +" -v, --verbose print verbose messages\n" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"Penggunaan: grub-mkimage [PILIHAN]... [MODUL]\n" +"\n" +"Buat sebuah image GRUB yang dapat diboot.\n" +"\n" +" -d, --directory=DIR gunakan image dan modul dibawah DIR [baku=%s]\n" +" -p, --prefix=DIR set direktori grub_prefix [baku=%s]\n" +" -m, --memdisk=BERKAS tempatkan BERKAS sebagai sebuah image memdisk\n" +" -c, --config=BERKAS tempatkan BERKAS sebagai konfigurasi boot\n" +" -o, --output=BERKAS keluarkan sebuah image yang dihasilkan ke BERKAS [baku=stdout]\n" +" -h, --help tampilkan pesan ini dan keluar\n" +" -V, --version tampilkan informasi versi dan keluar\n" +" -v, --verbose tampilkan informasi secara detail\n" +"\n" +"Laporkan bugs ke <%s>.\n" + +#: util/i386/pc/grub-mkimage.c:429 +#, c-format +msgid "cannot open %s" +msgstr "tidak dapat membuka %s" + +#: util/i386/pc/grub-setup.c:166 +msgid "The first sector of the core file is not sector-aligned" +msgstr "Sektor pertama dari berkas core tidak selaras secara sektor" + +#: util/i386/pc/grub-setup.c:180 +msgid "Non-sector-aligned data is found in the core file" +msgstr "Sektor-tidak-selaras data ditemukan dalam berkas core" + +#: util/i386/pc/grub-setup.c:194 +msgid "The sectors of the core file are too fragmented" +msgstr "Sektor dari berkas core terlalu terpotong potong" + +#: util/i386/pc/grub-setup.c:205 +#, c-format +msgid "The size of `%s' is not %u" +msgstr "Ukuran dari `%s' bukan %u" + +#: util/i386/pc/grub-setup.c:222 +#, c-format +msgid "The size of `%s' is too small" +msgstr "Ukuran dari `%s' terlalu kecil" + +#: util/i386/pc/grub-setup.c:224 +#, c-format +msgid "The size of `%s' is too large" +msgstr "Ukuran dari `%s' terlalu besar" + +#: util/i386/pc/grub-setup.c:261 +#, c-format +msgid "Unable to identify a filesystem in %s; safety check can't be performed" +msgstr "Tidak dapat mengidentifikasikan sebuah sistem berkas dalam %s; pemeriksaan keamanan tidak dapat dilakukan" + +#: util/i386/pc/grub-setup.c:265 +#, c-format +msgid "%s appears to contain a %s filesystem which isn't known to reserve space for DOS-style boot. Installing GRUB there could result in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup (--skip-fs-probe disables this check, use at your own risk)" +msgstr "%s sepertinya berisi sebuah sistem berkas %s yang tidak diketahui untuk mereserve ruang untuk boot gaya-DOS. Memasang GRUB disana dapat berakibat KERUSAKAN SISTEM BERKAS jika data berharga dipaksa tulis oleh grub-setup (--skip-fs-probe menonaktifkan pemeriksaan ini, gunakan sesuai resiko anda)" + +#: util/i386/pc/grub-setup.c:314 +msgid "No DOS-style partitions found" +msgstr "Tidak ditemukan gaya partisi DOS" + +#: util/i386/pc/grub-setup.c:330 util/i386/pc/grub-setup.c:355 +msgid "Attempting to install GRUB to a partitionless disk. This is a BAD idea." +msgstr "Mencoba memasang GRUB ke sebuah disk yang tidak berpartisi. Ini mungkin bukan ide baik." + +#: util/i386/pc/grub-setup.c:336 +msgid "Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea." +msgstr "Mencoba memasang GRUB ke sebuah partisi daripada MBR. Ini mungkin bukan ide baik." + +#: util/i386/pc/grub-setup.c:365 +msgid "This msdos-style partition label has no post-MBR gap; embedding won't be possible!" +msgstr "Label partisi gaya msdos ini tidak memiliki post-MBR gap; penempatan tidak memungkinkan!" + +#: util/i386/pc/grub-setup.c:367 +msgid "This GPT partition label has no BIOS Boot Partition; embedding won't be possible!" +msgstr "Label partisi GPT ini tidak memiliki partisi boot BIOS; penempatan tidak memungkinkan!" + +#: util/i386/pc/grub-setup.c:374 +msgid "Your core.img is unusually large. It won't fit in the embedding area." +msgstr "Besar core.img anda sangat besar. Ini tidak akan masuk dalam area penempatan." + +#: util/i386/pc/grub-setup.c:376 +msgid "Your embedding area is unusually small. core.img won't fit in it." +msgstr "Penempatan anda sangat kecil. core.img tidak akan masuk disana." + +#: util/i386/pc/grub-setup.c:418 +msgid "Embedding is not possible, but this is required when the root device is on a RAID array or LVM volume." +msgstr "Penempatan tidak memungkinkan, tetapi ini dibutuhkan ketika perangkat root berada di sebuah array RAID atau volume LVM." + +#: util/i386/pc/grub-setup.c:421 +msgid "Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and its use is discouraged." +msgstr "Penempatan tidak memungkinkan. GRUB hanya dapat dipasang di konfigurasi ini dengan menggunakan blocklists. Akan tetapi, blocklists TIDAK DAPAT DIJAGAKAN dan penggunaan ini tidak disarankan." + +#: util/i386/pc/grub-setup.c:425 +msgid "If you really want blocklists, use --force." +msgstr "Jika anda benar benar menginginkan blocklists, gunakan --force." + +#: util/i386/pc/grub-setup.c:439 +#, c-format +msgid "attempting to read the core image `%s' from GRUB" +msgstr "mencoba untuk membaca image core `%s' dari GRUB" + +#: util/i386/pc/grub-setup.c:440 +#, c-format +msgid "attempting to read the core image `%s' from GRUB again" +msgstr "mencoba untuk membaca image core `%s' dari GRUB lagi" + +#: util/i386/pc/grub-setup.c:498 +#, c-format +msgid "Cannot read `%s' correctly" +msgstr "Tidak dapat membaca `%s' secara benar" + +#: util/i386/pc/grub-setup.c:511 +msgid "No terminator in the core image" +msgstr "Tidak ada pengakhir dalam image core" + +#: util/i386/pc/grub-setup.c:522 +msgid "Failed to read the first sector of the core image" +msgstr "Gagal untuk membaca sektor pertama dari core image" + +#: util/i386/pc/grub-setup.c:528 +msgid "Failed to read the rest sectors of the core image" +msgstr "Gagal untuk membaca sektor selanjutnya dari image core" + +#: util/i386/pc/grub-setup.c:547 +#, c-format +msgid "Cannot open `%s'" +msgstr "Tidak dapat membuka `%s'" + +#: util/i386/pc/grub-setup.c:589 +#, c-format +msgid "" +"Usage: grub-setup [OPTION]... DEVICE\n" +"\n" +"Set up images to boot from DEVICE.\n" +"DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n" +"\n" +" -b, --boot-image=FILE use FILE as the boot image [default=%s]\n" +" -c, --core-image=FILE use FILE as the core image [default=%s]\n" +" -d, --directory=DIR use GRUB files in the directory DIR [default=%s]\n" +" -m, --device-map=FILE use FILE as the device map [default=%s]\n" +" -r, --root-device=DEV use DEV as the root device [default=guessed]\n" +" -f, --force install even if problems are detected\n" +" -s, --skip-fs-probe do not probe for filesystems in DEVICE\n" +" -h, --help display this message and exit\n" +" -V, --version print version information and exit\n" +" -v, --verbose print verbose messages\n" +"\n" +"Report bugs to <%s>.\n" +msgstr "" +"Penggunaan: grub-setup [PILIHAN]... PERANGKAT\n" +"\n" +"Konfigurasi image untuk boot dari PERANGKAT.\n" +"PERANGKAT harus berupa sebuah perangkat GRUB (e.g. ``(hd0,1)'').\n" +"\n" +" -b, --boot-image=BERKAS gunakan BERKAS sebagai image boot [baku=%s]\n" +" -c, --core-image=BERKAS gunakan BERKAS sebagai image core [baku=%s]\n" +" -d, --directory=DIR gunakan berkas GRUB dalam direktori DIR [baku=%s]\n" +" -m, --device-map=BERKAS gunakan BERKAS sebagai peta perangkat [baku=%s]\n" +" -r, --root-device=DEV gunakan DEV sebagai perangkat root [baku=ditebak]\n" +" -f, --force pasang walaupun masalah terdeteksi\n" +" -s, --skip-fs-probe jangan periksa untuk sistem berkas dalam PERANGKAT\n" +" -h, --help tampilkan pesan bantuan ini dan keluar\n" +" -V, --version tampilkan informasi versi dan keluar\n" +" -v, --verbose tampilkan informasi secara detail\n" +"\n" +"Laporkan bugs ke <%s>.\n" + +#: util/i386/pc/grub-setup.c:719 +#, c-format +msgid "No device is specified.\n" +msgstr "Perangkat tidak dispesifikasikan.\n" + +#: util/i386/pc/grub-setup.c:725 +#, c-format +msgid "Unknown extra argument `%s'.\n" +msgstr "Argumen ekstra `%s' tidak diketahui.\n" + +#: util/i386/pc/grub-setup.c:742 +#, c-format +msgid "Invalid device `%s'.\n" +msgstr "Perangkat `%s' tidak valid.\n" + +#: util/i386/pc/grub-setup.c:755 +#, c-format +msgid "Invalid root device `%s'" +msgstr "Perangkat root `%s' tidak valid" + +#: util/i386/pc/grub-setup.c:768 +msgid "Cannot guess the root device. Specify the option ``--root-device''." +msgstr "Tidak dapat menebak perangkat root. Spesifikasikan pilihan ``--root-device''." + +#: util/mkisofs/eltorito.c:96 +#, c-format +msgid "A boot catalog exists and appears corrupted.\n" +msgstr "Sebuah katalog boot ada dan mungkin terkorupsi.\n" + +#: util/mkisofs/eltorito.c:97 +#, c-format +msgid "Please check the following file: %s.\n" +msgstr "Mohon periksa berkas berikut: %s.\n" + +#: util/mkisofs/eltorito.c:98 +#, c-format +msgid "This file must be removed before a bootable CD can be done.\n" +msgstr "Berkas ini mungkin telah terhapus sebelum sebuah CD bootable dapat dilakukan.\n" + +#: util/mkisofs/eltorito.c:110 +#, c-format +msgid "Error creating boot catalog (%s)" +msgstr "Error membuat katalog boot (%s)" + +#: util/mkisofs/eltorito.c:114 +#, c-format +msgid "Error writing to boot catalog (%s)" +msgstr "Error menulis katalog boot (%s)" + +#: util/mkisofs/eltorito.c:144 +#, c-format +msgid "Boot catalog cannot be found!\n" +msgstr "Katalog boot tidak dapat ditemukan!\n" + +#: util/mkisofs/eltorito.c:158 +#, c-format +msgid "Boot image cannot be found!\n" +msgstr "Image boot tidak dapat ditemukan!\n" + +#: util/mkisofs/eltorito.c:221 +#, c-format +msgid "" +"\n" +"Size of boot image is %d sectors" +msgstr "" +"\n" +"Ukuran dari boot image adalah %d sektor" + +#: util/mkisofs/eltorito.c:227 +#, c-format +msgid "No emulation\n" +msgstr "Tidak ada emulasi\n" + +#: util/mkisofs/eltorito.c:235 +#, c-format +msgid "Emulating a 1.44 meg floppy\n" +msgstr "Mengemulasikan sebuah 1.44 meg floppy\n" + +#: util/mkisofs/eltorito.c:240 +#, c-format +msgid "Emulating a 2.88 meg floppy\n" +msgstr "Mengemulasikan sebuah 2.88 meg floppy\n" + +#: util/mkisofs/eltorito.c:245 +#, c-format +msgid "Emulating a 1.2 meg floppy\n" +msgstr "Mengemulasikan sebuah 1.2 meg floppy\n" + +#: util/mkisofs/eltorito.c:249 +#, c-format +msgid "" +"\n" +"Error - boot image is not the an allowable size.\n" +msgstr "" +"\n" +"Error - image boot tidak berukuran yang diperbolehkan.\n" + +#: util/mkisofs/eltorito.c:269 +msgid "Error opening boot catalog for update" +msgstr "Error membuka katalog boot untuk diperbarui" + +#: util/mkisofs/eltorito.c:275 util/mkisofs/eltorito.c:277 +msgid "Error writing to boot catalog" +msgstr "Error menulis ke katalog boot" + +#: util/mkisofs/eltorito.c:291 +#, c-format +msgid "Error opening boot image file '%s' for update" +msgstr "Error membuka berkas boot image '%s' untuk diperbarui" + +#: util/mkisofs/eltorito.c:299 +#, c-format +msgid "Odd alignment at non-end-of-file in boot image '%s'" +msgstr "Penyesuaian janggal di akhir-dari-berkas dalam image boot '%s'" + +#: util/mkisofs/eltorito.c:311 +#, c-format +msgid "Boot image file '%s' changed unexpectedly" +msgstr "Berkas image boot '%s' berubah secara tidak terduga" + +#: util/mkisofs/eltorito.c:323 +#, c-format +msgid "Error writing to boot image (%s)" +msgstr "Error menulis ke boot image (%s)" + +#: util/mkisofs/joliet.c:359 util/mkisofs/write.c:981 +#, c-format +msgid "Unable to generate sane path tables - too many directories (%d)\n" +msgstr "Tidak dapat menghasilkan tabel jalur yang masuk akal - terlalu banyak direktori (%d)\n" + +#: util/mkisofs/joliet.c:398 util/mkisofs/write.c:1017 +#, c-format +msgid "Entry %d not in path tables\n" +msgstr "Masukan %d tidak dalam tabel jalur\n" + +#: util/mkisofs/joliet.c:412 +#, c-format +msgid "Fatal goof - directory has amnesia\n" +msgstr "Fatal goof - direktori memiliki amnesia\n" + +#: util/mkisofs/joliet.c:478 +#, c-format +msgid "Joliet path table lengths do not match %d %d\n" +msgstr "Panjang tabel jalur joliet tidak cocok %d %d\n" + +#: util/mkisofs/joliet.c:530 +#, c-format +msgid "Unable to locate relocated directory\n" +msgstr "Tidak dapat menempatkan direktori yang ditempatkan\n" + +#: util/mkisofs/joliet.c:605 +#, c-format +msgid "Fatal goof - unable to find directory location\n" +msgstr "Fatal goof - tidak dapat menemukan lokasi direktori\n" + +#: util/mkisofs/joliet.c:654 +#, c-format +msgid "Unexpected joliet directory length %d %d %s\n" +msgstr "Panjang direktori joliet tidak terduga %d %d %s\n" + +#: util/mkisofs/mkisofs.c:373 +#, c-format +msgid "Using \"%s\"\n" +msgstr "Menggunakan \"%s\"\n" + +#: util/mkisofs/mkisofs.c:401 +#, c-format +msgid "%s:%d: name required\n" +msgstr "%s:%d: nama dibutuhkan\n" + +#: util/mkisofs/mkisofs.c:411 +#, c-format +msgid "%s:%d: equals sign required\n" +msgstr "%s:%d: tanda sama dibutuhkan\n" + +#: util/mkisofs/mkisofs.c:445 +#, c-format +msgid "%s:%d: field name \"%s\" unknown\n" +msgstr "%s:%d: nama daerah \"%s\" tidak diketahui\n" + +#: util/mkisofs/mkisofs.c:474 +#, c-format +msgid "Usage: %s [options] file...\n" +msgstr "Penggunaan: %s [pilihan] berkas...\n" + +#: util/mkisofs/mkisofs.c:476 +#, c-format +msgid "Options:\n" +msgstr "Pilihan:\n" + +#: util/mkisofs/mkisofs.c:706 +#, c-format +msgid "-i option no longer supported.\n" +msgstr "pilihan -i tidak lagi didukung.\n" + +#: util/mkisofs/mkisofs.c:720 +#, c-format +msgid "Required boot image pathname missing\n" +msgstr "Nama jalur boot image yang dibutuhkan hilang\n" + +#: util/mkisofs/mkisofs.c:729 +#, c-format +msgid "Required boot catalog pathname missing\n" +msgstr "Nama jalur katalog boot yang dibutuhkan hilang\n" + +#: util/mkisofs/mkisofs.c:737 +#, c-format +msgid "Ignoring -no-emul-boot (no-emulation is the default behaviour)\n" +msgstr "Mengabaikan -no-emul-boot (no-emulation adalah perilaku baku)\n" + +#: util/mkisofs/mkisofs.c:746 +#, c-format +msgid "Abstract filename string too long\n" +msgstr "String nama berkas abstrak terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:754 +#, c-format +msgid "Application-id string too long\n" +msgstr "String ID-Aplikasi terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:762 +#, c-format +msgid "Bibliographic filename string too long\n" +msgstr "String nama berkas bibliographic terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:770 +#, c-format +msgid "Copyright filename string too long\n" +msgstr "String nama berkas Hak Cipta terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:805 +#, c-format +msgid "Preparer string too long\n" +msgstr "String penyiap terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:816 +#, c-format +msgid "Publisher string too long\n" +msgstr "String penerbit terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:837 +#, c-format +msgid "System ID string too long\n" +msgstr "String ID sistem terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:848 +#, c-format +msgid "Volume ID string too long\n" +msgstr "String ID volume terlalu penjang\n" + +#: util/mkisofs/mkisofs.c:856 +#, c-format +msgid "Volume set ID string too long\n" +msgstr "String ID set volume terlalu panjang\n" + +#: util/mkisofs/mkisofs.c:867 +#, c-format +msgid "Volume set sequence number too big\n" +msgstr "Set urutan nomor volume terlalu besar\n" + +#: util/mkisofs/mkisofs.c:909 util/mkisofs/mkisofs.c:919 +#: util/mkisofs/mkisofs.c:929 util/mkisofs/mkisofs.c:939 +#, c-format +msgid "date string must be 16 characters.\n" +msgstr "string tanggal harus berupa 16 karakter.\n" + +#: util/mkisofs/mkisofs.c:958 +msgid "Warning: getrlimit" +msgstr "Peringatan: getrlimit" + +#: util/mkisofs/mkisofs.c:962 +msgid "Warning: setrlimit" +msgstr "Peringatan: setrlimit" + +#: util/mkisofs/mkisofs.c:978 +#, c-format +msgid "Multisession usage bug: Must specify -C if -M is used.\n" +msgstr "Bug penggunaan multi sesi: Harus menspesifikasikan -C jika -M digunakan.\n" + +#: util/mkisofs/mkisofs.c:984 +#, c-format +msgid "Warning: -C specified without -M: old session data will not be merged.\n" +msgstr "Peringatan: -C dispesifikasikan tanpa -M: data sesi lama tidak akan digabungkan.\n" + +#: util/mkisofs/mkisofs.c:1023 +#, c-format +msgid "can't open logfile: %s" +msgstr "tidak dapat membuka berkas log: %s" + +#: util/mkisofs/mkisofs.c:1027 +#, c-format +msgid "re-directing all messages to %s\n" +msgstr "menredireksikan seluruh pesan ke %s\n" + +#: util/mkisofs/mkisofs.c:1032 +#, c-format +msgid "can't open logfile: %s\n" +msgstr "tidak dapat membuka berkas log: %s\n" + +#: util/mkisofs/mkisofs.c:1073 +#, c-format +msgid "Unable to open previous session image %s\n" +msgstr "Tidak dapat membuka sesi image sebelumnya %s\n" + +#: util/mkisofs/mkisofs.c:1184 +#, c-format +msgid "Invalid node - %s\n" +msgstr "Node tidak valid -%s\n" + +#: util/mkisofs/mkisofs.c:1246 +msgid "Joliet tree sort failed.\n" +msgstr "Pengurutan pohon joliet gagal.\n" + +#: util/mkisofs/mkisofs.c:1261 +msgid "Unable to open /dev/null\n" +msgstr "Tidak dapat membuka /dev/null\n" + +#: util/mkisofs/mkisofs.c:1265 +msgid "Unable to open disc image file\n" +msgstr "Tidak dapat membuka berkas image disk\n" + +#: util/mkisofs/mkisofs.c:1387 +#, c-format +msgid "Max brk space used %x\n" +msgstr "Ruang maksimal brk yang digunakan %x\n" + +#: util/mkisofs/mkisofs.c:1390 +#, c-format +msgid "%llu extents written (%llu MiB)\n" +msgstr "%llu ekstensi ditulis (%llu MiB)\n" + +#: util/mkisofs/multi.c:161 +msgid "Seek error on old image\n" +msgstr "Error pencarian dalam image lama\n" + +#: util/mkisofs/multi.c:179 util/mkisofs/multi.c:250 +#, c-format +msgid "**Bad RR version attribute" +msgstr "**Atribut versi RR buruk" + +#: util/mkisofs/multi.c:546 +#, c-format +msgid "Warning: Neither Rock Ridge (-R) nor TRANS.TBL (-T) name translations were found on previous session. ISO (8.3) file names have been used instead.\n" +msgstr "Peringatan: Bukan Rock Ridge (-R) ataupun TRANS.TBL (-T) nama terjemahan ditemukan dalam sesi sebelumnya. ISO (8.3) nama berkas yang telah digunakan.\n" + +#: util/mkisofs/multi.c:764 +#, c-format +msgid "Read error on old image %s\n" +msgstr "Error membaca dalam image lama %s\n" + +#: util/mkisofs/multi.c:1084 +msgid "Special parameters for cdwrite not specified with -C\n" +msgstr "Parameter spesial untuk cdwrite tidak dispesifikasikan dengan -C\n" + +#: util/mkisofs/multi.c:1091 +msgid "Malformed cdwrite parameters\n" +msgstr "Parameter cdwrite salah format\n" + +#: util/mkisofs/rock.c:309 +#, c-format +msgid "symbolic link ``%s'' to long for one SL System Use Field, splitting" +msgstr "link simbolik ``%s'' terlalu panjang untuk satu SL Sistem Menggunakan Field, dipisahkan" + +#: util/mkisofs/rock.c:517 +#, c-format +msgid "Unable to insert transparent compressed file - name conflict\n" +msgstr "Tidak dapat memasukan berkas terkompress secara transparan - konflik nama\n" + +#: util/mkisofs/rock.c:591 +msgid "Extension record too long\n" +msgstr "Rekaman ekstensi terlalu panjang\n" + +#: util/mkisofs/tree.c:226 util/mkisofs/write.c:565 util/mkisofs/write.c:1037 +msgid "Fatal goof\n" +msgstr "Fatal goof\n" + +#: util/mkisofs/tree.c:284 +#, c-format +msgid "Unable to generate unique name for file %s\n" +msgstr "Tidak dapat menghasilkan nama unik untuk berkas %s\n" + +#: util/mkisofs/tree.c:295 util/mkisofs/tree.c:317 +#, c-format +msgid "Using %s for %s%s%s (%s)\n" +msgstr "Menggunakan %s untuk %s%s%s (%s)\n" + +#: util/mkisofs/tree.c:441 +#, c-format +msgid "Fatal error - RR overflow for file %s\n" +msgstr "Fatal error -RR overflow untuk berkas %s\n" + +#: util/mkisofs/tree.c:449 +#, c-format +msgid "Unable to sort directory %s\n" +msgstr "Tidak dapat mengurutkan direktori %s\n" + +#: util/mkisofs/tree.c:480 +#, c-format +msgid "Translation table size mismatch %d %d\n" +msgstr "Besar tabel terjemahan tidak cocok %d %d\n" + +#: util/mkisofs/tree.c:746 +msgid "Unable to locate directory parent\n" +msgstr "Tidak dapat menempatkan direktori atasnya\n" + +#: util/mkisofs/tree.c:796 +#, c-format +msgid "Scanning %s\n" +msgstr "Memindai %s\n" + +#: util/mkisofs/tree.c:811 +#, c-format +msgid "Unable to open directory %s\n" +msgstr "Tidak dapat membuka direktori %s\n" + +#: util/mkisofs/tree.c:856 +#, c-format +msgid "Ignoring file %s\n" +msgstr "Mengabaikan berkas %s\n" + +#: util/mkisofs/tree.c:863 +msgid "Overflow of stat buffer\n" +msgstr "Overflow dari penyangga statistik\n" + +#: util/mkisofs/tree.c:876 +#, c-format +msgid "Excluded by match: %s\n" +msgstr "Diabaikan oleh kecocokan: %s\n" + +#: util/mkisofs/tree.c:891 +#, c-format +msgid "Excluded: %s\n" +msgstr "Diabaikan: %s\n" + +#: util/mkisofs/tree.c:961 +#, c-format +msgid "Non-existant or inaccessible: %s\n" +msgstr "Tidak ada atau tidak dapat diakses: %s\n" + +#: util/mkisofs/tree.c:997 util/mkisofs/tree.c:1103 +#, c-format +msgid "Unable to stat file %s - ignoring and continuing.\n" +msgstr "Tidak dapat memperoleh statistik berkas %s - mengabaikan dan melanjutkan.\n" + +#: util/mkisofs/tree.c:1003 +#, c-format +msgid "Symlink %s ignored - continuing.\n" +msgstr "Link simbolik %s diabaikan - melanjutkan.\n" + +#: util/mkisofs/tree.c:1028 +#, c-format +msgid "Already cached directory seen (%s)\n" +msgstr "Direktori yang telah dicache terlihat (%s)\n" + +#: util/mkisofs/tree.c:1070 +#, c-format +msgid "File %s is not readable (%s) - ignoring\n" +msgstr "Berkas %s tidak dapat dibaca (%s) - mengabaikan\n" + +#: util/mkisofs/tree.c:1083 +#, c-format +msgid "Directory loop - fatal goof (%s %lx %lu).\n" +msgstr "Loop direktori - fatal goof (%s %lx %lu).\n" + +#: util/mkisofs/tree.c:1093 +#, c-format +msgid "Unknown file type %s - ignoring and continuing.\n" +msgstr "Tipe berkas %s tidak diketahui - mengabaikan dan melanjutkan.\n" + +#: util/mkisofs/tree.c:1179 +#, c-format +msgid "Hidden from ISO9660 tree: %s\n" +msgstr "Tersembunyi dari pohon ISO9660: %s\n" + +#: util/mkisofs/tree.c:1191 +#, c-format +msgid "Hidden from Joliet tree: %s\n" +msgstr "Tersembunyi dari pohon joliet: %s\n" + +#: util/mkisofs/tree.c:1600 +#, c-format +msgid "Directories too deep %s\n" +msgstr "Direktori terlalu dalam %s\n" + +#: util/mkisofs/tree.c:1632 +msgid "Unable to delete non-empty directory\n" +msgstr "Tidak dapat menghapus direktori yang tidak kosong\n" + +#: util/mkisofs/tree.c:1655 +msgid "Unable to locate child directory in parent list\n" +msgstr "Tidak dapat menemukan direktori anak dalam daftar orang-tua\n" + +#: util/mkisofs/tree.c:1772 +#, c-format +msgid "call to search_tree_file with an absolute path, stripping\n" +msgstr "memanggil ke search_tree_file dengan sebuah jalur absolut, dipotong\n" + +#: util/mkisofs/tree.c:1773 +#, c-format +msgid "initial path separator. Hope this was intended...\n" +msgstr "jalur pemisah awal. Semoga ini yang diinginkan...\n" + +#: util/mkisofs/write.c:158 +#, c-format +msgid "Cannot open '%s'" +msgstr "Tidak dapat membuka '%s'" + +#: util/mkisofs/write.c:166 +#, c-format +msgid "cannot fwrite %llu*%llu\n" +msgstr "tidak dapat fwrite %llu*%llu\n" + +#: util/mkisofs/write.c:248 +#, c-format +msgid "cannot open %s\n" +msgstr "tidak dapat membuka %s\n" + +#: util/mkisofs/write.c:257 +#, c-format +msgid "cannot read %llu bytes from %s" +msgstr "tidak dapat membaca %llu bytes dari %s" + +#: util/mkisofs/write.c:275 +#, c-format +msgid "%6.2f%% done, estimate finish %s" +msgstr "%6.2f%% selesai, kira kira selesai %s" + +#: util/mkisofs/write.c:542 +#, c-format +msgid "Cache hit for %s%s%s\n" +msgstr "Cache kena untuk %s%s%s\n" + +#: util/mkisofs/write.c:896 +#, c-format +msgid "Unexpected directory length %d %d %s\n" +msgstr "Panjang direktori tidak terduga %d %d %s\n" + +#: util/mkisofs/write.c:908 +#, c-format +msgid "Continuation entry record length mismatch (%d %d).\n" +msgstr "Panjang masukan rekaman lanjutan tidak cocok (%d %d).\n" + +#: util/mkisofs/write.c:1072 +#, c-format +msgid "Path table lengths do not match %d %d\n" +msgstr "Panjang jalur tabel tidak cocok %d %d\n" + +#: util/mkisofs/write.c:1118 util/mkisofs/write.c:1128 +#, c-format +msgid "Total extents scheduled to be written = %llu\n" +msgstr "Total ekstensi telah terjadwal untuk ditulis = %llu\n" + +#: util/mkisofs/write.c:1145 +#, c-format +msgid "Total extents actually written = %llu\n" +msgstr "Total ekstensi yang sebenarnya tertulis = %llu\n" + +#: util/mkisofs/write.c:1154 +#, c-format +msgid "Number of extents written different than what was predicted. Please fix.\n" +msgstr "Jumlah dari ekstensi yang ditulis berbeda dari apa yang direncanakan. Mohon betulkan.\n" + +#: util/mkisofs/write.c:1155 +#, c-format +msgid "Predicted = %d, written = %llu\n" +msgstr "Diperkirakan = %d, tertulis = %llu\n" + +#: util/mkisofs/write.c:1158 +#, c-format +msgid "Total translation table size: %d\n" +msgstr "Total besar tabel terjemahan: %d\n" + +#: util/mkisofs/write.c:1159 +#, c-format +msgid "Total rockridge attributes bytes: %d\n" +msgstr "Total atribut rockridge bytes: %d\n" + +#: util/mkisofs/write.c:1160 +#, c-format +msgid "Total directory bytes: %d\n" +msgstr "Total bytes direktori: %d\n" + +#: util/mkisofs/write.c:1161 +#, c-format +msgid "Path table size(bytes): %d\n" +msgstr "Ukuran tabel jalur(bytes): %d\n" + +#: util/grub.d/10_kfreebsd.in:40 +msgid "%s, with kFreeBSD %s" +msgstr "%s, dengan kFreeBSD %s" + +#: util/grub.d/10_linux.in:57 +msgid "%s, with Linux %s (recovery mode)" +msgstr "%s, dengan Linux %s (mode penyembuhan)" + +#: util/grub.d/10_linux.in:59 +msgid "%s, with Linux %s" +msgstr "%s, dengan Linux %s" + +#~ msgid "the size of memory disk is 0x%x" +#~ msgstr "besar dari disk memori 0x%0x" + +#~ msgid "the size of config file is 0x%x" +#~ msgstr "besar dari berkas konfig adalah 0x%x" + +#~ msgid "the total module size is 0x%x" +#~ msgstr "total besar modul adalah 0x%x" + +#~ msgid "the core size is 0x%x" +#~ msgstr "besar core adalah 0x%x" + +#~ msgid "the first sector is <%llu,%u,%u>" +#~ msgstr "sektor pertama adalah <%llu,%u,%u>" + +#~ msgid "saving <%llu,%u,%u> with the segment 0x%x" +#~ msgstr "menyimpan <%llu,%u,%u> dengan bagian 0x%x" + +#~ msgid "setting the root device to `%s'" +#~ msgstr "konfigurasi perangkat root ke `%s'" + +#~ msgid "dos partition is %d, bsd partition is %d" +#~ msgstr "partisi dos adalah %d, partisi bsd adalah %d" + +#~ msgid "the core image will be embedded at sector 0x%llx" +#~ msgstr "core image akan di ditempatkan di sektor 0x%llx" + +#~ msgid "succeeded in opening the core image but the size is different (%d != %d)" +#~ msgstr "sukses dalam membuka image core tetapi ukurannya berbeda (%d != %d)" + +#~ msgid "succeeded in opening the core image but cannot read %d bytes" +#~ msgstr "sukses dalam membuka image core tetapi tidak dapat membaca %d bytes" + +#~ msgid "succeeded in opening the core image but the data is different" +#~ msgstr "sukses dalam membuka image core tetapi data berbeda" + +#~ msgid "couldn't open the core image" +#~ msgstr "tidak dapat membuka image core" + +#~ msgid "error message = %s" +#~ msgstr "pesan error = %s" + +#~ msgid "opening the core image `%s'" +#~ msgstr "membuka image core `%s'" + +#~ msgid "guessing the root device failed, because of `%s'" +#~ msgstr "pendeteksian perangkat root gagal, karena `%s'"