error message
Hello,
Last part to add gettext support is loader/*. Specially some grub_error messages, since some of them appears to the standard user. I thought to translate the common ones only, but it's a bit difficult to know the "common ones". Then the appraoch is to add gettext support to all grub_error messages in loader/* (see the attached patch for reference).
The strings are not very uniform. One option would be to try to make the strings from grub_error a bit more standard. One suggestion would be:
* use an enum with all strings inside. So when we write a grub_error we will pick up one of them. We could have grub_error and grub_error_enum (so we don't loose the capacity to write other strings but we discourage).
* also print the filename, line number from where the error has happened. So when a user comes and says "Grub says no filename specified" we would have some more information.
(any problem to use the gcc macros to know the filename/line number? I remember something and I cannot find it now)
Any other ideas?
The goals are two, and a bit contradictory at first glance:
a) Have less strings
b) Have more precise error messages
Signature · 2 lines
Carles Pina i Estany http://pinux.info
=== modified file 'ChangeLog'
ChangeLog +19 -0
@@ -1,5 +1,24 @@ 2010-01-06 Carles Pina i Estany <[email protected]> + * kern/err.c (grub_print_error): Gettextizze error message. + * commands/boot.c: Gettextizze grub_error calls, grub_register_command + calls, include `<grub/i18n.h>' if needed. + * loader/i386/bsd.c: Likewise. + * loader/i386/efi/linux.c: Likewise. + * loader/i386/ieee1275/linux.c: Likewise. + * loader/i386/linux.c: Likewise. + * loader/i386/multiboot.c: Likewise. + * loader/i386/pc/linux.c: Likewise. + * loader/multiboot2.c: Likewise. + * loader/powerpc/ieee1275/linux.c: Likewise. + * loader/sparc64/ieee1275/linux.c: Likewise. + * po/POTFILES: Add `kern/err.c', `loader/i386/efi/linux.c', + `loader/i386/ieee1275/linux.c', `loader/i386/linux.c', + `loader/i386/multiboot.c', `loader/i386/pc/linux.c', + `loader/multiboot2.c' and `loader/powerpc/ieee1275/linux.c' files. + +2010-01-06 Carles Pina i Estany <[email protected]> + * kern/err.c: Include `<grub/i18n.h>'. (grub_print_error): Add full stop. Gettextizze. * loader/i386/bsd.c (grub_netbsd_boot): Change grub_error description.
=== modified file 'commands/boot.c'
boot.c +1 -1
@@ -144,7 +144,7 @@ grub_loader_boot (void)struct grub_preboot_t *cur;if (! grub_loader_loaded) -return grub_error (GRUB_ERR_NO_KERNEL ,"no loaded kernel" ); +return grub_error (GRUB_ERR_NO_KERNEL ,N_ ("no loaded kernel" ));if (grub_loader_noreturn)grub_machine_fini ();
=== modified file 'kern/err.c'
err.c +1 -1
@@ -122,7 +122,7 @@ grub_print_error (void)do {if (grub_errno !=GRUB_ERR_NONE ) -grub_err_printf (_ ("error: %s.\n" ), grub_errmsg); +grub_err_printf (_ ("error: %s.\n" ),_ (grub_errmsg)); }while (grub_error_pop ());
=== modified file 'loader/i386/bsd.c'
i386/bsd.c +23 -23
148 lines not on this page · raw message
=== modified file 'loader/i386/efi/linux.c'
i386/efi/linux.c +17 -16
@@ -33,6 +33,7 @@#include <grub/pci.h> #include <grub/command.h> #include <grub/memory.h> +#include <grub/i18n.h> #define GRUB_LINUX_CL_OFFSET 0x1000#define GRUB_LINUX_CL_END_OFFSET 0x2000
@@ -233,7 +234,7 @@ allocate_pages (grub_size_t prot_size)if (! real_mode_mem) { -grub_error (GRUB_ERR_OUT_OF_MEMORY ,"cannot allocate real mode pages" ); +grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("cannot allocate real mode pages" )); goto fail; }
@@ -245,7 +246,7 @@ allocate_pages (grub_size_t prot_size)if (! prot_mode_mem) {grub_error (GRUB_ERR_OUT_OF_MEMORY , -"cannot allocate protected mode pages" ); +N_ ("cannot allocate protected mode pages" )); goto fail; }
@@ -609,7 +610,7 @@ grub_cmd_linux (grub_command_t cmd __attif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto fail; }
@@ -619,19 +620,19 @@ grub_cmd_linux (grub_command_t cmd __attif (grub_file_read (file, &lh,sizeof (lh)) !=sizeof (lh)) { -grub_error (GRUB_ERR_READ_ERROR ,"cannot read the linux header" ); +grub_error (GRUB_ERR_READ_ERROR ,N_ ("cannot read the linux header" )); goto fail; }if (lh.boot_flag !=grub_cpu_to_le16 (0xaa55 )) { -grub_error (GRUB_ERR_BAD_OS ,"invalid magic number" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("invalid magic number" )); goto fail; }if (lh.setup_sects >GRUB_LINUX_MAX_SETUP_SECTS ) { -grub_error (GRUB_ERR_BAD_OS ,"too many setup sectors" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("too many setup sectors" )); goto fail; }
@@ -639,14 +640,14 @@ grub_cmd_linux (grub_command_t cmd __attif (lh.header !=grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE ) ||grub_le_to_cpu16 (lh.version) <0x0203 ) { -grub_error (GRUB_ERR_BAD_OS ,"too old version" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("too old version" )); goto fail; }/* I'm not sure how to support zImage on EFI. */ if (! (lh.loadflags &GRUB_LINUX_FLAG_BIG_KERNEL )) { -grub_error (GRUB_ERR_BAD_OS ,"zImage is not supported" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("zImage is not supported" )); goto fail; }
@@ -671,7 +672,7 @@ grub_cmd_linux (grub_command_t cmd __att len =0x400 -sizeof (lh);if (grub_file_read (file, (char *) real_mode_mem +sizeof (lh), len) != len) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -853,7 +854,7 @@ grub_cmd_linux (grub_command_t cmd __att len = prot_size;if (grub_file_read (file, (void *)GRUB_LINUX_BZIMAGE_ADDR , len) != len) -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" ));if (grub_errno ==GRUB_ERR_NONE ) {
@@ -890,13 +891,13 @@ grub_cmd_initrd (grub_command_t cmd __atif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no module specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no module specified" )); goto fail; }if (! loaded) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"you need to load the kernel first" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("you need to load the kernel first" )); goto fail; }
@@ -956,7 +957,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (addr ==0 ) { -grub_error (GRUB_ERR_OUT_OF_MEMORY ,"no free pages available" ); +grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("no free pages available" )); goto fail; }
@@ -966,7 +967,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (grub_file_read (file, initrd_mem, size) != size) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -989,9 +990,9 @@ static grub_command_t cmd_linux, cmd_iniGRUB_MOD_INIT (linux) { cmd_linux =grub_register_command ("linux" , grub_cmd_linux, -0 ,"Load Linux." ); +0 ,N_ ("Load Linux." )); cmd_initrd =grub_register_command ("initrd" , grub_cmd_initrd, -0 ,"Load initrd." ); +0 ,N_ ("Load initrd." )); my_mod = mod; }
=== modified file 'loader/i386/ieee1275/linux.c'
i386/ieee1275/linux.c +10 -9
@@ -32,6 +32,7 @@#include <grub/cpu/linux.h> #include <grub/ieee1275/ieee1275.h> #include <grub/command.h> +#include <grub/i18n.h> #define GRUB_OFW_LINUX_PARAMS_ADDR 0x90000#define GRUB_OFW_LINUX_KERNEL_ADDR 0x100000
@@ -155,7 +156,7 @@ grub_cmd_linux (grub_command_t cmd __attif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto fail; }
@@ -165,14 +166,14 @@ grub_cmd_linux (grub_command_t cmd __attif (grub_file_read (file, &lh,sizeof (lh)) !=sizeof (lh)) { -grub_error (GRUB_ERR_READ_ERROR ,"cannot read the linux header" ); +grub_error (GRUB_ERR_READ_ERROR ,N_ ("cannot read the linux header" )); goto fail; }if ((lh.boot_flag !=grub_cpu_to_le16 (0xaa55 )) || (lh.header !=grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE ))) { -grub_error (GRUB_ERR_BAD_OS ,"invalid magic number" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("invalid magic number" )); goto fail; }
@@ -211,7 +212,7 @@ grub_cmd_linux (grub_command_t cmd __att kernel_size = prot_size;if (grub_file_read (file, kernel_addr, prot_size) != (int ) prot_size) -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" ));if (grub_errno ==GRUB_ERR_NONE )grub_loader_set (grub_linux_boot, grub_linux_unload,1 );
@@ -242,13 +243,13 @@ grub_cmd_initrd (grub_command_t cmd __atif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no module specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no module specified" )); goto fail; }if (! kernel_addr) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"you need to load the kernel first" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("you need to load the kernel first" )); goto fail; }
@@ -260,7 +261,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (grub_file_read (file, (void *)GRUB_OFW_LINUX_INITRD_ADDR , initrd_size) != (int ) initrd_size) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -276,9 +277,9 @@ static grub_command_t cmd_linux, cmd_iniGRUB_MOD_INIT (linux) { cmd_linux =grub_register_command ("linux" , grub_cmd_linux, -0 ,"Load Linux." ); +0 ,N_ ("Load Linux." )); cmd_initrd =grub_register_command ("initrd" , grub_cmd_initrd, -0 ,"Load initrd." ); +0 ,N_ ("Load initrd." )); my_mod = mod; }
=== modified file 'loader/i386/linux.c'
i386/linux.c +14 -13
@@ -33,6 +33,7 @@#include <grub/video_fb.h> #include <grub/command.h> #include <grub/i386/pc/vbe.h> +#include <grub/i18n.h> #define GRUB_LINUX_CL_OFFSET 0x1000#define GRUB_LINUX_CL_END_OFFSET 0x2000
@@ -347,7 +348,7 @@ allocate_pages (grub_size_t prot_size)grub_mmap_iterate (hook);if (! real_mode_mem) { -grub_error (GRUB_ERR_OUT_OF_MEMORY ,"cannot allocate real mode pages" ); +grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("cannot allocate real mode pages" )); goto fail; }
@@ -603,7 +604,7 @@ grub_cmd_linux (grub_command_t cmd __attif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto fail; }
@@ -613,19 +614,19 @@ grub_cmd_linux (grub_command_t cmd __attif (grub_file_read (file, &lh,sizeof (lh)) !=sizeof (lh)) { -grub_error (GRUB_ERR_READ_ERROR ,"cannot read the linux header" ); +grub_error (GRUB_ERR_READ_ERROR ,N_ ("cannot read the linux header" )); goto fail; }if (lh.boot_flag !=grub_cpu_to_le16 (0xaa55 )) { -grub_error (GRUB_ERR_BAD_OS ,"invalid magic number" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("invalid magic number" )); goto fail; }if (lh.setup_sects >GRUB_LINUX_MAX_SETUP_SECTS ) { -grub_error (GRUB_ERR_BAD_OS ,"too many setup sectors" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("too many setup sectors" )); goto fail; }
@@ -673,7 +674,7 @@ grub_cmd_linux (grub_command_t cmd __att len =0x400 -sizeof (lh);if (grub_file_read (file, (char *) real_mode_mem +sizeof (lh), len) != len) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -862,7 +863,7 @@ grub_cmd_linux (grub_command_t cmd __att len = prot_size;if (grub_file_read (file, (void *)GRUB_LINUX_BZIMAGE_ADDR , len) != len) -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" ));if (grub_errno ==GRUB_ERR_NONE ) {
@@ -897,13 +898,13 @@ grub_cmd_initrd (grub_command_t cmd __atif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no module specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no module specified" )); goto fail; }if (! loaded) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"you need to load the kernel first" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("you need to load the kernel first" )); goto fail; }
@@ -951,7 +952,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (addr < addr_min) { -grub_error (GRUB_ERR_OUT_OF_RANGE ,"the initrd is too big" ); +grub_error (GRUB_ERR_OUT_OF_RANGE ,N_ ("the initrd is too big" )); goto fail; }
@@ -959,7 +960,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (grub_file_read (file, initrd_mem, size) != size) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -982,9 +983,9 @@ static grub_command_t cmd_linux, cmd_iniGRUB_MOD_INIT (linux) { cmd_linux =grub_register_command ("linux" , grub_cmd_linux, -0 ,"Load Linux." ); +0 ,N_ ("Load Linux." )); cmd_initrd =grub_register_command ("initrd" , grub_cmd_initrd, -0 ,"Load initrd." ); +0 ,N_ ("Load initrd." )); my_mod = mod; }
=== modified file 'loader/i386/multiboot.c'
i386/multiboot.c +10 -9
@@ -49,6 +49,7 @@#include <grub/partition.h> #endif #include <grub/i386/relocator.h> +#include <grub/i18n.h> extern grub_dl_t my_mod;static struct multiboot_info *mbi, *mbi_dest;
@@ -166,7 +167,7 @@ grub_multiboot_load_elf (grub_file_t filelse if (grub_multiboot_is_elf64 (buffer))return grub_multiboot_load_elf64 (file, buffer); -return grub_error (GRUB_ERR_UNKNOWN_OS ,"unknown ELF class" ); +return grub_error (GRUB_ERR_UNKNOWN_OS ,N_ ("unknown ELF class" )); } static int
@@ -226,21 +227,21 @@ grub_multiboot (int argc, char *argv[])if (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto fail; } file =grub_gzfile_open (argv[0 ],1 );if (! file) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"couldn't open file" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("couldn't open file" )); goto fail; } len =grub_file_read (file, buffer,MULTIBOOT_SEARCH );if (len <32 ) { -grub_error (GRUB_ERR_BAD_OS ,"file too small" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("file too small" )); goto fail; }
@@ -257,14 +258,14 @@ grub_multiboot (int argc, char *argv[])if (header ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no multiboot header found" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no multiboot header found" )); goto fail; }if (header->flags &MULTIBOOT_UNSUPPORTED ) {grub_error (GRUB_ERR_UNKNOWN_OS , -"unsupported flag: 0x%x" , header->flags); +N_ ("unsupported flag: 0x%x" ), header->flags); goto fail; }
@@ -408,14 +409,14 @@ grub_module (int argc, char *argv[])if (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no module specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no module specified" )); goto fail; }if (!mbi) {grub_error (GRUB_ERR_BAD_ARGUMENT , -"you need to load the multiboot kernel first" ); +N_ ("you need to load the multiboot kernel first" )); goto fail; }
@@ -430,7 +431,7 @@ grub_module (int argc, char *argv[])if (grub_file_read (file, module, size) != size) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
=== modified file 'loader/i386/pc/linux.c'
i386/pc/linux.c +17 -16
@@ -30,6 +30,7 @@#include <grub/dl.h> #include <grub/cpu/linux.h> #include <grub/command.h> +#include <grub/i18n.h> #define GRUB_LINUX_CL_OFFSET 0x9000#define GRUB_LINUX_CL_END_OFFSET 0x90FF
@@ -63,7 +64,7 @@ grub_cmd_linux (grub_command_t cmd __attif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto fail; }
@@ -73,7 +74,7 @@ grub_cmd_linux (grub_command_t cmd __attif ((grub_size_t )grub_file_size (file) > grub_os_area_size) { -grub_error (GRUB_ERR_OUT_OF_RANGE ,"too big kernel (0x%x > 0x%x)" , +grub_error (GRUB_ERR_OUT_OF_RANGE ,N_ ("too big kernel (0x%x > 0x%x)" ), (grub_size_t )grub_file_size (file), grub_os_area_size); goto fail;
@@ -81,19 +82,19 @@ grub_cmd_linux (grub_command_t cmd __attif (grub_file_read (file, &lh,sizeof (lh)) !=sizeof (lh)) { -grub_error (GRUB_ERR_READ_ERROR ,"cannot read the linux header" ); +grub_error (GRUB_ERR_READ_ERROR ,N_ ("cannot read the Linux header" )); goto fail; }if (lh.boot_flag !=grub_cpu_to_le16 (0xaa55 )) { -grub_error (GRUB_ERR_BAD_OS ,"invalid magic number" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("invalid magic number" )); goto fail; }if (lh.setup_sects >GRUB_LINUX_MAX_SETUP_SECTS ) { -grub_error (GRUB_ERR_BAD_OS ,"too many setup sectors" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("too many setup sectors" )); goto fail; }
@@ -153,7 +154,7 @@ grub_cmd_linux (grub_command_t cmd __attif (! grub_linux_is_bzimage && ((char *)GRUB_LINUX_ZIMAGE_ADDR + prot_size > grub_linux_real_addr)) { -grub_error (GRUB_ERR_BAD_OS ,"too big zImage (0x%x > 0x%x), use bzImage instead" , +grub_error (GRUB_ERR_BAD_OS ,N_ ("too big zImage (0x%x > 0x%x), use bzImage instead" ), (char *)GRUB_LINUX_ZIMAGE_ADDR + prot_size, (grub_size_t ) grub_linux_real_addr); goto fail;
@@ -163,7 +164,7 @@ grub_cmd_linux (grub_command_t cmd __att > (char *) UINT_TO_PTR (grub_mmap_get_lower ())) {grub_error (GRUB_ERR_OUT_OF_RANGE , -"too small lower memory (0x%x > 0x%x)" , +N_ ("too small lower memory (0x%x > 0x%x)" ), grub_linux_real_addr +GRUB_LINUX_SETUP_MOVE_SIZE , (int )grub_mmap_get_lower ()); goto fail;
@@ -234,7 +235,7 @@ grub_cmd_linux (grub_command_t cmd __att len = real_size +GRUB_DISK_SECTOR_SIZE -sizeof (lh);if (grub_file_read (file, grub_linux_tmp_addr +sizeof (lh), len) != len) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -265,7 +266,7 @@ grub_cmd_linux (grub_command_t cmd __att len = prot_size;if (grub_file_read (file, (void *)GRUB_LINUX_BZIMAGE_ADDR , len) != len) -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" ));if (grub_errno ==GRUB_ERR_NONE ) {
@@ -299,13 +300,13 @@ grub_cmd_initrd (grub_command_t cmd __atif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no module specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no module specified" )); goto fail; }if (!loaded) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"you need to load the kernel first" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("you need to load the kernel first" )); goto fail; }
@@ -314,7 +315,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (!(lh->header ==grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE ) &&grub_le_to_cpu16 (lh->version) >=0x0200 )) { -grub_error (GRUB_ERR_BAD_OS ,"the kernel is too old for initrd" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("the kernel is too old for initrd" )); goto fail; }
@@ -357,13 +358,13 @@ grub_cmd_initrd (grub_command_t cmd __atif (addr < addr_min) { -grub_error (GRUB_ERR_OUT_OF_RANGE ,"the initrd is too big" ); +grub_error (GRUB_ERR_OUT_OF_RANGE ,N_ ("the initrd is too big" )); goto fail; }if (grub_file_read (file, (void *) addr, size) != size) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -383,10 +384,10 @@ GRUB_MOD_INIT(linux16) { cmd_linux =grub_register_command ("linux16" , grub_cmd_linux, -0 ,"Load Linux." ); +0 ,N_ ("Load Linux." )); cmd_initrd =grub_register_command ("initrd16" , grub_cmd_initrd, -0 ,"Load initrd." ); +0 ,N_ ("Load initrd." )); my_mod = mod; }
=== modified file 'loader/multiboot2.c'
multiboot2.c +11 -10
@@ -28,6 +28,7 @@#include <grub/mm.h> #include <grub/misc.h> #include <grub/gzio.h> +#include <grub/i18n.h> static grub_addr_t entry;extern grub_dl_t my_mod;
@@ -226,7 +227,7 @@ grub_mb2_load_other (grub_file_t file __ void *buffer __attribute__ ((unused))) {/* XXX Create module tag here. */ -return grub_error (GRUB_ERR_UNKNOWN_OS ,"currently only ELF is supported" ); +return grub_error (GRUB_ERR_UNKNOWN_OS ,N_ ("currently only ELF is supported" )); }/* Create the tag containing the cmdline and the address of the module data. */
@@ -289,7 +290,7 @@ grub_mb2_load_elf (grub_elf_t elf, int a &kern_size); }else - err =grub_error (GRUB_ERR_UNKNOWN_OS ,"unknown ELF class" ); + err =grub_error (GRUB_ERR_UNKNOWN_OS ,N_ ("unknown ELF class" ));if (err) goto fail;
@@ -319,14 +320,14 @@ grub_multiboot2 (int argc, char *argv[])if (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto fail; } file =grub_gzfile_open (argv[0 ],1 );if (! file) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"couldn't open file" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("couldn't open file" )); goto fail; }
@@ -337,7 +338,7 @@ grub_multiboot2 (int argc, char *argv[]) len =grub_file_read (file, buffer,MULTIBOOT2_HEADER_SEARCH );if (len <32 ) { -grub_error (GRUB_ERR_BAD_OS ,"file too small" ); +grub_error (GRUB_ERR_BAD_OS ,N_ ("file too small" )); goto fail; }
@@ -378,7 +379,7 @@ grub_multiboot2 (int argc, char *argv[]) err =grub_mb2_load_other (file, header); else err =grub_error (GRUB_ERR_BAD_OS , -"need multiboot 2 header to load non-ELF files" ); +N_ ("need multiboot 2 header to load non-ELF files" ));grub_file_close (file); }
@@ -406,20 +407,20 @@ grub_module2 (int argc, char *argv[])if (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no module specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no module specified" ));return ; }if (argc ==1 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no module type specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no module type specified" ));return ; }if (entry ==0 ) {grub_error (GRUB_ERR_BAD_ARGUMENT , -"you need to load the multiboot kernel first" ); +N_ ("you need to load the multiboot kernel first" ));return ; }
@@ -437,7 +438,7 @@ grub_module2 (int argc, char *argv[]) modaddr + modsize);if (grub_file_read (file, (void *) modaddr, modsize) != modsize) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto out; }
=== modified file 'loader/powerpc/ieee1275/linux.c'
powerpc/ieee1275/linux.c +14 -13
@@ -26,6 +26,7 @@#include <grub/ieee1275/ieee1275.h> #include <grub/machine/loader.h> #include <grub/command.h> +#include <grub/i18n.h> #define ELF32_LOADMASK (0xc0000000UL)#define ELF64_LOADMASK (0xc000000000000000ULL)
@@ -75,10 +76,10 @@ grub_linux_release_mem (void) linux_args =0 ;if (linux_addr &&grub_ieee1275_release (linux_addr, linux_size)) -return grub_error (GRUB_ERR_OUT_OF_MEMORY ,"cannot release memory" ); +return grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("cannot release memory" ));if (initrd_addr &&grub_ieee1275_release (initrd_addr, initrd_size)) -return grub_error (GRUB_ERR_OUT_OF_MEMORY ,"cannot release memory" ); +return grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("cannot release memory" )); linux_addr =0 ; initrd_addr =0 ;
@@ -128,7 +129,7 @@ grub_linux_load32 (grub_elf_t elf)break ; }if (found_addr ==-1 ) -return grub_error (GRUB_ERR_OUT_OF_MEMORY ,"couldn't claim memory" ); +return grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("couldn't claim memory" ));/* Now load the segments into the area we claimed. */ autogrub_err_t offset_phdr (Elf32_Phdr *phdr,grub_addr_t *addr,int *do_load);
@@ -178,7 +179,7 @@ grub_linux_load64 (grub_elf_t elf)break ; }if (found_addr ==-1 ) -return grub_error (GRUB_ERR_OUT_OF_MEMORY ,"couldn't claim memory" ); +return grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("couldn't claim memory" ));/* Now load the segments into the area we claimed. */ autogrub_err_t offset_phdr (Elf64_Phdr *phdr,grub_addr_t *addr,int *do_load);
@@ -211,7 +212,7 @@ grub_cmd_linux (grub_command_t cmd __attif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto out; }
@@ -222,7 +223,7 @@ grub_cmd_linux (grub_command_t cmd __attif (elf->ehdr.ehdr32.e_type !=ET_EXEC ) {grub_error (GRUB_ERR_UNKNOWN_OS , -"this ELF file is not of the right type" ); +N_ ("this ELF file is not of the right type" )); goto out; }
@@ -236,7 +237,7 @@ grub_cmd_linux (grub_command_t cmd __attgrub_linux_load64 (elf); else { -grub_error (GRUB_ERR_BAD_FILE_TYPE ,"unknown ELF class" ); +grub_error (GRUB_ERR_BAD_FILE_TYPE ,N_ ("unknown ELF class" )); goto out; }
@@ -291,13 +292,13 @@ grub_cmd_initrd (grub_command_t cmd __atif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no initrd specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no initrd specified" )); goto fail; }if (!loaded) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"you need to load the kernel first" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("you need to load the kernel first" )); goto fail; }
@@ -321,7 +322,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (found_addr ==-1 ) { -grub_error (GRUB_ERR_OUT_OF_MEMORY ,"cannot claim memory" ); +grub_error (GRUB_ERR_OUT_OF_MEMORY ,N_ ("cannot claim memory" )); goto fail; }
@@ -330,7 +331,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (grub_file_read (file, (void *) addr, size) != size) {grub_ieee1275_release (addr, size); -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -349,9 +350,9 @@ static grub_command_t cmd_linux, cmd_iniGRUB_MOD_INIT (linux) { cmd_linux =grub_register_command ("linux" , grub_cmd_linux, -0 ,"Load Linux." ); +0 ,N_ ("Load Linux." )); cmd_initrd =grub_register_command ("initrd" , grub_cmd_initrd, -0 ,"Load initrd." ); +0 ,N_ ("Load initrd." )); my_mod = mod; }
=== modified file 'loader/sparc64/ieee1275/linux.c'
sparc64/ieee1275/linux.c +13 -12
@@ -27,6 +27,7 @@#include <grub/machine/loader.h> #include <grub/gzio.h> #include <grub/command.h> +#include <grub/i18n.h> static grub_dl_t my_mod;
@@ -256,12 +257,12 @@ grub_linux_load64 (grub_elf_t elf) paddr =alloc_phys (linux_size + off);if (paddr == (grub_addr_t) -1 )return grub_error (GRUB_ERR_OUT_OF_MEMORY , -"couldn't allocate physical memory" ); +N_ ("couldn't allocate physical memory" )); ret =grub_ieee1275_map_physical (paddr, linux_addr - off, linux_size + off,IEEE1275_MAP_DEFAULT );if (ret)return grub_error (GRUB_ERR_OUT_OF_MEMORY , -"couldn't map physical memory" ); +N_ ("couldn't map physical memory" ));grub_dprintf ("loader" ,"Loading linux at vaddr 0x%lx, paddr 0x%lx, size 0x%lx\n" , linux_addr, paddr, linux_size);
@@ -302,7 +303,7 @@ grub_cmd_linux (grub_command_t cmd __attif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no kernel specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no kernel specified" )); goto out; }
@@ -317,7 +318,7 @@ grub_cmd_linux (grub_command_t cmd __attif (elf->ehdr.ehdr32.e_type !=ET_EXEC ) {grub_error (GRUB_ERR_UNKNOWN_OS , -"this ELF file is not of the right type" ); +N_ ("this ELF file is not of the right type" )); goto out; }
@@ -328,7 +329,7 @@ grub_cmd_linux (grub_command_t cmd __attgrub_linux_load64 (elf); else { -grub_error (GRUB_ERR_BAD_FILE_TYPE ,"unknown ELF class" ); +grub_error (GRUB_ERR_BAD_FILE_TYPE ,N_ ("unknown ELF class" )); goto out; }
@@ -384,13 +385,13 @@ grub_cmd_initrd (grub_command_t cmd __atif (argc ==0 ) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"no initrd specified" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("no initrd specified" )); goto fail; }if (!loaded) { -grub_error (GRUB_ERR_BAD_ARGUMENT ,"you need to load the kernel first" ); +grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("you need to load the kernel first" )); goto fail; }
@@ -405,14 +406,14 @@ grub_cmd_initrd (grub_command_t cmd __atif (paddr == (grub_addr_t) -1 ) {grub_error (GRUB_ERR_OUT_OF_MEMORY , -"couldn't allocate physical memory" ); +N_ ("couldn't allocate physical memory" )); goto fail; } ret =grub_ieee1275_map_physical (paddr, addr, size,IEEE1275_MAP_DEFAULT );if (ret) {grub_error (GRUB_ERR_OUT_OF_MEMORY , -"couldn't map physical memory" ); +N_ ("couldn't map physical memory" )); goto fail; }
@@ -421,7 +422,7 @@ grub_cmd_initrd (grub_command_t cmd __atif (grub_file_read (file, (void *) addr, size) != size) { -grub_error (GRUB_ERR_FILE_READ_ERROR ,"couldn't read file" ); +grub_error (GRUB_ERR_FILE_READ_ERROR ,N_ ("couldn't read file" )); goto fail; }
@@ -516,9 +517,9 @@ GRUB_MOD_INIT(linux)fetch_translations (); cmd_linux =grub_register_command ("linux" , grub_cmd_linux, -0 ,"Load Linux." ); +0 ,N_ ("Load Linux." )); cmd_initrd =grub_register_command ("initrd" , grub_cmd_initrd, -0 ,"Load initrd." ); +0 ,N_ ("Load initrd." )); my_mod = mod; }
=== modified file 'po/POTFILES'
POTFILES +9 -0
@@ -51,9 +51,18 @@ disk/loopback.c hello/hello.c +kern/err.c + lib/arg.c loader/i386/bsd.c +loader/i386/efi/linux.c +loader/i386/ieee1275/linux.c +loader/i386/linux.c +loader/i386/multiboot.c +loader/i386/pc/linux.c +loader/multiboot2.c +loader/powerpc/ieee1275/linux.c normal/auth.c normal/color.c
Quoted 3 lines · Carles Pina i Estany
(any problem to use the gcc macros to know the filename/line number? I remember something and I cannot find it now)
__FILE__ yields a significant code size increase. We have an outstanding problem with this. See:
https://savannah.gnu.org/task/?10024
Signature · 3 lines
Robert Millan "Be the change you want to see in the world" -- Gandhi