I'm not a kernel hacker, but I have an idea about internationalizing
linux kernel.
It's based on logging the message code + message, not printk()'ing
to the console. (Otherwise it would be ugly)
An include file something like:
#define ktrans_mng(a,b) memcpy(a, b, sizeof(a));
#define KTRANS_CODE ""
#define KTR_BANNER "[00001]" /* Kernel banner */
#define KTR_PROCESSORDETECT "[00002]" /* Processor detected */
#define KTR_CONSOLEINFO "[00003]" /* Console information */
#define KTR_CALIB "[00004]" /* Calibrating delay loop */
/* ... */
then before every (needed) printks ktrans_mng() will be called.
init/main.c_956:
ktrans_mng(KTRANS_CODE, KTR_CALIB);
printk("Calibrating delay loop... ");
init/main.c_1119:
ktrans_mng(KTRANS_CODE, KTR_BANNER);
printk(linux_banner);
and lastly printk will be edited so that it will force to log the message
codes before the messages itself and zeros the KTRANS_CODE after used,
so that printks which are not called after ktrans_mng will not print the
last KTRANS_CODE again.
I don't know how to hack do_syslog without printing to the console, so
couldn't test it. But in theory, while booting no message codes will
be printed to the console but can be logged via do_syslog
(it's possible isn't it ?).
If it's possible then we should have lines something like that:
root@2:43pm:~# dmesg | more
[00001] Linux version 2.1.131 (root@piranha) (gcc version 2.7.2.3) #57 Thu
Dec 10 13:40:25 EET 1998
[00002] Detected 233.867 MHz processor.
[00003] Console: colour VGA+ 80x25
[00004] Calibrating delay loop... 233.47 BogoMIPS
[00005] Memory: 127784k/131072k available (964k kernel code, 408k
reserved, 1880k data, 36k init)
[00006] VFS: Diskquotas version dquot_6.4.0 initialized
[00007] CPU: Intel Pentium II (Klamath) stepping 04
[00008] Checking 386/387 coupling... OK, FPU using exception 16 error
reporting.
...
And a converter program which should be in scripts/ can handle the message
codes an prints the user, like:
root@2:45pm:~# dmesg | ktrans -tr -
Linux surum 2.1.131 (root@piranha) (gcc version 2.7.2.3) #57 Thu Dec 10
13:40:25 EET 1998
Islemci bulundu: 233.867.
Konsol: renkli VGA+ 80x25
...
the ktrans program will read from the stdin and check for the message
code in the first 7 bytes of every line. After that it will translate the
message for its message code, like:
[00003] Console: colour VGA+ 80x25, to
Konsol: renkli VGA+ 80x25
by replacing the arguments of that line.
OTOH, this idea have problems, at least 3, I found. The first one is
kernel source has about 70000 printks. But, for example:
drivers/net/*.c files (totally 203 files) has 4194 printks, that is;
about 20 printks for one C code. To solve that every maintainer can edit
their codes in a few minutes I think.
And the second one, which is more complexed, is printing one line with
more than one calls, like:
drivers/char/console.c_2416:
printk("Console: switching ");
if (!deflt)
printk("consoles %d-%d ", first+1, last+1);
if (j >= 0)
printk("to %s %s %dx%d\n",
vc_cons[j].d->vc_can_do_color ? "colour" : "mono",
desc, vc_cons[j].d->vc_cols,
vc_cons[j].d->vc_rows);
else
printk("to %s\n", desc);
And the third one is logging/displaying the native language characters,
like ISO8859-8 Hebrew, or ISO8859-9 Turkish, etc.
Anyhow, just an idea.
Regards,
Murat Arslan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/