📄 grub-0.97-patch6-chinese
字号:
+ if (! grub_open(arg))+ return 1;+ grub_close();+// }++ strcpy(fontfile, arg);++ /* get rid of TERM_NEED_INIT from the graphics terminal. */+ for (i = 0; term_table[i].name; i++) {+ if (grub_strcmp (term_table[i].name, "graphics") == 0) {+ term_table[i].flags &= ~TERM_NEED_INIT;+ break;+ }+ }+ + //graphics_set_splash (splashimage);++ if (/* flags == BUILTIN_CMDLINE && */ graphics_inited) {+ graphics_end();+ if (! graphics_init())+ return errnum = ERR_EXEC_FORMAT;+ graphics_cls();+ }++ /* FIXME: should we be explicitly switching the terminal as a + * side effect here? */+ terminal_func("graphics", flags);++ return 0;+}++static struct builtin builtin_fontfile =+{+ "fontfile",+ font_func,+ BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,+ "fontfile FILE",+ "Specify the Chinese Font File. "+ "If you want display chinese character, please run"+ "splashimage command later.",+ "fontfile FILE",+ "指定中文字体文件,并切换到简体中文显示方式。"+};+#endif /* SUPPORT_GRAPHICS */+ static int root_func (char *arg, int flags) {@@ -6972,7 +7297,15 @@ " optional HDBIAS parameter is a number to tell a BSD kernel" " how many BIOS drive numbers are on controllers before the current" " one. For example, if there is an IDE disk and a SCSI disk, and your"- " FreeBSD root partition is on the SCSI disk, then use a `1' for HDBIAS."+ " FreeBSD root partition is on the SCSI disk, then use a `1' for HDBIAS.",+ "root [DEVICE [HDBIAS]]",+ "设置根分区为指定设备(DEVICE), 然后尝试挂接该分区以得到分区"+ " 大小(用于在ES:ESI中传递, 扇区链式启动方式要求这样)。BSD"+ " 驱动类型用于启动 BSD 的核心启动), 和确定 BSD 子分区所在的"+ " PC 分区。"+ " 可选的磁盘偏移参数, 用于 BSD 核心确定有多少个控制器在当前"+ " 控制器前。比如: 假设同时有一个IDE和SCSI盘, 而BSD根分区在"+ " SCSI盘上, 那么磁盘偏移就为1。" }; @@ -6993,7 +7326,11 @@ " is useful for when an OS is outside of the area of the disk that" " GRUB can read, but setting the correct root device is still" " desired. Note that the items mentioned in `root' which"- " derived from attempting the mount will NOT work correctly."+ " derived from attempting the mount will NOT work correctly.",+ "rootnoverify [DEVICE [HDBIAS]]",+ "类似`root'指令, 但不测试安装该分区。"+ "这用于有些系统装在 GRUB 能访问的磁盘区之外, 但仍需要设置正确"+ " 的根分区的情况。有些需要安装分区才能确定的参数可能会有问题。" }; @@ -7329,7 +7666,9 @@ " `fallback' is used, next fallback entry is saved." " If T is not 0, prompt the user to confirm the write operation by" " pressing the Y key, and if no key-press detected within T seconds,"- " the write will be discarded."+ " the write will be discarded.",+ "savedefault",+ "将当前项设置为默认的引导项。" }; @@ -7481,7 +7820,14 @@ " PARITY is the type of parity, which is one of `no', `odd' and `even'." " STOP is the length of stop bit(s). The option --device can be used only" " in the grub shell, which specifies the file name of a tty device. The"- " default values are COM1, 9600, 8N1."+ " default values are COM1, 9600, 8N1.",+ "serial [--unit=UNIT] [--port=PORT] [--speed=SPEED] [--word=WORD] [--parity=PARITY] [--stop=STOP] [--device=DEV]",+ "初始化一个串口设备。 UNIT 用于指定要使用的串口设备"+ " (如,0 == COM1);"+ " PORT 用于指定端口号; SPEED 用于指定通讯的数率; WORD 为字长;"+ " PARITY 为奇偶类型(取 `no', `odd' 和 `even' 之一的值。);"+ " STOP 是停止位的长度值; 选项 --device 仅用于命令行模式,"+ " 用以指定 tty 设备的文件名。默认值是这样的,COM1, 9600, 8N1。" }; #endif /* SUPPORT_SERIAL */ @@ -7733,7 +8079,20 @@ " quote, doublequote, backquote, tilde, shift, backslash, bar, comma," " less, period, greater, slash, question, alt, space, capslock, FX (X" " is a digit), and delete. If no argument is specified, reset key"- " mappings."+ " mappings.",+ "setkey [TO_KEY FROM_KEY]",+ "改变键盘映射关系。把FROM_KEY映射为TO_KEY。这里的键必须是字母, "+ " 数字, 和以下特殊键:"+ " escape(转义), exclam(!), at(@), numbersign(#), dollar($),"+ " parenright[)], caret(^), ampersand(&), asterisk(*), plus(+),"+ " percent(%), minus(-), underscore(_), equal(=), parenleft[(],"+ " backspace(退格), tab(制表), bracketleft([), braceleft({),"+ " bracketright(]), braceright(}), enter(回车), control(控制),"+ " semicolon(;), colon(:), quote('), doublequote(\"), slash(/),"+ " backquote(`), tilde(~), shift(换档), backslash(\\), bar(|),"+ " comma(,), less(<), period(.), greater(>), question(?), "+ " alt(交互), space(空格), capslock(大写), Fx(功能键) "+ " 和 delete(删除)。" }; @@ -8063,7 +8422,16 @@ " doesn't work in LBA mode, specify the option `--force-lba'." " If you install GRUB under the grub shell and you cannot unmount the" " partition where GRUB images reside, specify the option `--stage2'"- " to tell GRUB the file name under your OS."+ " to tell GRUB the file name under your OS.",+ "setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE [IMAGE_DEVICE]",+ "自动安装GRUB. 这条命令使用更灵活的install命令将GRUB安装到"+ " 指定设备上。 "+ "如果给出了映象设备,将在该设备寻找GRUB,否则使用缺省的根设备。"+ " 根设备可用root指令指定。"+ "如果你确认系统的 BIOS 应该支持 LBA 模式, 但是 GRUB 却没有"+ " 工作于该模式, 则请指定 `--force-lba' 参数。"+ "如若你在命令行中已安装了一次 GRUB 可是,你却无法卸载 GRUB "+ " 程序所在的分区,请指定 `--stage2' 参数。" }; @@ -8261,7 +8629,18 @@ " If you specify --no-edit, the BASH-like editing feature will be disabled." " If --timeout is present, this command will wait at most for SECS" " seconds. The option --lines specifies the maximum number of lines."- " The option --silent is used to suppress messages."+ " The option --silent is used to suppress messages.",+ "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]",+ "选择一个终端。当指定了多个终端以后, 按任意键方可继续操作。"+ " 如果控制台和串口都被指定了, 那么你首先在其中按下键盘的终端"+ " 将被首先选中。"+ "如果没有指定任何参数, 那么此命令将显示出当前的终端设置;"+ "参数 --dumb 用以指定一个哑终端, 否则即为 vt100 兼容型;"+ "若使用了 --no-echo 参数, 屏幕上将不会回显输入的字符;"+ "若使用了 --no-edit 参数, the BASH-like 的编辑功能将被禁用;"+ "若使用了 --timeout 参数, 该命令将等待数秒钟(由SECS指定);"+ "可使用 --lines 指定最大的行数;"+ "可使用 --silent 选项关闭消息显示。" }; #endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ @@ -8377,7 +8756,14 @@ "Define the capabilities of your terminal. Use this command to" " define escape sequences, if it is not vt100-compatible." " You may use \\e for ESC and ^X for a control character."- " If no option is specified, the current settings are printed."+ " If no option is specified, the current settings are printed.",+ "terminfo [--name=NAME --cursor-address=SEQ [--clear-screen=SEQ]"+ " [--enter-standout-mode=SEQ] [--exit-standout-mode=SEQ]]",+ + "指定终端的功能。"+ " 如果此终端为 vt100 兼容型的,则可指定换码顺序"+ " (即使用 \\e 代表 ESC, ^X 代表控制码);"+ "在未给任何参数的情况下,将给出当前配置信息。" }; #endif /* SUPPORT_SERIAL */ @@ -8466,7 +8852,12 @@ " filepos=Y' reading has X and Y equal, then it is definitely" " consistent, and very likely works correctly subject to a" " consistent offset error. If this test succeeds, then a good next"- " step is to try loading a kernel."+ " step is to try loading a kernel.",+ "testload FILE",+ "以多种不同的方式读取文件(由FILE指定)的整个内容,并予以比较,"+ " 以测试文件系统的代码。输出看起来会有点儿混乱,但是,如果"+ " 没有错误的话,`i=X, filepos=Y' 里的 X 和 Y 最后必得相等。"+ " 如果测试即告成功,下一步即可试图载入内核了。" }; @@ -8585,7 +8976,9 @@ testvbe_func, BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, "testvbe MODE",- "Test the VBE mode MODE. Hit any key to return."+ "Test the VBE mode MODE. Hit any key to return.",+ "testvbe MODE",+ "测试所指定(MODE)的 VBE 模式。" }; static inline unsigned long vbe_far_ptr_to_linear (unsigned long ptr)@@ -8720,7 +9113,9 @@ setvbe_func, BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, "setvbe MODE_3D",- "Set the VBE mode MODE_3D(which is of the form 1024x768x32) for each subsequent kernel command-line."+ "Set the VBE mode MODE_3D(which is of the form 1024x768x32) for each subsequent kernel command-line.",+ "setvbe MODE_3D",+ "为后续的每个 kernel 命令行设置 VBE 模式 MODE_3D(例如 1024x768x32)。" }; @@ -8745,7 +9140,9 @@ tftpserver_func, BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, "tftpserver IPADDR",- "Override the TFTP server address."+ "Override the TFTP server address.",+ "tftpserver IPADDR",+ "指定 TFTP 服务器的 IP 地址。" }; #endif /* SUPPORT_NETBOOT */ @@ -8821,7 +9218,9 @@ "unhide [PARTITION]", "Unhide PARTITION by clearing the \"hidden\" bit in its" " partition type code. The default partition is the current"- " root device."+ " root device.",+ "unhide PARTITION",+ "通过清除隐藏标志,解除指定分区(PARTITION)的隐藏。" }; @@ -8843,7 +9242,10 @@ BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, "uppermem KBYTES", "Force GRUB to assume that only KBYTES kilobytes of upper memory are"- " installed. Any system address range maps are discarded."+ " installed. Any system address range maps are discarded.",+ "uppermem KBYTES",+ "强制指定仅有(KBYTES) KB 的上位内存。任何系统的地址变换将被"+ " 取消。" }; @@ -8941,7 +9343,10 @@ BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, "vbeprobe [MODE]", "Probe VBE information. If the mode number MODE is specified, show only"- " the information about only the mode."+ " the information about only the mode.",+ "vbeprobe [MODE]",+ "侦测 VBE 的信息。"+ " 如果指定了一个模式(MODE 不为空),则仅显示其信息。" }; @@ -8985,6 +9390,7 @@ &builtin_fallback, &builtin_find, #ifdef SUPPORT_GRAPHICS+ &builtin_fontfile, /* Chinese Support Function by Gandalf*/ &builtin_foreground, #endif &builtin_fstest,diff -Naur grub-0.97_splash/stage2/char_io.c grub-0.97_chinese/stage2/char_io.c--- grub-0.97_splash/stage2/char_io.c 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_chinese/stage2/char_io.c 2006-10-24 12:28:52.000000000 +0800@@ -325,8 +325,17 @@ { cls (); +#ifdef SUPPORT_GRAPHICS+if (graphics_inited && ushFontReaded)+ grub_printf ("\n GNU GRUB 中文化版[版本 %s](%dK 低端 / %dK 上位 内存)\n\n",+ version_string, mbi.mem_lower, mbi.mem_upper);+else grub_printf ("\n GNU GRUB version %s (%dK lower / %dK upper memory)\n\n", version_string, mbi.mem_lower, mbi.mem_upper);+#else+ grub_printf ("\n GNU GRUB version %s (%dK lower / %dK upper memory)\n\n",+ version_string, mbi.mem_lower, mbi.mem_upper);+#endif } #endifdiff -Naur grub-0.97_splash/stage2/cmdline.c grub-0.97_chinese/stage2/cmdline.c--- grub-0.97_splash/stage2/cmdline.c 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_chinese/stage2/cmdline.c 2006-10-24 12:28:52.000000000 +0800@@ -51,10 +51,23 @@ void print_cmdline_message (int forever) {+#ifdef SUPPORT_GRAPHICS+ if (graphics_inited && ushFontReaded)+ printf (" [ 提供类似 BASH 的行编辑功能。对于第一个词, TAB 键列出可能的\n"+ " 完整命令。否则即列出可能的设备/文件。%s ]\n",+ (forever ? "" : " 按 `ESC` 即可退出当前状态。"));+ else printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n" " lists possible command completions. Anywhere else TAB lists the possible\n" " completions of a device/filename.%s ]\n", (forever ? "" : " ESC at any time exits."));++#else+ printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n"+ " lists possible command completions. Anywhere else TAB lists the possible\n"+ " completions of a device/filename.%s ]\n",+ (forever ? "" : " ESC at any time exits."));+#endif } /* Find the builtin whose command name is COMMAND and return thediff -Naur grub-0.97_splash/stage2/graphics.c grub-0.97_chinese/stage2/graphics.c--- grub-0.97_splash/stage2/graphics.c 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_chinese/stage2/graphics.c 2006-10-24 12:28:52.000000000 +0800@@ -1,4 +1,5 @@ /* graphics.c - graphics mode support for GRUB */+/* Chinese double-byte character support by Gandalf <f22_storm@163.com> */ /* Implemented as a terminal type by Jeremy Katz <katzj@redhat.com> based * on a patch by Paulo C閟ar Pereira de Andrade <pcpa@conectiva.com.br> */@@ -42,6 +43,7 @@ static unsigned char *VSHADOW4 = (unsigned char *)0x3B2C00; //unsigned char VSHADOW4[38400]; static unsigned char *VSHADOW8 = (unsigned char *)0x3BC200; //unsigned char VSHADOW8[38400]; +#define BASE_FONT_ADDR 0x500000; /* Raw base address for Chinese Font.*/ /* constants to define the viewable area */ const int x0 = 0; const int x1 = 80;@@ -52,6 +54,8 @@ * scroll and the like */ static unsigned short text[80 * 30]; +unsigned short stg2_ptborder = 0; /* Is called from stage2 drawing the menu border? */+ /* why do these have to be kept here? */ int foreground = (63 << 16) | (63 << 8) | (63), background = 0, border = 0; @@ -59,9 +63,14 @@ static int fontx = 0; static int fonty = 0; +//static char* chrMsg = "(r)Powered by Gandalf, f22_storm@163.com, 07/15/2004";++unsigned short ushFontReaded = 0; /* font loaded? */ /* global state so that we don't try to recursively scroll or cursor */ static int no_scroll = 0; +int fontloaded = 0;+ /* color state */ static int graphics_standard_color = A_NORMAL; static int graphics_normal_color = A_NORMAL;@@ -113,10 +122,40 @@ saved_videomode = set_videomode(0x12); } + if (! ushFontReaded)+ {+ ushFontReaded = 1;+ +/* remove them all. + grub_open("/boot/grub/fonts") ||+ grub_open("/boot/fonts") ||+ grub_open("/grub/fonts") ||+ grub_open("/fonts") +*/ ++ if (grub_strlen(fontfile) > 0)+ {+ if ( grub_open(fontfile) )+ {+ grub_read ((char *) RAW_ADDR (0x500000), -1);++ grub_close();+ }+ else+ {+ ushFontReaded = 0; + grub_printf(" load fontfile failed!\n");+ }+ }+ }+ if (! read_image(splashimage)) {- set_videomode(saved_videomode);- grub_printf("failed to read image\n");- return 0;+ if(! ushFontReaded)+ {+ set_videomode(saved_videomode);+ grub_printf("failed to read image\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -