📄 patch-chinese.diff
字号:
}; @@ -8191,7 +8457,9 @@ quit_func, BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, "quit",- "Exit from the GRUB shell."+ "Exit from the GRUB shell.",+ "quit",+ "\t从 GRUB 命令行中退出。" }; #else /* quit */@@ -8284,7 +8552,9 @@ quit_func, BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, "quit [--disable-a20]",- "Go back to DOS if GRUB was previously launched from DOS."+ "Go back to DOS if GRUB was previously launched from DOS.",+ "quit [--disable-a20]",+ "\t如果 GRUB 先前是从 DOS 启动的,就返回到 DOS。" }; #endif /* GRUB_UTIL */ @@ -8314,7 +8584,9 @@ rarp_func, BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, "rarp",- "Initialize a network device via RARP."+ "Initialize a network device via RARP.",+ "rarp",+ "\t用 RARP 初始化网络设备。" }; #endif /* ! GRUB_UTIL */ #endif /* SUPPORT_NETBOOT */@@ -8342,7 +8614,9 @@ BUILTIN_MENU | BUILTIN_CMDLINE, "read ADDR", "Read a 32-bit value from memory at address ADDR and"- " display it in hex format."+ " display it in hex format.",+ "read ADDR",+ "\t从内存的指定位置读取一个 32-bit 的值,并以十六进制形式显示出来。" }; static int@@ -8372,7 +8646,9 @@ write_func, BUILTIN_MENU | BUILTIN_CMDLINE, "write ADDR VAL",- "Write a 32-bit value VAL to memory at address ADDR."+ "Write a 32-bit value VAL to memory at address ADDR.",+ "write ADDR VAL",+ "\t写一个 32 位的值 VAL 到内存地址 ADDR。" }; @@ -8392,7 +8668,9 @@ reboot_func, BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, "reboot",- "Reboot your system."+ "Reboot your system.",+ "reboot",+ "\t重启系统。" }; #endif /* ! GRUB_UTIL */ @@ -8647,6 +8925,78 @@ return next ? 1 : (saved_drive & 0x80); } +#ifdef SUPPORT_GRAPHICS+/* Chinese Support by Gandalf+ * These codes used for defining a proper fontfile+ */+char fontfile[256];+static int font_func (char *arg, int flags) {+ //int i;++ if (grub_strlen(arg) <= 0)+ {+#ifdef SUPPORT_GRAPHICS+ if (graphics_inited && ushFontReaded)+ grub_printf("当前字体文件: %s", fontfile);+ else+ grub_printf("Current font file is: %s", fontfile);+#else+ grub_printf("Current font file is: %s", fontfile);+#endif+ return 1;+ }+ + while(arg[0]==' '||arg[0]=='\t') arg++;++ if (strlen(arg) > 256)+ return !(errnum = ERR_WONT_FIT);+ +// if (flags == BUILTIN_CMDLINE) {+ if (! grub_open(arg))+ return 0;+ 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 1;+}++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",+ "\t指定中文字体文件,并切换到简体中文显示方式。"+};+#endif /* SUPPORT_GRAPHICS */+ static int root_func (char *arg, int flags) {@@ -8668,7 +9018,13 @@ " 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]]",+ "\t设置根分区为指定设备(DEVICE), 然后尝试挂接该分区以得到分区大小(用于"+ "\n\t在ES:ESI中传递, 扇区链式启动方式要求这样)。BSD 驱动类型用于启动 BSD"+ "\n\t的核心启动), 和确定 BSD 子分区所在的 PC 分区。可选的磁盘偏移参数, 用"+ "\n\t于 BSD 核心确定有多少个控制器在当前控制器前。比如, 假设同时有一个"+ "\n\tIDE 和 SCSI 盘, 而 BSD 根分区在 SCSI 盘上, 那么磁盘偏移就为 1。" }; @@ -8689,7 +9045,12 @@ " 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]]",+ "\t类似于“root”指令, 但不尝试挂接该分区。这用于有些操作系统安装在"+ "\n\tGRUB 能访问到的磁盘区域之外,或者其文件系统不能被 GRUB 识别出来,"+ "\n\t但你仍然想把这个设备强制设置为 root 设备的情况。说明:这样一来,"+ "\n\t原来在 root 命令中尝试挂接的那些项目,现在将不起作用了。" }; @@ -9026,7 +9387,13 @@ " `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",+ "\t如果没有指定参数,就把当前菜单项保存为默认的引导项。如果指定了参数"+ "\n\tNUM,那么保存的就是它。如果指定的是关键字 fallback,那么保存的是"+ "\n\tfallback 命令所指定的菜单项。如果 T 不是 0,将提示用户按下 Y 键来"+ "\n\t确认写盘操作,如果在 T 秒之内没有按键,或者按键不是 Y,那么写盘保存"+ "\n\t的操作将被取消。" }; @@ -9178,7 +9545,13 @@ " 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]",+ "\t初始化一个串口设备。UNIT 用于指定要使用的串口设备(如,0 == COM1);"+ "\n\tPORT 用于指定端口号; SPEED 用于指定通讯的数率; WORD 为字长;"+ "\n\tPARITY 为奇偶类型(取 `no', `odd' 和 `even' 之一的值。); STOP 是停止"+ "\n\t位的长度值; 选项 --device 仅用于命令行模式,用以指定 tty 设备的文件"+ "\n\t名。默认值是这样的,COM1, 9600, 8N1。" }; #endif /* SUPPORT_SERIAL */ @@ -9430,7 +9803,18 @@ " 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]",+ "\t改变键盘映射关系。把FROM_KEY映射为TO_KEY。这里的键必须是字母, 数字,"+ "\n\t和以下特殊键: escape(转义), exclam(!), at(@), numbersign(#),"+ "\n\tdollar($), parenright[)], caret(^), ampersand(&), asterisk(*),"+ "\n\tplus(+), percent(%), minus(-), underscore(_), equal(=),"+ "\n\tparenleft[(], backspace(退格), tab(制表), bracketleft([),"+ "\n\tbraceleft({), bracketright(]), braceright(}), enter(回车),"+ "\n\tcontrol(控制), semicolon(;), colon(:), quote('), doublequote(\"),"+ "\n\tslash(/), backquote(`), tilde(~), shift(换档), backslash(\\),"+ "\n\tbar(|), comma(,), less(<), period(.), greater(>), question(?),"+ "\n\talt(交互), space(空格), capslock(大写), Fx(功能键) 和 delete(删除)。" }; @@ -9761,7 +10145,14 @@ " 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]",+ "\t自动安装 GRUB. 这条命令使用更灵活的 install 命令将 GRUB 安装到指定"+ "\n\t设备上。如果给出了映象设备, 将在该设备寻找 GRUB, 否则使用缺省的根设"+ "\n\t备。根设备可用 root 指令指定。如果你确认系统的 BIOS 应该支持 LBA 模"+ "\n\t式, 但是 GRUB 却没有工作于该模式, 则请指定 --force-lba 参数。如若你"+ "\n\t在命令行中已安装了一次 GRUB, 可是你却无法卸载 GRUB 程序所在的分区,"+ "\n\t请指定 `--stage2' 参数。" }; @@ -9960,7 +10351,16 @@ " 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]",+ "\t选择一个终端。当指定了多个终端以后, 按任意键方可继续操作。如果控制"+ "\n\t台和串口都被指定了, 那么你首先在其中按下键盘的终端将被首先选中。"+ "\n\t如果没有指定任何参数, 那么此命令将显示出当前的终端设置; 参数 --dumb"+ "\n\t用以指定一个哑终端, 否则即为 vt100 兼容型; 若使用了 --no-echo 参数,"+ "\n\t屏幕上将不会回显输入的字符; 若使用了 --no-edit 参数, the BASH-like"+ "\n\t的编辑功能将被禁用; 若使用了 --timeout 参数, 该命令将等待数秒钟(由"+ "\n\tSECS 指定); 可使用 --lines 指定最大的行数; 可使用 --silent 选项关闭"+ "\n\t消息显示。" }; #endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ @@ -10076,7 +10476,13 @@ "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]]",+ + "\t指定终端的功能。如果此终端为 vt100 兼容型的,则可指定换码顺序(即使"+ "\n\t用 \\e 代表 ESC, ^X 代表控制码); 在未给任何参数的情况下,将给出"+ "\n\t当前配置信息。" }; #endif /* SUPPORT_SERIAL */ @@ -10165,7 +10571,13 @@ " 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",+ "\t用几种不同的方式读取文件 FILE 的整个内容并比较它们,以测试文件系统"+ "\n\t代码的正确性。输出看起来会有点儿混乱,但是,如果没有报告错误,而且"+ "\n\t最后的“i=X, filepos=Y”中的 X 和 Y 是相等的话,那么代码无疑是可靠"+ "\n\t的,而且很可能正确无误地工作而不会出现别的差错。如果测试成功,下一"+ "\n\t步尽可尝试加载一个内核。" }; @@ -10289,7 +10701,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",+ "\t测试所指定 MODE 的 VBE 模式。" }; static inline unsigned long vbe_far_ptr_to_linear (unsigned long ptr)@@ -10431,7 +10845,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",+ "\t为后续的每个 kernel 命令行设置 VBE 模式 MODE_3D(例如 1024x768x32)。" }; @@ -10456,7 +10872,9 @@ tftpserver_func, BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, "tftpserver IPADDR",- "Override the TFTP server address."+ "Override the TFTP server address.",+ "tftpserver IPADDR",+ "\t指定 TFTP 服务器的 IP 地址。" }; #endif /* SUPPORT_NETBOOT */ @@ -10529,7 +10947,10 @@ "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]",+ "\t通过清除分区类型码上的“隐藏”标志,来解除对分区 PARTITION 的隐藏。"+ "\n\t默认的分区是当前的根设备。" }; @@ -10552,7 +10973,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",+ "\t强制 GRUB 承认系统中只安装了 (KBYTES) KB 的上位内存。略过任何形式的"+ "\n\t系统内存地址区域查找步骤。" }; #endif @@ -10656,7 +11080,9 @@ 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]",+ "\t侦测 VBE 的信息。如果指定了一个模式 MODE,则仅显示这个模式的信息。" }; @@ -10705,6 +11131,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 2008-07-21 14:15:08.000000000 +0800+++ grub-0.97_chinese/stage2/char_io.c 2008-08-09 00:16:56.000000000 +0800@@ -390,8 +390,17 @@ { cls (); +#ifdef SUPPORT_GRAPHICS+if (graphics_inited && ushFontReaded)+ grub_printf ("GNU GRUB 中文化版[版本 %s](%dK 低端 / %dK 上位 内存)\n",+ version_string, saved_mem_lower, saved_mem_upper);+else grub_printf ("GNU GRUB version %s (%dK lower / %dK upper memory)\n", version_string, saved_mem_lower, saved_mem_upper);+#else+ grub_printf ("GNU GRUB version %s (%dK lower / %dK upper memory)\n",+ version_string, saved_mem_lower, saved_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 2008-08-04 13:44:31.000000000 +0800+++ grub-0.97_chinese/stage2/cmdline.c 2008-08-09 00:16:56.000000000 +0800@@ -59,10 +59,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"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -