1 | 本文档来源:http://bbs.znpc.net/viewthread.php?tid=5587
|
---|
2 | 感谢zw2312914提供
|
---|
3 | 原版是中英文对照的版本,这里已经经过删改。
|
---|
4 | 需要看原版的可以从上面的贴子下载.
|
---|
5 |
|
---|
6 | 一些旧的网址已经删除,只保留目前在用的.
|
---|
7 |
|
---|
8 | 注:本文仅供参考,可能有一些更新没有在这里说明.如果有发现错误可以到论坛发贴或email联系我(grub4dos@chenall.net)
|
---|
9 |
|
---|
10 | 其它命令用法请参考
|
---|
11 | http://grub4dos.sourceforge.net/wiki/ 处的 GRUB4DOS 有关文档。
|
---|
12 |
|
---|
13 | 外部命令的用法请参考
|
---|
14 | http://chenall.net/post/tag/grub4dos/
|
---|
15 |
|
---|
16 | 项目主页
|
---|
17 | http://code.google.com/p/grub4dos-chenall/
|
---|
18 |
|
---|
19 | 下载网址:
|
---|
20 | http://code.google.com/p/grub4dos-chenall/downloads/list
|
---|
21 | http://nufans.net/grub4dos/
|
---|
22 |
|
---|
23 | 工具和外部命令:
|
---|
24 | http://code.google.com/p/grubutils/downloads/list
|
---|
25 |
|
---|
26 | 通过匿名 svn 服务器获取最新源代码的方法:
|
---|
27 |
|
---|
28 | svn co http://grub4dos-chenall.googlecode.com/svn/trunk/ grub4dos
|
---|
29 |
|
---|
30 | 通过你的 web 浏览器在线查看源代码:
|
---|
31 | http://code.google.com/p/grub4dos-chenall/source/browse/
|
---|
32 |
|
---|
33 | GRUB4DOS 邮件列表(未用):
|
---|
34 | grub4dos-devel@gna.org
|
---|
35 |
|
---|
36 | 订阅页面:
|
---|
37 | https://mail.gna.org/listinfo/grub4dos-devel/
|
---|
38 |
|
---|
39 | 论坛(官方技术支持站点):
|
---|
40 | http://bbs.znpc.net/forumdisplay.php?fid=4
|
---|
41 | http://reboot.pro/forum/66/
|
---|
42 |
|
---|
43 | ---------------------近期更新记录-----------------------------------------------
|
---|
44 | 最新更新记录请查看,ChangeLog_chenall.txt
|
---|
45 | 2011-01-03
|
---|
46 | 添加了GRUB4DOS的变量用法及相关介绍。
|
---|
47 |
|
---|
48 | 2011-01-02
|
---|
49 | 1.为了方便pause命令添加--test-key参数,显示按键扫描码.
|
---|
50 |
|
---|
51 |
|
---|
52 | 2010-12-31 更新:
|
---|
53 | 1.pause命令增强,增加了显示按键扫描码的功能。需要debug 为-1.
|
---|
54 | 例子:显示一个按键扫描码
|
---|
55 | debug -1 && pause && debug 1
|
---|
56 | 注:此功能已为被参数--test-key代替。
|
---|
57 |
|
---|
58 | 2.hiddenmenu命令增强。增加一个--chkpass参数
|
---|
59 | 功能: 在隐藏菜单的时候按Esc键要输入正确的密码才可以显示菜单。
|
---|
60 | 注意: 1.该功能启用之后,如果按了其它按键则直接启动默认菜单。
|
---|
61 | 默认的Esc按键可以自由设置。使用--chkpass=KEY
|
---|
62 | 2.菜单初始化有password命令时才需要输入密码。
|
---|
63 | 3.按键代码如果不清楚可以使用上面的功能来获取。
|
---|
64 | 例子: hiddenmenu --chkpass=0x8500 按F11键才可以显示菜单。
|
---|
65 | hiddenmenu --chkpass 按Esc键才可以显示菜单。
|
---|
66 | hiddenmenu --chkpass=0x2200 按Alt+G显示菜单。
|
---|
67 |
|
---|
68 | ------------------------------------------------------------------------------
|
---|
69 | GRUB.EXE 用法:
|
---|
70 | GRUB [--bypass] [--time-out=T] [--hot-key=K] [--config-file=FILE]
|
---|
71 | 旁路 暂停时间 热键 配置文件
|
---|
72 |
|
---|
73 | 这里的 FILE ,例如,可以是 (hd0,0)/menu.lst
|
---|
74 |
|
---|
75 | 在 CONFIG.SYS 中,其配置行类似于:
|
---|
76 |
|
---|
77 | install=c:\some\where\grub.exe --config-file=FILE
|
---|
78 |
|
---|
79 | 如果没有使用选项,GRUB.EXE简单的使用(hd0,0)/menu.lst
|
---|
80 | 来作为配置文件,只要它存在的话。(注意!我们最终将默认的配
|
---|
81 | 置文件从 (hd0,0)/boot/grub/menu.lst 变更为 (hd0,0)/menu.lst)
|
---|
82 | (更新于2006-12-23。参见更新3)
|
---|
83 |
|
---|
84 | 这里的分区(hd0,0)可以是一个Windows分区或者是一个linux分区,
|
---|
85 | 或者是被 GRUB 支持的其他任意分区。
|
---|
86 |
|
---|
87 |
|
---|
88 | 这里的FILE只接受GRUB风格的文件名。DOS风格的文件名不被调用
|
---|
89 | (很明显,我们应该使用GRUB风格的文件名,原因是比如在Linux
|
---|
90 | ext2分区中不能使用DOS风格的文件名来访问文件 )。
|
---|
91 | (参见更新2)
|
---|
92 |
|
---|
93 | 更新:FILE 可以是菜单的内容。使用分号来分隔嵌入 FILE 中的命
|
---|
94 | 令。FILE 可以被一对双引号括起来,示例:
|
---|
95 |
|
---|
96 | GRUB --config-file="root (hd0,0);chainloader +1"
|
---|
97 | 这条命令将启动(hd0,0)上的系统。
|
---|
98 |
|
---|
99 | 另一个例子:
|
---|
100 | GRUB --config-file="reboot"
|
---|
101 | 这条命令将令机器重启。
|
---|
102 |
|
---|
103 | 再例如:
|
---|
104 | GRUB --config-file="halt"
|
---|
105 | 这条命令将令机器关闭。
|
---|
106 |
|
---|
107 | 如果选项--bypass 被指定,GRUB将在暂停时间截止后从DOS退出。
|
---|
108 | 选项'--time-out=T' 指定了以秒计时的暂停值。如果指定了--bypass
|
---|
109 | 则T的默认值为5 ,而--bypass选项没有被指定时默认值为0 。
|
---|
110 |
|
---|
111 | 默认的热键值是 0x3920 (即空格键)。如果此键被按下,GRUB将正常
|
---|
112 | 启动。如果其他键被按下,GRUB 将立即终止并返回到DOS。参见下面
|
---|
113 | 的“int16 键盘扫描码”
|
---|
114 |
|
---|
115 | 每个选项最多只能被指定一次。
|
---|
116 |
|
---|
117 | 更新 2:DOS风格的文件名已经被支持(由John Cobb先生提供此补丁)。
|
---|
118 | 如果 FILE 的起始两个字符是“ #@ ”,那么 FILE 中其余的部分将被视
|
---|
119 | 为一个DOS风格的文件名。例如:
|
---|
120 |
|
---|
121 | GRUB --config-file="#@c:\menu.lst"
|
---|
122 |
|
---|
123 | DOS风格的文件只有起始的4kB被使用。此文件应当是一个未被压缩的文
|
---|
124 | 本文件。
|
---|
125 |
|
---|
126 | 注意:你也可以在SHELL或者在CONFIG.SYS的INSTALL配置行使用‘DOS
|
---|
127 | 风格文件直接访问’。但不要在DEVICE 配置行使用它。DOS文档中表述
|
---|
128 | 了DOS设备驱动不能使用'打开文件'的DOS调用。
|
---|
129 |
|
---|
130 |
|
---|
131 | 更新 3(2006-12-23): 作为默认,GRUB.EXE将按以下顺序查找它的配置文件:
|
---|
132 |
|
---|
133 | (DOS风格文件) .\menu.lst, 当前目录下的MENU.LST。
|
---|
134 | (DOS风格文件) \menu.lst, 当前驱动器根目录下的MENU.LST
|
---|
135 | (GRUB风格文件) /menu.lst, 启动设备根目录下的MENU.LST
|
---|
136 |
|
---|
137 | 默认的启动设备还是(hd0,0)。
|
---|
138 |
|
---|
139 |
|
---|
140 | --------------------------------------------------------
|
---|
141 |
|
---|
142 | 更新 1 : 版本0.2.0 同时带来一个新的东西。GRUB for NTLDR ,它能够从
|
---|
143 | Windows NT/2000/XP的启动菜单启动到GRUB。复制GRLDR到Windows
|
---|
144 | NT/2000/XP的C盘根目录,并在C:\BOOT.INI中加入这样一行:
|
---|
145 |
|
---|
146 | C:\GRLDR="Start GRUB"
|
---|
147 |
|
---|
148 | 这样就完成了安装。GRLDR应该与 BOOT.INI及NTLDR 位于相同的目录。
|
---|
149 | 注意 BOOT.INI 通常是隐藏的因而你要看见它必须取消隐藏。如果GRLDR
|
---|
150 | 在一个NTFS分区,应该将它复制到一个非NTFS分区的根目录(并且menu.lst
|
---|
151 | 文件应当同样这样做)。假如GRLDR被压缩了,比如在NTFS分区中对它启
|
---|
152 | 用了压缩的情况下,它将不能运行。
|
---|
153 |
|
---|
154 | 即使这个磁盘的驱动器号已经被Windows设备管理器改变为另外的不同
|
---|
155 | 于 C 的盘号 ,你仍然需要在 BOOT.INI 中使用盘符 C ,否则,NTLDR
|
---|
156 | 将查找不到 GRLDR 文件。
|
---|
157 |
|
---|
158 | 也就表示,如果你从一个软盘上启动NTLDR,你也需要把A:\BOOT.INI
|
---|
159 | 中的 GRLDR 的所在行这样写:
|
---|
160 |
|
---|
161 | C:\GRLDR="Start GRUB"
|
---|
162 |
|
---|
163 | 而不能象下面这样使用盘符 A :
|
---|
164 |
|
---|
165 | A:\GRLDR="Start GRUB"
|
---|
166 |
|
---|
167 | (注意在 BOOT.INI 位于软盘 A 的这个例子中,标记“C:\GRLDR”
|
---|
168 | 实际将访问 A:\GRLDR )
|
---|
169 |
|
---|
170 |
|
---|
171 | 更新 2: GRUB for linux 也一起被引入到版本0.2.0。
|
---|
172 | 你可以使用使用linux的引导程序 KEXEC,LILO,SYSLINUX 或者别的
|
---|
173 | GRUB来启动它。(GRUB4LIN 已经合并到 GRUB.EXE 中)
|
---|
174 |
|
---|
175 | 从Linux中直接启动到GRUB ,使用这样一组命令:
|
---|
176 |
|
---|
177 | kexec -l grub.exe
|
---|
178 | kexec -e
|
---|
179 |
|
---|
180 | 经由GRUB启动到GRUB,使用如下的命令:
|
---|
181 |
|
---|
182 | kernel (hd0,0)/grub.exe
|
---|
183 | boot
|
---|
184 |
|
---|
185 | 经由LILO启动到GRUB,在lilo.conf中加入这样几行:
|
---|
186 |
|
---|
187 | image=/boot/grub.exe
|
---|
188 | label=grub.exe
|
---|
189 |
|
---|
190 | 经由syslinux启动到GRUB,在syslinux.cfg中加入这样几行:
|
---|
191 |
|
---|
192 | label grub.exe
|
---|
193 | kernel grub.exe
|
---|
194 |
|
---|
195 | LOADLIN在引导GRUB.EXE时可能会遇到问题,原因是grub.exe需要一些
|
---|
196 | 未更改的原始的BIOS中断向量,但是DOS破坏了这些中断向量,而loadlin
|
---|
197 | 在将控制权交给grub.exe前并没有恢复它们。
|
---|
198 |
|
---|
199 |
|
---|
200 | 更新 3: 从版本0.4.0开始,DOS下的GRUB支持内存驱动器。示例:
|
---|
201 |
|
---|
202 | # boot into a floppy image
|
---|
203 | map --mem (hd0,0)/floppy.img (fd0)
|
---|
204 | map --hook
|
---|
205 | chainloader (fd0)+1
|
---|
206 | rootnoverify (fd0)
|
---|
207 | map --floppies=1
|
---|
208 | boot
|
---|
209 |
|
---|
210 | 由于镜像将被拷贝到一个内存区域,所以镜像本身可以是非连续的,
|
---|
211 | 甚至可以是被gzip压缩过的。
|
---|
212 |
|
---|
213 | 另一个例子:
|
---|
214 | map --mem=-2880 (hd0,0)/floppy.img (fd0)
|
---|
215 |
|
---|
216 | 这个内存驱动器(fd0)将占用至少1440 KB的内存。
|
---|
217 | 这也对那些小于1440 KB的1.44M 软盘镜像有用。
|
---|
218 |
|
---|
219 | 再例如:
|
---|
220 | map --mem --read-only (hd0,0)/hd.img (hd1)
|
---|
221 |
|
---|
222 | 这个内存驱动器成为了一个硬盘驱动器,并且只读。
|
---|
223 | 这表示你不能向这个(hd1)中写入数据。
|
---|
224 |
|
---|
225 | 你可以同时使用多个内存驱动器和多个原来的基于磁盘虚拟的仿真驱动器。
|
---|
226 |
|
---|
227 | 如果BIOS不支持中断int15/EAX=e820h,你将不能使用任何内存驱动器。
|
---|
228 |
|
---|
229 | 更新 4: 对于内存驱动器仿真,一个单一的分区镜像可以被转换为整个硬盘镜像来
|
---|
230 |
|
---|
231 |
|
---|
232 | map --mem (hd0,7)/win98.img (hd0)
|
---|
233 | map --hook
|
---|
234 | chainloader (hd0)+1
|
---|
235 | rootnoverify (hd0)
|
---|
236 | map --harddrives=1
|
---|
237 | boot
|
---|
238 |
|
---|
239 | 这里的win98.img是一个头部不含主引导记录和分区表的分区镜像。
|
---|
240 | GRUB for DOS 确实会为这个内存驱动器(hd0)建立一个MBR和分区表。
|
---|
241 |
|
---|
242 | 更新 5: 现在GRLDR可以作为一个非模拟模式的可启动光盘的启动映像文件来使
|
---|
243 | 用。Linux用户使用示例:
|
---|
244 |
|
---|
245 | mkdir iso_root
|
---|
246 | cp grldr iso_root
|
---|
247 | mkisofs -R -b grldr -no-emul-boot -boot-load-seg 0x1000 -o bootable.iso iso_root
|
---|
248 |
|
---|
249 | 另一种选择是,grldr也可以用同样的方法作为stage2_eltorito来使用。
|
---|
250 | -boot-info-table选项是被允许使用的,但你可以省略它:
|
---|
251 |
|
---|
252 | mkdir iso_root
|
---|
253 | cp grldr iso_root
|
---|
254 | mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root
|
---|
255 |
|
---|
256 | 也要注意上面的可启动iso镜像是使用-boot-load-seg 0xHHHH选项来建立的话,
|
---|
257 | 就必须令HHHH大于或者等于1000(十六进制)
|
---|
258 | 如果HHHH小于1000(十六进制),虚拟机 QEMU 会死机。这是QEMU的一个缺陷。一
|
---|
259 | 个grldr.iso镜像可以使用也可以不使用-boot-load-seg 0xHHHH选项来创建。
|
---|
260 |
|
---|
261 | menu.lst文件应该被放置在光盘的根目录。
|
---|
262 |
|
---|
263 | 更新 6: 中文专用版被建立在"chinese"子目录中。
|
---|
264 | ( 由Gandalf先生提供此补丁,2005-06-27)
|
---|
265 |
|
---|
266 | 中文专用版同时内附了scdrom 功能。
|
---|
267 | (更新:scdrom 从2006-07-20起已被删除)
|
---|
268 |
|
---|
269 | 更新 7: 增加了内存驱动器(md) 。就像(nd)代表网络驱动器 (cd) 代表光驱一样,
|
---|
270 | 新的驱动器(md)实现了将整个内存作为一个磁盘驱动器来访问。
|
---|
271 | (md)只工作在支持BIOS中断int15/EAX=E820h的系统上。
|
---|
272 |
|
---|
273 | 现在,cat命令已经有了一个十六进制转储的新选项:--hex
|
---|
274 | 以及通过--locate=STRING 在文件中找查找字符串。
|
---|
275 |
|
---|
276 | 典型示例:
|
---|
277 |
|
---|
278 | cat --hex (hd0)+1
|
---|
279 |
|
---|
280 | 这将用十六进制的表格显示 MBR 扇区。
|
---|
281 |
|
---|
282 | cat --hex (md)+2
|
---|
283 |
|
---|
284 | 这将显示你内存起始处的1 KB内容(实际,这就是实模式的IDT表),也是
|
---|
285 | 使用十六进制的转储表。
|
---|
286 |
|
---|
287 | cat --hex (md)0x800+1
|
---|
288 |
|
---|
289 | 这将显示你的扩展内存的第一个扇区。
|
---|
290 |
|
---|
291 | cat --hex (hd0,0)+1
|
---|
292 | 这将显示(hd0,0)分区的第一扇区。通常这个扇区包含操作系统的引导记录。
|
---|
293 |
|
---|
294 | 更新 8: 增加了随机存贮驱动器 (rd) 。(md) 设备访问内存是从物理地址 0
|
---|
295 | 开始,而 (rd) 可以访问起始于任何基地址的内存。随机存贮器的基
|
---|
296 | 址与长度可以通过 map 命令指定。详情请使用 "help map" 命令。
|
---|
297 | 你甚至能够为(rd)驱动器指定一个BIOS驱动器号。比如:
|
---|
298 | map --ram-drive=0xf0。默认的 (rd) 驱动器号是使用0x7F的软驱号。
|
---|
299 | 如果 (rd) 是硬盘驱动器镜像,你应该用大于或等于0x80的值来改变
|
---|
300 | 它的驱动器号。(但应防止使用0xffff,因为0xffff是预留给(md)设
|
---|
301 | 备的。)
|
---|
302 |
|
---|
303 | (rd)+1这个标志始终代表文件,它包含存储在(rd)中的所有字节。
|
---|
304 |
|
---|
305 | 更新 9: 直接启动 WinNT/2K/XP 的 NTLDR 和 Win9x/ME 的 IO.SYS, 以及
|
---|
306 | FreeDOS 的 KERNEL.SYS. 例如:
|
---|
307 |
|
---|
308 | chainloader --edx=0xPPYY (hd0,0)/ntldr
|
---|
309 | boot
|
---|
310 |
|
---|
311 | chainloader --edx=0xYY (hd0,0)/io.sys
|
---|
312 | boot
|
---|
313 |
|
---|
314 | chainloader --ebx=0xYY (hd0,0)/kernel.sys
|
---|
315 | boot
|
---|
316 |
|
---|
317 | 十六进制的YY 指定了启动驱动器号,十六进制的PP指定了 NTLDR 的
|
---|
318 | 启动分区号。如果启动驱动器是软驱,PP应该是一个十六进制的值ff,
|
---|
319 | 即十进制的255.
|
---|
320 |
|
---|
321 | 对于 Freedos 的 KERNEL.SYS , 选项--edx不能执行,请使用--ebx 。
|
---|
322 |
|
---|
323 | 当文件位于它们平常的位置时,选项 --edx (--ebx)可以省略。但某些
|
---|
324 | 情况下,这些选项是必需的。
|
---|
325 | 例如,假设被调用的ntldr文件在ext2分区(hd2,8)中,而你又希望它认
|
---|
326 | 为(hd0,7)的 windows 分区是启动分区,那么--edx就是必需的:
|
---|
327 |
|
---|
328 | chainloader --edx=0x0780 (hd2,8)/ntldr
|
---|
329 |
|
---|
330 | 对于DOS核心(即,IO.SYS和KERNEL.SYS),启动分区号是没有意义的,
|
---|
331 | 因此你只需指定恰当的启动驱动器号YY(不过指定了启动分区号也是
|
---|
332 | 无害的)。
|
---|
333 |
|
---|
334 | 上面的PPYY也可以在chainloader命令之后通过root和rootnoverify命
|
---|
335 | 令来指定。例如:
|
---|
336 |
|
---|
337 | chainloader (hd2,6)/kernel.sys
|
---|
338 | rootnoverify (hd0) <-------- YY=80
|
---|
339 | boot
|
---|
340 |
|
---|
341 | chainloader (hd0,0)/ntldr
|
---|
342 | rootnoverify (hd0,5) <-------- YY=80, PP=05
|
---|
343 | boot
|
---|
344 |
|
---|
345 | 提示:CMLDR (the ComMan LoaDeR,它被用于加载Windows的故障
|
---|
346 | 恢复控制台)可以像NTLDR一样被良好的加载。
|
---|
347 |
|
---|
348 | Bean 成功地解压和启动了WinME的IO.SYS,感谢这个出色的工作。
|
---|
349 |
|
---|
350 | 更新 10: isolinux.bin (版本 3.73) 可以被自2009-02-09 起建立的版本加载。
|
---|
351 |
|
---|
352 | chainloader (cd)/isolinux.bin
|
---|
353 |
|
---|
354 | isolinux.bin必须是存在于在真实或虚拟的光驱之中的。
|
---|
355 |
|
---|
356 | 更新 11: Grub 传统版的 stage2 文件可以通过下面的方法加载:
|
---|
357 |
|
---|
358 | chainloader --force --load-segment=0 --load-offset=0x8000 --boot-cs=0 --boot-ip=0x8200 (...)/.../stage2
|
---|
359 |
|
---|
360 | --------------------------------------------------------
|
---|
361 | 这里用一些示例来演示磁盘仿真命令的用法:
|
---|
362 |
|
---|
363 | 1. 仿真硬盘分区C:为软驱A:并从C:中启动win98:
|
---|
364 |
|
---|
365 | map --read-only (hd0,0)+1 (fd0)
|
---|
366 | chainloader (hd0,0)+1
|
---|
367 | rootnoverify (hd0)
|
---|
368 | boot
|
---|
369 |
|
---|
370 | 在上面的示例中,(hd0,0)是一个装有win98的C:盘 。当win98启动完成后,你会发
|
---|
371 | 现A:中包含了C:的所有文件,而且如果你删除A:中的文件,C:上的相应文件也会消
|
---|
372 | 失。
|
---|
373 |
|
---|
374 | 在map命令行中,(hdm,n)+1式的写法被解释成代表整个(hdm,n)分区,而不仅仅是
|
---|
375 | 此分区的第一扇区。
|
---|
376 |
|
---|
377 | 2. 将硬盘分区C:仿真为软驱A:并从A:中启动win98:
|
---|
378 |
|
---|
379 | map --read-only (hd0,0)+1 (fd0)
|
---|
380 | map --hook
|
---|
381 | chainloader (fd0)+1
|
---|
382 | rootnoverify (fd0)
|
---|
383 | map --floppies=1
|
---|
384 | boot
|
---|
385 |
|
---|
386 | 在“map --hook”命令之后,仿真立即生效,即使是在GRUB的命令行模式中。
|
---|
387 |
|
---|
388 | Note that the (fd0) in "chainloader (fd0)+1" is the emulated virtual
|
---|
389 | floppy A:, not the real floppy diskette(because map is hooked now).
|
---|
390 | 注意“chainloader (fd0)+1” 中的(fd0)是仿真后的虚拟软驱 A:,而不是真
|
---|
391 | 实的软盘(因为映射现在已经被挂载了)。
|
---|
392 |
|
---|
393 |
|
---|
394 | 3. 仿真镜像文件为软驱A:并从C:盘中启动win98:
|
---|
395 |
|
---|
396 | map --read-only (hd0,0)/floppy.img (fd0)
|
---|
397 | chainloader (hd0,0)+1
|
---|
398 | rootnoverify (hd0)
|
---|
399 | map --floppies=1
|
---|
400 | map --harddrives=1
|
---|
401 | boot
|
---|
402 |
|
---|
403 | 4. 仿真硬盘分区为第一硬盘并从中启动DOS:
|
---|
404 |
|
---|
405 | map --read-only (hd2,6)+1 (hd0)
|
---|
406 | map --hook
|
---|
407 | chainloader (hd0,0)+1
|
---|
408 | rootnoverify (hd0)
|
---|
409 | map --harddrives=1
|
---|
410 | boot
|
---|
411 |
|
---|
412 | 在这个示例中,(hd2,6)+1代表BIOS序号为3的(hd2)硬盘中的,扩展的DOS逻辑分区。
|
---|
413 |
|
---|
414 | 如果一个DOS分区被仿真为一个硬盘,GRUB for DOS将首先定位分区表,通常,
|
---|
415 | 是在DOS分区的开头63个扇区中。如果那里没有分区表,GRUB for DOS将拒绝仿真。
|
---|
416 |
|
---|
417 | 5. 仿真一个镜像文件为第一硬盘然后从中启动DOS:
|
---|
418 |
|
---|
419 | map --read-only (hd0,0)/harddisk.img (hd0)
|
---|
420 | chainloader --load-length=512 (hd0,0)/harddisk.img
|
---|
421 | rootnoverify (hd0)
|
---|
422 | map --harddrives=1
|
---|
423 | boot
|
---|
424 |
|
---|
425 | 如果一个镜像文件被仿真为硬盘,此镜像文件必须包含MBR。也就是说,
|
---|
426 | HARDDISK.IMG的第一扇区必须包含被仿真的虚拟硬盘的分区表。
|
---|
427 |
|
---|
428 | 注意: BIOS数据区中的软盘和硬盘的总数在映射期间没有被改变。当主板上没有配置真
|
---|
429 | 实的软驱时,你通常应该专门使用诸如‘map --floppioes=’以及
|
---|
430 | map --harddrives=’来设置它们。如果不这样做,DOS可能会启动失败。
|
---|
431 |
|
---|
432 | ‘map --status’可以报告出一些有价值的东西。同时要注意‘map --floppies=’
|
---|
433 | 和‘map --harddrives=’需要在没有执行映射前单独使用。
|
---|
434 |
|
---|
435 | 版本0.4.2引入了一个新参数,memdisk_raw,用以模拟和内存驱动器类似的原生模式。
|
---|
436 | 如果BIOS不支持中断int15/87h,或者int18/87h的支持有缺陷,你应该在任何内
|
---|
437 | 存盘被使用前设置这个变量。这里是一个示例:
|
---|
438 |
|
---|
439 | map --memdisk-raw=1
|
---|
440 | map --mem (hd0,0)/floppy.img (fd0)
|
---|
441 | map --hook
|
---|
442 | chainloader (fd0)+1
|
---|
443 | rootnoverify (fd0)
|
---|
444 | boot
|
---|
445 |
|
---|
446 | 如果你碰到内存驱动器故障而又没有使用map --memdisk-raw=1时,你应当用
|
---|
447 | ‘map --memdisk-raw=1’来尝试一次。
|
---|
448 |
|
---|
449 | 你一执行‘map --memdisk-raw=0’之后,就应该执行一次‘map --unhook’
|
---|
450 | (如果需要的话在这之后再执行‘map --hook’)。
|
---|
451 |
|
---|
452 | 更新:memdisk_raw 现在默认值为1 。如果你希望使用中断int15/87h来访问内存
|
---|
453 | 驱动器,你应当令‘map --memdisk-raw=0 ’。
|
---|
454 |
|
---|
455 | --------------------------------------------------------
|
---|
456 |
|
---|
457 | 任意大小的软盘或硬盘可以被 GRUB for DOS 0.2.0 版仿真。
|
---|
458 | 镜像文件必须是连续的,否则GRUB for DOS 将拒绝执行。
|
---|
459 | ‘blocklist’命令可以列举一个文件的碎片或者分块。
|
---|
460 | 在GRUB提示符下输入“help map”可以获得简要的命令说明。
|
---|
461 |
|
---|
462 | 这样的形式
|
---|
463 | map ... (fd?)
|
---|
464 | 是一个软盘仿真,而下面的形式
|
---|
465 | map ... (hd?)
|
---|
466 | 是一个硬盘仿真。
|
---|
467 |
|
---|
468 | 使用硬盘仿真时,基于安全因素最好不要去启动Windows 。
|
---|
469 | Windows甚至可能会破坏掉所有的数据和你硬盘上的所有资料!!!!!!!!
|
---|
470 |
|
---|
471 | 关于--mem的更新 :当使用--mem时,甚至是在进入Windows的时候,它看
|
---|
472 | 来都相当安全。Win98可以正常运行内存驱动器。
|
---|
473 | Windows NT/2000/XP不能识别仿真的驱动器,不管是否使用了--mem选项。
|
---|
474 |
|
---|
475 | ******************************************************************************
|
---|
476 | *** grldr可启动的软盘或硬盘分区的说明 ***
|
---|
477 | ******************************************************************************
|
---|
478 | 1. Ext2 引导扇区/引导记录的布局 (用于载入grldr)
|
---|
479 |
|
---|
480 | ------------------------------------------------------------------------------
|
---|
481 | 一个EXT2/EXT3的卷可以是GRUB可启动的。复制grldr和可选的menu.lst文件到这个EXT2/EXT3
|
---|
482 | 卷的根目录,并按照grldr的第五扇区建立它的引导扇区(一些需要更改的字段在下面的表
|
---|
483 | 中做了详细注释)。那么,这个EXT2/EXT3的卷就是GRUB可启动的。
|
---|
484 |
|
---|
485 | 更新: bootlace.com是一个dos/linux下的工具,它可以把GRLDR的引导记录安装到一个
|
---|
486 | EXT2/EXT3卷的第一扇区。
|
---|
487 |
|
---|
488 | 偏移 长度 说明
|
---|
489 | ====== ====== ==============================================================
|
---|
490 | 00h 2 Machine code for short jump over the data.
|
---|
491 | 近转移指令的机器码
|
---|
492 |
|
---|
493 | 02h 1 LBA indicator. Valid values are 0x02 for CHS mode, or 0x42 for
|
---|
494 | LBA mode.
|
---|
495 | LBA指示码。CHS模式时,有效值是0x02;LBA模式时有效值为0x42。
|
---|
496 |
|
---|
497 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
498 | 0x42.
|
---|
499 | 如果BIOS的int13支持LBA,此字节可以安全地设置为0x42。
|
---|
500 |
|
---|
501 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
502 | format program should set this byte to 0x42. It seems that
|
---|
503 | (generally) all USB BIOSes have LBA support.
|
---|
504 | 某些 USB 设备的BIOS在使用CHS寻址模式时可能有缺陷,所以格式化程
|
---|
505 | 序应当设置这个字节为0X42 。似乎所有(多数)的USB BIOS都能支持LBA 。
|
---|
506 |
|
---|
507 | If the format program does not know whether the BIOS has LBA
|
---|
508 | support, it may operate this way:
|
---|
509 | 如果格式化程序不知道BIOS是否具有LBA支持,它可以采用以下方法:
|
---|
510 |
|
---|
511 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
512 | CHS addressing ability(especially when it is greater than
|
---|
513 | 1024*256*63), the caller should set this byte to 0x42,
|
---|
514 | otherwise, set to 0x02.
|
---|
515 | 如果(分区的起始地址加上分区的总扇区)超过了CHS的寻址能力。
|
---|
516 | (特别是当它大于1024*256*63时),调用程序应当设置此字节为0x42,
|
---|
517 | 否则,要设为0x02。
|
---|
518 |
|
---|
519 | Note that Windows98 uses the value 0x0e as the LBA indicator.
|
---|
520 | 注意 Windows98 使用0x0e作为LBA指示码。
|
---|
521 |
|
---|
522 | Update: this byte of LBA indicator is ignored. The boot
|
---|
523 | record can probe the LBA support of BIOS.
|
---|
524 | 更新:LBA指示码这个字节已被忽略。引导记录能够探测BIOS的LBA支持。
|
---|
525 |
|
---|
526 | 03h 10 OEM name string (of OS which formatted the disk).
|
---|
527 | Update: this field is now used for error message of "I/O error"
|
---|
528 | OEM 名称字符串(对该磁盘进行格式化的操作系统的名字)。
|
---|
529 | 更新:此字段现在被用于错误提示信息“I/O error”
|
---|
530 |
|
---|
531 | 0Dh 1 Sectors per block. Valid values are 2, 4, 8, 16 and 32.
|
---|
532 | 每块扇区数。有效值是2, 4, 8, 16 和 32。
|
---|
533 |
|
---|
534 | 0Eh 2 Bytes per block. Valid values are 0x400, 0x800, 0x1000, 0x2000
|
---|
535 | and 0x4000.
|
---|
536 | 每块字节数。有效值是0x400, 0x800, 0x1000, 0x2000 和 0x4000。
|
---|
537 |
|
---|
538 | 10h 4 Pointers in pointers-per-block blocks, that is, number of
|
---|
539 | blocks covered by a double-indirect block.
|
---|
540 | 在pointers-per-block块中的指针数,即一个二级间接块包含的块数。
|
---|
541 |
|
---|
542 | Valid values are 0x10000, 0x40000, 0x100000, 0x400000 and
|
---|
543 | 0x1000000.
|
---|
544 | 有效值是0x10000, 0x40000, 0x100000, 0x400000 和 0x1000000。
|
---|
545 |
|
---|
546 | 14h 4 Pointers per block, that is, number of blocks covered by an
|
---|
547 | indirect block.
|
---|
548 | 每块指针数,即一个间接块包含的块数。
|
---|
549 |
|
---|
550 | Valid values are 0x100, 0x200, 0x400, 0x800, 0x1000.
|
---|
551 | 有效值是0x100, 0x200, 0x400, 0x800, 0x1000 。
|
---|
552 |
|
---|
553 | 18h 2 Sectors per track.
|
---|
554 | 每磁道的扇区数。
|
---|
555 |
|
---|
556 | 1Ah 2 Number of heads/sides.
|
---|
557 | 磁头数/面数
|
---|
558 |
|
---|
559 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
560 | 隐藏扇区数(它们位于引导扇区之前)
|
---|
561 |
|
---|
562 | Also referred to as the starting sector of the partition.
|
---|
563 | 也被成为是分区的起始扇区。
|
---|
564 |
|
---|
565 | For floppies, it should be 0.
|
---|
566 | 对于软盘,它应当为0 。
|
---|
567 |
|
---|
568 | 20h 4 Total number of sectors in the filesystem(or in the partition).
|
---|
569 | 文件系统中的扇区总数(或者是分区的扇区总数)。
|
---|
570 |
|
---|
571 | 24h 1 BIOS drive number of the boot device.
|
---|
572 | 启动设备的 BIOS 驱动器号码。
|
---|
573 |
|
---|
574 | Actually this byte is ignored for read. The boot code will
|
---|
575 | write DL onto this byte. The BIOS or the caller should set
|
---|
576 | drive number in DL.
|
---|
577 | 实际此字节在读入时被忽略。引导代码将把DL的值写入到此字节中。
|
---|
578 | BIOS或者调用程序应当在DL中设置磁盘号码。
|
---|
579 |
|
---|
580 | We assume all BIOSes pass correct drive number in DL.
|
---|
581 | Buggy BIOSes are not supported!!
|
---|
582 | 我们假定所有的BIOS在DL中能传递正确的磁盘号码。
|
---|
583 | 糟糕的BIOS不被支持!!
|
---|
584 |
|
---|
585 | 25h 1 Partition number of this partition on the boot drive.
|
---|
586 | 此分区在启动驱动器上的分区号
|
---|
587 |
|
---|
588 | 0, 1, 2, 3 are primary partitions.
|
---|
589 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
590 | 0, 1, 2, 3 是主分区 。4, 5, 6, ... 等等是扩展分区中的逻辑分区。
|
---|
591 |
|
---|
592 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
593 | 0xff代表整个磁盘。所以对于软盘,其分区号码应当是0xff 。
|
---|
594 |
|
---|
595 | 26h 2 inode size in bytes. (Notice! We use the formerly reserved
|
---|
596 | word here for inode size!)
|
---|
597 | 字节计数的索引节点大小。(注意!我们在此处为索引节点大小使用
|
---|
598 | 了以前被保留的一个字,即两个字节)
|
---|
599 |
|
---|
600 | 28h 4 Number of inodes per group.
|
---|
601 | 每组的i节点数
|
---|
602 |
|
---|
603 | Normally a 1.44M floppy has only one group, and the total
|
---|
604 | number of inodes is 184. So the value should be 184 or
|
---|
605 | greater.
|
---|
606 | 通常,1.44M软盘只有一个组,并且总的i节点数是184。所以此值
|
---|
607 | 应为184或者更大。
|
---|
608 |
|
---|
609 | 2Ch 4 The block number for group descriptors.
|
---|
610 | 组描述符的块号码。
|
---|
611 |
|
---|
612 | Valid values are 2 for 1024-byte blocks, and 1 otherwise.
|
---|
613 | 对于1024字节的块有效值是2 ,否则是1 。
|
---|
614 |
|
---|
615 | The value here is equal to (s_first_data_block + 1).
|
---|
616 | 这里的值等于(s_first_data_block + 1)。
|
---|
617 |
|
---|
618 | 30h 1 code for "cld"(0xFC).
|
---|
619 | 指令“cld”(即0xFC)。
|
---|
620 |
|
---|
621 | 31h 2 code for "xor ax,ax"(0x31, 0xC0).
|
---|
622 | 指令“xor ax,ax”(即0x31,0xC0)
|
---|
623 |
|
---|
624 | 33h 1 code for "nop"(0x90) or "cwd"(0x99)
|
---|
625 | 指令“nop”(即0x90)或“cwd”(即0x99)
|
---|
626 |
|
---|
627 | 34h 458 The rest of the machine code.
|
---|
628 | 机器码部分。
|
---|
629 |
|
---|
630 | 1FEh 2 Boot Signature AA55h.
|
---|
631 | 引导签名AA55h 。
|
---|
632 |
|
---|
633 |
|
---|
634 | 2. FAT12/FAT16 Boot Sector/Boot Record Layout (for loading grldr)
|
---|
635 | 2. FAT12/FAT16 引导扇区/引导记录的布局 (用于载入grldr)
|
---|
636 |
|
---|
637 | ------------------------------------------------------------------------------
|
---|
638 | A FAT12/16 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
|
---|
639 | the root dir of the FAT12/16 volume, and build the boot sector based on the
|
---|
640 | fourth sector of grldr(some fields need to be changed as detailed in the
|
---|
641 | following table). And then the FAT12/16 volume is GRUB-bootable.
|
---|
642 | 一个FAT12/16的卷是GRUB可启动的。复制grldr和可选的menu.lst文件到这个FAT12/16 卷
|
---|
643 | 的根目录,并按照grldr的第四扇区建立它的引导扇区(一些需要更改的字段在下面的表中
|
---|
644 | 做了详细注释)。然后这个FAT12/16的卷就是GRUB可启动的。
|
---|
645 |
|
---|
646 | Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
|
---|
647 | record onto the boot sector of an FAT12/16 volume.
|
---|
648 | 更新: bootlace.com 是一个dos/linux下的工具,而它能把GRLDR的引导记录安装到一个
|
---|
649 | FAT12/16卷的引导扇区。
|
---|
650 |
|
---|
651 | Offset Length Description
|
---|
652 | 偏移 长度 说明
|
---|
653 |
|
---|
654 | ====== ====== ==============================================================
|
---|
655 | 00h 2 Machine code for short jump over the data.
|
---|
656 | 近转移指令的机器码
|
---|
657 |
|
---|
658 | 02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
|
---|
659 | LBA mode.
|
---|
660 | LBA指示码。CHS模式时,有效值为0x90;LBA模式时,有效值为0x0e 。
|
---|
661 |
|
---|
662 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
663 | 0x0e.
|
---|
664 | 如果BIOS int13支持LBA,此字节可以安全地设置为0x0e 。
|
---|
665 |
|
---|
666 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
667 | format program should set this byte to 0x0e. It seems that
|
---|
668 | (generally) all USB BIOSes have LBA support.
|
---|
669 | 某些USB设备的BIOS在使用CHS寻址模式时可能有缺陷,所以格式化程序
|
---|
670 | 应当设置这个字节为0X0e 。似乎所有的(多数)USB BIOS都能支持 LBA 。
|
---|
671 |
|
---|
672 | If the format program does not know whether the BIOS has LBA
|
---|
673 | support, it may operate this way:
|
---|
674 | 如果格式化程序不知道BIOS是否具有LBA支持,它可以采用以下方法:
|
---|
675 |
|
---|
676 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
677 | CHS addressing ability(especially when it is greater than
|
---|
678 | 1024*256*63), the caller should set this byte to 0x0e,
|
---|
679 | otherwise, set to 0x90.
|
---|
680 | 如果(分区的起始地址加上分区的总扇区)超过了CHS 的寻址能力。
|
---|
681 | (特别是当它大于1024*256*63),调用程序应当设置此字节为0x0e,
|
---|
682 | 否则,要设为0x90。
|
---|
683 |
|
---|
684 | Update: this byte of LBA indicator is ignored. The boot
|
---|
685 | record can probe the LBA support of BIOS.
|
---|
686 | 更新:LBA 指示码这个字节已被忽略。引导记录能探测BIOS的LBA支持。
|
---|
687 |
|
---|
688 | Update(2006-07-31): Though GRLDR won't use this LBA-indicator
|
---|
689 | byte, Windows 98 uses it. Usually this byte should be 0x90 for
|
---|
690 | CHS mode(especially for floppies). If this byte is not set
|
---|
691 | properly, Windows 98 will not recognize the floppy or
|
---|
692 | partition. This problem was reported by neiljoy. Many thanks!
|
---|
693 | 更新 (2006-07-31):尽管GRLDR不再使用LBA指示码这个字节,
|
---|
694 | 但Windows 98会使用它。通常这个字节在 CHS 模式中应当设置为0x90
|
---|
695 | (软盘尤其如此)。如果此字节未被正确设置,Windows 98将不能识别
|
---|
696 | 软盘或分区。这一问题由neiljoy先生报告。非常感谢!
|
---|
697 |
|
---|
698 | 03h 8 OEM name string (of OS which formatted the disk).
|
---|
699 | OEM名称字符串 (对该磁盘进行格式化的操作系统的名称)
|
---|
700 |
|
---|
701 | 0Bh 2 Bytes per sector. Must be 512.
|
---|
702 | 每扇区字节数。必须为512 。
|
---|
703 |
|
---|
704 | 0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
|
---|
705 | and 128. But a cluster size larger than 32K should not occur.
|
---|
706 | 每簇的扇区数。有效值是1, 2, 4, 8, 16, 32, 64和128 。但是簇大小
|
---|
707 | 大于32K的情况不应发生。
|
---|
708 |
|
---|
709 | 0Eh 2 Reserved sectors(number of sectors before the first FAT,
|
---|
710 | including the boot sector), usually 1.
|
---|
711 | 保留的扇区数(第一文件分配表之前的扇区数,包括引导扇区),通常是1。
|
---|
712 |
|
---|
713 | 10h 1 Number of FATs(nearly always 2).
|
---|
714 | 文件分配表数(几乎总是2)。
|
---|
715 |
|
---|
716 | 11h 2 Maximum number of root directory entries.
|
---|
717 | 根目录项的最大个数。
|
---|
718 |
|
---|
719 | 13h 2 Total number of sectors (for small disks only, if the disk is
|
---|
720 | too big this is set to 0 and offset 20h is used instead).
|
---|
721 | 扇区总数(仅用于小磁盘,如果磁盘太大此处被设置为0,而偏移 20h 处
|
---|
722 | 则替代它使用)。
|
---|
723 |
|
---|
724 | 15h 1 Media descriptor byte, pretty meaningless now (see below).
|
---|
725 | 媒体描述符字节,现在该此节已经没有太大意义了(参见后面)。
|
---|
726 |
|
---|
727 | 16h 2 Sectors per FAT.
|
---|
728 | 每个文件分配表的扇区数。
|
---|
729 |
|
---|
730 | 18h 2 Sectors per track.
|
---|
731 | 每个磁道的扇区数
|
---|
732 |
|
---|
733 | 1Ah 2 Total number of heads/sides.
|
---|
734 | 磁头或面的总数。
|
---|
735 |
|
---|
736 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
737 | 隐藏扇区数(位于引导扇区之前)。
|
---|
738 |
|
---|
739 | Also referred to as the starting sector of the partition.
|
---|
740 | 也被称为是分区的开始扇区。
|
---|
741 |
|
---|
742 | For floppies, it should be 0.
|
---|
743 | 对于软盘,它应当为0 。
|
---|
744 |
|
---|
745 | 20h 4 Total number of sectors for large disks.
|
---|
746 | 大磁盘的扇区总数。
|
---|
747 |
|
---|
748 | 24h 1 BIOS drive number of the boot device.
|
---|
749 | 引导设备的BIOS磁盘号。
|
---|
750 |
|
---|
751 | Actually this byte is ignored for read. The boot code will
|
---|
752 | write DL onto this byte. The BIOS or the caller should set
|
---|
753 | drive number in DL.
|
---|
754 | 实际此字节在读入时被忽略。引导代码将把DL中的值写入此字节。
|
---|
755 | BIOS或者调用程序应当在DL中设置磁盘号码。
|
---|
756 |
|
---|
757 | We assume all BIOSes pass correct drive number in DL.
|
---|
758 | Buggy BIOSes are not supported!!
|
---|
759 | 我们假定所有的BIOS在DL中能传递正确的磁盘号码。
|
---|
760 | 糟糕的BIOS不被支持!!
|
---|
761 |
|
---|
762 | 25h 1 Partition number of this filesystem in the boot drive.
|
---|
763 | 启动驱动器上此文件系统的分区号码。
|
---|
764 |
|
---|
765 | This byte is ignored for read. The boot code will write
|
---|
766 | partition number onto this byte. See offset 41h below.
|
---|
767 | 此字节在读入时被忽略。引导代码将分区号码写到此字节。
|
---|
768 | 见下述偏移41h 。
|
---|
769 |
|
---|
770 | 26h 1 Signature (must be 28h or 29h to be recognised by NT).
|
---|
771 | 签名(必须是28h或者29h以便能被 NT 识别)
|
---|
772 |
|
---|
773 | 27h 4 Volume serial number.
|
---|
774 | 卷的序列号。
|
---|
775 |
|
---|
776 | 2Bh 11 Volume label.
|
---|
777 | 卷标签。
|
---|
778 |
|
---|
779 | 36h 8 File system ID. "FAT12 ", "FAT16 " or "FAT ".
|
---|
780 | 文件系统ID。“FAT12”, “FAT16”或 “FAT”。
|
---|
781 |
|
---|
782 | 3Eh 1 code for "cli".
|
---|
783 | 指令“cli”。
|
---|
784 |
|
---|
785 | 3Fh 1 code for "cld".
|
---|
786 | 指令“cld”。
|
---|
787 |
|
---|
788 | 40h 1 code for "mov dh, imm8".
|
---|
789 | 指令“mov dh, imm8”。
|
---|
790 |
|
---|
791 | 41h 1 Partition number of this partition on the boot drive.
|
---|
792 | 此分区在启动驱动器的分区号。
|
---|
793 |
|
---|
794 | 0, 1, 2, 3 are primary partitions.
|
---|
795 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
796 | 0, 1, 2, 3 是主分区。4, 5, 6, ... 等等是扩展分区中的逻辑分区。
|
---|
797 |
|
---|
798 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
799 | 0xff代表整个磁盘。所以对于软盘,其分区号码应当是0xff 。
|
---|
800 |
|
---|
801 | 42h 442 The rest of the machine code.
|
---|
802 | 机器码部分。
|
---|
803 |
|
---|
804 | 1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
|
---|
805 | 引导签名AA550000h 。(Win9x 使用4字节作为魔数值。)
|
---|
806 |
|
---|
807 |
|
---|
808 | 3. FAT32 Boot Sector/Boot Record Layout (for loading grldr)
|
---|
809 | 3. FAT32 引导扇区/引导记录的布局 (用于载入grldr)
|
---|
810 |
|
---|
811 | ------------------------------------------------------------------------------
|
---|
812 | A FAT32 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
|
---|
813 | the root dir of the FAT32 volume, and build the boot sector based on the
|
---|
814 | third sector of grldr(some fields need to be changed as detailed in the
|
---|
815 | following table). And then the FAT32 volume is GRUB-bootable.
|
---|
816 | 一个FAT32的卷是GRUB可启动的。复制grldr和可选的menu.lst文件到这个FAT32卷的根
|
---|
817 | 目录,并按照grldr的第三扇区建立它的引导扇区(一些需要更改的字段在下面的表中
|
---|
818 | 做了详细注释)。然后这个FAT32的卷就是GRUB可启动的。
|
---|
819 |
|
---|
820 | Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
|
---|
821 | record onto the boot sector of an FAT32 volume.
|
---|
822 | 更新: bootlace.com 是一个dos及linux下的工具而它能把 GRLDR 的引导记录安装
|
---|
823 | 到一个FAT32卷的引导扇区。
|
---|
824 |
|
---|
825 |
|
---|
826 | Offset Length Description
|
---|
827 | 偏移 长度 说明
|
---|
828 |
|
---|
829 | ====== ====== ==============================================================
|
---|
830 | 00h 2 Machine code for short jump over the data.
|
---|
831 | 近转移指令的机器码。
|
---|
832 |
|
---|
833 | 02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
|
---|
834 | LBA mode.
|
---|
835 | LBA指示码。CHS模式时,有效值为0x90,而LBA模式时,有效值为0x0e。
|
---|
836 |
|
---|
837 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
838 | 0x0e.
|
---|
839 | 如果BIOS的int13支持LBA,此字节可以安全地设置为0x0e。
|
---|
840 |
|
---|
841 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
842 | format program should set this byte to 0x0e. It seems that
|
---|
843 | (generally) all USB BIOSes have LBA support.
|
---|
844 | 某些USB设备的BIOS在使用CHS寻址模式时可能有缺陷,所以格式化程
|
---|
845 | 序应当设置这个字节为0X0e。似乎所有(多数)的USB BIOS都能支持LBA 。
|
---|
846 |
|
---|
847 | If the format program does not know whether the BIOS has LBA
|
---|
848 | support, it may operate this way:
|
---|
849 | 如果格式化程序不知道BIOS是否具有LBA支持,它可以采用以下方法:
|
---|
850 |
|
---|
851 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
852 | CHS addressing ability(especially when it is greater than
|
---|
853 | 1024*256*63), the caller should set this byte to 0x0e,
|
---|
854 | otherwise, set to 0x90.
|
---|
855 | 如果(分区的起始地址加上分区的总扇区)超过了CHS 的寻址能力。
|
---|
856 | (特别是当它大于1024*256*63),调用程序应当设置此字节为0x0e,
|
---|
857 | 否则,要设为0x90。
|
---|
858 |
|
---|
859 | Update: this byte of LBA indicator is ignored. The boot
|
---|
860 | record can probe the LBA support of BIOS.
|
---|
861 | 更新: LBA 指示码这个字节已被忽略。引导记录能探测BIO的LBA支持。
|
---|
862 |
|
---|
863 | Update(2006-07-31): Though GRLDR won't use this LBA-indicator
|
---|
864 | byte, Windows 98 uses it. Usually this byte should be 0x90 for
|
---|
865 | CHS mode(especially for floppies). If this byte is not set
|
---|
866 | properly, Windows 98 will not recognize the floppy or
|
---|
867 | partition. This problem was reported by neiljoy. Many thanks!
|
---|
868 | 更新 (2006-07-31):尽管GRLDR不再使用 LBA 指示码这个字节,
|
---|
869 | 但Windows 98会使用它。通常这个字节在 CHS 模式中应当设置为0x90
|
---|
870 | (软盘尤其如此)。如果此字节未被正确设置,Windows 98 将不能识别
|
---|
871 | 软盘或分区。这一问题由neiljoy先生报告。非常感谢!
|
---|
872 |
|
---|
873 | 03h 8 OEM name string (of OS which formatted the disk).
|
---|
874 | OEM名称字符串 (对该磁盘进行格式化的操作系统的名称)
|
---|
875 |
|
---|
876 | 0Bh 2 Bytes per sector. Must be 512.
|
---|
877 | 每扇区字节数。必须为512 。
|
---|
878 |
|
---|
879 | 0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
|
---|
880 | and 128. But a cluster size larger than 32K should not occur.
|
---|
881 | 每簇的扇区数。有效值是1, 2, 4, 8, 16, 32, 64 和 128 。
|
---|
882 | 但是簇大小大于32K的情况不应发生。
|
---|
883 |
|
---|
884 | 0Eh 2 Reserved sectors(number of sectors before the first FAT,
|
---|
885 | including the boot sector), usually 1.
|
---|
886 | 保留的扇区数(第一文件分配表之前的扇区数,包括引导扇区),
|
---|
887 | 通常是1 。
|
---|
888 |
|
---|
889 | 10h 1 Number of FATs(nearly always 2).
|
---|
890 | 文件分配表数(几乎总是2)。
|
---|
891 |
|
---|
892 | 11h 2 (Maximum number of root directory entries)Must be 0.
|
---|
893 | (根目录项的最大个数)必须为0 。
|
---|
894 |
|
---|
895 | 13h 2 (Total number of sectors for small disks only)Must be 0.
|
---|
896 | (仅用于小磁盘的扇区总数)必须为0 。
|
---|
897 |
|
---|
898 | 15h 1 Media descriptor byte, pretty meaningless now (see below).
|
---|
899 | 媒体描述符字节,现在该此节已经没有太大意义了(参见后面)。
|
---|
900 |
|
---|
901 | 16h 2 (Sectors per FAT)Must be 0.
|
---|
902 | (每个文件分配表的扇区数)必须为0 。
|
---|
903 |
|
---|
904 | 18h 2 Sectors per track.
|
---|
905 | 每个磁道的扇区数
|
---|
906 |
|
---|
907 | 1Ah 2 Total number of heads/sides.
|
---|
908 | 磁头或面的总数。
|
---|
909 |
|
---|
910 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
911 | 隐藏扇区数(它们位于引导扇区之前)。
|
---|
912 |
|
---|
913 | Also referred to as the starting sector of the partition.
|
---|
914 | 也被称作是分区的起始扇区。
|
---|
915 |
|
---|
916 | For floppies, it should be 0.
|
---|
917 | 对于软盘,它应当为0 。
|
---|
918 |
|
---|
919 | 20h 4 Total number of sectors for large disks.
|
---|
920 | 大磁盘的扇区总数。
|
---|
921 |
|
---|
922 | 24h 4 FAT32 sectors per FAT.
|
---|
923 | 每个文件分配表的 FAT32 扇区数。
|
---|
924 |
|
---|
925 | 28h 2 If bit 7 is clear then all FATs are updated, otherwise bits
|
---|
926 | 0-3 give the current active FAT, all other bits are reserved.
|
---|
927 | 如果第7位被清零,所有文件分配表将被更新,否则0-3位给出当前活
|
---|
928 | 动的文件分配表,所有其它位被保留。
|
---|
929 |
|
---|
930 | 2Ah 2 High byte is major revision number, low byte is minor revision
|
---|
931 | number, currently both are 0.
|
---|
932 | 高字节是主修订号码,低字节是小修订号码,现在都是0 。
|
---|
933 |
|
---|
934 | 2Ch 4 Root directory starting cluster.
|
---|
935 | 根目录起始簇。
|
---|
936 |
|
---|
937 | 30h 2 File system information sector.
|
---|
938 | 文件系统信息扇区。
|
---|
939 |
|
---|
940 | 32h 2 If non-zero this gives the sector which holds a copy of the
|
---|
941 | boot record, usually 6.
|
---|
942 | 如果非零它给出具有引导记录的备份扇区,通常是6。
|
---|
943 |
|
---|
944 | 34h 12 Reserved, set to 0.
|
---|
945 | 保留,设为0 。
|
---|
946 |
|
---|
947 | 40h 1 BIOS drive number of the boot device.
|
---|
948 | 启动设备的 BIOS 驱动器号码。
|
---|
949 |
|
---|
950 | 80h is first HDD, 00h is first FDD.
|
---|
951 | 第一硬盘是80h,第一软盘是00h。
|
---|
952 |
|
---|
953 | Actually this byte is ignored for read. The boot code will
|
---|
954 | write DL onto this byte. The BIOS or the caller should set
|
---|
955 | drive number in DL.
|
---|
956 | 实际此字节在读入时被忽略。引导代码将把DL中的值写入此字节。
|
---|
957 | BIOS或者调用程序应当在DL中设置磁盘号码。
|
---|
958 |
|
---|
959 | We assume all BIOSes pass correct drive number in DL.
|
---|
960 | Buggy BIOSes are not supported!!
|
---|
961 | 我们假定所有的 BIOS 在DL中能传递正确的磁盘号码。
|
---|
962 | 糟糕的BIOS不被支持!!
|
---|
963 |
|
---|
964 | 41h 1 Partition number of this filesystem in the boot drive.
|
---|
965 | 启动驱动器上此文件系统的分区号码。
|
---|
966 |
|
---|
967 | This byte is ignored for read. The boot code will write
|
---|
968 | partition number onto this byte. See offset 5Dh below.
|
---|
969 | 此字节在读入时被忽略。引导代码将分区号码写到此字节。
|
---|
970 | 见下述的偏移5Dh 。
|
---|
971 |
|
---|
972 | 42h 1 Signature (must be 28h or 29h to be recognised by NT).
|
---|
973 | 签名(必须是 28h 或者 29h 以便能被 NT 识别)
|
---|
974 |
|
---|
975 | 43h 4 Volume serial number.
|
---|
976 | 卷的序列号。
|
---|
977 |
|
---|
978 | 47h 11 Volume label.
|
---|
979 | 卷标签。
|
---|
980 |
|
---|
981 | 52h 8 File system ID. "FAT32 ".
|
---|
982 | 文件系统标识。“FAT32 ”。
|
---|
983 |
|
---|
984 | 5Ah 1 opcode for "cli".
|
---|
985 | 指令 “cli”。
|
---|
986 |
|
---|
987 | 5Bh 1 opcode for "cld".
|
---|
988 | 指令 “cld” 。
|
---|
989 |
|
---|
990 | 5Ch 1 opcode for "mov dh, imm8".
|
---|
991 | 指令 “mov dh, imm8”。
|
---|
992 |
|
---|
993 | 5Dh 1 Partition number of this partition on the boot drive.
|
---|
994 | 此分区在启动驱动器上的分区号。
|
---|
995 |
|
---|
996 | 0, 1, 2, 3 are primary partitions.
|
---|
997 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
998 | 0, 1, 2, 3 是主分区。4, 5, 6, ...等等是扩展分区中的逻辑分区。
|
---|
999 |
|
---|
1000 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
1001 | 0xff 代表整个磁盘。所以对于软盘,其分区号码应当是0xff 。
|
---|
1002 |
|
---|
1003 | 5Eh 414 The rest of the machine code.
|
---|
1004 | 机器码部分。
|
---|
1005 |
|
---|
1006 | 1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
|
---|
1007 | 引导签名AA550000h 。(Win9x 使用4字节作为魔数值。)
|
---|
1008 |
|
---|
1009 |
|
---|
1010 | 4. NTFS Boot Sector/Boot Record Layout (for loading grldr)
|
---|
1011 | NTFS 引导扇区/引导记录的布局 (用于载入grldr)
|
---|
1012 |
|
---|
1013 | ------------------------------------------------------------------------------
|
---|
1014 | An NTFS volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
|
---|
1015 | the root dir of the NTFS volume, and build the boot sector based on the
|
---|
1016 | 6th-9th sectors of grldr(some fields need to be changed as detailed in the
|
---|
1017 | following table). And then the NTFS volume is GRUB-bootable.
|
---|
1018 | 一个FAT32的卷是GRUB可启动的。复制grldr和可选的menu.lst文件到这个FAT32卷的根
|
---|
1019 | 目录,并按照grldr的第6至9扇区建立它的引导扇区(一些需要更改的字段在下面的表
|
---|
1020 | 中做了详细注释)。然后这个FAT32的卷就是GRUB可启动的。
|
---|
1021 |
|
---|
1022 | Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
|
---|
1023 | record onto the leading 4 sectors of an NTFS volume.
|
---|
1024 | 更新: bootlace.com是一个在dos/linux下的工具,而它能把GRLDR的引导记录安装到
|
---|
1025 | 一个NTFS卷的开头4个扇区。
|
---|
1026 |
|
---|
1027 | Offset Length Description
|
---|
1028 | 偏移 长度 说明
|
---|
1029 |
|
---|
1030 | ====== ====== ==============================================================
|
---|
1031 | 00h 2 Machine code for short jump over the data.
|
---|
1032 | 近转移指令的机器码。
|
---|
1033 |
|
---|
1034 | 02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
|
---|
1035 | LBA mode.
|
---|
1036 | LBA指示码。CHS模式时,有效值为0x90;LAB模式时,有效值为0x0e。
|
---|
1037 |
|
---|
1038 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
1039 | 0x0e.
|
---|
1040 | 如果BIOS的int13支持LBA,此字节可以安全地设置为0x0e 。
|
---|
1041 |
|
---|
1042 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
1043 | format program should set this byte to 0x0e. It seems that
|
---|
1044 | (generally) all USB BIOSes have LBA support.
|
---|
1045 | 某些USB设备的BIOS在使用CHS寻址模式时可能有缺陷,所以格式化程
|
---|
1046 | 序应当设置这个字节为0X0e 。似乎所有(多数)的USB BIOS 都能支持LBA。
|
---|
1047 |
|
---|
1048 | If the format program does not know whether the BIOS has LBA
|
---|
1049 | support, it may operate this way:
|
---|
1050 | 如果格式化程序不知道BIOS是否具有LBA支持,它可以采用以下方法:
|
---|
1051 |
|
---|
1052 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
1053 | CHS addressing ability(especially when it is greater than
|
---|
1054 | 1024*256*63), the caller should set this byte to 0x0e,
|
---|
1055 | otherwise, set to 0x90.
|
---|
1056 | 如果(分区的起始地址加上分区的总扇区)超过了CHS 的寻址能力。
|
---|
1057 | (特别是当它大于1024*256*63),调用程序应当设置此字节为0x0e,
|
---|
1058 | 否则,要设为0x90。
|
---|
1059 |
|
---|
1060 | Update: this byte of LBA indicator is ignored. The boot
|
---|
1061 | record can probe the LBA support of BIOS.
|
---|
1062 | 更新: LBA 指示码这个字节已被忽略。引导记录能探测BIOS的LBA支持。
|
---|
1063 |
|
---|
1064 | Update(2006-07-31): Though GRLDR won't use this LBA-indicator
|
---|
1065 | byte, Windows 98 uses it. Usually this byte should be 0x90 for
|
---|
1066 | CHS mode(especially for floppies). If this byte is not set
|
---|
1067 | properly, Windows 98 will not recognize the floppy or
|
---|
1068 | partition. This problem was reported by neiljoy. Many thanks!
|
---|
1069 | 更新 (2006-07-31):尽管GRLDR不再使用 LBA 指示码这个字节,但
|
---|
1070 | Windows 98会使用它。通常这个字节在 CHS 模式中应当设置为0x90
|
---|
1071 | (软盘尤其如此)。如果此字节未被正确设置,Windows 98 将不能识别
|
---|
1072 | 软盘或分区。这一问题由neiljoy先生报告。非常感谢!
|
---|
1073 |
|
---|
1074 | 03h 8 OEM name string (of OS which formatted the disk).
|
---|
1075 | OEM名称字符串 (对该磁盘进行格式化的操作系统的名称)
|
---|
1076 |
|
---|
1077 | 0Bh 2 Bytes per sector. Must be 512.
|
---|
1078 | 每扇区字节数。必须为512 。
|
---|
1079 |
|
---|
1080 | 0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
|
---|
1081 | and 128. But a cluster size larger than 32K should not occur.
|
---|
1082 | 每簇的扇区数。有效值是1, 2, 4, 8, 16, 32, 64 和 128 。
|
---|
1083 | 但是簇大小大于32K的情况不应发生。
|
---|
1084 |
|
---|
1085 | 0Eh 2 (Reserved sectors)Unused.
|
---|
1086 | (保留的扇区数)未被使用。
|
---|
1087 |
|
---|
1088 | 10h 1 (Number of FATs)Must be 0.
|
---|
1089 | (文件分配表数)必须为 0 。
|
---|
1090 |
|
---|
1091 | 11h 2 (Maximum number of root directory entries)Must be 0.
|
---|
1092 | (根目录项的最大个数)必须为0 。
|
---|
1093 |
|
---|
1094 | 13h 2 (Total number of sectors for small disks only)Must be 0.
|
---|
1095 | (仅用于小磁盘的扇区总数)必须为0 。
|
---|
1096 |
|
---|
1097 | 15h 1 Media descriptor byte, pretty meaningless now (see below).
|
---|
1098 | 媒体描述符字节,现在该此节已经没有太大意义了(参见后面)。
|
---|
1099 |
|
---|
1100 | 16h 2 (Sectors per FAT)Must be 0.
|
---|
1101 | (每个文件分配表的扇区数)必须为0 。
|
---|
1102 |
|
---|
1103 | 18h 2 Sectors per track.
|
---|
1104 | 每个磁道的扇区数。
|
---|
1105 |
|
---|
1106 | 1Ah 2 Total number of heads/sides.
|
---|
1107 | 磁头/面的总数。
|
---|
1108 |
|
---|
1109 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
1110 | 隐藏扇区数(它们位于引导扇区之前)。
|
---|
1111 |
|
---|
1112 | Also referred to as the starting sector of the partition.
|
---|
1113 | 也被称作是分区的起始扇区。
|
---|
1114 |
|
---|
1115 | For floppies, it should be 0.
|
---|
1116 | 对于软盘,它应当为0 。
|
---|
1117 |
|
---|
1118 | 20h 4 (Total number of sectors for large disks)Must be 0.
|
---|
1119 | (大磁盘的扇区总数)必须为 0 。
|
---|
1120 |
|
---|
1121 | 24h 4 (FAT32 sectors per FAT) - Usually 80 00 80 00, A value of
|
---|
1122 | 80 00 00 00 has been seen on a USB thumb drive which is
|
---|
1123 | formatted with NTFS under Windows XP. Note this is removable
|
---|
1124 | media and is not partitioned, the drive as a whole is NTFS
|
---|
1125 | formatted.
|
---|
1126 | (每个文件分配表的 FAT32 扇区数)- 通常是 80 00 80 00 ,值
|
---|
1127 | 为80 00 00 00将被看作是由Windows XP格式化为NTFS的USB拇指碟
|
---|
1128 |
|
---|
1129 | 28h 8 Number of sectors in the volume.
|
---|
1130 | 此卷的扇区号。
|
---|
1131 |
|
---|
1132 | 30h 8 LCN of VCN 0 of the $MFT.
|
---|
1133 | $MFT的逻辑簇号。
|
---|
1134 |
|
---|
1135 | 38h 8 LCN of VCN 0 of the $MFTMirr.
|
---|
1136 | $MFTMirr的逻辑簇号。
|
---|
1137 |
|
---|
1138 | 40h 4 Clusters per MFT Record.
|
---|
1139 | 每个MFT记录的簇数。
|
---|
1140 |
|
---|
1141 | 44h 4 Clusters per Index Record.
|
---|
1142 | 每个索引的簇数。
|
---|
1143 |
|
---|
1144 | 48h 8 Volume serial number.
|
---|
1145 | 卷序列号
|
---|
1146 |
|
---|
1147 | 50h 4 Checksum, usually 0.
|
---|
1148 | 校验和,通常为 0 。
|
---|
1149 |
|
---|
1150 | 54h 1 opcode for "cli".
|
---|
1151 | 指令 “cli”。
|
---|
1152 |
|
---|
1153 | 55h 1 opcode for "cld".
|
---|
1154 | 指令 “cld”。
|
---|
1155 |
|
---|
1156 | 56h 1 opcode for "mov dh, imm8".
|
---|
1157 | 指令 “mov dh, imm8”。
|
---|
1158 |
|
---|
1159 | 57h 1 Partition number of this partition on the boot drive.
|
---|
1160 | 此分区在启动驱动器上的分区号。
|
---|
1161 |
|
---|
1162 | 0, 1, 2, 3 are primary partitions.
|
---|
1163 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
1164 | 0, 1, 2, 3 是主分区。4, 5, 6, ...等等是扩展分区中的逻辑分区。
|
---|
1165 |
|
---|
1166 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
1167 | 0xff 代表整个磁盘。所以对于软盘,其分区号码应当是0xff 。
|
---|
1168 |
|
---|
1169 | 58h 420 The rest of the machine code in the first sector.
|
---|
1170 | 机器码部分。
|
---|
1171 |
|
---|
1172 | 1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
|
---|
1173 | 引导签名AA550000h 。(Win9x 使用4字节作为魔数值。)
|
---|
1174 |
|
---|
1175 | 200h 1536 The rest of the machine code in the last 3 sectors.
|
---|
1176 | 末尾 3 个扇区为机器码部分。
|
---|
1177 |
|
---|
1178 | ------------------------------------------------------------------------------
|
---|
1179 |
|
---|
1180 | 附录A:FAT32 的文件系统信息扇区(不用于引导grldr)
|
---|
1181 |
|
---|
1182 | Offset Length Description
|
---|
1183 | 偏移 长度 说明
|
---|
1184 | ====== ====== ==============================================================
|
---|
1185 | 0h 4 Leading Signature 41615252h.
|
---|
1186 | 起始处签名 41615252h 。
|
---|
1187 |
|
---|
1188 | 4h 480 Reserved, set to 0.
|
---|
1189 | 被保留,设为 0 。
|
---|
1190 |
|
---|
1191 | 1E4h 4 FSI structure signature 61417272h.
|
---|
1192 | 故障征兆指数结构签名 61417272h
|
---|
1193 |
|
---|
1194 | 1E8h 4 Contains the last known count of free clusters, if this is
|
---|
1195 | equal to FFFFFFFFh, then the count is unknown.
|
---|
1196 | 最后已知的空闲簇数,如果它等于FFFFFFFFh,簇数是未知的。
|
---|
1197 |
|
---|
1198 | 1ECh 4 Cluster number at which you should begin a search for a free
|
---|
1199 | cluster, if this is equal to FFFFFFFFh then the field has not
|
---|
1200 | been set.
|
---|
1201 | 假如它等于FFFFFFFFh的话,你应当去寻找一个空闲簇的簇号码 。
|
---|
1202 | 此字段没有被设置。
|
---|
1203 |
|
---|
1204 | 1F0h 12 Reserved, set to 0.
|
---|
1205 | 被保留,设为 0 。
|
---|
1206 |
|
---|
1207 | 1FCh 4 Trailing Signature AA550000h.
|
---|
1208 | 结尾签名AA550000h 。
|
---|
1209 |
|
---|
1210 | ------------------------------------------------------------------------------
|
---|
1211 |
|
---|
1212 | Appendix B: Media Descriptor Byte(not used by grldr)
|
---|
1213 | 附录B:媒体描述字节(非用于grldr)
|
---|
1214 |
|
---|
1215 | The Media descriptor byte is meaningless because of the duplications, F0h for
|
---|
1216 | example.
|
---|
1217 | 此媒体描述字节没有意义,因为有些字节具有多重意义,例如 F0h 。
|
---|
1218 |
|
---|
1219 | Byte Type of disk Sectors Heads Tracks Capacity
|
---|
1220 | 字节 磁盘种类 扇区 头 磁道 容量
|
---|
1221 | ---- ------------ ------- ----- ------ --------
|
---|
1222 | FFh 5 1/4" 8 2 40 320KB
|
---|
1223 | FEh 5 1/4" 8 1 40 160KB
|
---|
1224 | FDh 5 1/4" 9 2 40 360KB
|
---|
1225 | FCh 5 1/4" 9 1 40 180KB
|
---|
1226 | FBh both 9 2 80 640KB
|
---|
1227 | FAh both 9 1 80 320KB
|
---|
1228 | F9h 5 1/4" 15 2 80 1200KB
|
---|
1229 | F9h 3 1/2" 9 2 80 720KB
|
---|
1230 | F0h 3 1/2" 18 2 80 1440KB
|
---|
1231 | F0h 3 1/2" 36 2 80 2880KB
|
---|
1232 | F8h hard disk NA NA NA NA
|
---|
1233 |
|
---|
1234 | ******************************************************************************
|
---|
1235 | *** grldr.mbr - 怎样将grldr.mbr写到硬盘的主引导磁道 ***
|
---|
1236 | ******************************************************************************
|
---|
1237 | grldr.mbr包含能够用作主引导记录的代码。此代码负责搜索所有分区的grldr,并且在发现
|
---|
1238 | 它后装载它。现在被支持的分区种类是:FAT12/FAT16/FAT32,NTFS,EXT2/EXT3。在扩展分区
|
---|
1239 | 上的逻辑分区也被支持,条件是此扩展分区与微软兼容。实际上,搜索机制没有充分地测试
|
---|
1240 | 分区类型(0x85 )的Linux 的扩展分区。
|
---|
1241 |
|
---|
1242 | 怎样将 GRLDR.MBR 写到硬盘的主引导磁道?
|
---|
1243 |
|
---|
1244 | 首先,读入 Windows 磁盘签名及分区信息字节(总共72字节,从主引导记录的偏移
|
---|
1245 | 0x01b8到0x01ff处),并且放置到GRLDR.MBR的开始扇区的相同范围的偏移0x01b8
|
---|
1246 | 到0x01ff处。
|
---|
1247 |
|
---|
1248 | 如果硬盘上的主引导记录是由微软的FDISK产生的单一的扇区主引导记录,
|
---|
1249 | 可以选择把它复制到GRLDR.MBR的第二扇区。
|
---|
1250 |
|
---|
1251 | GRLDR.MBR的第二扇区叫作“原先的主引导记录”。当找不到GRLDR后,将从“原先的主引
|
---|
1252 | 导记录”开始引导。
|
---|
1253 |
|
---|
1254 | 不需要其它的步骤,当所有的上述的必要的改变已经完成后,现在只要将GRLDR.MBR写到
|
---|
1255 | 主引导磁道。这就全部完成了。
|
---|
1256 |
|
---|
1257 | 注意:主引导磁道表示的是硬盘的第一条磁道。
|
---|
1258 |
|
---|
1259 | 注意:GRLDR.MBR 的自举代码只在分区的根目录寻找GRLDR。你最好把menu.lst文件和GRLDR
|
---|
1260 | 放置在一起。(就是说放在和 GRLDR 相同分区的相同根目录下。)
|
---|
1261 |
|
---|
1262 | “grldr” 文件名在ext2分区中必须是小写字母,而且grldr的文件种类必须是纯普通文件。
|
---|
1263 | 其它种类,例如,符号链接文件也是不行的。
|
---|
1264 |
|
---|
1265 | 更新: bootlace.com 是一个在 DOS/LINUX 下的能把 grldr.mbr 安装到主引导记录
|
---|
1266 | 的工具。整个grldr.mbr被嵌入到bootlace.com工具内部,因此 bootlace.com可以独
|
---|
1267 | 立使用。参见后面。
|
---|
1268 |
|
---|
1269 | 以下内容供开发人员参考.....
|
---|
1270 | ******************************************************************************
|
---|
1271 | *** grldr.mbr - Details about the control bytes ***
|
---|
1272 | ******************************************************************************
|
---|
1273 | grldr.mbr - 其控制字节的详述
|
---|
1274 |
|
---|
1275 | Six bytes can be used to control the boot process of GRLDR.MBR.
|
---|
1276 | 有六个字节可以控制GRLDR.MBR引导过程。
|
---|
1277 |
|
---|
1278 | Offset Length Description
|
---|
1279 | 偏移量 长度 说明
|
---|
1280 |
|
---|
1281 | ====== ====== ==============================================================
|
---|
1282 | 02h 1 bit0=1: disable the search for GRLDR on floppy
|
---|
1283 | bit0=0: enable the search for GRLDR on floppy
|
---|
1284 | 第 0 位=1 :允许搜索软盘上的GRLDR 。
|
---|
1285 | 第 0 位=0 :禁止搜索软盘上的GRLDR 。
|
---|
1286 |
|
---|
1287 | bit1=1: disable the boot of PREVIOUS MBR with invalid
|
---|
1288 | partition table(usually an OS boot sector)
|
---|
1289 | bit1=0: enable the boot of PREVIOUS MBR with invalid
|
---|
1290 | partition table(usually an OS boot sector)
|
---|
1291 | 第 1 位=1 :禁止引导分区表无效的原主引导记录
|
---|
1292 | (通常是一个操作系统的引导扇区)
|
---|
1293 | 第 1 位=0 :允许引导分区表无效的原主引导记录
|
---|
1294 | (通常是一个操作系统的引导扇区)
|
---|
1295 |
|
---|
1296 | bit2=1: disable the feature of unconditional entrance to
|
---|
1297 | the command-line(See below `--duce')
|
---|
1298 | bit2=0: enable the feature of unconditional entrance to
|
---|
1299 | the command-line(See below `--duce')
|
---|
1300 | 第 2 位 = 1 :禁止无条件进入命令行 (见下面的`--duce')
|
---|
1301 | 第 2 位 = 0 :允许无条件进入命令行(见下面的`--duce')
|
---|
1302 |
|
---|
1303 | bit3=1: disable geometry tune(See below `--chs-no-tune')
|
---|
1304 | bit3=0: enable geometry tune(See below `--chs-no-tune')
|
---|
1305 | 第 3 位= 1 :禁止改变磁盘几何参数(见下面的 `--chs-no-tune')
|
---|
1306 | 第 3 位= 0 :允许改变磁盘几何参数(见下面的 `--chs-no-tune')
|
---|
1307 |
|
---|
1308 | bit4 - bit6: reserved
|
---|
1309 | 第 4 位到第 6 位:被保留
|
---|
1310 |
|
---|
1311 | bit7=1: try to boot PREVIOUS MBR after the search for GRLDR
|
---|
1312 | bit7=0: try to boot PREVIOUS MBR before the search for GRLDR
|
---|
1313 | 第 7 位=1:在搜索 GRLDR 之后尝试引导原先的主引导记录
|
---|
1314 | 第 7 位=0:在搜索 GRLDR 之前尝试引导原先的主引导记录
|
---|
1315 |
|
---|
1316 | 03h 1 timeout in seconds to wait for a key press. 0xff stands for
|
---|
1317 | waiting all the time(endless).
|
---|
1318 | 等待键被按下时的暂停秒数。0xff代表始终暂停(即无休止的)。
|
---|
1319 |
|
---|
1320 |
|
---|
1321 | 04h 2 hot-key code. high byte is scan code, low byte is ASCII code.
|
---|
1322 | the default value is 0x3920, which stands for the space bar.
|
---|
1323 | if this key is pressed, GRUB will be started prior to the boot
|
---|
1324 | of previous MBR. See "int 16 keyboard scan codes" below.
|
---|
1325 | 热键代码。高字节是扫描码,低字节是ASCII码。默认值是0x3920,代
|
---|
1326 | 表的是空格键。如果此键被按下,GRUB将在引导原先的主引导记录之前
|
---|
1327 | 启动。见“ int16 键盘扫描码”。
|
---|
1328 |
|
---|
1329 | 06h 1 preferred boot drive number, 0xff for no-drive
|
---|
1330 | 优先引导的驱动器号,0xff 代表没有。
|
---|
1331 |
|
---|
1332 | 07h 1 preferred partition number, 0xff for whole drive
|
---|
1333 | 优先引导的分区号,0xff 代表整个驱动器。
|
---|
1334 |
|
---|
1335 | if the preferred boot drive number is 0xff, the order of the
|
---|
1336 | search for GRLDR will be:
|
---|
1337 | 如果优先引导的驱动器号是0xff,搜索 GRLDR 的顺序是:
|
---|
1338 |
|
---|
1339 | (hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
|
---|
1340 | (hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
|
---|
1341 | ... ... ... ... ... ... ... ...
|
---|
1342 | (hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
|
---|
1343 | (X=max harddrive number)
|
---|
1344 | (fd0)
|
---|
1345 |
|
---|
1346 | otherwise, if the preferred boot drive number is Y(not equal to
|
---|
1347 | 0xff) and the preferred partition number is K, then the order of
|
---|
1348 | the search for GRLDR will be:
|
---|
1349 | 否则,如果优先引导的驱动器号假定为Y (且不等于0xff),而优先引导
|
---|
1350 | 的分区号为K,那么搜索 GRLDR 的顺序是:
|
---|
1351 |
|
---|
1352 | (Y) if K=0xff; or (Y,K) otherwise
|
---|
1353 | (hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
|
---|
1354 | (hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
|
---|
1355 | ... ... ... ... ... ... ... ...
|
---|
1356 | (hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
|
---|
1357 | (X=max harddrive number)
|
---|
1358 | (fd0)
|
---|
1359 |
|
---|
1360 | Note: if Y < 0x80, then (Y) is floppy, else (Y) is harddrive,
|
---|
1361 | and (Y,K) is partition number K on harddrive (Y).
|
---|
1362 | 注意:如果Y小于0x80 ,那么这个(Y)驱动器代表软驱,否则就是硬盘驱动器。
|
---|
1363 | 而(Y,K)代表Y号硬盘驱动器上的 k 号分区。
|
---|
1364 |
|
---|
1365 |
|
---|
1366 | ******************************************************************************
|
---|
1367 | *** bootlace.com - 安装GRLDR.MBR自举代码到MBR ***
|
---|
1368 | ******************************************************************************
|
---|
1369 |
|
---|
1370 | BOOTLACE.COM 能将GRLDR的引导记录安装到硬盘驱动器或硬盘映像文件的主引导记录中,
|
---|
1371 | 或者安装到软盘或者软盘映像的引导扇区。
|
---|
1372 |
|
---|
1373 | 用法:
|
---|
1374 | bootlace.com [OPTIONS] DEVICE_OR_FILE
|
---|
1375 | 选项 设备或文件
|
---|
1376 | 选项:
|
---|
1377 | --read-only 对指定的设备或文件执行所有操作,但是并不不真正地写入。
|
---|
1378 |
|
---|
1379 | --restore-mbr 恢复原先的主引导记录。
|
---|
1380 |
|
---|
1381 | --mbr-no-bpb 即使最靠前的是一个FAT分区,也不复制BPB表到主引导记录。
|
---|
1382 |
|
---|
1383 | --no-backup-mbr 不复制旧的主引导记录到设备或文件的第二扇区。
|
---|
1384 |
|
---|
1385 | --force-backup-mbr 强行复制主引导记录到设备或文件的第二扇区。
|
---|
1386 |
|
---|
1387 | --mbr-enable-floppy 允许搜索软盘上的GRLDR 。
|
---|
1388 |
|
---|
1389 | --mbr-disable-floppy 禁止搜索软盘上的GRLDR 。
|
---|
1390 |
|
---|
1391 | --mbr-enable-osbr 允许引导分区表无效的原先的主引导记录(通常是
|
---|
1392 | 操作系统的引导扇区)
|
---|
1393 |
|
---|
1394 | --mbr-disable-osbr 禁止引导分区表无效的原先的主引导记录(通常是
|
---|
1395 | 操作系统的引导扇区)
|
---|
1396 |
|
---|
1397 | --duce 禁止无条件进入命令行功能。
|
---|
1398 |
|
---|
1399 | 任何人按‘C’键都可以正常取得命令行控制台,绕
|
---|
1400 | 过了所有的配置文件。(包括预置的配置文件)。
|
---|
1401 | 这是一种安全漏洞。所以我们需要这一选项来禁止这
|
---|
1402 | 种情况。
|
---|
1403 |
|
---|
1404 | DUCE 即 Disable Unconditional Command-line Entrance
|
---|
1405 | 的缩写,意为无条件的(或不受控的)命令行入口。
|
---|
1406 |
|
---|
1407 | --chs-no-tune 禁止磁盘几何参数修正功能。
|
---|
1408 |
|
---|
1409 | --boot-prevmbr-first 在搜索GRLDR之前,先尝试引导原先的主引导记录。
|
---|
1410 |
|
---|
1411 | --boot-prevmbr-last 在搜索GRLDR之后,再尝试引导原先的主引导记录。
|
---|
1412 |
|
---|
1413 | --preferred-drive=D 优先引导的驱动器号,驱动器号D应大于0而小于255 。
|
---|
1414 |
|
---|
1415 | --preferred-partition=P 优先引导的分区号,分区号P应大于0 而小于255 。
|
---|
1416 |
|
---|
1417 | --serial-number=SN 为硬盘驱动器设置一个新的序列号码。SN必须是非零的数。
|
---|
1418 |
|
---|
1419 | --time-out=T 在引导原先的主引导记录前等待 T 秒钟。如果T是0xff,
|
---|
1420 | 则始终等待。默认值是 5 。
|
---|
1421 |
|
---|
1422 | --hot-key=K 如果热键被按下,在引导原先的主引导记录之前启动
|
---|
1423 | GRUB 。K 是一个双字节的值,如同 int16/AH=1 返回
|
---|
1424 | 到AX寄存器的值一样。高字节是扫描码,低字节是ASCII
|
---|
1425 | 码。默认值是 0x3920,即空格键。参见“int16键盘扫描码”。
|
---|
1426 |
|
---|
1427 | --floppy 如果设备或文件是软盘,使用这一选项。
|
---|
1428 |
|
---|
1429 | --floppy=N 如果设备或文件是一个硬盘驱动器上的分区,使用此选项。
|
---|
1430 | N用于指定分区号码:0 ,1,2 和 3 为主分区,而 4,5,
|
---|
1431 | 6,...等等为逻辑分区。
|
---|
1432 |
|
---|
1433 | --sectors-per-track=S 为--floppy 选项指定每磁道扇区数。S 应大于1且小于63,
|
---|
1434 | 默认值是63 。
|
---|
1435 |
|
---|
1436 | --heads=H 为--floppy选项指定磁头数,H应大于1且小于256 。默认值是255 。
|
---|
1437 |
|
---|
1438 | --start-sector=B 为--floppy=N 选项指定隐藏扇区。
|
---|
1439 |
|
---|
1440 | --total-sectors=C 为--floppy 选项指定总扇区数。默认值是 0 。
|
---|
1441 |
|
---|
1442 | --lba 对--floppy 选项使用 lba 模式。如果软盘BIOS支持LBA,
|
---|
1443 | 你可以在这里指定--lba选项。理论上所有的软盘BIOS 都
|
---|
1444 | 支持CHS。因此你指定--chs选项更适当。如果--chs和--lba
|
---|
1445 | 选项都未被指定,那么LBA指示码(即引导扇区的第三字节)
|
---|
1446 | 将不被修改。
|
---|
1447 |
|
---|
1448 | --chs 为--floppy选项使用chs模式。如果软盘BIOS不支持
|
---|
1449 | LBA,你应当指定--chs选项。我们假定所有的软盘BIOS
|
---|
1450 | 都能支持CHS。所以你需要指定--chs 选项更为恰当。
|
---|
1451 | 如果既不指定--chs选项又不指定--lba选项,那么LBA
|
---|
1452 | 指示码(即,引导扇区的第三字节)将不被改变。
|
---|
1453 |
|
---|
1454 | --fat12 --floppy选项使用时,确认安装到FAT12系统。
|
---|
1455 |
|
---|
1456 | --fat16 --floppy选项使用时,确认安装到FAT16系统。
|
---|
1457 |
|
---|
1458 | --fat32 --floppy选项使用时,确认安装到FAT32系统。
|
---|
1459 |
|
---|
1460 | --vfat --floppy选项使用时,确认安装到FAT12/16/32等系统。
|
---|
1461 |
|
---|
1462 | --ntfs --floppy选项使用时,确认安装到NTFS系统。
|
---|
1463 |
|
---|
1464 | --ext2 --floppy选项使用时,确认安装到EXT2系统。
|
---|
1465 |
|
---|
1466 | --install-partition=I 将引导记录安装到指定的硬盘驱动器或硬盘映像(设备或文件)
|
---|
1467 | 的第 I 号分区的引导区中。
|
---|
1468 |
|
---|
1469 | DEVICE_OR_FILE: 设备或者映像文件的文件名。对于DOS,BIOS驱动器号(两位的十六进制
|
---|
1470 | 或三位的十进制数)可以被用来访问驱动器。BIOS驱动器号0表示第一软盘,1表示第二硬盘;
|
---|
1471 | 0x80 表示第一硬盘驱动器,0x81表示第二硬盘驱动器,等等。
|
---|
1472 |
|
---|
1473 | 注意:BOOTLACE.COM 仅仅是把引导代码写到MBR中。引导代码需要加载GRLDR作为GRUB启动
|
---|
1474 | 过程的第二(最后)阶段。因而在BOOTLACE.COM成功执行前或者是执行后,GRLDR应当被复
|
---|
1475 | 制到任一受支持分区的根目录下,当前受支持分区的文件系统类型仅有FAT12,FAT16,FAT32,
|
---|
1476 | NTFS,EXT2以及EXT3 。
|
---|
1477 |
|
---|
1478 | 注意 2:如果DEVICE_OR_FILE是硬盘设备或是硬盘映像文件,它必须包含有效的分区表,
|
---|
1479 | 否则,BOOTLACE.COM 将安装失败。如果设备或文件是指向软驱或者软盘映像文件,那么
|
---|
1480 | 他必须包含一个受支持的文件系统(FAT12/FAT16/FAT32/NTFS/EXT2/EXT3 等之一)。
|
---|
1481 |
|
---|
1482 | 注意 3:如果DEVICE_OR_FILE是软驱或软盘映像文件,而它又被格式化为EXT2或EXT3,
|
---|
1483 | 那么你必须明确指定--sectors-per-track 和 --heads 选项。
|
---|
1484 |
|
---|
1485 | 重要!! 如果你安装grldr的引导代码到一个软盘或者一个分区,此软盘或分区将只能从
|
---|
1486 | grldr引导 ,而你原本的IO.SYS(DOS/Win9x/Me)和NTLDR(WinNT/2K/XP)将变为不能
|
---|
1487 | 引导。这是由于软盘或分区的原始引导记录被覆盖了。而把GRLDR的引导记录安装到MBR
|
---|
1488 | 则没有这个问题。
|
---|
1489 | 更新:在最新版本的GRUB4DOS中NTLDR,IO.SYS或KERNEL.SYS等文件,可以被直接加载。
|
---|
1490 |
|
---|
1491 | 提示:如果文件名的开始是短划线(-)或数字,你可以在它前面加上目录名(./) 或 (.\)。
|
---|
1492 |
|
---|
1493 | 示例:
|
---|
1494 | 在Linux下安装GRLDR的引导代码到MBR:
|
---|
1495 | bootlace.com /dev/hda
|
---|
1496 |
|
---|
1497 | 在DOS下安装GRLDR的引导代码到MBR:
|
---|
1498 | bootlace.com 0x80
|
---|
1499 |
|
---|
1500 | 在DOS或Linux下安装GRLDR的引导代码到硬盘映像:
|
---|
1501 | bootlace.com hd.img
|
---|
1502 |
|
---|
1503 | 在Linux下安装GRLDR的引导代码到软盘:
|
---|
1504 | bootlace.com --floppy --chs /dev/fd0
|
---|
1505 |
|
---|
1506 | 在DOS下安装GRLDR的引导代码到软盘:
|
---|
1507 | bootlace.com --floppy --chs 0x00
|
---|
1508 |
|
---|
1509 | 在DOS或Linux下安装GRLDR的引导代码到软盘映像:
|
---|
1510 | bootlace.com --floppy --chs floppy.img
|
---|
1511 |
|
---|
1512 | BOOTLACE.COM 无法在Windows NT/2000/XP/2003下正常运行。它被希望(和设计)用于
|
---|
1513 | DOS/Win9x和Linux中。
|
---|
1514 |
|
---|
1515 | 更新:对于映像文件,在Windows NT/2000/XP/2003下,bootlace.com 可以正常使用。
|
---|
1516 |
|
---|
1517 | bootlace.com不能在 Windows NT/2000/XP/2003 中运行的原因是,bootlace.com是一个DOS工具而 Windows NT/2000/XP/2003
|
---|
1518 | 不认可它对设备的访问,你可以通过WINHEX/DISKRW之类的工具来间接的完全这个操作.
|
---|
1519 | 一个DISKRW的例子在这里:
|
---|
1520 | http://bbs.znpc.net/viewthread.php?tid=5447
|
---|
1521 |
|
---|
1522 | ******************************************************************************
|
---|
1523 | *** kexec-tools should be patched for the 1.101 release ***
|
---|
1524 | ******************************************************************************
|
---|
1525 | kexec-tools 应当打上1.101发布的补丁
|
---|
1526 |
|
---|
1527 | The file kexec-tools-1.101-patch is a patch to the kexec-tools-1.101 release.
|
---|
1528 | Kexec might fail to load grub.exe without this patch.
|
---|
1529 | kexec-tools-1.101-patch 是为kexec-tools-1.101发布的补丁。没有这个补丁Kexec 加载
|
---|
1530 | grub.exe 会失败。
|
---|
1531 |
|
---|
1532 | The home page of kexec-tools is:
|
---|
1533 | kexec-tools 的主页是:
|
---|
1534 |
|
---|
1535 | http://www.xmission.com/~ebiederm/files/kexec/
|
---|
1536 |
|
---|
1537 | Note: The Linux kernel should be KEXEC enabled before kexec can be run.
|
---|
1538 | 注意: 在使用 kexec 前应该使 Linux 核心支持 KEXEC 系统调用。
|
---|
1539 |
|
---|
1540 | !! Important Update !!
|
---|
1541 | 重要更新
|
---|
1542 |
|
---|
1543 | The patch `kexec-tools-1.101-patch' is not needed now and has been deleted.
|
---|
1544 | Even worse, it fails in `kexec -l grub.exe --initrd=imgfile'. So please
|
---|
1545 | do not use it any more.
|
---|
1546 | 现在不再需要`kexec-tools-1.101-patch'补丁而且它已经被删除了。很糟糕的是,执行
|
---|
1547 | `kexec -l grub.exe --initrd=imgfile'竟会失败。所以请不要再使用它。
|
---|
1548 |
|
---|
1549 | ******************************************************************************
|
---|
1550 | *** Direct transition to DOS/Win9x from within Linux ***
|
---|
1551 | ******************************************************************************
|
---|
1552 | 从Linux直接转换到DOS/Win9x
|
---|
1553 |
|
---|
1554 | 使用kexec,我们能够轻易地从运行中的 Linux 系统启动到 DOS/Win9x 。
|
---|
1555 |
|
---|
1556 | 假如 WIN98.IMG 是一个可引导的硬盘映像,按照如下操作:
|
---|
1557 |
|
---|
1558 | kexec -l grub.exe --initrd=WIN98.IMG --command-line="--config-file=map (rd) (hd0); map --hook; chainloader (hd0)+1; rootnoverify (hd0)"
|
---|
1559 |
|
---|
1560 | kexec -e
|
---|
1561 |
|
---|
1562 | 如果DOS.IMG是一个可引导的软盘映像,按照以下方法:
|
---|
1563 |
|
---|
1564 | kexec -l grub.exe --initrd=DOS.IMG --command-line="--config-file=map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1565 |
|
---|
1566 | kexec -e
|
---|
1567 |
|
---|
1568 | 注意,按照这种方式,我们可以不用使用真实的 DOS/Win9x 磁盘就启动到 DOS/Win9x 。
|
---|
1569 | 我们不需要FAT分区而只需要一个映像文件。
|
---|
1570 |
|
---|
1571 | 我们已经注意到通过使用 kexec 和 grub.exe,Linux本身就能够成为一个大的引导管理器。
|
---|
1572 | 这给安装程序或者引导程序或者初始化程序的开发者带来了方便。
|
---|
1573 |
|
---|
1574 | 当然,grub.exe和可引导的磁盘映像也能够被运行中的GRUB 或LILO 或syslinux 加载。例如:
|
---|
1575 |
|
---|
1576 | 1.通过 GRUB 加载:
|
---|
1577 |
|
---|
1578 | kernel (hd0,0)/grub.exe --config-file="map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1579 | initrd (hd0,0)/DOS.IMG
|
---|
1580 | boot
|
---|
1581 |
|
---|
1582 | 2.通过 LILO 加载:
|
---|
1583 |
|
---|
1584 | image=/boot/grub.exe
|
---|
1585 | label=grub.exe
|
---|
1586 | initrd=/boot/DOS.IMG
|
---|
1587 | append="--config-file=map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1588 |
|
---|
1589 | 3.通过 SYSLINUX 加载:
|
---|
1590 |
|
---|
1591 | label grub.exe
|
---|
1592 | kernel grub.exe
|
---|
1593 | append initrd=DOS.IMG --config-file="map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1594 |
|
---|
1595 | 注意:如果使用上面的‘map (rd) (...)’失败,你可以使用‘map (rd)+1 (...)’代替,
|
---|
1596 | 然后再试一次。
|
---|
1597 |
|
---|
1598 | ******************************************************************************
|
---|
1599 | *** Keyboard BIOS Scan Code/ASCII code tables ***
|
---|
1600 | ******************************************************************************
|
---|
1601 | 键盘 BIOS 扫描码和 ASCII 码表
|
---|
1602 |
|
---|
1603 | Keyboard bios scan code and ascii character code tables can be obtained from
|
---|
1604 | the web by, for example, googling for "3920 372A 4A2D 4E2B 352F". Here are 2
|
---|
1605 | main results:
|
---|
1606 | 键盘 bios 扫描码和 ASCII 字符码表能够通过 web 网获取,例如,使用 google 查找
|
---|
1607 | "3920 372A 4A2D 4E2B 352F"。这里有两项主要的结果:
|
---|
1608 |
|
---|
1609 | 1. From "http://heim.ifi.uio.no/~stanisls/helppc/scan_codes.html":
|
---|
1610 | 转自“http://heim.ifi.uio.no/~stanisls/helppc/scan_codes.html”:
|
---|
1611 |
|
---|
1612 | INT 16 - Keyboard Scan Codes
|
---|
1613 | INT 16 - 键盘扫描码
|
---|
1614 |
|
---|
1615 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1616 | 键位 常态 上档态 控制态 变更态
|
---|
1617 |
|
---|
1618 | A 1E61 1E41 1E01 1E00
|
---|
1619 | B 3062 3042 3002 3000
|
---|
1620 | C 2E63 2E43 2E03 2E00
|
---|
1621 | D 2064 2044 2004 2000
|
---|
1622 | E 1265 1245 1205 1200
|
---|
1623 | F 2166 2146 2106 2100
|
---|
1624 | G 2267 2247 2207 2200
|
---|
1625 | H 2368 2348 2308 2300
|
---|
1626 | I 1769 1749 1709 1700
|
---|
1627 | J 246A 244A 240A 2400
|
---|
1628 | K 256B 254B 250B 2500
|
---|
1629 | L 266C 264C 260C 2600
|
---|
1630 | M 326D 324D 320D 3200
|
---|
1631 | N 316E 314E 310E 3100
|
---|
1632 | O 186F 184F 180F 1800
|
---|
1633 | P 1970 1950 1910 1900
|
---|
1634 | Q 1071 1051 1011 1000
|
---|
1635 | R 1372 1352 1312 1300
|
---|
1636 | S 1F73 1F53 1F13 1F00
|
---|
1637 | T 1474 1454 1414 1400
|
---|
1638 | U 1675 1655 1615 1600
|
---|
1639 | V 2F76 2F56 2F16 2F00
|
---|
1640 | W 1177 1157 1117 1100
|
---|
1641 | X 2D78 2D58 2D18 2D00
|
---|
1642 | Y 1579 1559 1519 1500
|
---|
1643 | Z 2C7A 2C5A 2C1A 2C00
|
---|
1644 |
|
---|
1645 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1646 | 键位 常态 上档态 控制态 变更态
|
---|
1647 |
|
---|
1648 | 1 0231 0221 7800
|
---|
1649 | 2 0332 0340 0300 7900
|
---|
1650 | 3 0433 0423 7A00
|
---|
1651 | 4 0534 0524 7B00
|
---|
1652 | 5 0635 0625 7C00
|
---|
1653 | 6 0736 075E 071E 7D00
|
---|
1654 | 7 0837 0826 7E00
|
---|
1655 | 8 0938 092A 7F00
|
---|
1656 | 9 0A39 0A28 8000
|
---|
1657 | 0 0B30 0B29 8100
|
---|
1658 |
|
---|
1659 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1660 | 键位 常态 上档态 控制态 变更态
|
---|
1661 |
|
---|
1662 | - 0C2D 0C5F 0C1F 8200
|
---|
1663 | = 0D3D 0D2B 8300
|
---|
1664 | [ 1A5B 1A7B 1A1B 1A00
|
---|
1665 | ] 1B5D 1B7D 1B1D 1B00
|
---|
1666 | ; 273B 273A 2700
|
---|
1667 | ' 2827 2822
|
---|
1668 | ` 2960 297E
|
---|
1669 | \ 2B5C 2B7C 2B1C 2600 (same as Alt L)
|
---|
1670 | , 332C 333C
|
---|
1671 | . 342E 343E
|
---|
1672 | / 352F 353F
|
---|
1673 |
|
---|
1674 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1675 | 键位 常态 上档态 控制态 变更态
|
---|
1676 |
|
---|
1677 | F1 3B00 5400 5E00 6800
|
---|
1678 | F2 3C00 5500 5F00 6900
|
---|
1679 | F3 3D00 5600 6000 6A00
|
---|
1680 | F4 3E00 5700 6100 6B00
|
---|
1681 | F5 3F00 5800 6200 6C00
|
---|
1682 | F6 4000 5900 6300 6D00
|
---|
1683 | F7 4100 5A00 6400 6E00
|
---|
1684 | F8 4200 5B00 6500 6F00
|
---|
1685 | F9 4300 5C00 6600 7000
|
---|
1686 | F10 4400 5D00 6700 7100
|
---|
1687 | F11 8500 8700 8900 8B00
|
---|
1688 | F12 8600 8800 8A00 8C00
|
---|
1689 |
|
---|
1690 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1691 | 键位 常态 上档态 控制态 变更态
|
---|
1692 |
|
---|
1693 | BackSpace 0E08 0E08 0E7F 0E00
|
---|
1694 | Del 5300 532E 9300 A300
|
---|
1695 | Down Arrow 5000 5032 9100 A000
|
---|
1696 | End 4F00 4F31 7500 9F00
|
---|
1697 | Enter 1C0D 1C0D 1C0A A600
|
---|
1698 | Esc 011B 011B 011B 0100
|
---|
1699 | Home 4700 4737 7700 9700
|
---|
1700 | Ins 5200 5230 9200 A200
|
---|
1701 | Keypad 5 4C35 8F00
|
---|
1702 | Keypad * 372A 9600 3700
|
---|
1703 | Keypad - 4A2D 4A2D 8E00 4A00
|
---|
1704 | Keypad + 4E2B 4E2B 4E00
|
---|
1705 | Keypad / 352F 352F 9500 A400
|
---|
1706 | Left Arrow 4B00 4B34 7300 9B00
|
---|
1707 | PgDn 5100 5133 7600 A100
|
---|
1708 | PgUp 4900 4939 8400 9900
|
---|
1709 | PrtSc 7200
|
---|
1710 | Right Arrow 4D00 4D36 7400 9D00
|
---|
1711 | SpaceBar 3920 3920 3920 3920
|
---|
1712 | Tab 0F09 0F00 9400 A500
|
---|
1713 | Up Arrow 4800 4838 8D00 9800
|
---|
1714 |
|
---|
1715 |
|
---|
1716 | 一些组合键不是在所有系统中都能获取。PS/2 包括了很多不能在PC, XT和
|
---|
1717 | AT上获取的组合键。
|
---|
1718 |
|
---|
1719 | - To retrieve the character from a scan code logical AND the word
|
---|
1720 | with 0x00FF.
|
---|
1721 | 由扫描码检索出字符可以用 0x00FF 和该字符进行逻辑与操作。
|
---|
1722 |
|
---|
1723 | - see INT 16 MAKE CODES
|
---|
1724 | 参见INT16 通码
|
---|
1725 |
|
---|
1726 |
|
---|
1727 |
|
---|
1728 | 2. From "http://www.hoppie.nl/ivan/keycodes.txt":
|
---|
1729 | 转自“http://www.hoppie.nl/ivan/keycodes.txt”:
|
---|
1730 |
|
---|
1731 |
|
---|
1732 | Keystroke Keypress code
|
---|
1733 | --------------------------------------------------
|
---|
1734 | Esc 011B
|
---|
1735 | 1 0231
|
---|
1736 | 2 0332
|
---|
1737 | 3 0433
|
---|
1738 | 4 0534
|
---|
1739 | 5 0635
|
---|
1740 | 6 0736
|
---|
1741 | 7 0837
|
---|
1742 | 8 0938
|
---|
1743 | 9 0A39
|
---|
1744 | 0 0B30
|
---|
1745 | - 0C2D
|
---|
1746 | = 0D3D
|
---|
1747 | Backspace 0E08
|
---|
1748 | Tab 0F09
|
---|
1749 | q 1071
|
---|
1750 | w 1177
|
---|
1751 | e 1265
|
---|
1752 | r 1372
|
---|
1753 | t 1474
|
---|
1754 | y 1579
|
---|
1755 | u 1675
|
---|
1756 | i 1769
|
---|
1757 | o 186F
|
---|
1758 | p 1970
|
---|
1759 | [ 1A5B
|
---|
1760 | ] 1B5D
|
---|
1761 | Enter 1C0D
|
---|
1762 | Ctrl **
|
---|
1763 | a 1E61
|
---|
1764 | s 1F73
|
---|
1765 | d 2064
|
---|
1766 | f 2166
|
---|
1767 | g 2267
|
---|
1768 | h 2368
|
---|
1769 | j 246A
|
---|
1770 | k 256B
|
---|
1771 | l 266C
|
---|
1772 | ; 273B
|
---|
1773 | ' 2827
|
---|
1774 | ` 2960
|
---|
1775 | Shift **
|
---|
1776 | \ 2B5C
|
---|
1777 | z 2C7A
|
---|
1778 | x 2D78
|
---|
1779 | c 2E63
|
---|
1780 | v 2F76
|
---|
1781 | b 3062
|
---|
1782 | n 316E
|
---|
1783 | m 326D
|
---|
1784 | , 332C
|
---|
1785 | . 342E
|
---|
1786 | / 352F
|
---|
1787 | Gray * 372A
|
---|
1788 | Alt **
|
---|
1789 | Space 3920
|
---|
1790 | Caps Lock **
|
---|
1791 | F1 3B00
|
---|
1792 | F2 3C00
|
---|
1793 | F3 3D00
|
---|
1794 | F4 3E00
|
---|
1795 | F5 3F00
|
---|
1796 | F6 4000
|
---|
1797 | F7 4100
|
---|
1798 | F8 4200
|
---|
1799 | F9 4300
|
---|
1800 | F10 4400
|
---|
1801 | F11 8500
|
---|
1802 | F12 8600
|
---|
1803 | Num Lock **
|
---|
1804 | Scroll Lock **
|
---|
1805 | White Home 4700
|
---|
1806 | White Up Arrow 4800
|
---|
1807 | White PgUp 4900
|
---|
1808 | Gray - 4A2D
|
---|
1809 | White Left Arrow 4B00
|
---|
1810 | Center Key 4C00
|
---|
1811 | White Right Arrow 4D00
|
---|
1812 | Gray + 4E2B
|
---|
1813 | White End 4F00
|
---|
1814 | White Down Arrow 5000
|
---|
1815 | White PgDn 5100
|
---|
1816 | White Ins 5200
|
---|
1817 | White Del 5300
|
---|
1818 | SysReq **
|
---|
1819 | Key 45 [1] 565C
|
---|
1820 | Enter (number keypad) 1C0D
|
---|
1821 | Gray / 352F
|
---|
1822 | PrtSc **
|
---|
1823 | Pause **
|
---|
1824 | Gray Home 4700
|
---|
1825 | Gray Up Arrow 4800
|
---|
1826 | Gray Page Up 4900
|
---|
1827 | Gray Left Arrow 4B00
|
---|
1828 | Gray Right Arrow 4D00
|
---|
1829 | Gray End 4F00
|
---|
1830 | Gray Down Arrow 5000
|
---|
1831 | Gray Page Down 5100
|
---|
1832 | Gray Insert 5200
|
---|
1833 | Gray Delete 5300
|
---|
1834 |
|
---|
1835 | Shift Esc 011B
|
---|
1836 | ! 0221
|
---|
1837 | @ 0340
|
---|
1838 | # 0423
|
---|
1839 | $ 0524
|
---|
1840 | % 0625
|
---|
1841 | ^ 075E
|
---|
1842 | & 0826
|
---|
1843 | * (white) 092A
|
---|
1844 | ( 0A28
|
---|
1845 | ) 0B29
|
---|
1846 | _ 0C5F
|
---|
1847 | + (white) 0D2B
|
---|
1848 | Shift Backspace 0E08
|
---|
1849 | Shift Tab (Backtab) 0F00
|
---|
1850 | Q 1051
|
---|
1851 | W 1157
|
---|
1852 | E 1245
|
---|
1853 | R 1352
|
---|
1854 | T 1454
|
---|
1855 | Y 1559
|
---|
1856 | U 1655
|
---|
1857 | I 1749
|
---|
1858 | O 184F
|
---|
1859 | P 1950
|
---|
1860 | { 1A7B
|
---|
1861 | } 1B7D
|
---|
1862 | Shift Enter 1C0D
|
---|
1863 | Shift Ctrl **
|
---|
1864 | A 1E41
|
---|
1865 | S 1F53
|
---|
1866 | D 2044
|
---|
1867 | F 2146
|
---|
1868 | G 2247
|
---|
1869 | H 2348
|
---|
1870 | J 244A
|
---|
1871 | K 254B
|
---|
1872 | L 264C
|
---|
1873 | : 273A
|
---|
1874 | " 2822
|
---|
1875 | ~ 297E
|
---|
1876 | | 2B7C
|
---|
1877 | Z 2C5A
|
---|
1878 | X 2D58
|
---|
1879 | C 2E43
|
---|
1880 | V 2F56
|
---|
1881 | B 3042
|
---|
1882 | N 314E
|
---|
1883 | M 324D
|
---|
1884 | < 333C
|
---|
1885 | > 343E
|
---|
1886 | ? 353F
|
---|
1887 | Shift Gray * 372A
|
---|
1888 | Shift Alt **
|
---|
1889 | Shift Space 3920
|
---|
1890 | Shift Caps Lock **
|
---|
1891 | Shift F1 5400
|
---|
1892 | Shift F2 5500
|
---|
1893 | Shift F3 5600
|
---|
1894 | Shift F4 5700
|
---|
1895 | Shift F5 5800
|
---|
1896 | Shift F6 5900
|
---|
1897 | Shift F7 5A00
|
---|
1898 | Shift F8 5B00
|
---|
1899 | Shift F9 5C00
|
---|
1900 | Shift F10 5D00
|
---|
1901 | Shift F11 8700
|
---|
1902 | Shift F12 8800
|
---|
1903 | Shift Num Lock **
|
---|
1904 | Shift Scroll Lock **
|
---|
1905 | Shift 7 (number pad) 4737
|
---|
1906 | Shift 8 (number pad) 4838
|
---|
1907 | Shift 9 (number pad) 4939
|
---|
1908 | Shift Gray - 4A2D
|
---|
1909 | Shift 4 (number pad) 4B34
|
---|
1910 | Shift 5 (number pad) 4C35
|
---|
1911 | Shift 6 (number pad) 4D36
|
---|
1912 | Shift Gray + 4E2B
|
---|
1913 | Shift 1 (number pad) 4F31
|
---|
1914 | Shift 2 (number pad) 5032
|
---|
1915 | Shift 3 (number pad) 5133
|
---|
1916 | Shift 0 (number pad) 5230
|
---|
1917 | Shift . (number pad) 532E
|
---|
1918 | Shift SysReq **
|
---|
1919 | Shift Key 45 [1] 567C
|
---|
1920 | Shift Enter (number pad) 1C0D
|
---|
1921 | Shift Gray / 352F
|
---|
1922 | Shift PrtSc **
|
---|
1923 | Shift Pause **
|
---|
1924 | Shift Gray Home 4700
|
---|
1925 | Shift Gray Up Arrow 4800
|
---|
1926 | Shift Gray Page Up 4900
|
---|
1927 | Shift Gray Left Arrow 4B00
|
---|
1928 | Shift Gray Right Arrow 4D00
|
---|
1929 | Shift Gray End 4F00
|
---|
1930 | Shift Gray Down Arrow 5000
|
---|
1931 | Shift Gray Page Down 5100
|
---|
1932 | Shift Gray Insert 5200
|
---|
1933 | Shift Gray Delete 5300
|
---|
1934 |
|
---|
1935 | Ctrl Esc 011B
|
---|
1936 | Ctrl 1 --
|
---|
1937 | Ctrl 2 (NUL) 0300
|
---|
1938 | Ctrl 3 --
|
---|
1939 | Ctrl 4 --
|
---|
1940 | Ctrl 5 --
|
---|
1941 | Ctrl 6 (RS) 071E
|
---|
1942 | Ctrl 7 --
|
---|
1943 | Ctrl 8 --
|
---|
1944 | Ctrl 9 --
|
---|
1945 | Ctrl 0 --
|
---|
1946 | Ctrl - 0C1F
|
---|
1947 | Ctrl = --
|
---|
1948 | Ctrl Backspace (DEL) 0E7F
|
---|
1949 | Ctrl Tab 9400
|
---|
1950 | Ctrl q (DC1) 1011
|
---|
1951 | Ctrl w (ETB) 1117
|
---|
1952 | Ctrl e (ENQ) 1205
|
---|
1953 | Ctrl r (DC2) 1312
|
---|
1954 | Ctrl t (DC4) 1414
|
---|
1955 | Ctrl y (EM) 1519
|
---|
1956 | Ctrl u (NAK) 1615
|
---|
1957 | Ctrl i (HT) 1709
|
---|
1958 | Ctrl o (SI) 180F
|
---|
1959 | Ctrl p (DEL) 1910
|
---|
1960 | Ctrl [ (ESC) 1A1B
|
---|
1961 | Ctrl ] (GS) 1B1D
|
---|
1962 | Ctrl Enter (LF) 1C0A
|
---|
1963 | Ctrl a (SOH) 1E01
|
---|
1964 | Ctrl s (DC3) 1F13
|
---|
1965 | Ctrl d (EOT) 2004
|
---|
1966 | Ctrl f (ACK) 2106
|
---|
1967 | Ctrl g (BEL) 2207
|
---|
1968 | Ctrl h (Backspace) 2308
|
---|
1969 | Ctrl j (LF) 240A
|
---|
1970 | Ctrl k (VT) 250B
|
---|
1971 | Ctrl l (FF) 260C
|
---|
1972 | Ctrl ; --
|
---|
1973 | Ctrl ' --
|
---|
1974 | Ctrl ` --
|
---|
1975 | Ctrl Shift **
|
---|
1976 | Ctrl \ (FS) 2B1C
|
---|
1977 | Ctrl z (SUB) 2C1A
|
---|
1978 | Ctrl x (CAN) 2D18
|
---|
1979 | Ctrl c (ETX) 2E03
|
---|
1980 | Ctrl v (SYN) 2F16
|
---|
1981 | Ctrl b (STX) 3002
|
---|
1982 | Ctrl n (SO) 310E
|
---|
1983 | Ctrl m (CR) 320D
|
---|
1984 | Ctrl , --
|
---|
1985 | Ctrl . --
|
---|
1986 | Ctrl / --
|
---|
1987 | Ctrl Gray * 9600
|
---|
1988 | Ctrl Alt **
|
---|
1989 | Ctrl Space 3920
|
---|
1990 | Ctrl Caps Lock --
|
---|
1991 | Ctrl F1 5E00
|
---|
1992 | Ctrl F2 5F00
|
---|
1993 | Ctrl F3 6000
|
---|
1994 | Ctrl F4 6100
|
---|
1995 | Ctrl F5 6200
|
---|
1996 | Ctrl F6 6300
|
---|
1997 | Ctrl F7 6400
|
---|
1998 | Ctrl F8 6500
|
---|
1999 | Ctrl F9 6600
|
---|
2000 | Ctrl F10 6700
|
---|
2001 | Ctrl F11 8900
|
---|
2002 | Ctrl F12 8A00
|
---|
2003 | Ctrl Num Lock --
|
---|
2004 | Ctrl Scroll Lock --
|
---|
2005 | Ctrl White Home 7700
|
---|
2006 | Ctrl White Up Arrow 8D00
|
---|
2007 | Ctrl White PgUp 8400
|
---|
2008 | Ctrl Gray - 8E00
|
---|
2009 | Ctrl White Left Arrow 7300
|
---|
2010 | Ctrl 5 (number pad) 8F00
|
---|
2011 | Ctrl White Right Arrow 7400
|
---|
2012 | Ctrl Gray + 9000
|
---|
2013 | Ctrl White End 7500
|
---|
2014 | Ctrl White Down Arrow 9100
|
---|
2015 | Ctrl White PgDn 7600
|
---|
2016 | Ctrl White Ins 9200
|
---|
2017 | Ctrl White Del 9300
|
---|
2018 | Ctrl SysReq **
|
---|
2019 | Ctrl Key 45 [1] --
|
---|
2020 | Ctrl Enter (number pad) 1C0A
|
---|
2021 | Ctrl / (number pad) 9500
|
---|
2022 | Ctrl PrtSc 7200
|
---|
2023 | Ctrl Break 0000
|
---|
2024 | Ctrl Gray Home 7700
|
---|
2025 | Ctrl Gray Up Arrow 8DE0
|
---|
2026 | Ctrl Gray Page Up 8400
|
---|
2027 | Ctrl Gray Left Arrow 7300
|
---|
2028 | Ctrl Gray Right Arrow 7400
|
---|
2029 | Ctrl Gray End 7500
|
---|
2030 | Ctrl Gray Down Arrow 91E0
|
---|
2031 | Ctrl Gray Page Down 7600
|
---|
2032 | Ctrl Gray Insert 92E0
|
---|
2033 | Ctrl Gray Delete 93E0
|
---|
2034 |
|
---|
2035 | Alt Esc 0100
|
---|
2036 | Alt 1 7800
|
---|
2037 | Alt 2 7900
|
---|
2038 | Alt 3 7A00
|
---|
2039 | Alt 4 7B00
|
---|
2040 | Alt 5 7C00
|
---|
2041 | Alt 6 7D00
|
---|
2042 | Alt 7 7E00
|
---|
2043 | Alt 8 7F00
|
---|
2044 | Alt 9 8000
|
---|
2045 | Alt 0 8100
|
---|
2046 | Alt - 8200
|
---|
2047 | Alt = 8300
|
---|
2048 | Alt Backspace 0E00
|
---|
2049 | Alt Tab A500
|
---|
2050 | Alt q 1000
|
---|
2051 | Alt w 1100
|
---|
2052 | Alt e 1200
|
---|
2053 | Alt r 1300
|
---|
2054 | Alt t 1400
|
---|
2055 | Alt y 1500
|
---|
2056 | Alt u 1600
|
---|
2057 | Alt i 1700
|
---|
2058 | Alt o 1800
|
---|
2059 | Alt p 1900
|
---|
2060 | Alt [ 1A00
|
---|
2061 | Alt ] 1B00
|
---|
2062 | Alt Enter 1C00
|
---|
2063 | Alt Ctrl **
|
---|
2064 | Alt a 1E00
|
---|
2065 | Alt s 1F00
|
---|
2066 | Alt d 2000
|
---|
2067 | Alt f 2100
|
---|
2068 | Alt g 2200
|
---|
2069 | Alt h 2300
|
---|
2070 | Alt j 2400
|
---|
2071 | Alt k 2500
|
---|
2072 | Alt l 2600
|
---|
2073 | Alt ; 2700
|
---|
2074 | Alt ' 2800
|
---|
2075 | Alt ` 2900
|
---|
2076 | Alt Shift **
|
---|
2077 | Alt \ 2B00
|
---|
2078 | Alt z 2C00
|
---|
2079 | Alt x 2D00
|
---|
2080 | Alt c 2E00
|
---|
2081 | Alt v 2F00
|
---|
2082 | Alt b 3000
|
---|
2083 | Alt n 3100
|
---|
2084 | Alt m 3200
|
---|
2085 | Alt , 3300
|
---|
2086 | Alt . 3400
|
---|
2087 | Alt / 3500
|
---|
2088 | Alt Gray * 3700
|
---|
2089 | Alt Space 3920
|
---|
2090 | Alt Caps Lock **
|
---|
2091 | Alt F1 6800
|
---|
2092 | Alt F2 6900
|
---|
2093 | Alt F3 6A00
|
---|
2094 | Alt F4 6B00
|
---|
2095 | Alt F5 6C00
|
---|
2096 | Alt F6 6D00
|
---|
2097 | Alt F7 6E00
|
---|
2098 | Alt F8 6F00
|
---|
2099 | Alt F9 7000
|
---|
2100 | Alt F10 7100
|
---|
2101 | Alt F11 8B00
|
---|
2102 | Alt F12 8C00
|
---|
2103 | Alt Num Lock **
|
---|
2104 | Alt Scroll Lock **
|
---|
2105 | Alt Gray - 4A00
|
---|
2106 | Alt Gray + 4E00
|
---|
2107 | Alt 7 (number pad) #
|
---|
2108 | Alt 8 (number pad) #
|
---|
2109 | Alt 9 (number pad) #
|
---|
2110 | Alt 4 (number pad) #
|
---|
2111 | Alt 5 (number pad) #
|
---|
2112 | Alt 6 (number pad) #
|
---|
2113 | Alt 1 (number pad) #
|
---|
2114 | Alt 2 (number pad) #
|
---|
2115 | Alt 3 (number pad) #
|
---|
2116 | Alt Del --
|
---|
2117 | Alt SysReq **
|
---|
2118 | Alt Key 45 [1] --
|
---|
2119 | Alt Enter (number pad) A600
|
---|
2120 | Alt / (number pad) A400
|
---|
2121 | Alt PrtSc **
|
---|
2122 | Alt Pause **
|
---|
2123 | Alt Gray Home 9700
|
---|
2124 | Alt Gray Up Arrow 9800
|
---|
2125 | Alt Gray Page Up 9900
|
---|
2126 | Alt Gray Left Arrow 9B00
|
---|
2127 | Alt Gray Right Arrow 9D00
|
---|
2128 | Alt Gray End 9F00
|
---|
2129 | Alt Gray Down Arrow A000
|
---|
2130 | Alt Gray Page Down A100
|
---|
2131 | Alt Gray Insert A200
|
---|
2132 | Alt Gray Delete A300
|
---|
2133 |
|
---|
2134 | -------------------------------------------------------------------------
|
---|
2135 |
|
---|
2136 | Footnotes
|
---|
2137 | 脚注
|
---|
2138 | [1] In the United States, the 101/102-key keyboard is shipped
|
---|
2139 | with 101 keys. Overseas versions have an additional key
|
---|
2140 | sandwiched between the left Shift key and the Z key. This
|
---|
2141 | additional key is identified by IBM (and in this table) as
|
---|
2142 | "Key 45."
|
---|
2143 | 在美国,101/102键键盘有101 个键。海外版本有一个附加的键,夹在
|
---|
2144 | 左上档键和Z 键之间。此附加键是由IBM 确定的(在本表中是 45 键)。
|
---|
2145 |
|
---|
2146 | [**] Keys and key combinations marked ** are used by the ROM BIOS
|
---|
2147 | but do not put values into the keyboard buffer.
|
---|
2148 | 键及键组合若有 ** 标记,则被ROM BIOS所使用,但不会将键值放入键盘
|
---|
2149 | 缓冲区。
|
---|
2150 |
|
---|
2151 | [--] Keys and key combinations marked -- are ignored by the ROM
|
---|
2152 | BIOS.
|
---|
2153 | 键及键组合若有 -- 标记,则被ROM BIOS所忽略。
|
---|
2154 |
|
---|
2155 |
|
---|
2156 |
|
---|
2157 | 3. From "http://heim.ifi.uio.no/~stanisls/helppc/make_codes.html":
|
---|
2158 | 转自“http://heim.ifi.uio.no/~stanisls/helppc/make_codes.html”:
|
---|
2159 |
|
---|
2160 | INT 9 - Hardware Keyboard Make/Break Codes
|
---|
2161 | INT 9 - 硬件键盘的通/断码
|
---|
2162 |
|
---|
2163 | Key Make Break Key Make Break
|
---|
2164 | 键位 通码 断码 键位 通码 断码
|
---|
2165 |
|
---|
2166 | Backspace 0E 8E F1 3B BB
|
---|
2167 | Caps Lock 3A BA F2 3C BC
|
---|
2168 | Enter 1C 9C F3 3D BD
|
---|
2169 | Esc 01 81 F4 3E BE
|
---|
2170 | Left Alt 38 B8 F7 41 C1
|
---|
2171 | Left Ctrl 1D 9D F5 3F BF
|
---|
2172 | Left Shift 2A AA F6 40 C0
|
---|
2173 | Num Lock 45 C5 F8 42 C2
|
---|
2174 | Right Shift 36 B6 F9 43 C3
|
---|
2175 | Scroll Lock 46 C6 F10 44 C4
|
---|
2176 | Space 39 B9 F11 57 D7
|
---|
2177 | Sys Req (AT) 54 D4 F12 58 D8
|
---|
2178 | Tab 0F 8F
|
---|
2179 |
|
---|
2180 | Keypad Keys Make Break
|
---|
2181 | 数字小键盘键位 通码 断码
|
---|
2182 |
|
---|
2183 | Keypad 0 (Ins) 52 D2
|
---|
2184 | Keypad 1 (End) 4F CF
|
---|
2185 | Keypad 2 (Down arrow) 50 D0
|
---|
2186 | Keypad 3 (PgDn) 51 D1
|
---|
2187 | Keypad 4 (Left arrow) 4B CB
|
---|
2188 | Keypad 5 4C CC
|
---|
2189 | Keypad 6 (Right arrow) 4D CD
|
---|
2190 | Keypad 7 (Home) 47 C7
|
---|
2191 | Keypad 8 (Up arrow) 48 C8
|
---|
2192 | Keypad 9 (PgUp) 49 C9
|
---|
2193 | Keypad . (Del) 53 D3
|
---|
2194 | Keypad * (PrtSc) 37 B7
|
---|
2195 | Keypad - 4A CA
|
---|
2196 | Keypad + 4E CE
|
---|
2197 |
|
---|
2198 | Key Make Break Key Make Break
|
---|
2199 | 键位 通码 断码 键位 通码 断码
|
---|
2200 |
|
---|
2201 | A 1E 9E N 31 B1
|
---|
2202 | B 30 B0 O 18 98
|
---|
2203 | C 2E AE P 19 99
|
---|
2204 | D 20 A0 Q 10 90
|
---|
2205 | E 12 92 R 13 93
|
---|
2206 | F 21 A1 S 1F 9F
|
---|
2207 | G 22 A2 T 14 94
|
---|
2208 | H 23 A3 U 16 96
|
---|
2209 | I 17 97 V 2F AF
|
---|
2210 | J 24 A4 W 11 91
|
---|
2211 | K 25 A5 X 2D AD
|
---|
2212 | L 26 A6 Y 15 95
|
---|
2213 | M 32 B2 Z 2C AC
|
---|
2214 |
|
---|
2215 | Key Make Break Key Make Break
|
---|
2216 | 键位 通码 断码 键位 通码 断码
|
---|
2217 |
|
---|
2218 | 1 02 82 - 0C 8C
|
---|
2219 | 2 03 83 = 0D 8D
|
---|
2220 | 3 04 84 [ 1A 9A
|
---|
2221 | 4 05 85 ] 1B 9B
|
---|
2222 | 5 06 86 ; 27 A7
|
---|
2223 | 6 07 87 ' 28 A8
|
---|
2224 | 7 08 88 ` 29 A9
|
---|
2225 | 8 09 89 \ 2B AB
|
---|
2226 | 9 0A 8A , 33 B3
|
---|
2227 | 0 0B 8B . 34 B4
|
---|
2228 | / 35 B5
|
---|
2229 |
|
---|
2230 |
|
---|
2231 | Enhanced Keyboard Keys (101/102 keys)
|
---|
2232 | 键盘扩展键 (101/102 键)
|
---|
2233 |
|
---|
2234 | Control Keys Make Break
|
---|
2235 | 控制键 通码 断码
|
---|
2236 |
|
---|
2237 | Alt-PrtSc (SysReq) 54 D4
|
---|
2238 | Ctrl-PrtSc E0 37 E0 B7
|
---|
2239 | Enter E0 1C E0 9C
|
---|
2240 | PrtSc E0 2A E0 37 E0 B7 E0 AA
|
---|
2241 | Right Alt E0 38 E0 B8
|
---|
2242 | Right Ctrl E0 1D E0 9D
|
---|
2243 | Shift-PrtSc E0 37 E0 B7
|
---|
2244 | / E0 35 E0 B5
|
---|
2245 | Pause E1 1D 45 E1 9D C5 (not typematic)
|
---|
2246 | Ctrl-Pause (Ctrl-Break) E0 46 E0 C6 (not typematic)
|
---|
2247 |
|
---|
2248 | - Keys marked as "not typematic" generate one stream of bytes
|
---|
2249 | without corresponding break scan code bytes (actually the
|
---|
2250 | break codes are part of the make code).
|
---|
2251 | 键位是以未使用断码扫描码字节信息的“非机器自动连续打印的"所
|
---|
2252 | 生成的一种扫描码字节流来标记的。(实际上断码是通码的一部分)
|
---|
2253 | (译注:typematic 有人翻译为‘机打’)
|
---|
2254 |
|
---|
2255 |
|
---|
2256 | Normal Mode or
|
---|
2257 | Shift w/Numlock
|
---|
2258 | 常态或上档态及
|
---|
2259 | 数字键盘锁定态模式
|
---|
2260 |
|
---|
2261 | Key Make Break |----- Numlock on ------.
|
---|
2262 | 数字键盘锁定
|
---|
2263 | Make Break
|
---|
2264 | 键位 通码 断码 通码 断码
|
---|
2265 |
|
---|
2266 | Del E0 53 E0 D3 E0 2A E0 53 E0 D3 E0 AA
|
---|
2267 | Down arrow E0 50 E0 D0 E0 2A E0 50 E0 D0 E0 AA
|
---|
2268 | End E0 4F E0 CF E0 2A E0 4F E0 CF E0 AA
|
---|
2269 | Home E0 47 E0 C7 E0 2A E0 47 E0 C7 E0 AA
|
---|
2270 | Ins E0 52 E0 D2 E0 2A E0 52 E0 D2 E0 AA
|
---|
2271 | Left arrow E0 4B E0 CB E0 2A E0 4B E0 CB E0 AA
|
---|
2272 | PgDn E0 51 E0 D1 E0 2A E0 51 E0 D1 E0 AA
|
---|
2273 | PgUp E0 49 E0 C9 E0 2A E0 49 E0 C9 E0 AA
|
---|
2274 | Right arrow E0 4D E0 CD E0 2A E0 4D E0 CD E0 AA
|
---|
2275 | Up arrow E0 48 E0 C8 E0 2A E0 48 E0 C8 E0 AA
|
---|
2276 |
|
---|
2277 | Key |--Left Shift Pressed--. |--Right Shift Pressed--.
|
---|
2278 | 键位 左上档键按下时 右上档键按下时
|
---|
2279 |
|
---|
2280 | Make Break Make Break
|
---|
2281 | 通码 断码 通码 断码
|
---|
2282 |
|
---|
2283 | Del E0 AA E0 53 E0 D3 E0 2A E0 B6 E0 53 E0 D3 E0 36
|
---|
2284 | Down arrow E0 AA E0 50 E0 D0 E0 2A E0 B6 E0 50 E0 D0 E0 36
|
---|
2285 | End E0 AA E0 4F E0 CF E0 2A E0 B6 E0 4F E0 CF E0 36
|
---|
2286 | Home E0 AA E0 47 E0 C7 E0 2A E0 B6 E0 47 E0 C7 E0 36
|
---|
2287 | Ins E0 AA E0 52 E0 D2 E0 2A E0 B6 E0 52 E0 D2 E0 36
|
---|
2288 | Left arrow E0 AA E0 4B E0 CB E0 2A E0 B6 E0 4B E0 CB E0 36
|
---|
2289 | PgDn E0 AA E0 51 E0 D1 E0 2A E0 B6 E0 51 E0 D1 E0 36
|
---|
2290 | PgUp E0 AA E0 49 E0 C9 E0 2A E0 B6 E0 49 E0 C9 E0 36
|
---|
2291 | Right arrow E0 AA E0 4D E0 CD E0 2A E0 B6 E0 4D E0 CD E0 36
|
---|
2292 | Up arrow E0 AA E0 48 E0 C8 E0 2A E0 B6 E0 48 E0 C8 E0 36
|
---|
2293 | / E0 AA E0 35 E0 B5 E0 2A E0 B6 E0 35 E0 B5 E0 36
|
---|
2294 |
|
---|
2295 |
|
---|
2296 | - The PS/2 models have three make/break scan code sets. The first
|
---|
2297 | set matches the PC & XT make/break scan code set and is the one
|
---|
2298 | listed here. Scan code sets are selected by writing the value F0
|
---|
2299 | to the keyboard via the 8042 (port 60h). The following is a brief
|
---|
2300 | description of the scan code sets (see the PS/2 Technical Reference
|
---|
2301 | manuals for more information on scan code sets 2 and 3):
|
---|
2302 | PS/2 类型有三套通断扫描码。其中第一套是适用于PC & XT 的通断码扫描码集,
|
---|
2303 | 并列在了这里。扫描码集可以通过向8042 键盘控制器(端口60)写入值 F0 来
|
---|
2304 | 选择。下面是扫描码集的简要介绍(更多第2,3套扫描码集的信息见PS/2 技术
|
---|
2305 | 参考手册)
|
---|
2306 |
|
---|
2307 | / set 1, each key has a base scan code. Some keys generate
|
---|
2308 | extra scan codes to generate artificial shift states. This
|
---|
2309 | is similar to the standard scan code set used on the PC and XT.
|
---|
2310 | 第一套扫描码集,每个键具有一个基本的扫描码。一些键产生扩展扫
|
---|
2311 | 描码以便人工生成上档状态。它与 PC 和 XT 机上的标准扫描码相似。
|
---|
2312 |
|
---|
2313 | / set 2, each key sends one make scan code and two break scan
|
---|
2314 | codes bytes (F0 followed by the make code). This scan code
|
---|
2315 | set is available on the IBM AT also.
|
---|
2316 | 第二套扫描码集,每个键发送一个通码扫描码和两个断码扫描码字节
|
---|
2317 | (通码在F0之后)。这套扫描码集在 IBM AT 机上也有效。
|
---|
2318 |
|
---|
2319 | / set 3, each key sends one make scan code and two break scan
|
---|
2320 | codes bytes (F0 followed by the make code) and no keys are
|
---|
2321 | altered by Shift/Alt/Ctrl keys.
|
---|
2322 | 第三套扫描码集,每个键发送一个通码扫描码和两个断码扫描码字节
|
---|
2323 | (通码在F0之后)并且键位不随 Shift/Alt/Ctrl 等键的使用而改变。
|
---|
2324 |
|
---|
2325 | / typematic scan codes are the same as the make scan code
|
---|
2326 | “非机器自动连续打印的”扫描码和通码扫描码是相同的。
|
---|
2327 |
|
---|
2328 | - Some Tandy 1000's do not handle Alt key combinations when multiple
|
---|
2329 | shift keys are pressed. The Alt-Shift-H combination loses the Alt.
|
---|
2330 | 一些 Tandy 1000 机器在多重组合键的 shift 键被按下时不能处理 ALT 键。
|
---|
2331 | 使用键组合 Alt-Shift-H 时会丢失 ALT 键。
|
---|
2332 |
|
---|
2333 | - extended keys like (F11, F12) can only be read with systems that
|
---|
2334 | have extended keyboard BIOS support (or INT 9 extensions); to
|
---|
2335 | read these special keys on these systems INT 16,10 must be used
|
---|
2336 | 扩展键比如(F11,F12)等只能在具有 BIOS 键盘扩展支持(或 INT 9 扩展)
|
---|
2337 | 的系统上被读取。用INT16读取这些系统上的特别的键时,必须使用10号功能 。
|
---|
2338 |
|
---|
2339 |
|
---|
2340 | ******************************************************************************
|
---|
2341 | *** GRLDR Error messages ***
|
---|
2342 | ******************************************************************************
|
---|
2343 | GRLDR 错误提示信息
|
---|
2344 |
|
---|
2345 | 1. Missing MBR-helper.
|
---|
2346 | 缺少主引导辅助记录。
|
---|
2347 |
|
---|
2348 | 紧接在主引导记录后的辅助功能程序不见了,或者是它已经被病毒或 Windows
|
---|
2349 | XP/Vista等删除了。
|
---|
2350 |
|
---|
2351 | 运行 bootlace.com 工具来解决这个问题。
|
---|
2352 |
|
---|
2353 | 2. Buggy BIOS!
|
---|
2354 | 缺陷太多的BIOS!
|
---|
2355 |
|
---|
2356 | 你的 BIOS 太糟糕了。它甚至不能支持 INT 13/AH=8 。
|
---|
2357 |
|
---|
2358 | 除了升级你的 BIOS 没有办法解决。未来,缺陷多的 BIOS 将会很常见而且
|
---|
2359 | 会对 grub4dos 造成很多问题。
|
---|
2360 |
|
---|
2361 | 3. This partition is NTFS but with unknown boot record. Please install
|
---|
2362 | Microsoft NTFS boot sectors to this partition correctly, or create an
|
---|
2363 | FAT12/16/32 partition and place the same copy of GRLDR and MENU.LST there.
|
---|
2364 | 此分区系统是 NTFS 但包含未知的引导记录。请安装正确的微软 NTFS 引导扇区到
|
---|
2365 | 这个分区,或者建立一个FAT12/16/32的分区并将GRLDR 及MENU.LST 的相同的备份
|
---|
2366 | 文件放到那里。
|
---|
2367 |
|
---|
2368 | The boot record was changed or erased by Microsoft Windows XP Service
|
---|
2369 | Pack 2.
|
---|
2370 | 引导记录已经被微软 Windows XP Service Pack 2 改变或删除。
|
---|
2371 |
|
---|
2372 | You may install the old boot record introduced with the original clean
|
---|
2373 | Windows 2K/XP. As another solution, you may create an FAT partition
|
---|
2374 | for your system, and copy GRLDR and your MENU.LST to its root dir.
|
---|
2375 | 你可以用原来的引导记录来安装,以清理掉Windows 2K/XP的记录。另一个解决办
|
---|
2376 | 法是,你可以在系统上建立一个FAT分区,并且将GRLDR 和你的MENU.LST复制到它
|
---|
2377 | 的根目录。
|
---|
2378 |
|
---|
2379 | While the startup code of grldr might fail to load GRLDR in NTFS
|
---|
2380 | partitions, it always successfully loads GRLDR in FAT partitions(and
|
---|
2381 | even in ext2/ext3 partitions).
|
---|
2382 | 在NTFS分区grldr的自举代码在加载GRLDR时可能会失败,但在FAT分区(甚至在
|
---|
2383 | ext2/ext3分区)它总能成功加载 GRLDR 。
|
---|
2384 |
|
---|
2385 | Note that NTLDR only loads the startup code of grldr(i.e., the leading
|
---|
2386 | 16 sectors of grldr), not the whole grldr file.
|
---|
2387 | 注意 NTLDR只能加载grldr的自举代码(即,grldr开头的16个扇区),而不能将
|
---|
2388 | 整个grldr载入。
|
---|
2389 |
|
---|
2390 |
|
---|
2391 | Thus, C:\GRLDR must exist(here C: can be NTFS), since it is used for
|
---|
2392 | BOOT.INI and NTLDR. If C: is NTFS, X:\GRLDR should exist as well,
|
---|
2393 | where X: stands for a certain FAT partition.
|
---|
2394 | 因此,自从它用于 BOOT.INI 和 NTLDR 以来 ,C 盘根目录下必须存在有GRLDR
|
---|
2395 | (这里的C盘可以是 NTFS 文件系统)。
|
---|
2396 |
|
---|
2397 |
|
---|
2398 |
|
---|
2399 | ******************************************************************************
|
---|
2400 | *** Known BIOS bugs ***
|
---|
2401 | ******************************************************************************
|
---|
2402 | 已知的BIOS 缺陷
|
---|
2403 |
|
---|
2404 | 1. 一些较新的 Dell 机不能支持int13/AH=43h 。当你尝试对仿真磁盘进行写访问时,
|
---|
2405 | 可能会遭遇失败。
|
---|
2406 |
|
---|
2407 | 注意:这个缺陷非常严重!老的安装方法"root+setup" (在实模式的grub环
|
---|
2408 | 境中)使用INT13将stage2文件写入第一扇区。在这些有缺陷的DELL机上通过
|
---|
2409 | LBA 模式来访问 stage2 文件时将会失败。
|
---|
2410 |
|
---|
2411 | 2.一些有缺陷的BIOS不能引导启动光盘映像文件(见前面)。(虚拟机qemu 能良好的引导)
|
---|
2412 |
|
---|
2413 | 3.在DOS下运行GRUB.EXE时,一些较新的 Dell 机激烈地破坏那些硬件中断请求的中断向量,
|
---|
2414 | 而使得机器会失去响应 。你可以尝试用BADGRUB.EXE来再试一次。
|
---|
2415 |
|
---|
2416 | 4.有报告称,通过Linux中的kexec启动GRUB.EXE后,一些BIOS将功能异常。报告称一些
|
---|
2417 | 机器会死机,而另一些不能访问USB驱动器。
|
---|
2418 |
|
---|
2419 | ******************************************************************************
|
---|
2420 | *** Known Problems ***
|
---|
2421 | ******************************************************************************
|
---|
2422 | 已知问题
|
---|
2423 | 1. 在 Windows 9x/Me的DOS窗口运行GRUB.EXE时可能会死机,特别是在这些系统
|
---|
2424 | 使用USB的时候。在Linux下通过KEXEC运行GRUB.EXE时,你也可能碰到同样的
|
---|
2425 | 问题。
|
---|
2426 |
|
---|
2427 | 注意: 你不能在已进入保护模式的Win 9x 中运行GRUB.EXE,那可能会死机;作为变
|
---|
2428 | 通,你可以执行“重启并进入MS-DOS模式”选项来达到运行 GRUB.EXE 的目
|
---|
2429 | 的,这很安全。
|
---|
2430 |
|
---|
2431 | 2. 默认的chainloader动作将保持 A20 的状态。一些有缺陷的 DOS 扩展内存管理软
|
---|
2432 | 件可能会令机器死掉。你可以在chainloader命令行中使用--disable-a20选项
|
---|
2433 | 然后再试一次。至少,你应当避免使用那些有缺陷的内存管理软件。
|
---|
2434 |
|
---|
2435 | 3. THTF BIOS L4S5M Ver 1.1a(dated 2002-1-10) has a buggy int15 which
|
---|
2436 | causes hang at the boot of a multi boot kernel(memdisk for example).
|
---|
2437 | OEM签名为清华同方,主板为精英L4S5M, BIOS版本1.1a(日期 2002-1-10)
|
---|
2438 | 的机器上,其 int15 含有缺陷,当它启动一个多重引导核心时,会失去响应。
|
---|
2439 | (比如使用syslinux的memdisk时)
|
---|
2440 |
|
---|
2441 | 4. 在天汇标准中文系统中,较新的GRUB.EXE不能运行。
|
---|
2442 | 总之,在具有反跟踪措施的内存驻留程序的系统下GRUB.EXE不再运行。
|
---|
2443 |
|
---|
2444 | ******************************************************************************
|
---|
2445 | *** List of binary files and their corresponding source files ***
|
---|
2446 | ******************************************************************************
|
---|
2447 | 二进制文件及对应的源代码文件列表
|
---|
2448 |
|
---|
2449 | binary file main source file other included source or binary files
|
---|
2450 | 二进制文件 源代码主文件 包含的其他源代码或二进制文件
|
---|
2451 | ------------- ---------------- -------------------------------------
|
---|
2452 |
|
---|
2453 | bootlace.com bootlacestart.S bootlace.inc, grldrstart.S
|
---|
2454 |
|
---|
2455 | grldr grldrstart.S pre_stage2(binary, See note below)
|
---|
2456 |
|
---|
2457 | grldr.mbr mbrstart.S grldrstart.S
|
---|
2458 |
|
---|
2459 | grub.exe dosstart.S pre_stage2(binary, See note below)
|
---|
2460 |
|
---|
2461 | hmload.com hmloadstart.S
|
---|
2462 |
|
---|
2463 | -----------------------------------------------------------------------------
|
---|
2464 | 注意:pre_stage2 是GNU GRUB的主体程序,它以二进制格式被简单的添加到grldrstart
|
---|
2465 | 及dosstart部分,形成我们的grldr和grub.exe 。
|
---|
2466 |
|
---|
2467 | 注意:GRUB (无.exe后缀)在Linux下是一个静态链接的 ELF 格式的可执行文件,它
|
---|
2468 | 可以被GRUB Shell正常调用。GRUB Shell 是一个启动管理软件,但并不是一个引导装
|
---|
2469 | 载器(boot 命令在GRUB Shell里不能执行)。GRUB.EXE (通过KEXEC)能作为一个引
|
---|
2470 | 导装载器直接在 Linux 下使用。
|
---|
2471 |
|
---|
2472 | ******************************************************************************
|
---|
2473 | *** Memory Layout for Quiting to DOS from GRUB.EXE ***
|
---|
2474 | ******************************************************************************
|
---|
2475 | GRUB.EXE 返回 DOS 时的内存布局
|
---|
2476 |
|
---|
2477 | 使用 quit 命令实现返回到DOS,是在GRUB.EXE是从DOS启动的情况下。
|
---|
2478 |
|
---|
2479 | 1.在GRUB.EXE 将控制权移交给 pre_stage2 之前,它将复制 640 kb的常规内存到
|
---|
2480 | 物理地址0x200000 (即,2 M)处,并将立即写入4 字节的长整数到常规内存备
|
---|
2481 | 份区之后:
|
---|
2482 | At 0x2A0000: 0x50554B42, it is the "BKUP" signature.
|
---|
2483 | 0x50554b42, 它是“BKUP”的签名 。
|
---|
2484 |
|
---|
2485 | At 0x2A0004: Gate A20 status under DOS: non-zero means A20 on;
|
---|
2486 | zero means A20 off. Update: A20 always on, see below.
|
---|
2487 | DOS下的A20地址线门状态:非零表示A20开启;零表示A20
|
---|
2488 | 地址线关闭。更新:A20 始终开启,参见后面。
|
---|
2489 |
|
---|
2490 | At 0x2A0008: high word is boot-CS, low word is boot-IP. The quit
|
---|
2491 | command uses this entry point to return to DOS.
|
---|
2492 | 高字节是引导的代码段段地址,低字节是引导的指令指针值。
|
---|
2493 | 退出命令 quit 使用这个入口点返回DOS。
|
---|
2494 |
|
---|
2495 | At 0x2A000C: CheckSum: the sum of all long integers in the memory
|
---|
2496 | range from 0x200000 to 0x2A000F is 0.
|
---|
2497 | 校验和:内存范围从0x200000 到 0x2A000F的所有长整数的
|
---|
2498 | 和为 0 。
|
---|
2499 |
|
---|
2500 | 2.如果上述内存结构被某个grub命令所破坏,quit命令将发出一条错误提示信息而拒绝从grub中返回DOS。
|
---|
2501 |
|
---|
2502 | 3.由于GRUB可能破坏扩展内存,在DOS下你最好避免在GRUB.EXE运行前使用扩展内存。
|
---|
2503 |
|
---|
2504 | 4. Gate A20 will be enabled by GRUB.EXE. Hopefully this would hurt nothing.
|
---|
2505 | GRUB.EXE将开启A20 地址线。真希望这不会危及任何东西。
|
---|
2506 |
|
---|
2507 | ******************************************************************************
|
---|
2508 | *** Memory usage in conventional/low memory area ***
|
---|
2509 | ******************************************************************************
|
---|
2510 | 常规内存/低端内存空间的内存使用
|
---|
2511 |
|
---|
2512 | 1. boot.c, fsys_reiserfs.c: 8K below 0x68000.
|
---|
2513 |
|
---|
2514 | 2. fsys_ext2fs.c, fsys_minix.c: 1K below 0x68000.
|
---|
2515 |
|
---|
2516 | 3. fsys_jfs.c: 4K + 256 bytes below 0x68000.
|
---|
2517 |
|
---|
2518 | 4. fsys_reiserfs.c: 202 bytes at 0x600.
|
---|
2519 |
|
---|
2520 | 5. fsys_xfs.c: 188 bytes at 0x600.
|
---|
2521 |
|
---|
2522 | 6. fsys_xfs.c: (logical block size) bytes below 0x68000.
|
---|
2523 |
|
---|
2524 | 7. geometry tune: 0x50000 - 0x5ffff.
|
---|
2525 |
|
---|
2526 | ******************************************************************************
|
---|
2527 | *** Command-line Length about GRUB.EXE ***
|
---|
2528 | ******************************************************************************
|
---|
2529 | 关于GRUB.EXE的命令行长度
|
---|
2530 |
|
---|
2531 | GRUB.EXE 可以通过CONFIG.SYS中的DEVICE命令来启动:
|
---|
2532 |
|
---|
2533 | DEVICE=grub.exe [--config-file="FILENAME_OR_COMMANDS"]
|
---|
2534 |
|
---|
2535 | 1. 如果GRUB.EXE是被DEVICE命令调用而且FILENAME_OR_COMMANDS 参数是一个由分号分
|
---|
2536 | 隔的grub命令集合,那么FILENAME_OR_COMMANDS可以接近4 KB长 ----很吃惊?但这是
|
---|
2537 | 事实!MS-DOS 7及以上版本即使允许更长的行,但看起来4 KB对GRUB.EXE足够了。
|
---|
2538 | 当我们希望将一个大菜单嵌入到命令行时,这是非常有用的。注意 grldr 还不支持
|
---|
2539 | 任何命令行参数。
|
---|
2540 |
|
---|
2541 | 2. 如果GRUB.EXE是被INSTALL命令调用,那么选项长度的限制是80个字符(包括开头的
|
---|
2542 | --config-file= 这部分)。超出的话可能会立即将MS-DOS挂起。
|
---|
2543 |
|
---|
2544 | 3. 如果GRUB.EXE是被SHELL命令调用,那么选项长度的的限制是126个字符(包括开头的
|
---|
2545 | --config-file= 这部分)。超出的话虽然不会将 MS-DOS 挂起,但命令行将被截短。
|
---|
2546 | 这和 DOS 控制台或批处理文件中命令的限制是一样的。
|
---|
2547 |
|
---|
2548 | 4. DOS编辑器EDIT不支持一行4KB的长度。所以请使用其他编辑器,例如,vi for Linux 。
|
---|
2549 |
|
---|
2550 | 5. DEVICE=GRUB.EXE 这一行可以和其他的DEVICE命令同时使用,如DEVICE=HIMEM.SYS
|
---|
2551 | 及DEVICE=EMM386.EXE等。配置命令里的GRUB.EXE所在行必须出现在EMM386.EXE所在
|
---|
2552 | 行的前面,以避免因EMM386而冲突。
|
---|
2553 | 更新 :从0.4.2版本起,GRUB.EXE在EMM386.EXE加载后,仍然可以运行。
|
---|
2554 |
|
---|
2555 | 6. 在以上提到的任何情况下,你都可以通过quit命令返回到DOS 。
|
---|
2556 |
|
---|
2557 | 7. 命令行菜单的内存占用:4KB的命令行菜单起始于物理地址0x0800而终止于0x17ff。
|
---|
2558 |
|
---|
2559 | ******************************************************************************
|
---|
2560 | *** New Syntax for the DEFAULT/SAVEDEFAULT Commands ***
|
---|
2561 | ******************************************************************************
|
---|
2562 | DEFAULT 及 SAVEDEFAULT 命令的新语法
|
---|
2563 |
|
---|
2564 | 相对于原来的用法"default NUM"及"default saved "增加的部分,现在有一个新用
|
---|
2565 | 法"default FILE",象这样:
|
---|
2566 |
|
---|
2567 | default (hd0,0)/default
|
---|
2568 |
|
---|
2569 | 注意参数FILE必须是一个有效的DEFAULT文件格式。一个简单的DEFAULT文件就包含
|
---|
2570 | 在发行版中。你可以复制它到你希望的地方,但是你应该避免手工修改它的大小。
|
---|
2571 | DEFAULT文件可以按以下方法使用:
|
---|
2572 | (1) 首先,你要复制一个格式有效的default文件到你运行的系统上。
|
---|
2573 |
|
---|
2574 | (2) 其次,你要使用GRUB中的"default FILE"命令来表明是使用这个FILE作为我们新
|
---|
2575 | 的预设文件,以便"savedefault"命令执行时写入它。
|
---|
2576 |
|
---|
2577 |
|
---|
2578 | (3) 然后,你可以使用"savedefault"命令来把想要的入口数字保存到这个新的预设文
|
---|
2579 | 件中。
|
---|
2580 |
|
---|
2581 | (4) 下次启动时,你可以通过使用类似上面第二步骤中的"default FILE"一样的
|
---|
2582 | 命令来读取已保存的入口数字。
|
---|
2583 |
|
---|
2584 | 同时,SAVEDEFAULT 命令增加了一个选项 --wait=T ,象这样:
|
---|
2585 |
|
---|
2586 | savedefault --wait=5
|
---|
2587 |
|
---|
2588 | 如果`--wait=T' 选项被指定而且 T 非零,savedefault 命令将在它就要写入磁盘
|
---|
2589 | 前,给使用者一个提示信息。
|
---|
2590 |
|
---|
2591 | 这里是一个简单的menu.lst文件:
|
---|
2592 |
|
---|
2593 | #--------------------begin menu.lst---------------------------------------
|
---|
2594 | color black/cyan yellow/cyan
|
---|
2595 | timeout 30
|
---|
2596 | default /default
|
---|
2597 |
|
---|
2598 | title find and load NTLDR of Windows NT/2K/XP
|
---|
2599 | find --set-root /ntldr
|
---|
2600 | chainloader /ntldr
|
---|
2601 | savedefault --wait=2
|
---|
2602 |
|
---|
2603 | title find and load CMLDR, the Recovery Console of Windows NT/2K/XP
|
---|
2604 | fallback 2
|
---|
2605 | find --set-root /cmldr
|
---|
2606 | chainloader /cmldr
|
---|
2607 | #####################################################################
|
---|
2608 | # write string "cmdcons" to memory 0000:7C03 in 2 steps:
|
---|
2609 | #####################################################################
|
---|
2610 | # step 1. Write 4 chars "cmdc" at 0000:7C03
|
---|
2611 | write 0x7C03 0x63646D63
|
---|
2612 | # step 2. Write 3 chars "ons" and an ending null at 0000:7C07
|
---|
2613 | write 0x7C07 0x00736E6F
|
---|
2614 | savedefault --wait=2
|
---|
2615 |
|
---|
2616 | title find and load IO.SYS of Windows 9x/Me
|
---|
2617 | find --set-root /io.sys
|
---|
2618 | chainloader /io.sys
|
---|
2619 | savedefault --wait=2
|
---|
2620 |
|
---|
2621 | title floppy (fd0)
|
---|
2622 | chainloader (fd0)+1
|
---|
2623 | rootnoverify (fd0)
|
---|
2624 | savedefault --wait=2
|
---|
2625 |
|
---|
2626 | title find and boot Linux with menu.lst already installed
|
---|
2627 | find --set-root /sbin/init
|
---|
2628 | savedefault --wait=2
|
---|
2629 | configfile /boot/grub/menu.lst
|
---|
2630 |
|
---|
2631 | title find and boot Mandriva with menu.lst already installed
|
---|
2632 | find --set-root /etc/mandriva-release
|
---|
2633 | savedefault --wait=2
|
---|
2634 | configfile /boot/grub/menu.lst
|
---|
2635 |
|
---|
2636 | title back to dos
|
---|
2637 | savedefault --wait=2
|
---|
2638 | quit
|
---|
2639 |
|
---|
2640 | title commandline
|
---|
2641 | savedefault --wait=2
|
---|
2642 | commandline
|
---|
2643 |
|
---|
2644 | title reboot
|
---|
2645 | savedefault --wait=2
|
---|
2646 | reboot
|
---|
2647 |
|
---|
2648 | title halt
|
---|
2649 | savedefault --wait=2
|
---|
2650 | halt
|
---|
2651 | #--------------------end menu.lst---------------------------------------
|
---|
2652 |
|
---|
2653 | 注意 1:预设文件 DEFAULT 必须是存在的而且具有和前面所述一样严格的格式。
|
---|
2654 |
|
---|
2655 | 注意 2:在一个有 MENU.LST 文件的相同目录中的 DEFAULT 文件将和 MENU.LST 文
|
---|
2656 | 件一起被联合调用
|
---|
2657 |
|
---|
2658 | 注意 3:即使没有出现`default'命令,被关联的 DEFAULT 文件也将自动生效。
|
---|
2659 |
|
---|
2660 | 注意 4:就在菜单文件(诸如,GRLDR 的关联文件MENU.LST,或是通过
|
---|
2661 | `grub.exe --config-file=(DEVICE)/PATH/YOUR_MENU_FILE'来指定的,
|
---|
2662 | 或是通过grub的`configfile'命令来指定的)取得控制权之前,它的
|
---|
2663 | 关联文件DEFAULT只要出现就会被使用,直到遇见了一个明确的`default'命令。
|
---|
2664 |
|
---|
2665 | ******************************************************************************
|
---|
2666 | *** The New `cdrom' Command Syntax ***
|
---|
2667 | ******************************************************************************
|
---|
2668 | 新的 `cdrom' 命令的语法
|
---|
2669 |
|
---|
2670 | 1. 初始化ATAPI接口的CDROM设备:
|
---|
2671 |
|
---|
2672 | grub> cdrom --init
|
---|
2673 |
|
---|
2674 | 显示找到的atapi接口的cdrom光驱的数目:参数为 atapi_dev_count
|
---|
2675 |
|
---|
2676 | 2. 停止ATAPI接口的CDROM设备:
|
---|
2677 |
|
---|
2678 | grub> cdrom --stop
|
---|
2679 |
|
---|
2680 | 这会设置参数atapi_dev_count为0 。
|
---|
2681 |
|
---|
2682 | 3. 增加搜索atapi cdrom设备的IO端口。例如:
|
---|
2683 |
|
---|
2684 | grub> cdrom --add-io-ports=0x03F601F0
|
---|
2685 |
|
---|
2686 | 在执行`cdrom --init'以及`map --hook'命令后,cdrom光驱可以通过(cd0),
|
---|
2687 | (cd1), ...等设备号来访问。
|
---|
2688 |
|
---|
2689 | 注意 1:如果系统不完全支持ATAPI CD-ROM 规范,在你试图访问这些(cdX)设备时将
|
---|
2690 | 遭遇失败。
|
---|
2691 |
|
---|
2692 | 注意 2:在执行一条`cdrom --stop'命令后,你应当使用一条`map --unhook'命令。当然,
|
---|
2693 | 你可以再次使用`map --hook'命令,假如还有驱动器被映射着的话。
|
---|
2694 |
|
---|
2695 | 注意 3:在增加IO端口之后,你应当接着`cdrom --init'执行一条`map --unhook'命令然
|
---|
2696 | 后再接着执行一条`map --hook'命令。
|
---|
2697 |
|
---|
2698 | 默认将使用这些端口来搜索cdrom设备(因此不需要再添加了)
|
---|
2699 | 0x03F601F0, 0x03760170, 0x02F600F0,
|
---|
2700 | 0x03860180, 0x6F006B00, 0x77007300.
|
---|
2701 |
|
---|
2702 | 注意 4:BIOS可能已经提供了cdrom 的接口。它的设备号总是(cd)。在 `cdrom --init'
|
---|
2703 | 和 `map --hook' 执行后,我们可以有我们自己有效的(cd0), (cd1), ...等设备。
|
---|
2704 |
|
---|
2705 | 注意 5:你可以用块列表的方式去访问(cd)和 (cdX) 等设备。例子:
|
---|
2706 |
|
---|
2707 | cat --hex (cd0)16+2
|
---|
2708 |
|
---|
2709 | cdrom 扇区是大小为 2048 字节的大扇区。
|
---|
2710 |
|
---|
2711 | 注意 6:我们的iso9660文件系统驱动具有Rock-Ridge扩展支持,但没有Joliet扩展支持。
|
---|
2712 | 因此当你试图在一个使用Joliet扩展的光盘上读取文件时,可能遭遇失败。
|
---|
2713 |
|
---|
2714 | 注意 7:现在,(cd)及 (cdX)设备可以被引导了。示例:
|
---|
2715 | chainloader (cd)
|
---|
2716 | boot
|
---|
2717 |
|
---|
2718 | chainloader (cd0)
|
---|
2719 | boot
|
---|
2720 |
|
---|
2721 | chainloader (cd1)
|
---|
2722 | boot
|
---|
2723 |
|
---|
2724 | 在chainloader (cd)之前,你必须保证已经可以访问该设备。
|
---|
2725 |
|
---|
2726 | ******************************************************************************
|
---|
2727 | *** About the New `setvbe' Command ***
|
---|
2728 | ******************************************************************************
|
---|
2729 | 关于新命令 `setvbe'
|
---|
2730 |
|
---|
2731 | Gerardo Richarte contributed the `setvbe' code and the following comment:
|
---|
2732 | Gerardo Richarte 先生提供了`setvbe'的源码,下面是注释:
|
---|
2733 |
|
---|
2734 | New command is `setvbe', and can be used to change the video mode
|
---|
2735 | before executing the kernel.
|
---|
2736 | `setvbe'是一个新的命令,它可以在系统核心运行前被用来改变视频模式。
|
---|
2737 |
|
---|
2738 | For example, you can do
|
---|
2739 | 例如,你可以执行
|
---|
2740 |
|
---|
2741 | setvbe 1024x768x32
|
---|
2742 |
|
---|
2743 | this will scan the list of available modes and set it, and
|
---|
2744 | automatically append a `video=' option to each subsequent kernel
|
---|
2745 | command-line. The appended `video=' option is like this:
|
---|
2746 | 这会扫描出其可用模式的列表并设置它,并且自动在随后的每个kernel命令
|
---|
2747 | 行中增加一个选项`video='。增加的选项`video='类似于:
|
---|
2748 |
|
---|
2749 | video=1024x768x32@0xf0000000,4096
|
---|
2750 |
|
---|
2751 | where 0xf0000000 is the video framebuffer address as reported by vbe,
|
---|
2752 | and 4096 is the size of a scanline in bytes (also as reported by vbe).
|
---|
2753 | 这里的0xf0000000是vbe报告的视频模式的帧缓存地址,而4096是扫描线的字节大小。
|
---|
2754 |
|
---|
2755 | This is really useful if you want to give some graphics support to your
|
---|
2756 | OS, but you don't want to implement any video functionality other than
|
---|
2757 | writing a pixel to video memory.
|
---|
2758 | 如果你想在你的操作系统上获得一些图形支持,但是除了只写一个像素点到视频内
|
---|
2759 | 存而外,你却不想使用任何视频功能,这确实有用。
|
---|
2760 |
|
---|
2761 |
|
---|
2762 | ******************************************************************************
|
---|
2763 | *** About the DOS utility `hmload' ***
|
---|
2764 | ******************************************************************************
|
---|
2765 | 关于DOS工具`hmload'
|
---|
2766 |
|
---|
2767 | 此程序由 John Cobb 先生编写(伦敦玛丽皇后学院)。
|
---|
2768 |
|
---|
2769 | John Cobb先生的注释:
|
---|
2770 |
|
---|
2771 | To make use of the ram drive feature I wrote a program `hmload' to load
|
---|
2772 | an arbitrary file to an arbitrary address in high memory. The program
|
---|
2773 | is not very sophisticated and relies on XMS to turn on the A20 line.
|
---|
2774 | (Also one must be very careful to steer clear of any areas of memory
|
---|
2775 | already in use).
|
---|
2776 | 为了使用内存驱动器的特性,我写了一个程序“hmload”来将任意文件加载
|
---|
2777 | 到高端内存的任意地址。这个程序不是十分深奥但依赖在XMS 里开启A20地址线。
|
---|
2778 | (并且必须将那些已经使用了的任何内存空间精心的清理干净)
|
---|
2779 |
|
---|
2780 | Under Linux we generated a disk image `dskimg' (with the kernel and
|
---|
2781 | Initrd and a partition table).
|
---|
2782 | 我们在linux下生成一个磁盘映象“dskimg”(包含kernel和initrd及一个分区表)。
|
---|
2783 |
|
---|
2784 | Using this our boot procedure looked something like this:
|
---|
2785 | 我们的引导过程看起来是下面这样:
|
---|
2786 |
|
---|
2787 | hmload -fdskimg -a128
|
---|
2788 | fixrb
|
---|
2789 | <unload network drivers>
|
---|
2790 | grub
|
---|
2791 |
|
---|
2792 | map --ram-drive=0x81
|
---|
2793 | map --rd-base=0x8000000
|
---|
2794 | map --rd-size=0x400000
|
---|
2795 | root (rd,0)
|
---|
2796 | kernel /kernel root=/dev/ram0 rw ip=bootp ramdisk_size=32768 ...
|
---|
2797 | initrd /initrd
|
---|
2798 | boot
|
---|
2799 |
|
---|
2800 | See http://sysdocs.stu.qmul.ac.uk/sysdocs/Comment/GrubForDOS/ for details.
|
---|
2801 | 详情参阅 http://sysdocs.stu.qmul.ac.uk/sysdocs/Comment/GrubForDOS/
|
---|
2802 |
|
---|
2803 | Update 2007-12-05:
|
---|
2804 | 更新 2007-12-05 :
|
---|
2805 |
|
---|
2806 | Now the MAP command can handle gzipped (rd) image. One can use this
|
---|
2807 | feature with the hmload utility. For example,
|
---|
2808 |
|
---|
2809 | step 1. Load the gzipped image under DOS at a relatively low address:
|
---|
2810 | 步骤 1. 在DOS的相对较低的地址处加载gzip压缩映像:
|
---|
2811 |
|
---|
2812 | hmload -fdskimg.gz -a16
|
---|
2813 |
|
---|
2814 | step 2. Unload network drivers.
|
---|
2815 | 步骤 2 卸载网络驱动器
|
---|
2816 |
|
---|
2817 | step 3. Run GRUB.EXE.
|
---|
2818 | 步骤 3. 运行 GRUB.EXE
|
---|
2819 |
|
---|
2820 | step 4. At the grub prompt, run these commands:
|
---|
2821 | 步骤 4. 在grub 命令提示符下,执行下列命令:
|
---|
2822 |
|
---|
2823 | map --rd-base=0x1000000 # set rd-base address to be 16M
|
---|
2824 | # 设置rd-base地址为16M
|
---|
2825 |
|
---|
2826 | map --rd-size=<the accurate size of dskimg.gz in bytes>
|
---|
2827 | < dsking.gz 精确的字节数 >
|
---|
2828 |
|
---|
2829 | map (rd)+1 (hd0) # This will decompress (rd) and place
|
---|
2830 | # the decompressed image at the top end
|
---|
2831 | # of the extended memory. The (rd)+1
|
---|
2832 | # here has special meaning and stands
|
---|
2833 | # for the whole (rd) device. You must
|
---|
2834 | # use (rd)+1 instead of (rd).
|
---|
2835 | # 这会将(rd)解压并且把解压后的映像放到扩展内存的顶端。
|
---|
2836 | # 这里的(rd)+1具有特定的含义而且将整个(rd)设备放到了顶端。
|
---|
2837 | # 这里你必须使用 (rd)+1 来替代(rd)。
|
---|
2838 | map --hook
|
---|
2839 | root (hd0,0)
|
---|
2840 | kernel /kernel root=/dev/ram0 rw ip=bootp ramdisk_size=32768 ...
|
---|
2841 | initrd /initrd
|
---|
2842 | map --unhook
|
---|
2843 | map (hd0) (hd0) # Delete the map; this is needed.
|
---|
2844 | # 删除map映射;这是需要的
|
---|
2845 | boot
|
---|
2846 |
|
---|
2847 |
|
---|
2848 | ******************************************************************************
|
---|
2849 | *** Notes on the use of stack ***
|
---|
2850 | ******************************************************************************
|
---|
2851 | 关于堆栈的注释
|
---|
2852 | The protected-mode and real-mode stack are merged at physical address 0x2000.
|
---|
2853 | 保护模式与实模式的堆栈被合并到物理地址 0x2000 处。
|
---|
2854 |
|
---|
2855 | All functions should use at most 2K stack space(0x1800-0x2000). So each
|
---|
2856 | subfunction should use as little stack as possible to avoid stack-overflow.
|
---|
2857 | 所有的功能应当最多使用 2K 的堆空间 (0x1800到0x2000)。因此各个子功能部分
|
---|
2858 | 应当使用尽可能小的堆以避免堆栈溢出。
|
---|
2859 |
|
---|
2860 | Don't use recursive functions because they could expend too much stack space.
|
---|
2861 | 不要使用递归功能,因为他们会消耗太多的堆空间。
|
---|
2862 |
|
---|
2863 | The original protected mode stack at 0x68000(expand-down) is free now and can
|
---|
2864 | be reused for any purposes.
|
---|
2865 | 原来位于0x68000(向下延伸)的保护模式的堆现在不再使用,并且它可以被用于任何目的。
|
---|
2866 |
|
---|
2867 |
|
---|
2868 | ******************************************************************************
|
---|
2869 | *** A bug was found in the CDROM driver ***
|
---|
2870 | ******************************************************************************
|
---|
2871 | CDROM 驱动器上发现的缺陷
|
---|
2872 |
|
---|
2873 | 似乎 cdrom 应当连接在IDE控制器的主设备通道上。
|
---|
2874 |
|
---|
2875 | 如果 cdrom 是从设备,读取cdrom扇区的驱动将失败。希望有人能解决这个问题。
|
---|
2876 |
|
---|
2877 | ******************************************************************************
|
---|
2878 | *** BIOS and the (cd) drive ***
|
---|
2879 | ******************************************************************************
|
---|
2880 | BIOS 与 (cd)驱动器
|
---|
2881 |
|
---|
2882 | 当BIOS启动一个非模拟模式的可启动的CD-ROM设备时,它会分配一个BIOS驱动器号给这个
|
---|
2883 | CD设备。如果这个CD-ROM使用grldr或stage2_eltorito作为启动映像文件,那么GRUB可以
|
---|
2884 | 通过BIOS分配的驱动器号来访问这个CD-ROM 媒体。
|
---|
2885 |
|
---|
2886 | BIOS 会分配一个驱动器号给非模拟模式启动的CDROM 设备,即使这个CDROM 是不能启动的。
|
---|
2887 | 虚拟机QEMU就是这样处理的。在引导的时候,GRUB4DOS将搜索那些由BIOS分配的,驱动器号
|
---|
2888 | 从0x80至0xFF的,可能存在的非模拟模式的CDROM 驱动器。 所以,如果BIOS为CDROM提供了
|
---|
2889 | 扩展int13(功能号41h-4eh)接口,那么这个(cd)设备自动在GRUB4DOS 中有效。
|
---|
2890 |
|
---|
2891 |
|
---|
2892 | ******************************************************************************
|
---|
2893 | *** The way of disk emulation changed greatly ***
|
---|
2894 | ******************************************************************************
|
---|
2895 | 磁盘仿真方式发生了巨大变化
|
---|
2896 |
|
---|
2897 | 磁盘仿真方式自从0.4.2正式版之后已经发生了巨大变化。在使用磁盘仿真功能时候,
|
---|
2898 | 请不要将较新的版本和旧的版本混合使用。
|
---|
2899 |
|
---|
2900 | 较新的版本不会自动卸载之前已经在grub4dos环境建立的仿真盘。GRUB.EXE 的一个
|
---|
2901 | 很古老的版本,在将控制权移交给grub主程序(即,pre_stage2)前,将会自动释放
|
---|
2902 | 先前建立的仿真盘。
|
---|
2903 |
|
---|
2904 |
|
---|
2905 | ******************************************************************************
|
---|
2906 | *** FreeDOS EMM386 v2.26 (2006-08-27) VCPI problem ***
|
---|
2907 | ******************************************************************************
|
---|
2908 | FreeDOS EMM386 版本2.26 (2006-08-27) VCPI服务的问题
|
---|
2909 |
|
---|
2910 | The VCPI function "AX=DE0Ch - Switch From Protected Mode to V86 Mode" of
|
---|
2911 | FreeDOS EMM386 v2.26 was not implemented properly(it always hangs). As an
|
---|
2912 | alternative, you can use Microsoft's EMM386 instead.
|
---|
2913 | FreeDOS 的 EMM386 版本2.26 中的VCPI服务,“功能号 AX=DE0Ch-选择从
|
---|
2914 | 保护模式到虚拟8086模式”,不能正确的执行(总是死机)。选择之一是,
|
---|
2915 | 你用微软的 EMM386 来代替它。
|
---|
2916 |
|
---|
2917 | Even while emm386 is running, grub.exe can be started. But if you try to quit
|
---|
2918 | to DOS from grub4dos by using the `quit' command, the VCPI function DE0C will
|
---|
2919 | be called. If EMM386 is of Microsoft, everything goes ok. If EMM386 is of
|
---|
2920 | FreeDOS, the machine will hang.
|
---|
2921 | 即使emm386已经运行,grub.exe也能够启动。但是如果你试图从grub4dos中通过`quit'
|
---|
2922 | 命令来返回DOS,VCPI 服务的DE0C 号功能将被调用。如果是微软的 EMM386 ,接下来的
|
---|
2923 | 一切都很正常 。而如果是FreeDOS 的 EMM386 ,那么将会死机。
|
---|
2924 |
|
---|
2925 | ******************************************************************************
|
---|
2926 | *** New options for map were added ***
|
---|
2927 | ******************************************************************************
|
---|
2928 | map 命令的新增选项
|
---|
2929 |
|
---|
2930 | 随着0.4.2 最终版的发布,map 命令有了两个新选项。它们是--safe-mbr-hook=SMH
|
---|
2931 | 以及--int13-scheme=SCH 。它们都和Win9x环境下(尽可能稳定的)使用磁盘仿真有关。
|
---|
2932 |
|
---|
2933 | SMH参数可以是0或1这个两个值之一。作为默认,SMH参数为1 。如果你在Win9x中遇到
|
---|
2934 | 磁盘仿真的问题,你可以插入这样一行到`boot'命令之前,
|
---|
2935 |
|
---|
2936 | map --safe-mbr-hook=0
|
---|
2937 |
|
---|
2938 | 然后再试一次。
|
---|
2939 |
|
---|
2940 | SCH在使用时,也可以取0或1之一的值。作为默认,SCH为1 。如果你在Win9x中遇到
|
---|
2941 | 磁盘仿真的问题,你可以插入这样一行到`boot'命令之前,
|
---|
2942 |
|
---|
2943 | map --int13-scheme=0
|
---|
2944 |
|
---|
2945 | 然后再试一次。
|
---|
2946 |
|
---|
2947 | 顺便提醒一下。类似于--safe-mbr-hook和--int13-scheme ,MAP命令中有几个其他
|
---|
2948 | 选项可被用以设置全局变量。
|
---|
2949 |
|
---|
2950 | map --floppies=M
|
---|
2951 |
|
---|
2952 | 其中的M 可以是0 , 1 或者2 。MAP 将把一个恰当的M 值设置在地址0040:0010 处。
|
---|
2953 |
|
---|
2954 | map --harddrives=N
|
---|
2955 |
|
---|
2956 | 其中的N 可以是从0到127之间的值。MAP将把N 值设置在0040:0075处。
|
---|
2957 |
|
---|
2958 | map --memdisk-raw=RAW
|
---|
2959 |
|
---|
2960 | 其中的RAW默认为1 。如果RAW=0,将通过`int15/ah=87h'访问内存驱动器。
|
---|
2961 |
|
---|
2962 | map --ram-drive=RD
|
---|
2963 |
|
---|
2964 | 其中RD默认是0x7F的软驱号。如果随机内存驱动器是一个硬盘驱动器镜像(第一扇区
|
---|
2965 | 含有分区表),那么你可以将 RD 设置为大于或等于0x80并且小于0xA0之间的值。
|
---|
2966 | 如果是一个光盘镜像,那需要设置为大于或等0xA0并且小于0xFF之间的值。
|
---|
2967 |
|
---|
2968 | map --rd-base=ADDR
|
---|
2969 |
|
---|
2970 | map --rd-size=SIZE
|
---|
2971 |
|
---|
2972 | 其中的 ADDR 指定出内存映像的物理基地址。SIZE指定出内存映像的字节数大小。ADDR
|
---|
2973 | 默认为0 。SIZE的默认值也是0 ,但是值为0 表示4 GB ,而不是零字节长的磁盘。随机
|
---|
2974 | 内存驱动器可以在 GRUB 环境中通过使用 (rd) 设备来访问。
|
---|
2975 |
|
---|
2976 |
|
---|
2977 | ******************************************************************************
|
---|
2978 | *** About the new map option --in-situ ***
|
---|
2979 | ******************************************************************************
|
---|
2980 | 关于 map 的新选项 --in-situ
|
---|
2981 |
|
---|
2982 | --in-situ被使用于硬盘驱动器映像或者是硬盘驱动器分区。通过--in-situ ,我们可以把
|
---|
2983 | 一个逻辑分区象征性的作为一个主分区来使用。
|
---|
2984 |
|
---|
2985 | --in-situ 的映射是整个驱动器的映射。它只虚拟出分区表和 DBR 上的BPB里的隐藏扇区数。
|
---|
2986 |
|
---|
2987 | 尽管磁盘仿真在 win9x 中可能会遇到的各种问题,但在win9x中,in-situ的映射却运行得很好。
|
---|
2988 |
|
---|
2989 | 注意 --in-situ 的映射不会改变真实的分区表。
|
---|
2990 |
|
---|
2991 | 示例:
|
---|
2992 | map --in-situ (hd0,4)+1 (hd0)
|
---|
2993 |
|
---|
2994 | ******************************************************************************
|
---|
2995 | *** The PARTNEW Command Syntax ***
|
---|
2996 | ******************************************************************************
|
---|
2997 | PARTNEW 命令的语法
|
---|
2998 |
|
---|
2999 | 除了上述章节的仿真方法而外,你也可以替代选择用 PARTNEW 来建立一个新的主分区。
|
---|
3000 | PARTNEW可以为逻辑分区生成一个新的主分区项(在分区表中)。
|
---|
3001 |
|
---|
3002 | 例如,
|
---|
3003 | partnew (hd0,3) 0x07 (hd0,4)+1
|
---|
3004 |
|
---|
3005 | 这里的(hd0,4)+1 代表了整个(hd0,4)分区。这条命令将建立一个分区类型为 0x07
|
---|
3006 | 的新的主分区(hd0,3),并且它的内容(即数据)和逻辑分区(hd0,4)一样。
|
---|
3007 |
|
---|
3008 | 就像整个逻辑分区时的情况一样,一个连续的分区映像文件也可以用在PARTNEW 命令中:
|
---|
3009 |
|
---|
3010 | partnew (hd0,3) 0x00 (hd0,0)/my_partition.img
|
---|
3011 |
|
---|
3012 | The type 0x00 indicates a type-auto-detection of the image MY_PARTITION.IMG.
|
---|
3013 | The above command will create a new primary partition (hd0,3) with a proper
|
---|
3014 | type and with contents/data being exactly that of the contiguous file
|
---|
3015 | (hd0,0)/my_partition.img.
|
---|
3016 | 这个 0x00 类型表示这个 MY_PARTITION.IMG 映像文件的分区类型由自动检测确定。
|
---|
3017 | 上面的命令将建立一个类型恰当的新的主分区(hd0,3),并且使用这个连续的
|
---|
3018 | (hd0,0)/my_partition.img 文件中的全部内容(数据)作为它的内容(数据)。
|
---|
3019 |
|
---|
3020 | PARTNEW 将自动修正 BPB 中的“隐藏扇区数”并且这个修改是永久的。而且PARTNEW
|
---|
3021 | 修改分区表也是永久的。
|
---|
3022 |
|
---|
3023 | 除了建立分区表项外,PARTNEW也可以用来删除(抹掉,擦除)一个分区表项。例如,
|
---|
3024 |
|
---|
3025 | partnew (hd0,3) 0 0 0
|
---|
3026 |
|
---|
3027 | 这样,主引导记录中最后一个分区表项将被清空。通常,你可以用"partnew PARTITION 0 0 0"的格式来
|
---|
3028 | 抹掉其分区表项,但是已经存储在这个分区中的数据不被影响。
|
---|
3029 |
|
---|
3030 | ******************************************************************************
|
---|
3031 | *** Newly implemented operators `&&' and `||' ***
|
---|
3032 | ******************************************************************************
|
---|
3033 | 最近实现的运算符 `&&' and `||'
|
---|
3034 |
|
---|
3035 | 它的实现非常简单。它不处理嵌套的运算符。
|
---|
3036 |
|
---|
3037 | `&&'的用法:
|
---|
3038 | command1 && command2
|
---|
3039 | 说明 :
|
---|
3040 | 如果 command1 返回 真,那么 command2 将执行
|
---|
3041 |
|
---|
3042 | `||'的用法:
|
---|
3043 |
|
---|
3044 | command1 || command2
|
---|
3045 |
|
---|
3046 | 说明 :
|
---|
3047 | 如果 command1 返回 假,那么 command2 将执行
|
---|
3048 |
|
---|
3049 | 示例:
|
---|
3050 | is64bit && default 0
|
---|
3051 | is64bit || default 1
|
---|
3052 |
|
---|
3053 | 注意:
|
---|
3054 | 1.只要返回值非0都是真,否则是假.比如
|
---|
3055 | read 0x60000 && command2
|
---|
3056 | command2有可能会不被执行.因为内存地址0x60000的值有可能是0.
|
---|
3057 | 一般情况下命令执行失败时总是返回0(假).所以可以用于判断命令执行的结果.
|
---|
3058 | 2.在菜单中使用这些符号会忽略错误检测,这是一个很有用的功能.
|
---|
3059 | 比如:
|
---|
3060 | find --set-root /file.ext
|
---|
3061 | 在菜单中使用时可能会返回文件未找到的错误并停止执行.必要的话我们可以使用
|
---|
3062 | find --set-root /file.ext || echo file not found.
|
---|
3063 | 这个命令在菜单中使用会显示find not found,但不停止执行.
|
---|
3064 |
|
---|
3065 | 更新1: 最新版本可以使用嵌套,例子:
|
---|
3066 | find --set-root /file1 || find --set-root /file2 || find --set-root /file3
|
---|
3067 | 如果没有找到file1就继续找file2,还是没有找到就找file3,如果还是没有找到将会失败
|
---|
3068 |
|
---|
3069 | ******************************************************************************
|
---|
3070 | *** Three new commands is64bit, errnum and errorcheck ***
|
---|
3071 | ******************************************************************************
|
---|
3072 | 三个新命令 is64bit, errnum 和 errorcheck
|
---|
3073 |
|
---|
3074 | is64bit 和 errnum 命令分别用来检索是否是 64 位的系统和错误值。
|
---|
3075 |
|
---|
3076 | errcheck off|on
|
---|
3077 |
|
---|
3078 | errorcheck(错误检查)命令控制着错误是否被处理。默认错误检查是开启的 ,即在
|
---|
3079 | 错误发生时命令脚本将停止执行。而假如错误检查是关闭的,那么脚本将一直执行到 boot
|
---|
3080 | 命令。一条 boot 命令可以把错误检查转变为开启。
|
---|
3081 |
|
---|
3082 | ******************************************************************************
|
---|
3083 | *** Use numeric keys to select a menu entry ***
|
---|
3084 | ******************************************************************************
|
---|
3085 | 使用数字键来选择菜单项
|
---|
3086 |
|
---|
3087 | 例如,如果你想要选择第25项菜单项,你可以先按下数字键2 之后再按下 5 。
|
---|
3088 |
|
---|
3089 | ******************************************************************************
|
---|
3090 | *** Use the INSERT key to debug step by step at startup ***
|
---|
3091 | ******************************************************************************
|
---|
3092 | 启动时使用 INSERT 键逐步的调试
|
---|
3093 |
|
---|
3094 | 在一些有缺陷机器上进入 grub4dos 环境时可能会失败。可能是意外的死机或者重启。
|
---|
3095 | 在启动时尽可能快的按下 INSERT 键,你就可能获得进入单步启动进程的机会而看到它最
|
---|
3096 | 多能运行到哪里,然后请上报这些bug截图 。
|
---|
3097 |
|
---|
3098 | ******************************************************************************
|
---|
3099 | *** The debug command syntax has been changed ***
|
---|
3100 | ******************************************************************************
|
---|
3101 | debug 命令的语法已经改变
|
---|
3102 |
|
---|
3103 | DEBUG 命令现在可以用来控制冗余的命令输出:
|
---|
3104 | debug [ on | off | normal | status | INTEGER ]
|
---|
3105 |
|
---|
3106 | 0 或者 off 指定为静默模式
|
---|
3107 |
|
---|
3108 | 1 或者 normal 指定为标准模式
|
---|
3109 |
|
---|
3110 | 从 2 到 0x7fffffff 或者 on 指定为冗余模式
|
---|
3111 | (调试报告BUG时请使用该模式,可以获得更详细的信息)
|
---|
3112 |
|
---|
3113 | ******************************************************************************
|
---|
3114 | *** GRUB4DOS and Windows Vista ***
|
---|
3115 | ******************************************************************************
|
---|
3116 | GRUB4DOS 与 Windows Vista
|
---|
3117 |
|
---|
3118 | 首先,使用以下命令来建立一个启动项:
|
---|
3119 |
|
---|
3120 | bcdedit /create /d "GRUB for DOS" /application bootsector
|
---|
3121 |
|
---|
3122 | 执行结果看起来类似这样:
|
---|
3123 | The entry {05d33150-3fde-11dc-a457-00021cf82fb0} was successfully created.
|
---|
3124 |
|
---|
3125 | 其中长字串{05d33150-3fde-11dc-a457-00021cf82fb0} 是这个项的数字标识{id}。
|
---|
3126 |
|
---|
3127 | 然后,通过以下命令来设置启动参数:
|
---|
3128 | bcdedit /set {id} device boot
|
---|
3129 | bcdedit /set {id} path \grldr.mbr
|
---|
3130 | bcdedit /displayorder {id} /addlast
|
---|
3131 | 请用先前的命令所返回的实际的id 来替换掉 {id}。
|
---|
3132 |
|
---|
3133 | 最后,复制 GRLDR.MBR 到 你引导分区的根目录下,并且将 GRLDR 和 menu.lst 复制到
|
---|
3134 | 任意一个 FAT16/FAT32/EXT2/NTFS 的分区根目录下。
|
---|
3135 |
|
---|
3136 | 注意:引导分区必须是含有 BOOTMGR 的激活的主分区。
|
---|
3137 |
|
---|
3138 | LianJiang 先生写出了一个脚本来自动化的完成这个麻烦的工作:
|
---|
3139 |
|
---|
3140 | @echo off
|
---|
3141 | rem by lianjiang
|
---|
3142 | cls
|
---|
3143 | echo.
|
---|
3144 | echo Please run as administrator
|
---|
3145 | echo.
|
---|
3146 | pause
|
---|
3147 | set gname=GRUB for DOS
|
---|
3148 | set vid=
|
---|
3149 | set timeout=5
|
---|
3150 | bcdedit >bcdtemp.txt
|
---|
3151 | type bcdtemp.txt | find "\grldr.mbr" >nul && echo. && echo BCD entry existing, no need to install. && pause && goto exit
|
---|
3152 | bcdedit /export "Bcd_Backup" >nul
|
---|
3153 | bcdedit /create /d "%gname%" /application bootsector >vid.ini
|
---|
3154 | for,/f,"tokens=2 delims={",%%i,In (vid.ini) Do (
|
---|
3155 | set vida=%%i
|
---|
3156 | )
|
---|
3157 | for,/f,"tokens=1 delims=}",%%i,In ("%vida%") Do (
|
---|
3158 | set vid={%%i}
|
---|
3159 | )
|
---|
3160 | echo %vid%>vid.ini
|
---|
3161 | bcdedit /set %vid% device boot >nul
|
---|
3162 | bcdedit /set %vid% path \grldr.mbr >nul
|
---|
3163 | bcdedit /displayorder %vid% /addlast >nul
|
---|
3164 | bcdedit /timeout %timeout% >nul
|
---|
3165 | if exist grldr.mbr copy grldr.mbr %systemdrive%\ /y && goto exit
|
---|
3166 | echo.
|
---|
3167 | echo Please copy grldr.mbr to %systemdrive%\
|
---|
3168 | echo.
|
---|
3169 | pause
|
---|
3170 | :exit
|
---|
3171 | del bcdtemp.txt >nul
|
---|
3172 | -------------------------------------------------------------------
|
---|
3173 | 更新: Fujianabc 先生指出以下这行
|
---|
3174 | bcdedit /set %vid% device boot >nul
|
---|
3175 | 必须更改为
|
---|
3176 | bcdedit /set %vid% device partition=%SystemDrive% >nul
|
---|
3177 | chenall注: 其实没有必要改,使用boot可以获得更好的兼容性.
|
---|
3178 | -------------------------------------------------------------------
|
---|
3179 | 你还需要自行复制 grldr和menu.lst文件。
|
---|
3180 |
|
---|
3181 | 注意: 你只需要指定BCD的位置就可以修改另一个操作系统的BCD 启动项:
|
---|
3182 | bcdedit /store D:\boot\BCD ...
|
---|
3183 |
|
---|
3184 | 注意: 执行这些命令需要提高权限,它们必须是“以管理员身份运行”于cmd.exe中。
|
---|
3185 |
|
---|
3186 | 注意:已有人报告说,即使使用管理员身份,Vista的某些版本也不支持在C盘根目录下建立
|
---|
3187 | 无扩展名的文件。你既可以复制grldr到另外的一个分区来解决这个问题,也可以将 grldr
|
---|
3188 | 重命名,比如为 grub.bin 。如何改名,请参见下节。
|
---|
3189 |
|
---|
3190 | ******************************************************************************
|
---|
3191 | *** How to rename grldr ***
|
---|
3192 | ******************************************************************************
|
---|
3193 | 怎样重命名 grldr
|
---|
3194 |
|
---|
3195 | grldr 和 grldr.mbr引用引导文件内部的文件名来决定装载哪个文件,所以假如你
|
---|
3196 | 想更换它们的名字,那么你也必须要修改那些内嵌在文件内部的设置。你可以使用
|
---|
3197 | 辅助程序grubinst 来做到这些,grubinst 可以在以下网址下载到:
|
---|
3198 |
|
---|
3199 | http://download.gna.org/grubutil/
|
---|
3200 |
|
---|
3201 | grubinst 能生成自定义的grldr.mbr:
|
---|
3202 |
|
---|
3203 | grubinst -o -b=mygrldr C:\mygrldr.mbr
|
---|
3204 |
|
---|
3205 | grubinst 也能编辑一个既有的 grldr 或 grldr.mbr:
|
---|
3206 |
|
---|
3207 | grubinst -e -b=mygrldr C:\mygrldr
|
---|
3208 |
|
---|
3209 | grubinst -e -b=mygrldr C:\mygrldr.mbr
|
---|
3210 |
|
---|
3211 | 在这种情况中,你必须使用一个和 grub4dos 版本兼容的grubinst,否则修改将会失败。
|
---|
3212 |
|
---|
3213 | 所以,在命令中通过加载mygrldr来代替grldr ,你可以使用下面的方法之一:
|
---|
3214 |
|
---|
3215 | 1.使用已定制好的grldr.mbr 来加载 mygrldr 。在这种情况下,你需要修改内嵌在
|
---|
3216 | grldr.mbr中的引导文件名。grldr.mbr的名字可以被任意的改变。
|
---|
3217 |
|
---|
3218 | 2.直接使用mygrldr 。在这种情况下,你需要将 mygrldr 中内嵌的引导文件名改为
|
---|
3219 | 一个合适的名字。
|
---|
3220 |
|
---|
3221 | 注意: 引导文件名必须遵循 8.3 文件名规范。
|
---|
3222 |
|
---|
3223 | ******************************************************************************
|
---|
3224 | *** GRLDR as PXE boot file ***
|
---|
3225 | ******************************************************************************
|
---|
3226 | GRLDR 作为 PXE 启动文件
|
---|
3227 |
|
---|
3228 | GRLDR 可以被用作远程或网络服务器的 PXE 启动文件。(pd) 设备被用于访问服务器上文件。
|
---|
3229 | 当 GRLDR 已经通过网络启动后,它将使用预设菜单作为配置文件。不过,你可以使用
|
---|
3230 | 一条"pxe detect"命令,它的表现是和pxelinux一样的方式。
|
---|
3231 |
|
---|
3232 | * 首先,它将使用设备类型(使用它的 ARP 类型码)和地址来搜索配置文件,全部用
|
---|
3233 | 破折号分割的十六进制;例如,对一个以太网(ARP 类型是1)的88:99:AA:BB:CC:DD
|
---|
3234 | 地址,它会用文件名01-88-99-AA-BB-CC-DD 来搜索。
|
---|
3235 |
|
---|
3236 | * 其次,它将使用它本地的IP 地址大写字母的十六进制格式(即192.0.2.91 转换为
|
---|
3237 | C000025B。)来搜索配置文件。如果文件没有找到,它将去掉一个十六进制数字后再试一次。
|
---|
3238 | 最后,它会尝试寻找一个名为 default (小写字母)的文件。
|
---|
3239 |
|
---|
3240 | ******************************************************************************
|
---|
3241 | *** PXE device ***
|
---|
3242 | ******************************************************************************
|
---|
3243 | PXE 设备
|
---|
3244 |
|
---|
3245 | 如果使用PXE启动,GRUB4DOS 将建立一个虚拟设备 (pd),可能通过它来访问tftp服务器
|
---|
3246 | 上的文件。你可以使用下面的步骤来设置一个无盘启动环境:
|
---|
3247 |
|
---|
3248 | 客户端
|
---|
3249 | 你需要从 PXE ROM 上启动。
|
---|
3250 |
|
---|
3251 | 服务器端
|
---|
3252 | 你需要配置一个dhcp服务器和一个tftp服务器。在dhcp服务器上,使用grldr作为引导文件。
|
---|
3253 |
|
---|
3254 | 你可能希望为不同的客户端加载一个不同的menu.lst 。GRUB4DOS将在以下位置查找配置文件:
|
---|
3255 |
|
---|
3256 | [/mybootdir]/menu.lst/01-88-99-AA-BB-CC-DD
|
---|
3257 | [/mybootdir]/menu.lst/C000025B
|
---|
3258 | [/mybootdir]/menu.lst/C000025
|
---|
3259 | [/mybootdir]/menu.lst/C00002
|
---|
3260 | [/mybootdir]/menu.lst/C0000
|
---|
3261 | [/mybootdir]/menu.lst/C000
|
---|
3262 | [/mybootdir]/menu.lst/C00
|
---|
3263 | [/mybootdir]/menu.lst/C0
|
---|
3264 | [/mybootdir]/menu.lst/C
|
---|
3265 | [/mybootdir]/menu.lst/default
|
---|
3266 |
|
---|
3267 | 更新1: 如果/mybootdir/menu.lst 文件存在,将会优先使用,这样可以加快引导速度.
|
---|
3268 |
|
---|
3269 | 这里,我们假设客户端的网卡mac地址是 88:99:AA:BB:CC:DD ,而ip地址是192.0.2.91 (C000025B)。
|
---|
3270 | /mybootdir 是引导文件所在目录,例如,如果引导文件是 /tftp/grldr ,那么mybootdir=tftp 。
|
---|
3271 |
|
---|
3272 | 如果上面的文件都未出现,grldr将使用它的内置的menu.lst 。
|
---|
3273 |
|
---|
3274 | 这是一个如何访问tftp服务器上文件的menu.lst文件。
|
---|
3275 |
|
---|
3276 | title Create ramdisk using map
|
---|
3277 | map --mem (pd)/floppy.img (fd0)
|
---|
3278 | map --hook
|
---|
3279 | rootnoverify (fd0)
|
---|
3280 | chainloader (fd0)+1
|
---|
3281 |
|
---|
3282 | title Create ramdisk using memdisk
|
---|
3283 | kernel (pd)/memdisk
|
---|
3284 | initrd (pd)/floppy.img
|
---|
3285 |
|
---|
3286 | chenall注: 1.你也可以省略(pd)/或者使用(bd)/或()/
|
---|
3287 | 这样可以使得一个菜单可以不经过修改就可以用于其它地方的启动.
|
---|
3288 |
|
---|
3289 | 你可以看到这个 menu.lst 和在普通磁盘上引导的是相似的,你只是需要把象(hd0,0)
|
---|
3290 | 这样的设备用(pd) 来代替。
|
---|
3291 |
|
---|
3292 | 磁盘设备和 pxe 设备有一些不同点:
|
---|
3293 |
|
---|
3294 | 1. 你不能把pxe设备上的文件以列表显示。
|
---|
3295 | 更新2: 现在可以列表,但要求服务器上有dir.txt文件,使用以下命令可以创建一个dir.txt文件
|
---|
3296 | dir /b>dir.txt
|
---|
3297 | 也可以直接使用TFTPD32的服务器,选择自动生成DIR.TXT文件.
|
---|
3298 |
|
---|
3299 | 2.blocklist 命令不能用于 pxe 设备上的文件。
|
---|
3300 |
|
---|
3301 | 3.如果你想映射一个pxe服务器上的文件,你必须使用--mem 选项 。
|
---|
3302 |
|
---|
3303 | 当你使用 chainloader 命令装载一个pxe 设备上的文件时,有一个选项你可以使用:
|
---|
3304 |
|
---|
3305 | chainloader --raw (pd)/BOOT_FILE
|
---|
3306 |
|
---|
3307 | 选项 --raw 的执行就和--force一样,但是它是一次性将文件装载执行。这可以改善
|
---|
3308 | 一些情况下的执行效率。
|
---|
3309 |
|
---|
3310 | 你可以使用 pxe 命令来控制 pxe 设备。
|
---|
3311 |
|
---|
3312 | 1. pxe
|
---|
3313 | 如果没有使用任何参数,pxe 命令将显示当前设置。
|
---|
3314 |
|
---|
3315 | 2. pxe blksize N
|
---|
3316 | 设置tftp packet size (传输包)大小。最小值是 512 ,最大值是 1432 。这个参数主要使
|
---|
3317 | 用在那些不支持远大于 512 字节包大小的tftp 服务器上。
|
---|
3318 |
|
---|
3319 | 3. pxe basedir /dir
|
---|
3320 | 为tftp 服务器上的文件设置基本目录。如
|
---|
3321 | pxe basedir /tftp
|
---|
3322 |
|
---|
3323 | 那么在pxe 设备上的所有文件都和目录 /tftp 相关。例如,(pd)/aa.img
|
---|
3324 | 对应于服务器上的 /tftp/aa.img 。
|
---|
3325 |
|
---|
3326 | 基本目录的默认值是引导文件所在目录,例如,如果引导文件是 /tftp/grldr ,
|
---|
3327 | 那么默认的基本目录就是 /tftp 。
|
---|
3328 |
|
---|
3329 | 4. pxe keep
|
---|
3330 | 保持 pxe stack。GRUB4DOS的默认退出时自动卸载pxe strack。
|
---|
3331 | 如果你希望在引导后继续使用PXE功能,比如用于RIS安装,这时必须使用这个选项.
|
---|
3332 |
|
---|
3333 | 5. pxe unload
|
---|
3334 | 立即卸载 PXE stack。pxe占用了大量的常规内存,某些引导程序可能会无法正常引导。
|
---|
3335 | 这时你可以先卸载然后再引导。一个例子:
|
---|
3336 | title Linux memtest
|
---|
3337 | map --mem /memtest.bin (rd)
|
---|
3338 | pxe unload
|
---|
3339 | kernel (rd)+1
|
---|
3340 | 如果在PXE启动时直接kernel /memtest.bin可能会失败。
|
---|
3341 |
|
---|
3342 |
|
---|
3343 | ******************************************************************************
|
---|
3344 | *** New Feature of Relative Path Support ***
|
---|
3345 | ******************************************************************************
|
---|
3346 | 相对路径支持的新特性
|
---|
3347 |
|
---|
3348 | 使用`root' 或 `rootnoverify'命令来指定`工作目录' 。
|
---|
3349 |
|
---|
3350 | 例如:
|
---|
3351 | root (hd0,0)/boot/grub
|
---|
3352 |
|
---|
3353 | 这就指定了当前工作目录是(hd0,0)/boot/grub 。因此所有继"/..."之后的文件名将实际
|
---|
3354 | 提交到(hd0,0)/boot/grub/...
|
---|
3355 |
|
---|
3356 | 也就是说:
|
---|
3357 |
|
---|
3358 | cat /menu.lst
|
---|
3359 | 将等同于
|
---|
3360 | cat (hd0,0)/boot/grub/menu.lst
|
---|
3361 |
|
---|
3362 |
|
---|
3363 | ******************************************************************************
|
---|
3364 | *** Notation For The Current Root Device ***
|
---|
3365 | ******************************************************************************
|
---|
3366 | 当前根设备的符号
|
---|
3367 |
|
---|
3368 | 符号`()'可以在访问当前根设备时使用。你可以使用`find --set-root ...'来设置当前根
|
---|
3369 | 设备,但find 命令不能设置根设备的`工作目录'。这时你应该使用`()'在find命令后来设
|
---|
3370 | 置工作目录。
|
---|
3371 | root ()/boot/grub
|
---|
3372 |
|
---|
3373 | 2008-05-01 更新:
|
---|
3374 | 现在 FIND 命令也可以设置`工作目录'了。例如:
|
---|
3375 |
|
---|
3376 | find --set-root=/tmp /boot/grub/menu.lst
|
---|
3377 |
|
---|
3378 | 它等同于这一组命令:
|
---|
3379 | find --set-root /boot/grub/menu.lst
|
---|
3380 | root ()/tmp
|
---|
3381 |
|
---|
3382 | ******************************************************************************
|
---|
3383 | *** The new map option --a20-keep-on ***
|
---|
3384 | ******************************************************************************
|
---|
3385 | map 新选项 --a20-keep-on
|
---|
3386 |
|
---|
3387 | 随着0.4.3最终版的发布,map 有了一个新选项 --a20-keep-on ,它跟内存驱动器扇区访
|
---|
3388 | 问后的A20 地址线控制有关
|
---|
3389 |
|
---|
3390 | map --a20-keep-on=0
|
---|
3391 |
|
---|
3392 | 它必须被使用于"map --hook"命令之前。
|
---|
3393 |
|
---|
3394 | 作为默认,在INT13 对随机内存的扇区访问之后 A20 将一直开启。如果"map --a20-keep-on=0"
|
---|
3395 | 被使用,那么在INT13 中断调用后的 A20 的状态将和在INT13中断调用前相同。
|
---|
3396 |
|
---|
3397 | ******************************************************************************
|
---|
3398 | *** The CDROM emulation (virtualization) ***
|
---|
3399 | ******************************************************************************
|
---|
3400 | 光盘仿真(虚拟化)
|
---|
3401 | 光盘仿真有时候又称为 ISO 仿真。这里是个示例:
|
---|
3402 | map (hd0,0)/myiso.iso (hd32)
|
---|
3403 | map --hook
|
---|
3404 | chainloader (hd32)
|
---|
3405 | boot
|
---|
3406 |
|
---|
3407 | 如果myiso.iso 是不连续的并且你有足够的内存,那么要增加一个--mem选项:
|
---|
3408 | map --mem (hd0,0)/myiso.iso (hd32)
|
---|
3409 | map --hook
|
---|
3410 | chainloader (hd32)
|
---|
3411 | boot
|
---|
3412 |
|
---|
3413 | 注意:(hd32) 是一个 grub 驱动器,驱动器号和 (0xA0) 等价。如果一个虚拟驱动器被指
|
---|
3414 | 定为一个大于或等于0xA0 的驱动器号,那么它将被视为是一个光盘。(即,是 2048 字节
|
---|
3415 | 的大扇区)
|
---|
3416 |
|
---|
3417 | 就像标准的磁盘仿真一样,光盘仿真也(主要)工作于实模式操作系统中。在一个保护模式的
|
---|
3418 | 操作系统核心(例如WinNT/2K/XP/VISTA/LINUX)获得控制后,操作系统一般没有能力通过BIOS
|
---|
3419 | 的int13 来访问虚拟光盘。
|
---|
3420 |
|
---|
3421 | DOS/Win9x 的使用者可以用google搜索到 ELTORITO.SYS 然后将它作为虚拟光驱的设
|
---|
3422 | 备驱动使用到CONFIG.SYS 中。
|
---|
3423 |
|
---|
3424 | CONFIG.SYS 中 eltorito.sys 的用法举例:
|
---|
3425 | device=eltorito.sys /D:oemcd001
|
---|
3426 |
|
---|
3427 | 对应的可能是放在 AUTOEXEC.BAT中的 MSCDEX 命令:
|
---|
3428 | MSCDEX /D:oemcd001 /L:D
|
---|
3429 |
|
---|
3430 | 由于在 eltorito.sys中发现了一些缺陷,驱动器可能会加载失败。假如你碰到这类问题,
|
---|
3431 | 那么你可以将虚拟光盘的驱动器号从(hd32)更换为(0xFF)然后再试一次。
|
---|
3432 |
|
---|
3433 | ******************************************************************************
|
---|
3434 | *** The New Command CHECKRANGE ***
|
---|
3435 | ******************************************************************************
|
---|
3436 | 新命令 CHECKRANGE
|
---|
3437 |
|
---|
3438 | Checkrang 命令检查一条命令的返回值是否是在指定的值域或排列中。
|
---|
3439 |
|
---|
3440 | Usage: checkrange RANGE COMMAND
|
---|
3441 | 用法: checkrange 域 命令
|
---|
3442 |
|
---|
3443 | 这里是参数 RANGE 的一些示例:
|
---|
3444 | 3 是仅包含数字 3 的值
|
---|
3445 |
|
---|
3446 | 3:3 等价于 3
|
---|
3447 |
|
---|
3448 | 3:8 是一个包含数字3, 4, 5, 6, 7, 8的值域
|
---|
3449 | 3,4,5,6,7,8 等同于3:8
|
---|
3450 | 3:5,6:8 也等同于3:8
|
---|
3451 | 3,4:7,8 也等同于3:8
|
---|
3452 |
|
---|
3453 | 注意:你不能把空格放在值域中。比如:以下是错误的。
|
---|
3454 | checkrange 1 2 COMMAND
|
---|
3455 |
|
---|
3456 | 这里用一个示例来演示怎样使用 checkrange 命令:
|
---|
3457 | checkrange 0x05,0x0F,0x85 parttype (hd0,1) || hide (hd0,1)
|
---|
3458 | 这意谓着:如果 (hd0,1) 不是一个扩展分区,那么执行hide (hd0,1)命令隐藏它。
|
---|
3459 |
|
---|
3460 | ******************************************************************************
|
---|
3461 | *** The New Command TPM ***
|
---|
3462 | ******************************************************************************
|
---|
3463 | 新命令 TPM
|
---|
3464 |
|
---|
3465 | "tpm --init"在地址0000:7c00处使用512字节数据作为初始化TPM(可信赖平台模块)的缓存。
|
---|
3466 |
|
---|
3467 | 在你引导 VISTA 的 BOOTMGR 前,你可能需要在一些机器上使用"tpm --init"。通常你应该在
|
---|
3468 | 一条 CHAINLOADR 命令后执行"tpm --init"指令。
|
---|
3469 |
|
---|
3470 | ******************************************************************************
|
---|
3471 | *** Delimitors or comments between titles ***
|
---|
3472 | ******************************************************************************
|
---|
3473 | 标题间的限制或注释
|
---|
3474 |
|
---|
3475 | 把标题用来做限制或注释是可能的。如果一个标题(或菜单项)下所有的菜单命令都是非启动敏感的,
|
---|
3476 | 它被叫做是不可启动的。
|
---|
3477 |
|
---|
3478 | 下面的命令是启动敏感的(而其他命令是非启动敏感的)
|
---|
3479 | boot
|
---|
3480 | bootp
|
---|
3481 | chainloader
|
---|
3482 | configfile
|
---|
3483 | embed
|
---|
3484 | commandline
|
---|
3485 | halt
|
---|
3486 | install
|
---|
3487 | kernel
|
---|
3488 | pxe
|
---|
3489 | quit
|
---|
3490 | reboot
|
---|
3491 | setup
|
---|
3492 |
|
---|
3493 | 一个不可启动的标题在使用者按向上方向键或向下方向键时将被跳过。
|
---|
3494 | 不可启动的菜单项可以通过使用左方向键或右方向键来被访问(和执行)的。示例:
|
---|
3495 |
|
---|
3496 | title This is an UNBOOTABLE entry(so this line is also a comment)
|
---|
3497 | pause --wait=0 This title is a comment. Nothing to do.
|
---|
3498 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3499 | pause --wait=0 of any kind and as many as you would like.
|
---|
3500 | help
|
---|
3501 | help root
|
---|
3502 | help chainloader
|
---|
3503 | help parttype
|
---|
3504 | clear
|
---|
3505 | title ------------------------------------------------------------
|
---|
3506 | pause --wait=0 This title is a delimitor. Nothing to do.
|
---|
3507 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3508 | pause --wait=0 of any kind and as many as you would like.
|
---|
3509 | clear
|
---|
3510 | help
|
---|
3511 | help boot
|
---|
3512 | title ============================================================
|
---|
3513 | pause --wait=0 This title is a delimitor. Nothing to do.
|
---|
3514 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3515 | pause --wait=0 of any kind and as many as you would like.
|
---|
3516 | help
|
---|
3517 | clear
|
---|
3518 | help pause
|
---|
3519 | title ************************************************************
|
---|
3520 | pause --wait=0 This title is a delimitor. Nothing to do.
|
---|
3521 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3522 | pause --wait=0 of any kind and as many as you would like.
|
---|
3523 | help kernel
|
---|
3524 | help
|
---|
3525 | clear
|
---|
3526 |
|
---|
3527 | 注意:一个不可启动菜单项必须至少包含一条命令。如果标题下没有命令,标题将被简单的
|
---|
3528 | 丢弃并且不被显示。
|
---|
3529 |
|
---|
3530 | ******************************************************************************
|
---|
3531 | *** Bifurcate drives ***
|
---|
3532 | ******************************************************************************
|
---|
3533 | 分支式驱动器
|
---|
3534 |
|
---|
3535 | 一些机器在 CHS 和 LBA 模式之间对驱动器实施不同的动作。
|
---|
3536 | 当你使用标准的BIOS调用int13/AH=02h来读取扇区时,你可能会发现这个驱动器是一个软盘
|
---|
3537 | 但是当你用扩展的BIOS调用(EBIOS)int13/AH=42h来读取扇区时,你会发现是一个光盘。
|
---|
3538 | 这样的驱动器被叫做分支式的。
|
---|
3539 |
|
---|
3540 | 一个分支式的驱动器拥有两个驱动器号:一个是标准的 BIOS 驱动器号十六进制
|
---|
3541 | 的 00或FF ,并且这个驱动器只使用 CHS 模式的磁盘访问(标准的BIOS int13/AH=02h);
|
---|
3542 | 另一个是标准的 BIOS 驱动器号(按位与)0x100 (即十进制的256),并且这个驱动器只
|
---|
3543 | 使用 LBA 模式的磁盘访问(EBIOS int13/AH=42h)。
|
---|
3544 | 例如,驱动器0x00(即,第一软驱)是分支式的.
|
---|
3545 | 那么驱动器(0x00)使用 CHS 模式来访问它的扇区
|
---|
3546 | 而驱动器(0x100)则使用LBA 模式来访问它的扇区。
|
---|
3547 |
|
---|
3548 | geometry 命令会用 BIF 代替常见的 CHS 和 LBA 来报告分支式驱动器的磁盘访问模式。
|
---|
3549 |
|
---|
3550 | 已知的分支式驱动器。发现虚拟机Virtual PC和一些真实机器当它们引导一个软盘模拟模式
|
---|
3551 | 的可启动光盘时会建立一个分支式的软驱。命令"geometry (fd0)"将显示:
|
---|
3552 | drive 0x00(BIF): C/H/S=...Sector Count/Size=.../512
|
---|
3553 |
|
---|
3554 | 而"geometry (0x100)"将显示
|
---|
3555 | drive 0x100(BIF): C/H/S=...Sector Count/Size=.../2048
|
---|
3556 |
|
---|
3557 | 实际上(0x100) 可以访问整个光盘。
|
---|
3558 | 你可以执行"ls (0x100)/" 显示光盘上文件(不是那个被引导的软盘映像中的文件)。
|
---|
3559 | 当然 "ls (fd0)/"可以列举那些在被引导的软盘映像中的文件。
|
---|
3560 |
|
---|
3561 | 注意:仅仅是某些(真实的或虚拟的)机器有这样的行为,其他的机器不会产生分支式驱动器。
|
---|
3562 |
|
---|
3563 | ******************************************************************************
|
---|
3564 | *** New program badgrub.exe ***
|
---|
3565 | ******************************************************************************
|
---|
3566 | 新程序 badgrub.exe
|
---|
3567 |
|
---|
3568 | 新程序 badgrub.exe 是特意供那些不能运行标准 grub.exe 的‘糟糕的’机器(一些典型
|
---|
3569 | 的 DELL 原型机)使用的。
|
---|
3570 |
|
---|
3571 |
|
---|
3572 | ******************************************************************************
|
---|
3573 | *** Conditional find ***
|
---|
3574 | ******************************************************************************
|
---|
3575 | 条件查找
|
---|
3576 |
|
---|
3577 | 新的find 命令的语法允许带条件的查找设备。
|
---|
3578 |
|
---|
3579 | find [OPTIONS] [FILENAME] [CONDITION]
|
---|
3580 | 选项 文件名 条件
|
---|
3581 |
|
---|
3582 | OPTIONS:
|
---|
3583 | --set-root set the current root device.
|
---|
3584 | --set-root=DIR set current root device and working directory to DIR.
|
---|
3585 | please also see "Notation For The Current Root Device".
|
---|
3586 | --ignore-cd skip search on (cd).
|
---|
3587 | --ignore-floppies bypass all floppies.
|
---|
3588 | --devices=DEVLIST specify the search devices and order.
|
---|
3589 | DEVLIST u->(ud)
|
---|
3590 | n->(nd)
|
---|
3591 | p->(pd)
|
---|
3592 | h->(hdx)
|
---|
3593 | c->(cd)
|
---|
3594 | f->(fdx)
|
---|
3595 | default: upnhcf
|
---|
3596 |
|
---|
3597 |
|
---|
3598 | 其中的 CONDITION 是一个返回值是 TRUE 或者 FALSE 的标准 grub 命令。
|
---|
3599 |
|
---|
3600 | 示例 1: 列举所有的分区,所有的软驱和 (cd) 。
|
---|
3601 |
|
---|
3602 | find
|
---|
3603 |
|
---|
3604 | 示例 2:列举文件系统已知的所有设备。
|
---|
3605 |
|
---|
3606 | find +1
|
---|
3607 |
|
---|
3608 | 示例 3: 列举分区类型为0xAF的所有分区。
|
---|
3609 |
|
---|
3610 | find checkrange 0xAF parttype
|
---|
3611 |
|
---|
3612 | 示例 4:列举分区类型为 0x07 且根目录存在 ntldr 的所有分区。
|
---|
3613 |
|
---|
3614 | find /ntldr checkrange 0x07 parttype
|
---|
3615 |
|
---|
3616 | 示例 5: 设置当前根设备到第一个根目录有存在ntldr的分区。
|
---|
3617 |
|
---|
3618 | find --set-root /ntldr
|
---|
3619 |
|
---|
3620 | 示例 6: 同例5,但是以下命令只查在硬盘上查找bootmgr
|
---|
3621 |
|
---|
3622 | find --set-root --devices=h /bootmgr
|
---|
3623 |
|
---|
3624 | 示例 7: 设置当前根设备为第一激活的主分区。
|
---|
3625 |
|
---|
3626 | find --set-root --devices=h makeactive --status
|
---|
3627 |
|
---|
3628 | 更新: 新的find 命令语法允许指定要查找和设备和查找的顺序。
|
---|
3629 | 新的参数 --devices=DEVLIST,用于指定查找的设备和顺序。
|
---|
3630 | DEVLIST可以下以下的字母组合。
|
---|
3631 | u,p,n,h,c,f -->分别对应 ud,pd,nd,hd,cd,fd,
|
---|
3632 | 查找时根据DEVLIST指定的设备顺序进行查找。默认是upnhcf.
|
---|
3633 |
|
---|
3634 |
|
---|
3635 | 例子: 1.只查找硬盘上的文件
|
---|
3636 | find --devices=h /file
|
---|
3637 | 2.依次查找硬盘、光盘、软盘上的文件
|
---|
3638 | find --devices=hcf /file
|
---|
3639 |
|
---|
3640 | 注意:新的find命令有一个改变,查找的时候会优先查找当前设备(如果在列表中的话)。
|
---|
3641 |
|
---|
3642 | ******************************************************************************
|
---|
3643 | *** How to build grldr boot images ***
|
---|
3644 | ******************************************************************************
|
---|
3645 | 如何创建 grldr 引导的映像文件
|
---|
3646 |
|
---|
3647 | 1. 创建1.44M 软盘镜像文件 ext2grldr.img
|
---|
3648 |
|
---|
3649 | dd if=/dev/zero of=ext2grldr.img bs=512 count=2880
|
---|
3650 | mke2fs ext2grldr.img
|
---|
3651 | mkdir ext2tmp
|
---|
3652 | mount -o loop ext2grldr.img ext2tmp
|
---|
3653 | cp default ext2tmp
|
---|
3654 | cp menu.lst ext2tmp
|
---|
3655 | cp grldr ext2tmp
|
---|
3656 | umount ext2tmp
|
---|
3657 | bootlace.com --floppy --chs --sectors-per-track=18 --heads=2 --start-sector=0 --total-sectors=2880 ext2grldr.img
|
---|
3658 |
|
---|
3659 | 2. 创建1.44M 软盘镜像文件 fat12grldr.img
|
---|
3660 |
|
---|
3661 | dd if=/dev/zero of=fat12grldr.img bs=512 count=2880
|
---|
3662 | mkdosfs fat12grldr.img
|
---|
3663 | mkdir fat12tmp
|
---|
3664 | mount -o loop fat12grldr.img fat12tmp
|
---|
3665 | cp default fat12tmp
|
---|
3666 | cp menu.lst fat12tmp
|
---|
3667 | cp grldr fat12tmp
|
---|
3668 | umount fat12tmp
|
---|
3669 | bootlace.com --floppy --chs fat12grldr.img
|
---|
3670 |
|
---|
3671 | 3. 创建 iso9660 文件系统的光盘镜像文件 grldr.iso
|
---|
3672 |
|
---|
3673 | mkdir iso_root
|
---|
3674 | cp grldr iso_root
|
---|
3675 | cp menu.lst iso_root
|
---|
3676 | mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root
|
---|
3677 |
|
---|
3678 |
|
---|
3679 | ******************************************************************************
|
---|
3680 | *** Use bootlace.com to install partition boot record ***
|
---|
3681 | ******************************************************************************
|
---|
3682 | 使用 bootlace.com 来安装分区引导记录
|
---|
3683 |
|
---|
3684 | 在 bootlace.com 没有实现 --install-partition 选项之前,你需要用已实现的
|
---|
3685 | --floppy=PartitionNumber 选项来替代。
|
---|
3686 |
|
---|
3687 | 你必须按下面的方法执行:
|
---|
3688 |
|
---|
3689 | 步骤 1. 获取分区的引导扇区然后保存为一个文件 MYPART.TMP 。对于 NTFS 文件系统,你需要获取
|
---|
3690 | 起始的16 个扇区。对于其他类型的文件系统,你只需要获取一个扇区,但获取多个扇区
|
---|
3691 | 也是没问题的。
|
---|
3692 |
|
---|
3693 | 步骤 2. 执行这些命令:
|
---|
3694 |
|
---|
3695 | bootlace.com --floppy=Y --sectors-per-track=S --heads=H --start-sector=B --total-sectors=C --vfat --ext2 --ntfs MYPART.TMP
|
---|
3696 |
|
---|
3697 | 这里我们假定 MYPART.TMP 是从 (hdx,y) 获取的而且分区号 Y 必须在--floppy=Y 选项中被指定。
|
---|
3698 |
|
---|
3699 | 注意:对于FAT12/16/32/NTFS等分区,你可以省略这些选项:
|
---|
3700 | --sectors-per-track, --heads, --start-sector, --total-sectors,
|
---|
3701 | --vfat and --ext2.
|
---|
3702 |
|
---|
3703 | 对于 NTFS 分区,你必须指定 --ntfs 选项。
|
---|
3704 |
|
---|
3705 | 对于 ext2 分区,你可以省略 --vfat, --ntfs he --ext2 选项,但是其他选项必须被指定。
|
---|
3706 |
|
---|
3707 | 步骤 3. 将 MYPART.TMP 写回你原来分区(hdx,y)的引导扇区。
|
---|
3708 |
|
---|
3709 | 注意:现在只有一些文件系统(FAT12/16/32/NTFS/ext2/ext3)被支持。
|
---|
3710 |
|
---|
3711 | 注意2:在Linux 下你可以对分区直接写。也就是说,步骤1 和步骤3 是不需要的。简单使用
|
---|
3712 | 它的设备名代替 MYPART.TMP 即可。
|
---|
3713 |
|
---|
3714 | 注意3:grubinst 具有把 grldr 的自举代码安装到分区引导扇区的功能。
|
---|
3715 |
|
---|
3716 | ******************************************************************************
|
---|
3717 | *** Use a single key to select menu item ***
|
---|
3718 | ******************************************************************************
|
---|
3719 | 使用一个单一的键来选择菜单项
|
---|
3720 |
|
---|
3721 | 一些机器具有简化的键盘。这些键盘可能只有数字键 0 到 9 ,外加少数几个其他键。当
|
---|
3722 | 菜单还未显示时,使用者可以按下某个键 8 次。当菜单控制模块发现一个连续的单一按
|
---|
3723 | 键时,它将认为使用者希望使用这个键来选择菜单和启动。这个单一的键可以充当右方向
|
---|
3724 | 键来为使用者选择菜单。然后在使用者停止按键的 5 秒之后,被选择的菜单项将自动启
|
---|
3725 | 动。任何的标准键可以被作为单一的键来达到这个目的,除了少数功能键,比如 b ,e ,
|
---|
3726 | 回车键,等等。一旦另外的键被按下,单键选择特性将立即消失。
|
---|
3727 |
|
---|
3728 |
|
---|
3729 | ******************************************************************************
|
---|
3730 | *** Parameter file for bootlace running under DOS ***
|
---|
3731 | ******************************************************************************
|
---|
3732 |
|
---|
3733 | 你可以把所有或部分的命令行参数放到一个文件中。这个文件可以有多行。就像空格
|
---|
3734 | 和制表符一样,回车符和换行符也可以在参数文件中分割命令行参数。
|
---|
3735 |
|
---|
3736 | 示例:
|
---|
3737 | bootlace < my_parafile
|
---|
3738 | bootlace --read-only my_mbr < my_other_options
|
---|
3739 |
|
---|
3740 | 注意: 不能使用管道符"|"。你必须使用输入重定向符 (<) 。
|
---|
3741 |
|
---|
3742 | ******************************************************************************
|
---|
3743 | *** Use bootlace to create a triple MBR ***
|
---|
3744 | ******************************************************************************
|
---|
3745 | 使用 bootlace 来建立一个三重的 MBR
|
---|
3746 |
|
---|
3747 | 虽然这也能用于硬盘,但是它典型的使用是被用于 USB 设备。
|
---|
3748 | 创建三重的 MBR 的步骤:
|
---|
3749 |
|
---|
3750 | 1. 使用一个新版的 FDISK 分区软件来建立一个从第 95 扇区开始的FAT12或16或32 的分区
|
---|
3751 | (这里是 LBA 扇区表示法,起始扇区(MBR)是 0 扇区。)
|
---|
3752 |
|
---|
3753 | 2. 安装 grldr 的引导扇区到这个分区的引导扇区。参见上面的“使用 bootlace.com 来安装分区引导记录”
|
---|
3754 |
|
---|
3755 | 3. 获取从起始扇区 0 扇区(MBR)开始的96个扇区,然后保存到一个文件 MYMBR96.TMP 中。
|
---|
3756 |
|
---|
3757 | 4. 运行 bootlace.com:
|
---|
3758 | bootlace.com MYMBR96.TMP
|
---|
3759 | 5. 将 MYMBR96.TMP 从MBR (0 扇区)开始回写到驱动器上。
|
---|
3760 |
|
---|
3761 | 注意: 如果驱动器已经是一个三重的 MBR ,那么 bootlace 会删除它并且恢复为原本的分区布局。
|
---|
3762 |
|
---|
3763 | ******************************************************************************
|
---|
3764 | *** Use 'pxe detect' in preset-menu ***
|
---|
3765 | ******************************************************************************
|
---|
3766 | 在预置菜单中使用 'pxe detect' 命令
|
---|
3767 |
|
---|
3768 | 现在“pxe”命令有了个新的子命令“detect”:
|
---|
3769 | pxe detect [BLOCK_SIZE] [MENU_FILE]
|
---|
3770 | 包大小选项 菜单文件选项
|
---|
3771 |
|
---|
3772 | BLOCK_SIZE 选项指定出 pxe 包的大小。如果它没有被指定或者是被指定为 0 ,那么
|
---|
3773 | grub4dos将通过一个侦测过程来获取数据传送包的一个恰当的的值。
|
---|
3774 |
|
---|
3775 | MENU_FILE 选项指定出 PXE 服务器上的配置文件。如果它被省略,在 menu.lst 子目录
|
---|
3776 | 中的标准配置文件将获得控制。关于menu.lst 子目录中的配置文件的描述,请查阅上面
|
---|
3777 | 的“GRLDR 作为 PXE 启动文件”一节。
|
---|
3778 |
|
---|
3779 | 如果MENU_FILE 是以"/"开始的,那么PXE 服务器上的 MENU_FILE 将获得控制,否则
|
---|
3780 | (如果MENU_FILE不是以"/"开始)将没有菜单被执行。
|
---|
3781 |
|
---|
3782 | 在你的系统用 512 字节的默认包大小不能运行时,通常你应该在访问(pd)设备之前
|
---|
3783 | 使用一条 "pxe blksize ..." 或 一条 "pxe detect ..."命令。
|
---|
3784 |
|
---|
3785 | ******************************************************************************
|
---|
3786 | *** Use 'configfile' in preset-menu ***
|
---|
3787 | ******************************************************************************
|
---|
3788 | 在预置菜单中使用 'configfile'命令
|
---|
3789 |
|
---|
3790 | 现在预置菜单具有最高控制权。它将在启动设备上的 menu.lst 之前获得控制。如果
|
---|
3791 | 'configfile' 命令在初始化命令组中出现,那么控制将转到启动设备上的menu.lst文件。
|
---|
3792 |
|
---|
3793 | ******************************************************************************
|
---|
3794 | *** New command 'dd' to copy files ***
|
---|
3795 | ******************************************************************************
|
---|
3796 | 复制文件的新命令 'dd'
|
---|
3797 |
|
---|
3798 | 用法:
|
---|
3799 |
|
---|
3800 | dd if=IF of=OF [bs=BS] [count=C] [skip=IN] [seek=OUT] [buf=ADDR] [buflen=SIZE]
|
---|
3801 |
|
---|
3802 | 将 IF(源文件)复制到OF (目标文件)中。BS 是以字节计数的一个块的大小,默认
|
---|
3803 | 值是512 。C 是复制的块数,默认值是源文件中的总块数。IN 指定在读取时跳过的块
|
---|
3804 | 数,默认值是 0 。OUT 指定在写入时跳过的块数,默认值是0 。已跳过的块不会被改
|
---|
3805 | 变。源文件和目标文件必须是存在的。
|
---|
3806 | 译注:新增参数buf表示dd所用的读写缓存的起始地址,buflen表示缓存的长度,即大小。
|
---|
3807 |
|
---|
3808 | 源文件和目标文件必须以设备名开头,即,`(...)'的格式。对于当前根设备你应该使用`()'。
|
---|
3809 |
|
---|
3810 | dd 命令既不扩大也不减小目标文件的大小,源文件尾部剩余的部分将被丢弃。目标
|
---|
3811 | 文件不能是gzip压缩过的文件。如果源文件是gzip 压缩过的文件,它将在复制时被
|
---|
3812 | 自动解压。
|
---|
3813 |
|
---|
3814 | dd 具有危险性,使用风险由你自己的承担。作为一种安全方面的考虑,你应当只使
|
---|
3815 | 用 dd 来写入一个内存中的文件。
|
---|
3816 |
|
---|
3817 | 某些情况下在写入NTFS 中的文件的时,dd 可能会失败。
|
---|
3818 |
|
---|
3819 | 假如你尝试在菜单中执行dd命令来写入一个不是内存中的设备或者块文件时,你会被安全的拒绝:-)
|
---|
3820 | (更新:现在不再限制)
|
---|
3821 |
|
---|
3822 | 更新: 新选项实现了让使用者自定义dd 命令的读写缓存。默认读写缓存起始于地
|
---|
3823 | 址0x50000,长度为0x10000 (即64KB)。你不能指定起始地址ADDR 低于0x100000
|
---|
3824 | (即 1 MB)的缓存位置。此外,你必须指定参数SIZE 大于0x10000(即64K)。
|
---|
3825 | 通常,你需要令ADDR大于或等于0x1000000 (16MB),并且 SIZE 也要大于或等于16MB 。
|
---|
3826 | 增大 SIZE 的值能够加快 dd 的读写速度。
|
---|
3827 |
|
---|
3828 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3829 | !!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!
|
---|
3830 | !!!! Caution! Both IF and OF can be a device name which stands for !!!!
|
---|
3831 | !!!! all the sectors on the device. Take utmost care! !!!!
|
---|
3832 | !!!!______________________________________________________________________!!!!
|
---|
3833 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3834 | 警告!IF 和 OF 都可以是一个设备名,即它代表了设备上全部的扇区。慎之又慎!
|
---|
3835 |
|
---|
3836 | ******************************************************************************
|
---|
3837 | *** New command 'uuid' to identify partitions ***
|
---|
3838 | ******************************************************************************
|
---|
3839 | 确认分区的新命令 'uuid'
|
---|
3840 |
|
---|
3841 | 用法:
|
---|
3842 |
|
---|
3843 | uuid [DEVICE] [UUID]
|
---|
3844 |
|
---|
3845 | 如果 DEVICE 选项未被指定,将在所有分区中搜索指定的 UUID 号的文件系统,
|
---|
3846 | 然后把包含这个文件系统的分区设置为新的根 (如果 uuid 被指定时),或者只列举所
|
---|
3847 | 有设备上的文件系统的 uuid 号(如果 uuid 未被指定时)。
|
---|
3848 | 如果 DEVICE 选项被指定了,将返回 真 或 假 ,对应于指定的设备是否与指定的 UUID
|
---|
3849 | 号相符(如果uuid被指定时),或者仅仅列举指定设备的uuid 号(uuid 未被指定时)。
|
---|
3850 |
|
---|
3851 | 示例 1:
|
---|
3852 | find --set-root uuid () 7f95820f-5e33-4e6c-8f50-0760bf06d79c
|
---|
3853 |
|
---|
3854 | 这将查找 uuid 等于 7f95820f-5e33-4e6c-8f50-0760bf06d79c的分区,然后将这个找到的分区设置为根。
|
---|
3855 |
|
---|
3856 | 示例 2:
|
---|
3857 | uuid ()
|
---|
3858 | 这将显示当前根设备的 uuid 号。
|
---|
3859 |
|
---|
3860 | ******************************************************************************
|
---|
3861 | *** gfxmenu support in grub4dos ***
|
---|
3862 | ******************************************************************************
|
---|
3863 | grub4dos 的 gfxmenu 支持
|
---|
3864 |
|
---|
3865 | gfxmenu 支持已经被增加到 grub4dos 当中。使用它,你首先需要找到一个你需要的mesage
|
---|
3866 | 文件,然后在menu.lst中用类似这样的命令来装载它:
|
---|
3867 |
|
---|
3868 | gfxmenu /message
|
---|
3869 |
|
---|
3870 | 这是一个全局命令,也就是说,不能放入任何的菜单项中。同时,它只能被使用于配置文件
|
---|
3871 | 中,而在控制台模式中执行它是无效的。
|
---|
3872 |
|
---|
3873 | gfxmenu 不能与全局密码保护功能同时使用。
|
---|
3874 |
|
---|
3875 | message 文件有两个主要的格式。老的格式是通过gfxboot 3.2版或更旧的版本创建的
|
---|
3876 | (message文件的大小通常只能是150 k),当采用 gfxboot 3.3 版或更新的版本创建
|
---|
3877 | 新格式时,(message文件的大小通常可以超过 300K)。这两种格式在grub4dos 中都
|
---|
3878 | 已被支持。
|
---|
3879 |
|
---|
3880 | ******************************************************************************
|
---|
3881 | *** Use 'write' to write a string into a device or file ***
|
---|
3882 | ******************************************************************************
|
---|
3883 | 使用 'write' 命令将字符串写入设备或文件中
|
---|
3884 |
|
---|
3885 | 用法:
|
---|
3886 |
|
---|
3887 | write [--offset=SKIP] ADDR_OR_FILE INTEGER_OR_STRING
|
---|
3888 |
|
---|
3889 | SKIP 是一个整数默认值是 0 。
|
---|
3890 |
|
---|
3891 | 如果 ADDR_OR_FILE选项 被指定为一个整数,那么它被作为一个内存地址对待,并且
|
---|
3892 | INTEGER_OR_STRING选项也必须是一个整数值。整数 INTEGER_OR_STRING 将被写
|
---|
3893 | 入(ADDR_OR_FILE 加上 SKIP 值)的地址处。
|
---|
3894 |
|
---|
3895 | 如果 ADDR_OR_FILE选项 指定的是一个设备或一个文件,那么INTEGER_OR_STRING 选
|
---|
3896 | 项将被作为一个字符串对待,它将被写入跳过 SKIP 个字节(字节计数)的指定的设
|
---|
3897 | 备或文件当中。
|
---|
3898 |
|
---|
3899 | 字符串不需要被引用,也就是说,不需要单引号(') 也不用 双引号(") 来引用它。
|
---|
3900 |
|
---|
3901 | 空格符必须被反斜杠(\)引用。(更新:现在不需要了)
|
---|
3902 | (译注:如果字符串以空格开头,开头的这个空格符还是需要反斜杠引用)
|
---|
3903 |
|
---|
3904 | 单引号(')和双引号(")不用特别说明并且可以直接使用到字符串中。
|
---|
3905 |
|
---|
3906 | 下面是一些 C 语言风格的引用序列说明:
|
---|
3907 |
|
---|
3908 | \NNN (1到3位)八进制值 NNN 表示的字符
|
---|
3909 | \\ 反斜杠
|
---|
3910 | \a 警报 (声音)
|
---|
3911 | \b 退格符
|
---|
3912 | \f 换页符
|
---|
3913 | \n 换行符
|
---|
3914 | \r 回车符
|
---|
3915 | \t 水平制表符
|
---|
3916 | \v 垂直制表符
|
---|
3917 | \xHH (1到2位)十六进制值为 HH 的字节
|
---|
3918 |
|
---|
3919 | 就像 dd 命令一样,write 命令既不扩大也不缩小目标文件的文件大小,字符串的
|
---|
3920 | 剩余部分将被丢弃。目标文件也不能是一个压缩过的文件。
|
---|
3921 |
|
---|
3922 | 还是和 dd 类似,write 命令也具有危险性,使用风险你自己承担。作为一种安全
|
---|
3923 | 方面的考虑,你应当只向内存中的文件写入。
|
---|
3924 |
|
---|
3925 | 某些情况下当写入 NTFS 中的文件时,write命令可能失败。
|
---|
3926 |
|
---|
3927 | 假如你尝试在菜单中执行 write 命令来写入一个不是内存中的设备或者块文件时,
|
---|
3928 | 你会被安全的拒绝:-) (更新:现在不再限制)
|
---|
3929 |
|
---|
3930 |
|
---|
3931 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3932 | !!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!
|
---|
3933 | !!!! Caution! The file to write can be a device name which stands !!!!
|
---|
3934 | !!!! for all the sectors on the device. Take utmost care! !!!!
|
---|
3935 | !!!!______________________________________________________________________!!!!
|
---|
3936 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3937 | 警告!被write 命令写入的文件可以是一个设备名,即它代表了设备上的所有
|
---|
3938 | 扇区。慎之又慎!
|
---|
3939 |
|
---|
3940 |
|
---|
3941 | ******************************************************************************
|
---|
3942 | *** Item-by-item help text for menu entries ***
|
---|
3943 | ******************************************************************************
|
---|
3944 | 为菜单项添加提示信息
|
---|
3945 |
|
---|
3946 | 当你选择一个菜单项时,屏幕底部的提示信息将发生变化。
|
---|
3947 |
|
---|
3948 | 你可以在标题行中添加你的提示信息。必须用"\n" 开头,示例:
|
---|
3949 | title This is the title\nThis is the help text.\nAnd this is the 2nd line of the help text.
|
---|
3950 |
|
---|
3951 | 一些 C 语言风格的引用符号在请看前面章节的说明。
|
---|
3952 |
|
---|
3953 | ******************************************************************************
|
---|
3954 | *** initrd can load multiple cpio files for Linux 2.6 kernels ***
|
---|
3955 | ******************************************************************************
|
---|
3956 | inird 命令可以为Linux 2.6 核心装载多个cpio 格式的文件
|
---|
3957 |
|
---|
3958 | 用法:
|
---|
3959 | initrd FILE [FILE ...]
|
---|
3960 |
|
---|
3961 | 注意 1:你不能用这种方法装载多于一个的老式磁盘镜像,因为Linux 核心不支持。
|
---|
3962 | 注意 2:其中的 FILE 必须和在syslinux中使用的顺序一样。
|
---|
3963 |
|
---|
3964 | ******************************************************************************
|
---|
3965 | *** access some internel variables at a fixed location ***
|
---|
3966 | ******************************************************************************
|
---|
3967 | 在固定位置访问一些内部变量
|
---|
3968 | 地址 长度 说明
|
---|
3969 | ========= ======== ==============================================
|
---|
3970 | 0000:8208 4字节(即双字) 启动分区号 install_partition (the boot partition)
|
---|
3971 | 0000:8280 4字节(即双字) 启动驱动器号(boot_drive)
|
---|
3972 | 0000:8284 4字节(即双字) pxe 客户端 ip (即本地ip)
|
---|
3973 | 0000:8288 4字节(即双字) pxe 服务器 ip
|
---|
3974 | 0000:828C 4字节(即双字) pxe 网关 ip
|
---|
3975 | 0000:8290 8字节(即四字) 最后访问的文件的大小(是执行"cat --length=0"后的文件大小)
|
---|
3976 | 0000:8298 4字节(即双字) 可用的扩展内存大小(以 KB 为单位)
|
---|
3977 | 0000:829C 4字节(即双字) 当前根分区号(current root partition)
|
---|
3978 | 0000:82A0 4字节(即双字) 当前根所在的驱动器(current root drive)
|
---|
3979 | 0000:82A4 4字节(即双字) 解压标志 (gzip非自动解压),非0时不自动解压
|
---|
3980 | 0000:82A8 8字节(即四字) 最后访问的分区的起始扇区号
|
---|
3981 | 0000:82B0 8字节(即四字) 最后访问的分区的扇区总数
|
---|
3982 | 0000:8278 4字节(即双字) GRUB4DOS编译的日期十进制数.
|
---|
3983 | 以下命令用于判断当前使用的GRUB是否在2010-12-30日编译的。
|
---|
3984 | checkrange 20101230 read 0x8278
|
---|
3985 |
|
---|
3986 | 注意 1:Filesize 通过执行 "cat --length=0 FILE" 来初始化和修改。
|
---|
3987 | 注意 2:尽量不要改写这些变量(应该只是读取)。
|
---|
3988 | 注意 3:你可以使用内存地址6000:0000开始的 1K空间作为你自己的变量区(参见注意4)。
|
---|
3989 | 注意 4:read 命令现在从指定的地址处返回32位整数值。
|
---|
3990 | 注意 5:grub4dos 还没有变量扩展的功能。你只能使用整数变量。你不需要申明它们,就
|
---|
3991 | 可以直接使用这些内存地址。通常你需要通过一个逻辑值或者一个条件测试命令
|
---|
3992 | 来使用这些变量,即,类似这种格式:"checkrange RANGE read ADDR"
|
---|
3993 | 注意 6:内部变量no_decompression, saved_drive and saved_partition 是可写的。
|
---|
3994 |
|
---|
3995 | ******************************************************************************
|
---|
3996 | *** possibility to run another menu.lst after gfxmenu ***
|
---|
3997 | ******************************************************************************
|
---|
3998 | 在 gfxmenu 之后后运行其它 menu.lst
|
---|
3999 |
|
---|
4000 | 注意下面是在 GFXMENU 之后使用 CONFIGILE 的示例:
|
---|
4001 |
|
---|
4002 | # The menu.lst file for gfxmenu
|
---|
4003 | default=0
|
---|
4004 | timeout=5
|
---|
4005 | gfxmenu /message
|
---|
4006 | configfile /another.lst
|
---|
4007 | title 0..........
|
---|
4008 | ................
|
---|
4009 | title 1..........
|
---|
4010 | ................
|
---|
4011 | title 2..........
|
---|
4012 | ................
|
---|
4013 | # End of menu.lst
|
---|
4014 |
|
---|
4015 | # Begin another.lst
|
---|
4016 | default=0
|
---|
4017 | timeout=5
|
---|
4018 | title 0..........
|
---|
4019 | ................
|
---|
4020 | title 1..........
|
---|
4021 | ................
|
---|
4022 | title 2..........
|
---|
4023 | ................
|
---|
4024 | # End of another.lst
|
---|
4025 |
|
---|
4026 | 会首先尝试执行 gfxmenu 命令。当它退出时(或者失败时)控制会转到 another.lst 菜单。
|
---|
4027 |
|
---|
4028 | ******************************************************************************
|
---|
4029 | *** a range of drives can be unmapped ***
|
---|
4030 | ******************************************************************************
|
---|
4031 |
|
---|
4032 | 用法:
|
---|
4033 | map --unmap=RANGE
|
---|
4034 |
|
---|
4035 | 其中的 RANGE 是一个已被映射的 BIOS 驱动器域。BIOS 驱动器号 0 表示第一软驱,1 表示
|
---|
4036 | 第二软驱;0x80 表示第一硬盘,0x81 表示第二硬盘,等等;虚拟光盘(hd32) 对应于
|
---|
4037 | BIOS 驱动器号 0xA0 ,(hd33) 对应于0xA1 ,等等。
|
---|
4038 |
|
---|
4039 | 关于RANGE 的说明,请参阅前述的“新命令 CHECKRANGE ”这节。
|
---|
4040 |
|
---|
4041 | 示例 1:
|
---|
4042 | map --unmap=0,0x80,0xff
|
---|
4043 |
|
---|
4044 | 这将反映射虚拟软驱 (fd0),虚拟硬盘(hd0)和虚拟光盘(0xff)。
|
---|
4045 |
|
---|
4046 | 示例 2:
|
---|
4047 | map --unmap=0:0xff
|
---|
4048 |
|
---|
4049 | 这将反映射所有的虚拟软驱,所有的虚拟硬盘和所有的虚拟光盘。
|
---|
4050 |
|
---|
4051 | 注意 1:通常,一条‘map’命令将在驱动器映射表中为虚拟驱动器增加一个表项。而
|
---|
4052 | ‘--unmap’意味着在驱动器映射表中(具体是指虚拟驱动器)的表项会被删除。
|
---|
4053 |
|
---|
4054 | Note 2: The --unhook option only breaks the INT13 hook(to the inerrupt
|
---|
4055 | vector table). It will not affect the drive map table. And later on
|
---|
4056 | execution of a `boot' command, the INT13 disk emulation routine will
|
---|
4057 | automatically get hooked(to the interrupt vector table) when needed
|
---|
4058 | (e.g., the drive map table is non-empty) even if it has been unhooked.
|
---|
4059 | 注意 2:--unhook 选项仅仅是断开 INT13 的挂钩(在中断矢量表中)。它不会影响到驱
|
---|
4060 | 动器映射表。而且在执行了一个‘boot’命令之后,即使是它已经被反映射了的
|
---|
4061 | 时候,INT13磁盘仿真程序也会在需要的时候(即,驱动器映射表非空时)自动建立挂钩。
|
---|
4062 |
|
---|
4063 | 注意 3:通常你需要在已经改变了驱动器映射表之后执行一条`map --rehook'命令。
|
---|
4064 |
|
---|
4065 | ******************************************************************************
|
---|
4066 | *** geometry tune and sync ***
|
---|
4067 | ******************************************************************************
|
---|
4068 | 磁盘几何参数的修正和同步
|
---|
4069 |
|
---|
4070 | 当一个USB 存储设备被连接到一台(或者是不同的)机器上时,分区表中或 BPB 中的磁盘
|
---|
4071 | 几何参数值可能是无效的,并且这个机器可能在启动时死机。因此你需要为驱动器找到一个
|
---|
4072 | 正确的磁盘几何参数(使用 `geometry --tune'),然后更新分区表或 BPB 中的磁盘
|
---|
4073 | 几何参数(使用`geometry --sync')。
|
---|
4074 |
|
---|
4075 | 假如你想启动到DOS,那上面的步骤是必要的,因为 DOS 要求有正确的磁盘几何参数在分区
|
---|
4076 | 表和BPB 中。Windows 及 Linux 应该也需要,因为引导程序运行在实模式中。
|
---|
4077 |
|
---|
4078 | ******************************************************************************
|
---|
4079 | *** 版本编号 ***
|
---|
4080 | ******************************************************************************
|
---|
4081 |
|
---|
4082 | 我们添加了一个字符 'a', 'b', 'c' or 'p' 到版本编号(e.g., 0.4.5).
|
---|
4083 | 所以现在版本编号是 0.4.5a, 0.4.5b, 0.4.5c, 0.4.5 or 0.4.5p.
|
---|
4084 |
|
---|
4085 | 'a' - alpha test. 不稳定, 尤其是在有已知BUG的情况下。
|
---|
4086 | 'b' - beta test. 测试版,开发人员觉得这个版本没有bug,希望有一个长期的测试。
|
---|
4087 | 'c' - 候选发布版,相对比较稳定。
|
---|
4088 | ''(nothing) - 正式版,比较稳定。
|
---|
4089 | 'p' - 修补版,对于在正式版中发现的一些问题进行修正.
|
---|
4090 |
|
---|
4091 | ******************************************************************************
|
---|
4092 | *** Running User Programs(外部命令,供开发人员参考) ***
|
---|
4093 | ******************************************************************************
|
---|
4094 |
|
---|
4095 | 从0.4.5起,用户可以自行编写程序以在GRUB4DOS中运行。
|
---|
4096 | 该可执行程序文件必须以8字节grub4dos EXEC签名结尾。
|
---|
4097 | 0x05, 0x18, 0x05, 0x03, 0xBA, 0xA7, 0xBA, 0xBC
|
---|
4098 |
|
---|
4099 | The executable must have no relocations, and the entry point is at the very
|
---|
4100 | beginning of the file, just like a DOS .com file(but the grub4dos executable
|
---|
4101 | is 32-bit).
|
---|
4102 | 程序的入口点在文件头,和DOS的.com文件很像(但我们是32位的程序)。
|
---|
4103 |
|
---|
4104 | 注:因为使用了linux gcc的特性,所以程序只能在linux下使用gcc进行编译。
|
---|
4105 |
|
---|
4106 | 附上一个简单的echo.c源码,供参考。
|
---|
4107 | /*================ begin echo.c ================*/
|
---|
4108 |
|
---|
4109 | /*
|
---|
4110 | * 编译:
|
---|
4111 | gcc -nostdlib -fno-zero-initialized-in-bss -fno-function-cse -fno-jump-tables -Wl,-N -fPIE echo.c
|
---|
4112 |
|
---|
4113 | * disassemble: objdump -d a.out
|
---|
4114 | * confirm no relocation: readelf -r a.out
|
---|
4115 | * generate executable: objcopy -O binary a.out echo
|
---|
4116 | * 经过这一步之后生成的echo文件就是可以在grub4dos中运行的程序。
|
---|
4117 | * and then the resultant echo will be grub4dos executable.
|
---|
4118 | */
|
---|
4119 |
|
---|
4120 | /*
|
---|
4121 | * This is a simple ECHO command, running under grub4dos.
|
---|
4122 | */
|
---|
4123 | #define sprintf ((int (*)(char *, const char *, ...))((*(int **)0x8300)[0]))
|
---|
4124 | #define printf(...) sprintf(NULL, __VA_ARGS__)
|
---|
4125 |
|
---|
4126 | int i = 0x66666666; /* 这是必要的,看下面的注释。*/
|
---|
4127 | /* gcc treat the following as data only if a global initialization like the
|
---|
4128 | * above line occurs.
|
---|
4129 | */
|
---|
4130 |
|
---|
4131 | /* GRUB4DOS可执行程序结尾必须有以下8个字节(EXEC签名) */
|
---|
4132 | asm(".long 0x03051805");
|
---|
4133 | asm(".long 0xBCBAA7BA");
|
---|
4134 | /* 感谢上帝, gcc 会把上面的8个字按兵不动放在最终程序的最后面。
|
---|
4135 | * 不要在这里插入其它任何代码.
|
---|
4136 | */
|
---|
4137 |
|
---|
4138 | int main(char *arg,int flags)
|
---|
4139 | {
|
---|
4140 | return printf("%s\n",arg);
|
---|
4141 | }
|
---|
4142 | /*================ end echo.c ================*/
|
---|
4143 |
|
---|
4144 | 0x8300 是 grub4dos 系统函数(API)的入口点. 你可以在 asm.S 源码中找到它的定义.
|
---|
4145 |
|
---|
4146 | 目前可以使用的函数和变量:
|
---|
4147 | http://grubutils.googlecode.com/svn/trunk/src/include/grub4dos.h
|
---|
4148 |
|
---|
4149 | ******************************************************************************
|
---|
4150 | *** Map options added by Karyonix ***
|
---|
4151 | ******************************************************************************
|
---|
4152 |
|
---|
4153 | (from boot-land.net) Karyonix's note:
|
---|
4154 | 注:boot-land.net网站已经改成 reboot.pro
|
---|
4155 | map --add-mbt= option to be used with --mem. If =0 master boot track will not
|
---|
4156 | be added automatically.
|
---|
4157 | 配合--mem 使用. 如果=0 则不会自动添加主引导磁道.
|
---|
4158 | 说明:默认情况下把一个分区镜像map为一个硬盘时会自动添加一个主引导磁道.
|
---|
4159 | 使用该参数可以禁止GRUB4DOS自动添加。一般不需要使用这个参数。
|
---|
4160 |
|
---|
4161 | map --top option to be used with --mem. map --mem will try to allocate memory
|
---|
4162 | at highest available address.
|
---|
4163 | 配合--mem 使用. 如果=0 则不会自动添加主引导磁道.
|
---|
4164 | 说明:默认情况下把一个分区镜像map为一个硬盘时会自动添加一个主引导磁道.
|
---|
4165 | 使用该参数可以禁止GRUB4DOS自动添加。一般不需要使用这个参数。
|
---|
4166 | map --mem-max=, map --mem-min options to be used before map --mem. Allow user
|
---|
4167 | to manually limit range of address that map --mem can use.
|
---|
4168 |
|
---|
4169 | safe_parse_maxint_with_suffix function parses K,M,G,T suffix after number.
|
---|
4170 | 注:更新的GRUB4DOS版本中已经使用这个参数替换了默认的safe_parse_maxint函数。
|
---|
4171 | 所以只要支持数值的命令行都可以使用以上特性。比如:
|
---|
4172 | read 0x100000 //读取内存1MB处的数值
|
---|
4173 | 可以写成如下方式,方便使用。
|
---|
4174 | read 1m
|
---|
4175 | 其它的命令只要支持数值输入的都可以使用这个特性。
|
---|
4176 |
|
---|
4177 | ******************************************************************************
|
---|
4178 | *** Graphics mode 6A: 800x600 with 16 colors ***
|
---|
4179 | ******************************************************************************
|
---|
4180 |
|
---|
4181 | 现在有两2种可选的图形模式,默认的是640x480模式.
|
---|
4182 | 新的是800x600模式(对一些机子支持不是很好,有可能会死机)。
|
---|
4183 |
|
---|
4184 | 使用以下方法可以切换图形显示模式。
|
---|
4185 |
|
---|
4186 | 1. 确定目前是在控制台模式,你可以执行命令 "terminal console" 进行切换。
|
---|
4187 | 2. 使用命令"graphicsmode 0x6a" 设置图形模式为0x6A。
|
---|
4188 | 3. 进入图形模式,你可以使用命令"terminal graphics".
|
---|
4189 | 如果在切换之前不是图形模式,那该命令无效,你可以使用splashimg或fontfile命令。
|
---|
4190 |
|
---|
4191 | 注: 1. 如果想换回默认的640x480,把上面的第2步改成"graphicsmode 0x12".
|
---|
4192 | 2. 经过改进,更新的版本,可以直接改变,只要上面第2步一条命令就可以搞定。
|
---|
4193 | 例子:
|
---|
4194 | 在默认图形模式中(使用splashimage或fontfile命令都会进入图形模式).
|
---|
4195 | 输入以下命令可以直接切换到800x600.
|
---|
4196 | graphicsmode 0x6a
|
---|
4197 |
|
---|
4198 | *****************************************************************************
|
---|
4199 | ***** GRUB4DOS的变量支持 *****
|
---|
4200 | *****************************************************************************
|
---|
4201 |
|
---|
4202 | 新的版本支持变量,用法和MSDOS一样。
|
---|
4203 | 关键命令:
|
---|
4204 | set [/p] [/a|/A] [/l|/u] [VARIABLE=[STRING]]
|
---|
4205 |
|
---|
4206 | variable 指定环境变量名(最长8个字符)。
|
---|
4207 | string 指定要指派给变量的一系列字符串(最长512个字符)。
|
---|
4208 |
|
---|
4209 | 不带参数的 SET命令会显示当前变量。
|
---|
4210 |
|
---|
4211 | 要删除某个变量,只需要让=后面为空就可以
|
---|
4212 | set myvar=
|
---|
4213 | 将会删除变量myvar
|
---|
4214 |
|
---|
4215 | 显示已使用的名称的所有变量的值。例如:
|
---|
4216 | set ex_
|
---|
4217 | 会显示所有以ex_开头的变量,如果没有任何匹配返回0.
|
---|
4218 |
|
---|
4219 | 注:1.使用和MSDOS一样的处理方用户法,一整行的命令会在执行前先进行变量替换。
|
---|
4220 | 2.变量名必须使用字母或_开头。否则你将无法访问你的变量。
|
---|
4221 | 3.长度限制请看前面说明。
|
---|
4222 | 4.输入"set *"可以清除所有已设置的变量。
|
---|
4223 | 5./a 后面的STRING是一个表达式,将调用CALC进行计算,保存结果为10进制数。
|
---|
4224 | 6./A 同上,但保存结果为16进制数。
|
---|
4225 | 7./l|/u 大小写转换。
|
---|
4226 | 8./p 显示一个提示STRING并获取用户的输入内容并设置为变量VARIABLE的值。
|
---|
4227 |
|
---|
4228 |
|
---|
4229 | 新增的命令if
|
---|
4230 | if [/I] [NOT] STRING1==STRING2 [COMMAND]
|
---|
4231 | if [NOT] exist VARIABLE|FILENAME [COMMAND]
|
---|
4232 | 1.如果STRING1==STRING2 字符串匹配,执行后面的COMMAND(如果有指定的话)。
|
---|
4233 | 否则返回TRUE。
|
---|
4234 | 2./I 参数指写不区分大小写匹配。
|
---|
4235 | 3.[NOT] 相反,如果STRING1==STRING2不匹配。
|
---|
4236 | 4.exist 用于判断变量VARIABLE或文件FILENAME是否存在(filename必须以"/"或"("开头).
|
---|
4237 |
|
---|
4238 | 例子:
|
---|
4239 | 1.判断字符串是否相等,并且不区分大小写。
|
---|
4240 | if /i test==%myvar% echo this is a test
|
---|
4241 | 2.判断字符是否为空。
|
---|
4242 | if %myvar%#==# echo variable myvar not defined.
|
---|
4243 | 注:我们使用了一个#不防止空操作,当然也可以使用其它字符,如
|
---|
4244 | if "%myvar%"=="" echo variable myvar not defined.
|
---|
4245 |
|
---|
4246 | 使用方法举例:
|
---|
4247 | 1.显示一个包括变量的串。
|
---|
4248 | echo myvar = %myvar%
|
---|
4249 | 2.使用一个变量代替命令。
|
---|
4250 | set print=echo
|
---|
4251 | %print% This a test.
|
---|
4252 | 3.你可以使用一个“^”来阻此被变被扩展,例子
|
---|
4253 | echo %myvar^%
|
---|
4254 | 或
|
---|
4255 | echo %my^var%
|
---|
4256 | 将会显示 %myvar%而不是扩展myvar之后的字符。
|
---|
4257 | 总之,只要出现了^那就不会扩展这个变量。
|
---|
4258 |
|
---|
4259 | 注:我们只处理在%%之间的^符号。
|
---|
4260 |
|
---|
4261 | *****************************************************************************
|
---|
4262 | ***** GRUB4DOS的批处理脚本支持 *****
|
---|
4263 | *****************************************************************************
|
---|
4264 |
|
---|
4265 | 新的版本支持运行一个批处理脚本,语法和MS-DOS的批处理几乎一模一样。
|
---|
4266 | 你不需要学习新的知识就可以应用GRUB4DOS的批处理,唯一要做的就是学习GRUB4DOS命令。
|
---|
4267 |
|
---|
4268 | 例子一个简单的脚本(看一下是不是和MS-DOS一样):
|
---|
4269 | =========GRUB4DOS BATCH SCRIPT START===============================
|
---|
4270 | !BAT #注:文件头!BAT是必须的用于识别这是一个GRUB4DOS批处理脚本
|
---|
4271 | echo %0
|
---|
4272 | echo Your type: %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
4273 | call :label1 This is a test string
|
---|
4274 | goto :label2
|
---|
4275 | :label1
|
---|
4276 | echo %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
4277 | goto :eof
|
---|
4278 | :label2
|
---|
4279 | echo end of batch script.
|
---|
4280 | =========GRUB4DOS BATCH SCRIPT END===============================
|
---|
4281 |
|
---|
4282 | 一些区别说明:
|
---|
4283 | 1.出现错误时将停止执行。
|
---|
4284 | 2.如果需要中途停止批处理脚本的运行可以用exit 1
|
---|
4285 | 3.%9是指剩下的所有参数。
|
---|
4286 | 4.支持shift命令。
|
---|
4287 | 5.可扩展参数
|
---|
4288 | %~d0 扩展%0到磁盘号.例如:(hd0,0),默认是()。
|
---|
4289 | %~p0 扩展%0到一个路径。
|
---|
4290 | %~n0 扩展%0到一个文件名.
|
---|
4291 | %~x0 扩展%0到一个文件扩展名。
|
---|
4292 | %~f0 扩展%0到一个完整的文件路径名(相当于%~dpnx0).
|
---|
4293 | %~z0 扩展%0到文件大小.
|
---|
4294 | 6.其它用法请参考CMD的批处理。
|
---|
4295 | 在这里可以找到一些脚本
|
---|
4296 | http://chenall.net/post/tag/grub4dos/
|
---|
4297 |
|
---|
4298 | ********************************************************************************
|
---|
4299 | 条件菜单(iftitle)
|
---|
4300 | ********************************************************************************
|
---|
4301 | 自2011-12-04的版本开始支持条件菜单,可以根据某个特定的条件来决定是否显示某个菜单。
|
---|
4302 | 为了区别之前的普通菜单,使用新的参数iftitle。
|
---|
4303 | 语法如下:
|
---|
4304 | iftitle [<command>] Actual Title displayed\nOptional help line
|
---|
4305 | iftitle [<command>] 菜单标题\n菜单帮助
|
---|
4306 |
|
---|
4307 | 注意:
|
---|
4308 | 1.command必须是一个合法的GRUB4DOS命令,支持调用外部命令。
|
---|
4309 | 注:像echo/pause之类的命令在条件菜单命令中被禁用。
|
---|
4310 | 大部份的命令都可以使用,如果碰到不能使用的不要奇怪,非要使用可以提交BUG。
|
---|
4311 | 2.菜单标题前至少要保留一个空格.
|
---|
4312 | 3.[]是必须的,不可少。
|
---|
4313 | 4.如果[]里面的内容为空相当于title即不判断。
|
---|
4314 | 5.你可以使用该功能来快速注释整个菜单的内容(不显示菜单),只需要使用一个非法的命令即可。 |
---|