1 | Please refer to http://grub4dos.sourceforge.net/wiki/ for DOCs on GRUB4DOS.
|
---|
2 |
|
---|
3 | Main project page: http://grub4dos-chenall.googlecode.com/
|
---|
4 |
|
---|
5 | Download site: http://code.google.com/p/grub4dos-chenall/downloads/list
|
---|
6 |
|
---|
7 | Unused:
|
---|
8 | Download site: http://grub4dos.sourceforge.net/
|
---|
9 | Download site: http://sarovar.org/projects/grub4dos/
|
---|
10 | Download site: http://grub4dos.nufans.net/
|
---|
11 | Download site: http://sites.google.com/site/grubdos/
|
---|
12 | Download site: ftp://grub4dos.sarovar.org/pub/grub4dos/
|
---|
13 |
|
---|
14 | Get the latest source code by using anonymous svn in this way:
|
---|
15 |
|
---|
16 | svn co http://grub4dos-chenall.googlecode.com/svn/trunk/ grub4dos
|
---|
17 |
|
---|
18 | or in this way:
|
---|
19 |
|
---|
20 | git clone git://github.com/chenall/GRUB4DOS.git
|
---|
21 |
|
---|
22 | View the source code online with your web browser at:
|
---|
23 |
|
---|
24 | http://code.google.com/p/grub4dos-chenall/source/browse/
|
---|
25 |
|
---|
26 | GRUB4DOS mailing list:
|
---|
27 |
|
---|
28 | grub4dos-devel@gna.org
|
---|
29 |
|
---|
30 | Subscription page:
|
---|
31 |
|
---|
32 | https://mail.gna.org/listinfo/grub4dos-devel/
|
---|
33 |
|
---|
34 | Discussion forum(Official technical support site):
|
---|
35 |
|
---|
36 | Chinese:
|
---|
37 | http://bbs.wuyou.com/forumdisplay.php?fid=60
|
---|
38 | http://bbs.znpc.net/forumdisplay.php?fid=4
|
---|
39 | English:
|
---|
40 | http://reboot.pro/forum/66/
|
---|
41 |
|
---|
42 | ------------------------------------------------------------------------------
|
---|
43 |
|
---|
44 | Usage:
|
---|
45 | GRUB [--bypass] [--time-out=T] [--hot-key=K] [--config-file=FILE]
|
---|
46 |
|
---|
47 | The FILE, for example, can be (hd0,0)/menu.lst
|
---|
48 |
|
---|
49 | In CONFIG.SYS, the line looks like:
|
---|
50 |
|
---|
51 | install=c:\some\where\grub.exe --config-file=FILE
|
---|
52 |
|
---|
53 | If no options present, GRUB.EXE simply uses
|
---|
54 |
|
---|
55 | (hd0,0)/menu.lst
|
---|
56 |
|
---|
57 | as the configure file, if it exists. (Notice! We finally
|
---|
58 | changed the default file from (hd0,0)/boot/grub/menu.lst to
|
---|
59 | (hd0,0)/menu.lst) (Changed 2006-12-23. See Update 3 below.)
|
---|
60 |
|
---|
61 | The partition (hd0,0) can be of a Windows partition or a Linux
|
---|
62 | partition, or any other partition type supported by GRUB.
|
---|
63 |
|
---|
64 | Only GRUB-style filename is acceptable here for FILE. A DOS
|
---|
65 | filename won't work(it is certain we should use GRUB-style
|
---|
66 | filenames because DOS-filenames won't access a file in a
|
---|
67 | Linux ext2 partition for example).(See Update 2 below)
|
---|
68 |
|
---|
69 | Update: FILE can be the contents of a menu. Use semi-colon
|
---|
70 | to delimitate the embedded commands here in FILE. The FILE
|
---|
71 | can be enclosed with a pair of double-quotes. For example:
|
---|
72 |
|
---|
73 | GRUB --config-file="root (hd0,0);chainloader +1"
|
---|
74 |
|
---|
75 | This command will boot the system in (hd0,0).
|
---|
76 |
|
---|
77 | Another example:
|
---|
78 |
|
---|
79 | GRUB --config-file="reboot"
|
---|
80 |
|
---|
81 | This command will reboot the machine.
|
---|
82 |
|
---|
83 | One more example:
|
---|
84 |
|
---|
85 | GRUB --config-file="halt"
|
---|
86 |
|
---|
87 | This command will halt the machine.
|
---|
88 |
|
---|
89 | if --bypass is specified, GRUB will exit to DOS when
|
---|
90 | timeout reached.
|
---|
91 |
|
---|
92 | The option `--time-out=T' specifies the timeout value in
|
---|
93 | seconds. T defaults to 5 if --bypass is specified and defaults
|
---|
94 | to 0 if --bypass is not specified.
|
---|
95 |
|
---|
96 | The default hot key value is 0x3920(for space bar). If this
|
---|
97 | key is pressed, GRUB will boot normally. If another key is
|
---|
98 | pressed, GRUB will terminate immediately and return back to
|
---|
99 | DOS. See "int 16 keyboard scan codes" below.
|
---|
100 |
|
---|
101 | Each option can be specified only once at most.
|
---|
102 |
|
---|
103 | Update 2: DOS filenames have been supported(patched by John
|
---|
104 | Cobb). If the beginning two characters of FILE are "#@", then
|
---|
105 | the rest of FILE is taken as a DOS filename. Example:
|
---|
106 |
|
---|
107 | GRUB --config-file="#@c:\menu.lst"
|
---|
108 |
|
---|
109 | Only the beginning 4KB of the DOS file will be used. The file
|
---|
110 | should be an uncompressed text file.
|
---|
111 |
|
---|
112 | Note: You may also use the `direct DOS file access' with the
|
---|
113 | SHELL or INSTALL line in CONFIG.SYS, but should not use it
|
---|
114 | with the DEVICE line. The DOS document said that a DOS device
|
---|
115 | driver should not call the `open file' DOS call.
|
---|
116 |
|
---|
117 | Update 3(2006-12-23): By default, GRUB.EXE will locate its
|
---|
118 | config file in the following order:
|
---|
119 |
|
---|
120 | (DOS file) .\menu.lst, the MENU.LST in the current dir.
|
---|
121 |
|
---|
122 | (DOS file) \menu.lst, the MENU.LST in the root dir of
|
---|
123 | the current drive.
|
---|
124 | (GRUB file) /menu.lst, the MENU.LST in the root dir of
|
---|
125 | the boot device.
|
---|
126 |
|
---|
127 | The default boot device is still (hd0,0).
|
---|
128 |
|
---|
129 |
|
---|
130 | --------------------------------------------------------
|
---|
131 |
|
---|
132 | Update 1: Version 0.2.0 also brings out a new thing, GRUB for NTLDR,
|
---|
133 | which could be used to boot into GRUB from the boot menu
|
---|
134 | of Windows NT/2000/XP. Copy GRLDR to the root directory of
|
---|
135 | drive C: of Windows NT/2000/XP and append to C:\BOOT.INI
|
---|
136 | this line:
|
---|
137 |
|
---|
138 | C:\GRLDR="Start GRUB"
|
---|
139 |
|
---|
140 | That will be done. The GRLDR should be in the same directory
|
---|
141 | as BOOT.INI and NTLDR. Note that BOOT.INI is usually hidden
|
---|
142 | and you must unhide it before you can see it. The filename
|
---|
143 | GRLDR shouldn't be changed. If GRLDR is in a NTFS partition,
|
---|
144 | it should be copied to the root directory of another non-NTFS
|
---|
145 | partition(and likewise should the menu.lst file be). If GRLDR
|
---|
146 | is compressed, e.g., in a NTFS partition, it will not work.
|
---|
147 |
|
---|
148 | Even if the drive letter of this disk has been changed to
|
---|
149 | other than C by the Windows device manager, it seems you still
|
---|
150 | have to use the letter C here in BOOT.INI, otherwise, NTLDR
|
---|
151 | will fail to locate the GRLDR file.
|
---|
152 |
|
---|
153 | And what's more, if you are booting NTLDR from a floppy, you
|
---|
154 | will have to write the GRLDR line in A:\BOOT.INI like this:
|
---|
155 |
|
---|
156 | C:\GRLDR="Start GRUB"
|
---|
157 |
|
---|
158 | and shouldn't use the letter A like this:
|
---|
159 |
|
---|
160 | A:\GRLDR="Start GRUB"
|
---|
161 |
|
---|
162 | (Note that in the case when BOOT.INI is on floppy A, the
|
---|
163 | notation "C:\GRLDR" actually refer to the file A:\GRLDR).
|
---|
164 |
|
---|
165 |
|
---|
166 | Update 2: GRUB for Linux is also introduced along with 0.2.0. You can
|
---|
167 | boot grub using a linux loader KEXEC, LILO, SYSLINUX or another
|
---|
168 | GRUB. (GRUB4LIN has merged into GRUB.EXE)
|
---|
169 |
|
---|
170 | To boot GRUB off Linux, use this pair of commands:
|
---|
171 |
|
---|
172 | kexec -l grub.exe
|
---|
173 | kexec -e
|
---|
174 |
|
---|
175 | To boot GRUB via GRUB, use commands like the following:
|
---|
176 |
|
---|
177 | kernel (hd0,0)/grub.exe
|
---|
178 | boot
|
---|
179 |
|
---|
180 | To boot GRUB via LILO, use these lines in lilo.conf:
|
---|
181 |
|
---|
182 | image=/boot/grub.exe
|
---|
183 | label=grub.exe
|
---|
184 |
|
---|
185 | To boot GRUB via SYSLINUX, use these lines in syslinux.cfg:
|
---|
186 |
|
---|
187 | label grub.exe
|
---|
188 | kernel grub.exe
|
---|
189 |
|
---|
190 | LOADLIN may encounter problems when loading grub.exe, because
|
---|
191 | grub.exe requires some unchanged original BIOS interrupt
|
---|
192 | vectors, but DOS has destroyed them, and loadlin does not
|
---|
193 | recover them before it transfers control to grub.exe.
|
---|
194 |
|
---|
195 | Update 3: Beginning at version 0.4.0, GRUB for DOS supports memdrives.
|
---|
196 | Example:
|
---|
197 |
|
---|
198 | # boot into a floppy image
|
---|
199 | map --mem (hd0,0)/floppy.img (fd0)
|
---|
200 | map --hook
|
---|
201 | chainloader (fd0)+1
|
---|
202 | rootnoverify (fd0)
|
---|
203 | map --floppies=1
|
---|
204 | boot
|
---|
205 |
|
---|
206 | Because the image will be copied to a memory area, the image
|
---|
207 | itself can be non-contiguous and even gzipped.
|
---|
208 |
|
---|
209 | Another Example:
|
---|
210 |
|
---|
211 | map --mem=-2880 (hd0,0)/floppy.img (fd0)
|
---|
212 |
|
---|
213 | This memdrive (fd0) will occupy at least 1440 KB of memory.
|
---|
214 | This is useful when the size of a 1.44M-floppy image is less
|
---|
215 | than 1440 KB.
|
---|
216 |
|
---|
217 | One more example:
|
---|
218 |
|
---|
219 | map --mem --read-only (hd0,0)/hd.img (hd1)
|
---|
220 |
|
---|
221 | This memdrive is a hard drive, and read-only. That means you
|
---|
222 | will not be able to write data to the memdrive (hd1).
|
---|
223 |
|
---|
224 | You can use many memdrives and many ordinary virtual emulated
|
---|
225 | disk-based drives at the same time.
|
---|
226 |
|
---|
227 | If the BIOS does not support int15/EAX=e820h, you will not be
|
---|
228 | able to use any memdrives.
|
---|
229 |
|
---|
230 | Update 4: For memdrive emulation, a single-partition image can be used
|
---|
231 | instead of a whole-harddrive image. Example:
|
---|
232 |
|
---|
233 | map --mem (hd0,7)/win98.img (hd0)
|
---|
234 | map --hook
|
---|
235 | chainloader (hd0)+1
|
---|
236 | rootnoverify (hd0)
|
---|
237 | map --harddrives=1
|
---|
238 | boot
|
---|
239 |
|
---|
240 | Here win98.img is a partition image without the leading MBR
|
---|
241 | and partition table in it. Surely GRUB for DOS will build an
|
---|
242 | MBR and partition table for the memdrive (hd0).
|
---|
243 |
|
---|
244 | Update 5: Now GRLDR can be used as a no-emulation-mode bootable CD-ROM
|
---|
245 | boot image. Example for Linux users:
|
---|
246 |
|
---|
247 | mkdir iso_root
|
---|
248 | cp grldr iso_root
|
---|
249 | mkisofs -R -b grldr -no-emul-boot -boot-load-seg 0x1000 -o bootable.iso iso_root
|
---|
250 |
|
---|
251 | As an alternative, grldr can also be used the same way as
|
---|
252 | stage2_eltorito. The -boot-info-table option is allowed but you
|
---|
253 | can omit it:
|
---|
254 |
|
---|
255 | mkdir iso_root
|
---|
256 | cp grldr iso_root
|
---|
257 | mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root
|
---|
258 |
|
---|
259 | Also note that the bootable.iso above must be created with the
|
---|
260 | -boot-load-seg 0xHHHH option where HHHH is greater than or
|
---|
261 | equal to 1000(hex). If HHHH < 1000(hex), QEMU will hang. This
|
---|
262 | is a bug in QEMU. The grldr.iso can be created with or without
|
---|
263 | -boot-load-seg 0xHHHH option.
|
---|
264 |
|
---|
265 | The menu.lst file should be placed in the root dir of the CD.
|
---|
266 |
|
---|
267 | Update 6: The Chinese special build is in the "chinese" subdirectory.
|
---|
268 | (patched by Gandalf, 2005-06-27)
|
---|
269 |
|
---|
270 | The Chinese special build also has scdrom builtin.
|
---|
271 | (update: scdrom has been dropped since 2006-07-20)
|
---|
272 |
|
---|
273 | Update 7: Added memory drive (md). Like (nd) for network drive and (cd)
|
---|
274 | for CD-ROM drive, a new drive (md) is implemented for accessing
|
---|
275 | the whole memory as a disk drive. (md) only works for systems
|
---|
276 | with BIOS int15/EAX=E820h support.
|
---|
277 |
|
---|
278 | The cat command now has a few new options: --hex for hexdump,
|
---|
279 | and --locate=STRING for string search in file.
|
---|
280 |
|
---|
281 | Typical examples:
|
---|
282 |
|
---|
283 | cat --hex (hd0)+1
|
---|
284 |
|
---|
285 | It will display the MBR sector in hex form.
|
---|
286 |
|
---|
287 | cat --hex (md)+2
|
---|
288 |
|
---|
289 | It will display 1KB of your memory(in fact, it is the real-mode
|
---|
290 | IDT table), also in hexdump form.
|
---|
291 |
|
---|
292 | cat --hex (md)0x800+1
|
---|
293 |
|
---|
294 | It will display 1 sector of your extended memory.
|
---|
295 |
|
---|
296 | cat --hex (hd0,0)+1
|
---|
297 |
|
---|
298 | It will display the first sector of partition (hd0,0). Usually
|
---|
299 | this sector contains the boot record of an operating system.
|
---|
300 |
|
---|
301 | Update 8: Added ram drive (rd). The (md) device accesses the memory
|
---|
302 | starting at physical address 0. But (rd) accesses memory
|
---|
303 | starting at any base address. The base and length of the ram
|
---|
304 | drive can be specified through the map command. "help map" for
|
---|
305 | details. You can even specify the BIOS drive number used for
|
---|
306 | the (rd) drive, e.g., map --ram-drive=0xf0. The default drive
|
---|
307 | number for (rd) is 0x7F which is a floppy. If (rd) is a hard
|
---|
308 | drive image, you should change the drive number to a value
|
---|
309 | greater than or equal to 0x80(but should avoid using 0xffff,
|
---|
310 | because 0xffff is for the (md) device).
|
---|
311 |
|
---|
312 | The notation (rd)+1 always represents the file which contains
|
---|
313 | all the bytes stored in (rd).
|
---|
314 |
|
---|
315 | Update 9: Directly boot NTLDR of WinNT/2K/XP and IO.SYS of Win9x/ME and
|
---|
316 | KERNEL.SYS of FreeDOS. Examples:
|
---|
317 |
|
---|
318 | chainloader --edx=0xPPYY (hd0,0)/ntldr
|
---|
319 | boot
|
---|
320 |
|
---|
321 | chainloader --edx=0xYY (hd0,0)/io.sys
|
---|
322 | boot
|
---|
323 |
|
---|
324 | chainloader --ebx=0xYY (hd0,0)/kernel.sys
|
---|
325 | boot
|
---|
326 |
|
---|
327 | Hex YY specifies the boot drive number, and hex PP specifies
|
---|
328 | the boot partition number of NTLDR. If the boot drive is
|
---|
329 | floppy, PP should be the hex value ff, i.e., decimal 255.
|
---|
330 |
|
---|
331 | For KERNEL.SYS of FreeDOS, the --edx won't work,
|
---|
332 | use --ebx please.
|
---|
333 |
|
---|
334 | The option --edx ( --ebx ) can be omitted if the file is in
|
---|
335 | its normal place. But in some cases, those options are needed.
|
---|
336 |
|
---|
337 | If, e.g., the ntldr file is in an ext2 partition called
|
---|
338 | (hd2,8) while you want it to think of the Windows partition
|
---|
339 | (hd0,7) as the boot partition, then --edx is required:
|
---|
340 |
|
---|
341 | chainloader --edx=0x0780 (hd2,8)/ntldr
|
---|
342 |
|
---|
343 | For DOS kernels(i.e., IO.SYS and KERNEL.SYS), the boot
|
---|
344 | partition number is meaningless, so you only need to specify
|
---|
345 | the correct boot drive number YY(but specifying the boot
|
---|
346 | partition number is harmless).
|
---|
347 |
|
---|
348 | The above PPYY can also be specified by using a root or
|
---|
349 | rootnoverify command after the chainloader command. Examples:
|
---|
350 |
|
---|
351 | chainloader (hd2,6)/kernel.sys
|
---|
352 | rootnoverify (hd0) <-------- YY=80
|
---|
353 | boot
|
---|
354 |
|
---|
355 | chainloader (hd0,0)/ntldr
|
---|
356 | rootnoverify (hd0,5) <-------- YY=80, PP=05
|
---|
357 | boot
|
---|
358 |
|
---|
359 | Tip: CMLDR (the ComMand LoaDeR, which is used to load the
|
---|
360 | Windows Fault Recovery Console) can be chainloaded as well
|
---|
361 | as NTLDR.
|
---|
362 |
|
---|
363 | Bean has successfully decompressed and booted IO.SYS of WinME.
|
---|
364 | Thanks for the great job!
|
---|
365 |
|
---|
366 | Update 10: isolinux.bin (version 3.73) can be chainloaded as with build
|
---|
367 | 2009-02-09.
|
---|
368 |
|
---|
369 | chainloader (cd)/isolinux.bin
|
---|
370 |
|
---|
371 | isolinux.bin must reside in a real or virtual cdrom.
|
---|
372 |
|
---|
373 | Update 11: stage2 of Grub Legacy can be chainloaded in this way:
|
---|
374 |
|
---|
375 | chainloader --force --load-segment=0 --load-offset=0x8000 --boot-cs=0 --boot-ip=0x8200 (...)/.../stage2
|
---|
376 |
|
---|
377 | --------------------------------------------------------
|
---|
378 |
|
---|
379 | There is no full documentation in English at present. Here are some
|
---|
380 | examples showing the usage of disk emulation commands:
|
---|
381 |
|
---|
382 | 1. Emulates HD partition C: as floppy drive A: and boot win98 from C:
|
---|
383 |
|
---|
384 | map --read-only (hd0,0)+1 (fd0)
|
---|
385 | chainloader (hd0,0)+1
|
---|
386 | rootnoverify (hd0)
|
---|
387 | boot
|
---|
388 |
|
---|
389 | In the above example, (hd0,0) is drive C: with win98 on it. After win98
|
---|
390 | boot complete, you will find that A: contains all files of C:, and if
|
---|
391 | you delete files in A:, the files in C: will also disappear.
|
---|
392 |
|
---|
393 | At the map command line, the notation (hdm,n)+1 is interpreted to
|
---|
394 | represent the whole partition (hdm,n), not just the first sector of the
|
---|
395 | partition.
|
---|
396 |
|
---|
397 | 2. Emulates HD partition C: as floppy drive A: and boot win98 from A:
|
---|
398 |
|
---|
399 | map --read-only (hd0,0)+1 (fd0)
|
---|
400 | map --hook
|
---|
401 | chainloader (fd0)+1
|
---|
402 | rootnoverify (fd0)
|
---|
403 | map --floppies=1
|
---|
404 | boot
|
---|
405 |
|
---|
406 | After the "map --hook" command, the emulation takes effect instantly
|
---|
407 | even in the GRUB command line.
|
---|
408 |
|
---|
409 | Note that the (fd0) in "chainloader (fd0)+1" is the emulated virtual
|
---|
410 | floppy A:, not the real floppy diskette(because map is hooked now).
|
---|
411 |
|
---|
412 |
|
---|
413 | 3. Emulates an image file as floppy drive A: and boot win98 from C:
|
---|
414 |
|
---|
415 | map --read-only (hd0,0)/floppy.img (fd0)
|
---|
416 | chainloader (hd0,0)+1
|
---|
417 | rootnoverify (hd0)
|
---|
418 | map --floppies=1
|
---|
419 | map --harddrives=1
|
---|
420 | boot
|
---|
421 |
|
---|
422 | 4. Emulates an HD partition as the first hard disk and boot DOS from it:
|
---|
423 |
|
---|
424 | map --read-only (hd2,6)+1 (hd0)
|
---|
425 | map --hook
|
---|
426 | chainloader (hd0,0)+1
|
---|
427 | rootnoverify (hd0)
|
---|
428 | map --harddrives=1
|
---|
429 | boot
|
---|
430 |
|
---|
431 | In this example, (hd2,6)+1 represents an extended logical DOS partition
|
---|
432 | of the third BIOS hard disk (hd2).
|
---|
433 |
|
---|
434 | If a DOS partition is used to emulate a hard disk, GRUB for DOS will
|
---|
435 | first try to locate the partition table, usually 63 sectors ahead of
|
---|
436 | the DOS partition. GRUB for DOS will refuse the emulation if the
|
---|
437 | partition table is not there.
|
---|
438 |
|
---|
439 | 5. Emulates an image file as the first hard disk and boot DOS from it:
|
---|
440 |
|
---|
441 | map --read-only (hd0,0)/harddisk.img (hd0)
|
---|
442 | chainloader --load-length=512 (hd0,0)/harddisk.img
|
---|
443 | rootnoverify (hd0)
|
---|
444 | map --harddrives=1
|
---|
445 | boot
|
---|
446 |
|
---|
447 | If an image file is used to emulate a hard disk, the image file must
|
---|
448 | contain an MBR. In other word, the first sector of HARDDISK.IMG must
|
---|
449 | contain the partition table of the emulated virtual hard disk.
|
---|
450 |
|
---|
451 | Note: Counters for floppies and harddrives in the BIOS Data Area remain
|
---|
452 | unchanged during the mapping. You should manually set them to proper
|
---|
453 | values with `map --floppies=' and/or `map --harddrives=', especially,
|
---|
454 | e.g., when there is no real floppy drive attached to the mother board.
|
---|
455 | If not doing so, DOS might fail to start.
|
---|
456 |
|
---|
457 | `map --status' can report the values. Note also that `map --floppies='
|
---|
458 | and `map --harddrives=' can be used independently without the
|
---|
459 | appearance of mappings.
|
---|
460 |
|
---|
461 | 0.4.2 has introduced a new variable, memdisk_raw, to simulate the
|
---|
462 | memdisk-like raw mode. If the BIOS has no int15/87h, or if it has
|
---|
463 | buggy int15/87h support, you should set this variable before any
|
---|
464 | memdrives are used. Here is an example:
|
---|
465 |
|
---|
466 | map --memdisk-raw=1
|
---|
467 | map --mem (hd0,0)/floppy.img (fd0)
|
---|
468 | map --hook
|
---|
469 | chainloader (fd0)+1
|
---|
470 | rootnoverify (fd0)
|
---|
471 | boot
|
---|
472 |
|
---|
473 | If you encountered a memdrive failure without using
|
---|
474 | map --memdisk-raw=1, you should have a try with `map --memdisk-raw=1'.
|
---|
475 |
|
---|
476 | If you `map --memdisk-raw=0' later, you should afterwards do a
|
---|
477 | `map --unhook'(and followed by a `map --hook' if needed).
|
---|
478 |
|
---|
479 | Update: memdisk_raw now defaults to 1. You should `map --memdisk-raw=0'
|
---|
480 | if you want to use int15/87h to access memdrives.
|
---|
481 |
|
---|
482 | --------------------------------------------------------
|
---|
483 |
|
---|
484 | Floppies/harddisks of any size can be emulated with GRUB for DOS 0.2.0.
|
---|
485 |
|
---|
486 | Image file must be contiguous, or else GRUB for DOS will refuse it.
|
---|
487 |
|
---|
488 | The `blocklist' command can list fragments or pieces of a file.
|
---|
489 |
|
---|
490 | Type "help map" at the GRUB prompt to get a brief description of the
|
---|
491 | command.
|
---|
492 |
|
---|
493 | The form
|
---|
494 |
|
---|
495 | map ... (fd?)
|
---|
496 |
|
---|
497 | is a floppy emulation, and the form
|
---|
498 |
|
---|
499 | map ... (hd?)
|
---|
500 |
|
---|
501 | is a hard disk emulation.
|
---|
502 |
|
---|
503 | When a HARD DISK emulation is used, better not start Windows for
|
---|
504 | security reasons. Windows may even destroy all data and all information
|
---|
505 | on all your real hard disks!!!!!!!!
|
---|
506 |
|
---|
507 | Update for --mem: when --mem is used, it seems rather safe even after
|
---|
508 | entering Windows. Win98 can operate the memdrive normally.
|
---|
509 |
|
---|
510 | Windows NT/2000/XP does not recognize the emulated drives no matter
|
---|
511 | whether the --mem option is present.
|
---|
512 |
|
---|
513 |
|
---|
514 |
|
---|
515 | ******************************************************************************
|
---|
516 | *** Explanation of the grldr-bootable floppies or harddisk partitions ***
|
---|
517 | ******************************************************************************
|
---|
518 |
|
---|
519 | 1. Ext2 Boot Sector/Boot Record Layout (for loading grldr)
|
---|
520 | ------------------------------------------------------------------------------
|
---|
521 | An EXT2/EXT3 volume can be GRUB-bootable. Copy grldr and an optional menu.lst
|
---|
522 | to the root dir of the EXT2/EXT3 volume, and build the boot sector based on the
|
---|
523 | fifth sector of grldr(some fields need to be changed as detailed in the
|
---|
524 | following table). And then the EXT2/EXT3 volume is GRUB-bootable.
|
---|
525 |
|
---|
526 | Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
|
---|
527 | record onto the first sector of an EXT2/EXT3 volume.
|
---|
528 |
|
---|
529 | Offset Length Description
|
---|
530 | ====== ====== ==============================================================
|
---|
531 | 00h 2 Machine code for short jump over the data.
|
---|
532 |
|
---|
533 | 02h 1 LBA indicator. Valid values are 0x02 for CHS mode, or 0x42 for
|
---|
534 | LBA mode.
|
---|
535 |
|
---|
536 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
537 | 0x42.
|
---|
538 |
|
---|
539 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
540 | format program should set this byte to 0x42. It seems that
|
---|
541 | (generally) all USB BIOSes have LBA support.
|
---|
542 |
|
---|
543 | If the format program does not know whether the BIOS has LBA
|
---|
544 | support, it may operate this way:
|
---|
545 |
|
---|
546 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
547 | CHS addressing ability(especially when it is greater than
|
---|
548 | 1024*256*63), the caller should set this byte to 0x42,
|
---|
549 | otherwise, set to 0x02.
|
---|
550 |
|
---|
551 | Note that Windows98 uses the value 0x0e as the LBA indicator.
|
---|
552 |
|
---|
553 | Update: this byte of LBA indicator is ignored. The boot
|
---|
554 | record can probe the LBA support of BIOS.
|
---|
555 |
|
---|
556 | 03h 10 OEM name string (of OS which formatted the disk).
|
---|
557 | Update: this field is now used for error message of "I/O error"
|
---|
558 |
|
---|
559 | 0Dh 1 Sectors per block. Valid values are 2, 4, 8, 16 and 32.
|
---|
560 |
|
---|
561 | 0Eh 2 Bytes per block. Valid values are 0x400, 0x800, 0x1000, 0x2000
|
---|
562 | and 0x4000.
|
---|
563 |
|
---|
564 | 10h 4 Pointers in pointers-per-block blocks, that is, number of
|
---|
565 | blocks covered by a double-indirect block.
|
---|
566 |
|
---|
567 | Valid values are 0x10000, 0x40000, 0x100000, 0x400000 and
|
---|
568 | 0x1000000.
|
---|
569 |
|
---|
570 | 14h 4 Pointers per block, that is, number of blocks covered by an
|
---|
571 | indirect block.
|
---|
572 |
|
---|
573 | Valid values are 0x100, 0x200, 0x400, 0x800, 0x1000.
|
---|
574 |
|
---|
575 | 18h 2 Sectors per track.
|
---|
576 |
|
---|
577 | 1Ah 2 Number of heads/sides.
|
---|
578 |
|
---|
579 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
580 |
|
---|
581 | Also referred to as the starting sector of the partition.
|
---|
582 |
|
---|
583 | For floppies, it should be 0.
|
---|
584 |
|
---|
585 | 20h 4 Total number of sectors in the filesystem(or in the partition).
|
---|
586 |
|
---|
587 | 24h 1 BIOS drive number of the boot device.
|
---|
588 |
|
---|
589 | Actually this byte is ignored for read. The boot code will
|
---|
590 | write DL onto this byte. The BIOS or the caller should set
|
---|
591 | drive number in DL.
|
---|
592 |
|
---|
593 | We assume all BIOSes pass correct drive number in DL.
|
---|
594 | Buggy BIOSes are not supported!!
|
---|
595 |
|
---|
596 | 25h 1 Partition number of this partition on the boot drive.
|
---|
597 |
|
---|
598 | 0, 1, 2, 3 are primary partitions.
|
---|
599 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
600 |
|
---|
601 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
602 |
|
---|
603 | 26h 2 inode size in bytes. (Notice! We use the formerly reserved
|
---|
604 | word here for inode size!)
|
---|
605 |
|
---|
606 | 28h 4 Number of inodes per group.
|
---|
607 |
|
---|
608 | Normally a 1.44M floppy has only one group, and the total
|
---|
609 | number of inodes is 184. So the value should be 184 or
|
---|
610 | greater.
|
---|
611 |
|
---|
612 | 2Ch 4 The block number for group descriptors.
|
---|
613 |
|
---|
614 | Valid values are 2 for 1024-byte blocks, and 1 otherwise.
|
---|
615 |
|
---|
616 | The value here is equal to (s_first_data_block + 1).
|
---|
617 |
|
---|
618 | 30h 1 code for "cld"(0xFC).
|
---|
619 |
|
---|
620 | 31h 2 code for "xor ax,ax"(0x31, 0xC0).
|
---|
621 |
|
---|
622 | 33h 1 code for "nop"(0x90) or "cwd"(0x99)
|
---|
623 |
|
---|
624 | 34h 458 The rest of the machine code.
|
---|
625 |
|
---|
626 | 1FEh 2 Boot Signature AA55h.
|
---|
627 |
|
---|
628 |
|
---|
629 | 2. FAT12/FAT16 Boot Sector/Boot Record Layout (for loading grldr)
|
---|
630 | ------------------------------------------------------------------------------
|
---|
631 | A FAT12/16 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
|
---|
632 | the root dir of the FAT12/16 volume, and build the boot sector based on the
|
---|
633 | fourth sector of grldr(some fields need to be changed as detailed in the
|
---|
634 | following table). And then the FAT12/16 volume is GRUB-bootable.
|
---|
635 |
|
---|
636 | Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
|
---|
637 | record onto the boot sector of an FAT12/16 volume.
|
---|
638 |
|
---|
639 | Offset Length Description
|
---|
640 | ====== ====== ==============================================================
|
---|
641 | 00h 2 Machine code for short jump over the data.
|
---|
642 |
|
---|
643 | 02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
|
---|
644 | LBA mode.
|
---|
645 |
|
---|
646 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
647 | 0x0e.
|
---|
648 |
|
---|
649 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
650 | format program should set this byte to 0x0e. It seems that
|
---|
651 | (generally) all USB BIOSes have LBA support.
|
---|
652 |
|
---|
653 | If the format program does not know whether the BIOS has LBA
|
---|
654 | support, it may operate this way:
|
---|
655 |
|
---|
656 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
657 | CHS addressing ability(especially when it is greater than
|
---|
658 | 1024*256*63), the caller should set this byte to 0x0e,
|
---|
659 | otherwise, set to 0x90.
|
---|
660 |
|
---|
661 | Update: this byte of LBA indicator is ignored. The boot
|
---|
662 | record can probe the LBA support of BIOS.
|
---|
663 |
|
---|
664 | Update(2006-07-31): Though GRLDR won't use this LBA-indicator
|
---|
665 | byte, Windows 98 uses it. Usually this byte should be 0x90 for
|
---|
666 | CHS mode(especially for floppies). If this byte is not set
|
---|
667 | properly, Windows 98 will not recognize the floppy or
|
---|
668 | partition. This problem was reported by neiljoy. Many thanks!
|
---|
669 |
|
---|
670 | 03h 8 OEM name string (of OS which formatted the disk).
|
---|
671 |
|
---|
672 | 0Bh 2 Bytes per sector. Must be 512.
|
---|
673 |
|
---|
674 | 0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
|
---|
675 | and 128. But a cluster size larger than 32K should not occur.
|
---|
676 |
|
---|
677 | 0Eh 2 Reserved sectors(number of sectors before the first FAT,
|
---|
678 | including the boot sector), usually 1.
|
---|
679 |
|
---|
680 | 10h 1 Number of FATs(nearly always 2).
|
---|
681 |
|
---|
682 | 11h 2 Maximum number of root directory entries.
|
---|
683 |
|
---|
684 | 13h 2 Total number of sectors (for small disks only, if the disk is
|
---|
685 | too big this is set to 0 and offset 20h is used instead).
|
---|
686 |
|
---|
687 | 15h 1 Media descriptor byte, pretty meaningless now (see below).
|
---|
688 |
|
---|
689 | 16h 2 Sectors per FAT.
|
---|
690 |
|
---|
691 | 18h 2 Sectors per track.
|
---|
692 |
|
---|
693 | 1Ah 2 Total number of heads/sides.
|
---|
694 |
|
---|
695 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
696 |
|
---|
697 | Also referred to as the starting sector of the partition.
|
---|
698 |
|
---|
699 | For floppies, it should be 0.
|
---|
700 |
|
---|
701 | 20h 4 Total number of sectors for large disks.
|
---|
702 |
|
---|
703 | 24h 1 BIOS drive number of the boot device.
|
---|
704 |
|
---|
705 | Actually this byte is ignored for read. The boot code will
|
---|
706 | write DL onto this byte. The BIOS or the caller should set
|
---|
707 | drive number in DL.
|
---|
708 |
|
---|
709 | We assume all BIOSes pass correct drive number in DL.
|
---|
710 | Buggy BIOSes are not supported!!
|
---|
711 |
|
---|
712 | 25h 1 Partition number of this filesystem in the boot drive.
|
---|
713 |
|
---|
714 | This byte is ignored for read. The boot code will write
|
---|
715 | partition number onto this byte. See offset 41h below.
|
---|
716 |
|
---|
717 | 26h 1 Signature (must be 28h or 29h to be recognised by NT).
|
---|
718 |
|
---|
719 | 27h 4 Volume serial number.
|
---|
720 |
|
---|
721 | 2Bh 11 Volume label.
|
---|
722 |
|
---|
723 | 36h 8 File system ID. "FAT12 ", "FAT16 " or "FAT ".
|
---|
724 |
|
---|
725 | 3Eh 1 code for "cli".
|
---|
726 |
|
---|
727 | 3Fh 1 code for "cld".
|
---|
728 |
|
---|
729 | 40h 1 code for "mov dh, imm8".
|
---|
730 |
|
---|
731 | 41h 1 Partition number of this partition on the boot drive.
|
---|
732 |
|
---|
733 | 0, 1, 2, 3 are primary partitions.
|
---|
734 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
735 |
|
---|
736 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
737 |
|
---|
738 | 42h 442 The rest of the machine code.
|
---|
739 |
|
---|
740 | 1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
|
---|
741 |
|
---|
742 |
|
---|
743 | 3. FAT32 Boot Sector/Boot Record Layout (for loading grldr)
|
---|
744 | ------------------------------------------------------------------------------
|
---|
745 | A FAT32 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
|
---|
746 | the root dir of the FAT32 volume, and build the boot sector based on the
|
---|
747 | third sector of grldr(some fields need to be changed as detailed in the
|
---|
748 | following table). And then the FAT32 volume is GRUB-bootable.
|
---|
749 |
|
---|
750 | Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
|
---|
751 | record onto the boot sector of an FAT32 volume.
|
---|
752 |
|
---|
753 | Offset Length Description
|
---|
754 | ====== ====== ==============================================================
|
---|
755 | 00h 2 Machine code for short jump over the data.
|
---|
756 |
|
---|
757 | 02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
|
---|
758 | LBA mode.
|
---|
759 |
|
---|
760 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
761 | 0x0e.
|
---|
762 |
|
---|
763 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
764 | format program should set this byte to 0x0e. It seems that
|
---|
765 | (generally) all USB BIOSes have LBA support.
|
---|
766 |
|
---|
767 | If the format program does not know whether the BIOS has LBA
|
---|
768 | support, it may operate this way:
|
---|
769 |
|
---|
770 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
771 | CHS addressing ability(especially when it is greater than
|
---|
772 | 1024*256*63), the caller should set this byte to 0x0e,
|
---|
773 | otherwise, set to 0x90.
|
---|
774 |
|
---|
775 | Update: this byte of LBA indicator is ignored. The boot
|
---|
776 | record can probe the LBA support of BIOS.
|
---|
777 |
|
---|
778 | Update(2006-07-31): Though GRLDR won't use this LBA-indicator
|
---|
779 | byte, Windows 98 uses it. Usually this byte should be 0x90 for
|
---|
780 | CHS mode(especially for floppies). If this byte is not set
|
---|
781 | properly, Windows 98 will not recognize the floppy or
|
---|
782 | partition. This problem was reported by neiljoy. Many thanks!
|
---|
783 |
|
---|
784 | 03h 8 OEM name string (of OS which formatted the disk).
|
---|
785 |
|
---|
786 | 0Bh 2 Bytes per sector. Must be 512.
|
---|
787 |
|
---|
788 | 0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
|
---|
789 | and 128. But a cluster size larger than 32K should not occur.
|
---|
790 |
|
---|
791 | 0Eh 2 Reserved sectors(number of sectors before the first FAT,
|
---|
792 | including the boot sector), usually 1.
|
---|
793 |
|
---|
794 | 10h 1 Number of FATs(nearly always 2).
|
---|
795 |
|
---|
796 | 11h 2 (Maximum number of root directory entries)Must be 0.
|
---|
797 |
|
---|
798 | 13h 2 (Total number of sectors for small disks only)Must be 0.
|
---|
799 |
|
---|
800 | 15h 1 Media descriptor byte, pretty meaningless now (see below).
|
---|
801 |
|
---|
802 | 16h 2 (Sectors per FAT)Must be 0.
|
---|
803 |
|
---|
804 | 18h 2 Sectors per track.
|
---|
805 |
|
---|
806 | 1Ah 2 Total number of heads/sides.
|
---|
807 |
|
---|
808 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
809 |
|
---|
810 | Also referred to as the starting sector of the partition.
|
---|
811 |
|
---|
812 | For floppies, it should be 0.
|
---|
813 |
|
---|
814 | 20h 4 Total number of sectors for large disks.
|
---|
815 |
|
---|
816 | 24h 4 FAT32 sectors per FAT.
|
---|
817 |
|
---|
818 | 28h 2 If bit 7 is clear then all FATs are updated, otherwise bits
|
---|
819 | 0-3 give the current active FAT, all other bits are reserved.
|
---|
820 |
|
---|
821 | 2Ah 2 High byte is major revision number, low byte is minor revision
|
---|
822 | number, currently both are 0.
|
---|
823 |
|
---|
824 | 2Ch 4 Root directory starting cluster.
|
---|
825 |
|
---|
826 | 30h 2 File system information sector.
|
---|
827 |
|
---|
828 | 32h 2 If non-zero this gives the sector which holds a copy of the
|
---|
829 | boot record, usually 6.
|
---|
830 |
|
---|
831 | 34h 12 Reserved, set to 0.
|
---|
832 |
|
---|
833 | 40h 1 BIOS drive number of the boot device.
|
---|
834 |
|
---|
835 | 80h is first HDD, 00h is first FDD.
|
---|
836 |
|
---|
837 | Actually this byte is ignored for read. The boot code will
|
---|
838 | write DL onto this byte. The BIOS or the caller should set
|
---|
839 | drive number in DL.
|
---|
840 |
|
---|
841 | We assume all BIOSes pass correct drive number in DL.
|
---|
842 | Buggy BIOSes are not supported!!
|
---|
843 |
|
---|
844 | 41h 1 Partition number of this filesystem in the boot drive.
|
---|
845 |
|
---|
846 | This byte is ignored for read. The boot code will write
|
---|
847 | partition number onto this byte. See offset 5Dh below.
|
---|
848 |
|
---|
849 | 42h 1 Signature (must be 28h or 29h to be recognised by NT).
|
---|
850 |
|
---|
851 | 43h 4 Volume serial number.
|
---|
852 |
|
---|
853 | 47h 11 Volume label.
|
---|
854 |
|
---|
855 | 52h 8 File system ID. "FAT32 ".
|
---|
856 |
|
---|
857 | 5Ah 1 opcode for "cli".
|
---|
858 |
|
---|
859 | 5Bh 1 opcode for "cld".
|
---|
860 |
|
---|
861 | 5Ch 1 opcode for "mov dh, imm8".
|
---|
862 |
|
---|
863 | 5Dh 1 Partition number of this partition on the boot drive.
|
---|
864 |
|
---|
865 | 0, 1, 2, 3 are primary partitions.
|
---|
866 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
867 |
|
---|
868 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
869 |
|
---|
870 | 5Eh 414 The rest of the machine code.
|
---|
871 |
|
---|
872 | 1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
|
---|
873 |
|
---|
874 |
|
---|
875 | 4. NTFS Boot Sector/Boot Record Layout (for loading grldr)
|
---|
876 | ------------------------------------------------------------------------------
|
---|
877 | An NTFS volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
|
---|
878 | the root dir of the NTFS volume, and build the boot sector based on the
|
---|
879 | 6th-9th sectors of grldr(some fields need to be changed as detailed in the
|
---|
880 | following table). And then the NTFS volume is GRUB-bootable.
|
---|
881 |
|
---|
882 | Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
|
---|
883 | record onto the leading 4 sectors of an NTFS volume.
|
---|
884 |
|
---|
885 | Offset Length Description
|
---|
886 | ====== ====== ==============================================================
|
---|
887 | 00h 2 Machine code for short jump over the data.
|
---|
888 |
|
---|
889 | 02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
|
---|
890 | LBA mode.
|
---|
891 |
|
---|
892 | If the BIOS int13 supports LBA, this byte can be safely set to
|
---|
893 | 0x0e.
|
---|
894 |
|
---|
895 | Some USB BIOSes might have bugs when using CHS mode, so the
|
---|
896 | format program should set this byte to 0x0e. It seems that
|
---|
897 | (generally) all USB BIOSes have LBA support.
|
---|
898 |
|
---|
899 | If the format program does not know whether the BIOS has LBA
|
---|
900 | support, it may operate this way:
|
---|
901 |
|
---|
902 | if (partition_start + total_sectors_in_partition) exceeds the
|
---|
903 | CHS addressing ability(especially when it is greater than
|
---|
904 | 1024*256*63), the caller should set this byte to 0x0e,
|
---|
905 | otherwise, set to 0x90.
|
---|
906 |
|
---|
907 | Update: this byte of LBA indicator is ignored. The boot
|
---|
908 | record can probe the LBA support of BIOS.
|
---|
909 |
|
---|
910 | Update(2006-07-31): Though GRLDR won't use this LBA-indicator
|
---|
911 | byte, Windows 98 uses it. Usually this byte should be 0x90 for
|
---|
912 | CHS mode(especially for floppies). If this byte is not set
|
---|
913 | properly, Windows 98 will not recognize the floppy or
|
---|
914 | partition. This problem was reported by neiljoy. Many thanks!
|
---|
915 |
|
---|
916 | 03h 8 OEM name string (of OS which formatted the disk).
|
---|
917 |
|
---|
918 | 0Bh 2 Bytes per sector. Must be 512.
|
---|
919 |
|
---|
920 | 0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
|
---|
921 | and 128. But a cluster size larger than 32K should not occur.
|
---|
922 |
|
---|
923 | 0Eh 2 (Reserved sectors)Unused.
|
---|
924 |
|
---|
925 | 10h 1 (Number of FATs)Must be 0.
|
---|
926 |
|
---|
927 | 11h 2 (Maximum number of root directory entries)Must be 0.
|
---|
928 |
|
---|
929 | 13h 2 (Total number of sectors for small disks only)Must be 0.
|
---|
930 |
|
---|
931 | 15h 1 Media descriptor byte, pretty meaningless now (see below).
|
---|
932 |
|
---|
933 | 16h 2 (Sectors per FAT)Must be 0.
|
---|
934 |
|
---|
935 | 18h 2 Sectors per track.
|
---|
936 |
|
---|
937 | 1Ah 2 Total number of heads/sides.
|
---|
938 |
|
---|
939 | 1Ch 4 Number of hidden sectors (those preceding the boot sector).
|
---|
940 |
|
---|
941 | Also referred to as the starting sector of the partition.
|
---|
942 |
|
---|
943 | For floppies, it should be 0.
|
---|
944 |
|
---|
945 | 20h 4 (Total number of sectors for large disks)Must be 0.
|
---|
946 |
|
---|
947 | 24h 4 (FAT32 sectors per FAT) - Usually 80 00 80 00, A value of
|
---|
948 | 80 00 00 00 has been seen on a USB thumb drive which is
|
---|
949 | formatted with NTFS under Windows XP. Note this is removable
|
---|
950 | media and is not partitioned, the drive as a whole is NTFS
|
---|
951 | formatted.
|
---|
952 |
|
---|
953 | 28h 8 Number of sectors in the volume.
|
---|
954 |
|
---|
955 | 30h 8 LCN of VCN 0 of the $MFT.
|
---|
956 |
|
---|
957 | 38h 8 LCN of VCN 0 of the $MFTMirr.
|
---|
958 |
|
---|
959 | 40h 4 Clusters per MFT Record.
|
---|
960 |
|
---|
961 | 44h 4 Clusters per Index Record.
|
---|
962 |
|
---|
963 | 48h 8 Volume serial number.
|
---|
964 |
|
---|
965 | 50h 4 Checksum, usually 0.
|
---|
966 |
|
---|
967 | 54h 1 opcode for "cli".
|
---|
968 |
|
---|
969 | 55h 1 opcode for "cld".
|
---|
970 |
|
---|
971 | 56h 1 opcode for "mov dh, imm8".
|
---|
972 |
|
---|
973 | 57h 1 Partition number of this partition on the boot drive.
|
---|
974 |
|
---|
975 | 0, 1, 2, 3 are primary partitions.
|
---|
976 | 4, 5, 6, ... are logical partitions in the extended partition.
|
---|
977 |
|
---|
978 | 0xff is for whole drive. So for floppies, it should be 0xff.
|
---|
979 |
|
---|
980 | 58h 420 The rest of the machine code in the first sector.
|
---|
981 |
|
---|
982 | 1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
|
---|
983 |
|
---|
984 | 200h 1536 The rest of the machine code in the last 3 sectors.
|
---|
985 |
|
---|
986 | ------------------------------------------------------------------------------
|
---|
987 |
|
---|
988 | Appendix A: File System Information Sector of FAT32(not used by grldr)
|
---|
989 |
|
---|
990 | Offset Length Description
|
---|
991 | ====== ====== ==============================================================
|
---|
992 | 0h 4 Leading Signature 41615252h.
|
---|
993 |
|
---|
994 | 4h 480 Reserved, set to 0.
|
---|
995 |
|
---|
996 | 1E4h 4 FSI structure signature 61417272h.
|
---|
997 |
|
---|
998 | 1E8h 4 Contains the last known count of free clusters, if this is
|
---|
999 | equal to FFFFFFFFh, then the count is unknown.
|
---|
1000 |
|
---|
1001 | 1ECh 4 Cluster number at which you should begin a search for a free
|
---|
1002 | cluster, if this is equal to FFFFFFFFh then the field has not
|
---|
1003 | been set.
|
---|
1004 |
|
---|
1005 | 1F0h 12 Reserved, set to 0.
|
---|
1006 |
|
---|
1007 | 1FCh 4 Trailing Signature AA550000h.
|
---|
1008 |
|
---|
1009 | ------------------------------------------------------------------------------
|
---|
1010 |
|
---|
1011 | Appendix B: Media Descriptor Byte(not used by grldr)
|
---|
1012 |
|
---|
1013 | The Media descriptor byte is meaningless because of the duplications, F0h for
|
---|
1014 | example.
|
---|
1015 |
|
---|
1016 | Byte Type of disk Sectors Heads Tracks Capacity
|
---|
1017 | ---- ------------ ------- ----- ------ --------
|
---|
1018 | FFh 5 1/4" 8 2 40 320KB
|
---|
1019 | FEh 5 1/4" 8 1 40 160KB
|
---|
1020 | FDh 5 1/4" 9 2 40 360KB
|
---|
1021 | FCh 5 1/4" 9 1 40 180KB
|
---|
1022 | FBh both 9 2 80 640KB
|
---|
1023 | FAh both 9 1 80 320KB
|
---|
1024 | F9h 5 1/4" 15 2 80 1200KB
|
---|
1025 | F9h 3 1/2" 9 2 80 720KB
|
---|
1026 | F0h 3 1/2" 18 2 80 1440KB
|
---|
1027 | F0h 3 1/2" 36 2 80 2880KB
|
---|
1028 | F8h hard disk NA NA NA NA
|
---|
1029 |
|
---|
1030 | ******************************************************************************
|
---|
1031 | *** grldr.mbr - How to write it to Master Boot Track of the hard disk ***
|
---|
1032 | ******************************************************************************
|
---|
1033 |
|
---|
1034 | grldr.mbr contains code that can be used as Master Boot Record. The code is
|
---|
1035 | responsible for searching all partitions for grldr and when found, loading it.
|
---|
1036 | Currently supported partition types are: FAT12/FAT16/FAT32, NTFS, EXT2/EXT3.
|
---|
1037 | Logical partitions in the extended partition are supported, provided that the
|
---|
1038 | extended partition type is Microsoft-compatible. In fact, the Linux extended
|
---|
1039 | partition type(0x85) is not fully tested for the search mechanism.
|
---|
1040 |
|
---|
1041 | How to write GRLDR.MBR to the Master Boot Track of a hard disk?
|
---|
1042 |
|
---|
1043 | First, read the Windows disk signature and partition information bytes
|
---|
1044 | (72 bytes in total, from offset 0x01b8 to 0x01ff of the MBR sector), and put
|
---|
1045 | them on the same range from offset 0x01b8 to 0x01ff of the beginning sector of
|
---|
1046 | GRLDR.MBR.
|
---|
1047 |
|
---|
1048 | Optionally, if the MBR in the hard disk is a single sector MBR created by
|
---|
1049 | Microsoft FDISK, it may be copied onto the second sector of GRLDR.MBR.
|
---|
1050 |
|
---|
1051 | The second sector of GRLDR.MBR is called "previous MBR". When GRLDR not found,
|
---|
1052 | "previous MBR" will be started.
|
---|
1053 |
|
---|
1054 | No other steps needed, after all necessary changes stated above have been made,
|
---|
1055 | now simply write GRLDR.MBR on to the Master Boot Track. That's all.
|
---|
1056 |
|
---|
1057 | Note: The Master Boot Track means the first track of the hard drive.
|
---|
1058 |
|
---|
1059 | Note: The bootstrap code of GRLDR.MBR only finds GRLDR file in the root dir of
|
---|
1060 | a partition. You'd better place menu.lst file accompanying with GRLDR(i.e., in
|
---|
1061 | the same root dir of the same partition as GRLDR).
|
---|
1062 |
|
---|
1063 | The filename "grldr" in an ext2 partition must be in lower case letters, and
|
---|
1064 | the file type of grldr must be plain regular. Other types, e.g., a symbolic
|
---|
1065 | link, won't work.
|
---|
1066 |
|
---|
1067 | Update: bootlace.com is a DOS/Linux utility for installing grldr.mbr to MBR.
|
---|
1068 | The whole grldr.mbr is embedded in the body of the bootlace.com utility, so
|
---|
1069 | bootlace.com can be used independently. See below.
|
---|
1070 |
|
---|
1071 | ******************************************************************************
|
---|
1072 | *** grldr.mbr - Details about the control bytes ***
|
---|
1073 | ******************************************************************************
|
---|
1074 |
|
---|
1075 | Six bytes can be used to control the boot process of GRLDR.MBR.
|
---|
1076 |
|
---|
1077 | Offset Length Description
|
---|
1078 | ====== ====== ==============================================================
|
---|
1079 | 02h 1 bit0=1: disable the search for GRLDR on floppy
|
---|
1080 | bit0=0: enable the search for GRLDR on floppy
|
---|
1081 |
|
---|
1082 | bit1=1: disable the boot of PREVIOUS MBR with invalid
|
---|
1083 | partition table(usually an OS boot sector)
|
---|
1084 | bit1=0: enable the boot of PREVIOUS MBR with invalid
|
---|
1085 | partition table(usually an OS boot sector)
|
---|
1086 |
|
---|
1087 | bit2=1: disable the feature of unconditional entrance to
|
---|
1088 | the command-line(See below `--duce')
|
---|
1089 | bit2=0: enable the feature of unconditional entrance to
|
---|
1090 | the command-line(See below `--duce')
|
---|
1091 |
|
---|
1092 | bit3=1: disable geometry tune(See below `--chs-no-tune')
|
---|
1093 | bit3=0: enable geometry tune(See below `--chs-no-tune')
|
---|
1094 |
|
---|
1095 | bit4 - bit6: reserved
|
---|
1096 |
|
---|
1097 | bit7=1: try to boot PREVIOUS MBR after the search for GRLDR
|
---|
1098 | bit7=0: try to boot PREVIOUS MBR before the search for GRLDR
|
---|
1099 |
|
---|
1100 | 03h 1 timeout in seconds to wait for a key press. 0xff stands for
|
---|
1101 | waiting all the time(endless).
|
---|
1102 |
|
---|
1103 | 04h 2 hot-key code. high byte is scan code, low byte is ASCII code.
|
---|
1104 | the default value is 0x3920, which stands for the space bar.
|
---|
1105 | if this key is pressed, GRUB will be started prior to the boot
|
---|
1106 | of previous MBR. See "int 16 keyboard scan codes" below.
|
---|
1107 |
|
---|
1108 | 06h 1 preferred boot drive number, 0xff for no-drive
|
---|
1109 | 07h 1 preferred partition number, 0xff for whole drive
|
---|
1110 |
|
---|
1111 | if the preferred boot drive number is 0xff, the order of the
|
---|
1112 | search for GRLDR will be:
|
---|
1113 |
|
---|
1114 | (hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
|
---|
1115 | (hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
|
---|
1116 | ... ... ... ... ... ... ... ...
|
---|
1117 | (hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
|
---|
1118 | (X=max harddrive number)
|
---|
1119 | (fd0)
|
---|
1120 |
|
---|
1121 | otherwise, if the preferred boot drive number is Y(not equal to
|
---|
1122 | 0xff) and the preferred partition number is K, then the order of
|
---|
1123 | the search for GRLDR will be:
|
---|
1124 |
|
---|
1125 | (Y) if K=0xff; or (Y,K) otherwise
|
---|
1126 | (hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
|
---|
1127 | (hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
|
---|
1128 | ... ... ... ... ... ... ... ...
|
---|
1129 | (hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
|
---|
1130 | (X=max harddrive number)
|
---|
1131 | (fd0)
|
---|
1132 |
|
---|
1133 | Note: if Y < 0x80, then (Y) is floppy, else (Y) is harddrive,
|
---|
1134 | and (Y,K) is partition number K on harddrive (Y).
|
---|
1135 |
|
---|
1136 |
|
---|
1137 | ******************************************************************************
|
---|
1138 | *** bootlace.com - Install GRLDR.MBR bootstrap code to MBR ***
|
---|
1139 | ******************************************************************************
|
---|
1140 |
|
---|
1141 | BOOTLACE.COM installs GRLDR.MBR boot record to the MBR of a harddrive or of a
|
---|
1142 | harddrive image file, or to the boot sector of a floppy or a floppy image.
|
---|
1143 |
|
---|
1144 | Usage:
|
---|
1145 |
|
---|
1146 | bootlace.com [OPTIONS] DEVICE_OR_FILE
|
---|
1147 |
|
---|
1148 | OPTIONS:
|
---|
1149 |
|
---|
1150 | --read-only do everything except the actual write to the
|
---|
1151 | specified DEVICE_OR_FILE.
|
---|
1152 |
|
---|
1153 | --restore-mbr restore the previous mbr.
|
---|
1154 |
|
---|
1155 | --mbr-no-bpb do not copy BPB in the boot sector of the
|
---|
1156 | leading FAT partition to MBR.
|
---|
1157 |
|
---|
1158 | --no-backup-mbr do not copy the old MBR to the second sector of
|
---|
1159 | DEVICE_OR_FILE.
|
---|
1160 |
|
---|
1161 | --force-backup-mbr force the copy of old MBR to the second sector
|
---|
1162 | of DEVICE_OR_FILE.
|
---|
1163 |
|
---|
1164 | --mbr-enable-floppy enable the search for GRLDR on floppy.
|
---|
1165 |
|
---|
1166 | --mbr-disable-floppy disable the search for GRLDR on floppy.
|
---|
1167 |
|
---|
1168 | --mbr-enable-osbr enable the boot of PREVIOUS MBR with invalid
|
---|
1169 | partition table(usually an OS boot sector).
|
---|
1170 |
|
---|
1171 | --mbr-disable-osbr disable the boot of PREVIOUS MBR with invalid
|
---|
1172 | partition table(usually an OS boot sector).
|
---|
1173 |
|
---|
1174 | --duce disable the feature of unconditional entrance
|
---|
1175 | to the command-line.
|
---|
1176 |
|
---|
1177 | Normally one can unconditionally get the
|
---|
1178 | command-line console by a keypress of `C',
|
---|
1179 | bypassing all config-files(including the
|
---|
1180 | preset-menu). This is a security hole. So we
|
---|
1181 | need this option to disable the feature.
|
---|
1182 |
|
---|
1183 | DUCE is for Disable Unconditional Command-line
|
---|
1184 | Entrance.
|
---|
1185 |
|
---|
1186 | --chs-no-tune disable the feature of geometry tune.
|
---|
1187 |
|
---|
1188 | --boot-prevmbr-first try to boot PREVIOUS MBR before the search for
|
---|
1189 | GRLDR.
|
---|
1190 |
|
---|
1191 | --boot-prevmbr-last try to boot PREVIOUS MBR after the search for
|
---|
1192 | GRLDR.
|
---|
1193 |
|
---|
1194 | --preferred-drive=D preferred boot drive number, 0 <= D < 255.
|
---|
1195 |
|
---|
1196 | --preferred-partition=P preferred partition number, 0 <= P < 255.
|
---|
1197 |
|
---|
1198 | --serial-number=SN setup a new serial number for the hard drive.
|
---|
1199 | SN must be non-zero.
|
---|
1200 |
|
---|
1201 | --time-out=T wait T seconds before booting PREVIOUS MBR. if
|
---|
1202 | T is 0xff, wait forever. The default is 5.
|
---|
1203 |
|
---|
1204 | --hot-key=K if the desired key K is pressed, start GRUB
|
---|
1205 | before booting PREVIOUS MBR. K is a word
|
---|
1206 | value, just as the value in AX register
|
---|
1207 | returned from int16/AH=1. The high byte is the
|
---|
1208 | scan code and the low byte is ASCII code. The
|
---|
1209 | default is 0x3920 for space bar. See "int 16
|
---|
1210 | keyboard scan codes" below.
|
---|
1211 |
|
---|
1212 | --floppy if DEVICE_OR_FILE is floppy, use this option.
|
---|
1213 |
|
---|
1214 | --floppy=N if DEVICE_OR_FILE is a partition on a hard
|
---|
1215 | drive, use this option. N is used to specify
|
---|
1216 | the partition number: 0,1,2 and 3 for the
|
---|
1217 | primary partitions, and 4,5,6,... for the
|
---|
1218 | logical partitions.
|
---|
1219 |
|
---|
1220 | --sectors-per-track=S specifies sectors per track for --floppy.
|
---|
1221 | 1 <= S <= 63, default is 63.
|
---|
1222 |
|
---|
1223 | --heads=H specifies number of heads for --floppy.
|
---|
1224 | 1 <= H <= 256, default is 255.
|
---|
1225 |
|
---|
1226 | --start-sector=B specifies hidden sectors for --floppy=N.
|
---|
1227 |
|
---|
1228 | --total-sectors=C specifies total sectors for --floppy.
|
---|
1229 | default is 0.
|
---|
1230 |
|
---|
1231 | --lba use lba mode for --floppy. If the floppy BIOS
|
---|
1232 | has LBA support, you can specify --lba here.
|
---|
1233 | It is assumed that all floppy BIOSes have CHS
|
---|
1234 | support. So you would rather specify --chs.
|
---|
1235 | If neither --chs nor --lba is specified, then
|
---|
1236 | the LBA indicator(i.e., the third byte of the
|
---|
1237 | boot sector) will not be touched.
|
---|
1238 |
|
---|
1239 | --chs use chs mode for --floppy. You should specify
|
---|
1240 | --chs if the floppy BIOS does not support LBA.
|
---|
1241 | We assume all floppy BIOSes have CHS support.
|
---|
1242 | So it is likely you want to specify --chs.
|
---|
1243 | If neither --chs nor --lba is specified, then
|
---|
1244 | the LBA indicator(i.e., the third byte of the
|
---|
1245 | boot sector) will not be touched.
|
---|
1246 |
|
---|
1247 | --fat12 FAT12 is allowed to be installed for --floppy.
|
---|
1248 |
|
---|
1249 | --fat16 FAT16 is allowed to be installed for --floppy.
|
---|
1250 |
|
---|
1251 | --fat32 FAT32 is allowed to be installed for --floppy.
|
---|
1252 |
|
---|
1253 | --vfat FAT12/16/32 are allowed to be installed for
|
---|
1254 | --floppy.
|
---|
1255 |
|
---|
1256 | --ntfs NTFS is allowed to be installed for --floppy.
|
---|
1257 |
|
---|
1258 | --ext2 EXT2 is allowed to be installed for --floppy.
|
---|
1259 |
|
---|
1260 | --install-partition=I Install the boot record onto the boot area of
|
---|
1261 | partition number I of the specified hard drive
|
---|
1262 | or harddrive image DEVICE_OR_FILE.
|
---|
1263 |
|
---|
1264 | DEVICE_OR_FILE: Filename of the device or the image file. For DOS, a BIOS drive
|
---|
1265 | number(hex 0xHH or decimal DDD) can be used to access the drive. BIOS drive
|
---|
1266 | number 0 is for the first floppy, 1 is for the second floppy; 0x80 is for the
|
---|
1267 | first hard drive, 0x81 is for the second hard drive, etc.
|
---|
1268 |
|
---|
1269 | Note: BOOTLACE.COM writes only the boot code to MBR. The boot code needs to
|
---|
1270 | load GRLDR as the second(and last) stage of the GRUB boot process. Therefore
|
---|
1271 | GRLDR should be copied to the root directory of one of the supported
|
---|
1272 | partitions, either before or after a successful execution of BOOTLACE.COM.
|
---|
1273 | Currently only partitions with filesystem type of FAT12, FAT16, FAT32, NTFS,
|
---|
1274 | EXT2 or EXT3 are supported.
|
---|
1275 |
|
---|
1276 | Note 2: If DEVICE_OR_FILE is a harddisk device or a harddisk image file, it
|
---|
1277 | must contain a valid partition table, otherwise, BOOTLACE.COM will fail. If
|
---|
1278 | DEVICE_OR_FILE is a floppy device or a floppy image file, then it must contain
|
---|
1279 | a supported filesystem(i.e., either of FAT12/FAT16/FAT32/NTFS/EXT2/EXT3).
|
---|
1280 |
|
---|
1281 | Note 3: If DEVICE_OR_FILE is a floppy device or a floppy image file, and it
|
---|
1282 | was formated EXT2/EXT3, then you should specify --sectors-per-track and
|
---|
1283 | --heads explicitly.
|
---|
1284 |
|
---|
1285 |
|
---|
1286 | Important!! If you install GRLDR Boot Record to a floppy or a partition, the
|
---|
1287 | floppy or partition will boot solely grldr, and your original
|
---|
1288 | IO.SYS(DOS/Win9x/Me) and NTLDR(WinNT/2K/XP) will become unbootable. This is
|
---|
1289 | because the original boot record of the floppy or partition was overwritten.
|
---|
1290 | There is no such problem when installing GRLDR Boot Record onto the MBR.
|
---|
1291 | Update: Some NTLDR/IO.SYS/KERNEL.SYS files can be directly chainloaded in the
|
---|
1292 | latest GRUB4DOS.
|
---|
1293 |
|
---|
1294 | Tip: If the filename begins in a dash(-) or a digit, you may prefix a dirname
|
---|
1295 | (./) or (.\) to it.
|
---|
1296 |
|
---|
1297 | Examples:
|
---|
1298 |
|
---|
1299 | Installing GRLDR boot code to MBR under Linux:
|
---|
1300 |
|
---|
1301 | bootlace.com /dev/hda
|
---|
1302 |
|
---|
1303 | Installing GRLDR boot code to MBR under DOS:
|
---|
1304 |
|
---|
1305 | bootlace.com 0x80
|
---|
1306 |
|
---|
1307 | Installing GRLDR boot code to a harddisk image under DOS or Linux:
|
---|
1308 |
|
---|
1309 | bootlace.com hd.img
|
---|
1310 |
|
---|
1311 | Installing GRLDR boot code to floppy under Linux:
|
---|
1312 |
|
---|
1313 | bootlace.com --floppy --chs /dev/fd0
|
---|
1314 |
|
---|
1315 | Installing GRLDR boot code to floppy under DOS:
|
---|
1316 |
|
---|
1317 | bootlace.com --floppy --chs 0x00
|
---|
1318 |
|
---|
1319 | Installing GRLDR boot code to a floppy image under DOS or Linux:
|
---|
1320 |
|
---|
1321 | bootlace.com --floppy --chs floppy.img
|
---|
1322 |
|
---|
1323 | BOOTLACE.COM cannot function well under Windows NT/2000/XP/2003. It is expected
|
---|
1324 | (and designed) to run under DOS/Win9x and Linux. Update: For image FILES,
|
---|
1325 | bootlace.com function well under Windows NT/2000/XP/2003. For devices,
|
---|
1326 | bootlace.com will not work under Windows NT/2000/XP/2003 because bootlace.com
|
---|
1327 | is a DOS utility and Windows NT/2000/XP/2003 does not allow bootlace.com to
|
---|
1328 | access devices.
|
---|
1329 |
|
---|
1330 | ******************************************************************************
|
---|
1331 | *** kexec-tools should be patched for the 1.101 release ***
|
---|
1332 | ******************************************************************************
|
---|
1333 |
|
---|
1334 | The file kexec-tools-1.101-patch is a patch to the kexec-tools-1.101 release.
|
---|
1335 | Kexec might fail to load grub.exe without this patch.
|
---|
1336 |
|
---|
1337 | The home page of kexec-tools is:
|
---|
1338 |
|
---|
1339 | http://www.xmission.com/~ebiederm/files/kexec/
|
---|
1340 |
|
---|
1341 | Note: The Linux kernel should be KEXEC enabled before kexec can be run.
|
---|
1342 |
|
---|
1343 | !! Important Update !!
|
---|
1344 |
|
---|
1345 | The patch `kexec-tools-1.101-patch' is not needed now and has been deleted.
|
---|
1346 | Even worse, it fails in `kexec -l grub.exe --initrd=imgfile'. So please
|
---|
1347 | do not use it any more.
|
---|
1348 |
|
---|
1349 | ******************************************************************************
|
---|
1350 | *** Direct transition to DOS/Win9x from within Linux ***
|
---|
1351 | ******************************************************************************
|
---|
1352 |
|
---|
1353 | By using kexec, we can easily boot into DOS/Win9x from a running Linux system.
|
---|
1354 |
|
---|
1355 | If WIN98.IMG is a bootable hard-disk image, do as follows:
|
---|
1356 |
|
---|
1357 | kexec -l grub.exe --initrd=WIN98.IMG --command-line="--config-file=map (rd) (hd0); map --hook; chainloader (hd0)+1; rootnoverify (hd0)"
|
---|
1358 |
|
---|
1359 | kexec -e
|
---|
1360 |
|
---|
1361 | If DOS.IMG is a bootable floppy image, do this way:
|
---|
1362 |
|
---|
1363 | kexec -l grub.exe --initrd=DOS.IMG --command-line="--config-file=map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1364 |
|
---|
1365 | kexec -e
|
---|
1366 |
|
---|
1367 | Note that in this manner, we can boot DOS/Win9x without using a real DOS/Win9x
|
---|
1368 | disk. We need no FAT partition but an image file.
|
---|
1369 |
|
---|
1370 | We have noticed that Linux itself can act as a big boot manager by using kexec
|
---|
1371 | and grub.exe. This may be convenient to developers who write installation or
|
---|
1372 | bootstrap or initialization programs.
|
---|
1373 |
|
---|
1374 | Certainly, grub.exe and the bootable disk image can also be loaded by a running
|
---|
1375 | GRUB or LILO or syslinux. Examples:
|
---|
1376 |
|
---|
1377 | 1. Loaded by GRUB:
|
---|
1378 |
|
---|
1379 | kernel (hd0,0)/grub.exe --config-file="map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1380 | initrd (hd0,0)/DOS.IMG
|
---|
1381 | boot
|
---|
1382 |
|
---|
1383 | 2. Loaded by LILO:
|
---|
1384 |
|
---|
1385 | image=/boot/grub.exe
|
---|
1386 | label=grub.exe
|
---|
1387 | initrd=/boot/DOS.IMG
|
---|
1388 | append="--config-file=map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1389 |
|
---|
1390 | 3. Loaded by SYSLINUX:
|
---|
1391 |
|
---|
1392 | label grub.exe
|
---|
1393 | kernel grub.exe
|
---|
1394 | append initrd=DOS.IMG --config-file="map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
|
---|
1395 |
|
---|
1396 | Note: If the above `map (rd) (...)' failed, you may use `map (rd)+1 (...)'
|
---|
1397 | instead and try again.
|
---|
1398 |
|
---|
1399 | ******************************************************************************
|
---|
1400 | *** Keyboard BIOS Scan Code/ASCII code tables ***
|
---|
1401 | ******************************************************************************
|
---|
1402 |
|
---|
1403 | Keyboard bios scan code and ascii character code tables can be obtained from
|
---|
1404 | the web by, for example, googling for "3920 372A 4A2D 4E2B 352F". Here are 2
|
---|
1405 | main results:
|
---|
1406 |
|
---|
1407 | 1. From "http://heim.ifi.uio.no/~stanisls/helppc/scan_codes.html":
|
---|
1408 |
|
---|
1409 | INT 16 - Keyboard Scan Codes
|
---|
1410 |
|
---|
1411 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1412 |
|
---|
1413 | A 1E61 1E41 1E01 1E00
|
---|
1414 | B 3062 3042 3002 3000
|
---|
1415 | C 2E63 2E43 2E03 2E00
|
---|
1416 | D 2064 2044 2004 2000
|
---|
1417 | E 1265 1245 1205 1200
|
---|
1418 | F 2166 2146 2106 2100
|
---|
1419 | G 2267 2247 2207 2200
|
---|
1420 | H 2368 2348 2308 2300
|
---|
1421 | I 1769 1749 1709 1700
|
---|
1422 | J 246A 244A 240A 2400
|
---|
1423 | K 256B 254B 250B 2500
|
---|
1424 | L 266C 264C 260C 2600
|
---|
1425 | M 326D 324D 320D 3200
|
---|
1426 | N 316E 314E 310E 3100
|
---|
1427 | O 186F 184F 180F 1800
|
---|
1428 | P 1970 1950 1910 1900
|
---|
1429 | Q 1071 1051 1011 1000
|
---|
1430 | R 1372 1352 1312 1300
|
---|
1431 | S 1F73 1F53 1F13 1F00
|
---|
1432 | T 1474 1454 1414 1400
|
---|
1433 | U 1675 1655 1615 1600
|
---|
1434 | V 2F76 2F56 2F16 2F00
|
---|
1435 | W 1177 1157 1117 1100
|
---|
1436 | X 2D78 2D58 2D18 2D00
|
---|
1437 | Y 1579 1559 1519 1500
|
---|
1438 | Z 2C7A 2C5A 2C1A 2C00
|
---|
1439 |
|
---|
1440 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1441 |
|
---|
1442 | 1 0231 0221 7800
|
---|
1443 | 2 0332 0340 0300 7900
|
---|
1444 | 3 0433 0423 7A00
|
---|
1445 | 4 0534 0524 7B00
|
---|
1446 | 5 0635 0625 7C00
|
---|
1447 | 6 0736 075E 071E 7D00
|
---|
1448 | 7 0837 0826 7E00
|
---|
1449 | 8 0938 092A 7F00
|
---|
1450 | 9 0A39 0A28 8000
|
---|
1451 | 0 0B30 0B29 8100
|
---|
1452 |
|
---|
1453 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1454 |
|
---|
1455 | - 0C2D 0C5F 0C1F 8200
|
---|
1456 | = 0D3D 0D2B 8300
|
---|
1457 | [ 1A5B 1A7B 1A1B 1A00
|
---|
1458 | ] 1B5D 1B7D 1B1D 1B00
|
---|
1459 | ; 273B 273A 2700
|
---|
1460 | ' 2827 2822
|
---|
1461 | ` 2960 297E
|
---|
1462 | \ 2B5C 2B7C 2B1C 2600 (same as Alt L)
|
---|
1463 | , 332C 333C
|
---|
1464 | . 342E 343E
|
---|
1465 | / 352F 353F
|
---|
1466 |
|
---|
1467 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1468 |
|
---|
1469 | F1 3B00 5400 5E00 6800
|
---|
1470 | F2 3C00 5500 5F00 6900
|
---|
1471 | F3 3D00 5600 6000 6A00
|
---|
1472 | F4 3E00 5700 6100 6B00
|
---|
1473 | F5 3F00 5800 6200 6C00
|
---|
1474 | F6 4000 5900 6300 6D00
|
---|
1475 | F7 4100 5A00 6400 6E00
|
---|
1476 | F8 4200 5B00 6500 6F00
|
---|
1477 | F9 4300 5C00 6600 7000
|
---|
1478 | F10 4400 5D00 6700 7100
|
---|
1479 | F11 8500 8700 8900 8B00
|
---|
1480 | F12 8600 8800 8A00 8C00
|
---|
1481 |
|
---|
1482 | Key Normal Shifted w/Ctrl w/Alt
|
---|
1483 |
|
---|
1484 | BackSpace 0E08 0E08 0E7F 0E00
|
---|
1485 | Del 5300 532E 9300 A300
|
---|
1486 | Down Arrow 5000 5032 9100 A000
|
---|
1487 | End 4F00 4F31 7500 9F00
|
---|
1488 | Enter 1C0D 1C0D 1C0A A600
|
---|
1489 | Esc 011B 011B 011B 0100
|
---|
1490 | Home 4700 4737 7700 9700
|
---|
1491 | Ins 5200 5230 9200 A200
|
---|
1492 | Keypad 5 4C35 8F00
|
---|
1493 | Keypad * 372A 9600 3700
|
---|
1494 | Keypad - 4A2D 4A2D 8E00 4A00
|
---|
1495 | Keypad + 4E2B 4E2B 4E00
|
---|
1496 | Keypad / 352F 352F 9500 A400
|
---|
1497 | Left Arrow 4B00 4B34 7300 9B00
|
---|
1498 | PgDn 5100 5133 7600 A100
|
---|
1499 | PgUp 4900 4939 8400 9900
|
---|
1500 | PrtSc 7200
|
---|
1501 | Right Arrow 4D00 4D36 7400 9D00
|
---|
1502 | SpaceBar 3920 3920 3920 3920
|
---|
1503 | Tab 0F09 0F00 9400 A500
|
---|
1504 | Up Arrow 4800 4838 8D00 9800
|
---|
1505 |
|
---|
1506 |
|
---|
1507 | - Some key combinations are not available on all systems. The PS/2
|
---|
1508 | includes many that aren't available on the PC, XT and AT.
|
---|
1509 | - To retrieve the character from a scan code logical AND the word
|
---|
1510 | with 0x00FF.
|
---|
1511 | - see INT 16 MAKE CODES
|
---|
1512 |
|
---|
1513 |
|
---|
1514 |
|
---|
1515 | 2. From "http://www.hoppie.nl/ivan/keycodes.txt":
|
---|
1516 |
|
---|
1517 |
|
---|
1518 |
|
---|
1519 | Keystroke Keypress code
|
---|
1520 | --------------------------------------------------
|
---|
1521 | Esc 011B
|
---|
1522 | 1 0231
|
---|
1523 | 2 0332
|
---|
1524 | 3 0433
|
---|
1525 | 4 0534
|
---|
1526 | 5 0635
|
---|
1527 | 6 0736
|
---|
1528 | 7 0837
|
---|
1529 | 8 0938
|
---|
1530 | 9 0A39
|
---|
1531 | 0 0B30
|
---|
1532 | - 0C2D
|
---|
1533 | = 0D3D
|
---|
1534 | Backspace 0E08
|
---|
1535 | Tab 0F09
|
---|
1536 | q 1071
|
---|
1537 | w 1177
|
---|
1538 | e 1265
|
---|
1539 | r 1372
|
---|
1540 | t 1474
|
---|
1541 | y 1579
|
---|
1542 | u 1675
|
---|
1543 | i 1769
|
---|
1544 | o 186F
|
---|
1545 | p 1970
|
---|
1546 | [ 1A5B
|
---|
1547 | ] 1B5D
|
---|
1548 | Enter 1C0D
|
---|
1549 | Ctrl **
|
---|
1550 | a 1E61
|
---|
1551 | s 1F73
|
---|
1552 | d 2064
|
---|
1553 | f 2166
|
---|
1554 | g 2267
|
---|
1555 | h 2368
|
---|
1556 | j 246A
|
---|
1557 | k 256B
|
---|
1558 | l 266C
|
---|
1559 | ; 273B
|
---|
1560 | ' 2827
|
---|
1561 | ` 2960
|
---|
1562 | Shift **
|
---|
1563 | \ 2B5C
|
---|
1564 | z 2C7A
|
---|
1565 | x 2D78
|
---|
1566 | c 2E63
|
---|
1567 | v 2F76
|
---|
1568 | b 3062
|
---|
1569 | n 316E
|
---|
1570 | m 326D
|
---|
1571 | , 332C
|
---|
1572 | . 342E
|
---|
1573 | / 352F
|
---|
1574 | Gray * 372A
|
---|
1575 | Alt **
|
---|
1576 | Space 3920
|
---|
1577 | Caps Lock **
|
---|
1578 | F1 3B00
|
---|
1579 | F2 3C00
|
---|
1580 | F3 3D00
|
---|
1581 | F4 3E00
|
---|
1582 | F5 3F00
|
---|
1583 | F6 4000
|
---|
1584 | F7 4100
|
---|
1585 | F8 4200
|
---|
1586 | F9 4300
|
---|
1587 | F10 4400
|
---|
1588 | F11 8500
|
---|
1589 | F12 8600
|
---|
1590 | Num Lock **
|
---|
1591 | Scroll Lock **
|
---|
1592 | White Home 4700
|
---|
1593 | White Up Arrow 4800
|
---|
1594 | White PgUp 4900
|
---|
1595 | Gray - 4A2D
|
---|
1596 | White Left Arrow 4B00
|
---|
1597 | Center Key 4C00
|
---|
1598 | White Right Arrow 4D00
|
---|
1599 | Gray + 4E2B
|
---|
1600 | White End 4F00
|
---|
1601 | White Down Arrow 5000
|
---|
1602 | White PgDn 5100
|
---|
1603 | White Ins 5200
|
---|
1604 | White Del 5300
|
---|
1605 | SysReq **
|
---|
1606 | Key 45 [1] 565C
|
---|
1607 | Enter (number keypad) 1C0D
|
---|
1608 | Gray / 352F
|
---|
1609 | PrtSc **
|
---|
1610 | Pause **
|
---|
1611 | Gray Home 4700
|
---|
1612 | Gray Up Arrow 4800
|
---|
1613 | Gray Page Up 4900
|
---|
1614 | Gray Left Arrow 4B00
|
---|
1615 | Gray Right Arrow 4D00
|
---|
1616 | Gray End 4F00
|
---|
1617 | Gray Down Arrow 5000
|
---|
1618 | Gray Page Down 5100
|
---|
1619 | Gray Insert 5200
|
---|
1620 | Gray Delete 5300
|
---|
1621 |
|
---|
1622 | Shift Esc 011B
|
---|
1623 | ! 0221
|
---|
1624 | @ 0340
|
---|
1625 | # 0423
|
---|
1626 | $ 0524
|
---|
1627 | % 0625
|
---|
1628 | ^ 075E
|
---|
1629 | & 0826
|
---|
1630 | * (white) 092A
|
---|
1631 | ( 0A28
|
---|
1632 | ) 0B29
|
---|
1633 | _ 0C5F
|
---|
1634 | + (white) 0D2B
|
---|
1635 | Shift Backspace 0E08
|
---|
1636 | Shift Tab (Backtab) 0F00
|
---|
1637 | Q 1051
|
---|
1638 | W 1157
|
---|
1639 | E 1245
|
---|
1640 | R 1352
|
---|
1641 | T 1454
|
---|
1642 | Y 1559
|
---|
1643 | U 1655
|
---|
1644 | I 1749
|
---|
1645 | O 184F
|
---|
1646 | P 1950
|
---|
1647 | { 1A7B
|
---|
1648 | } 1B7D
|
---|
1649 | Shift Enter 1C0D
|
---|
1650 | Shift Ctrl **
|
---|
1651 | A 1E41
|
---|
1652 | S 1F53
|
---|
1653 | D 2044
|
---|
1654 | F 2146
|
---|
1655 | G 2247
|
---|
1656 | H 2348
|
---|
1657 | J 244A
|
---|
1658 | K 254B
|
---|
1659 | L 264C
|
---|
1660 | : 273A
|
---|
1661 | " 2822
|
---|
1662 | ~ 297E
|
---|
1663 | | 2B7C
|
---|
1664 | Z 2C5A
|
---|
1665 | X 2D58
|
---|
1666 | C 2E43
|
---|
1667 | V 2F56
|
---|
1668 | B 3042
|
---|
1669 | N 314E
|
---|
1670 | M 324D
|
---|
1671 | < 333C
|
---|
1672 | > 343E
|
---|
1673 | ? 353F
|
---|
1674 | Shift Gray * 372A
|
---|
1675 | Shift Alt **
|
---|
1676 | Shift Space 3920
|
---|
1677 | Shift Caps Lock **
|
---|
1678 | Shift F1 5400
|
---|
1679 | Shift F2 5500
|
---|
1680 | Shift F3 5600
|
---|
1681 | Shift F4 5700
|
---|
1682 | Shift F5 5800
|
---|
1683 | Shift F6 5900
|
---|
1684 | Shift F7 5A00
|
---|
1685 | Shift F8 5B00
|
---|
1686 | Shift F9 5C00
|
---|
1687 | Shift F10 5D00
|
---|
1688 | Shift F11 8700
|
---|
1689 | Shift F12 8800
|
---|
1690 | Shift Num Lock **
|
---|
1691 | Shift Scroll Lock **
|
---|
1692 | Shift 7 (number pad) 4737
|
---|
1693 | Shift 8 (number pad) 4838
|
---|
1694 | Shift 9 (number pad) 4939
|
---|
1695 | Shift Gray - 4A2D
|
---|
1696 | Shift 4 (number pad) 4B34
|
---|
1697 | Shift 5 (number pad) 4C35
|
---|
1698 | Shift 6 (number pad) 4D36
|
---|
1699 | Shift Gray + 4E2B
|
---|
1700 | Shift 1 (number pad) 4F31
|
---|
1701 | Shift 2 (number pad) 5032
|
---|
1702 | Shift 3 (number pad) 5133
|
---|
1703 | Shift 0 (number pad) 5230
|
---|
1704 | Shift . (number pad) 532E
|
---|
1705 | Shift SysReq **
|
---|
1706 | Shift Key 45 [1] 567C
|
---|
1707 | Shift Enter (number pad) 1C0D
|
---|
1708 | Shift Gray / 352F
|
---|
1709 | Shift PrtSc **
|
---|
1710 | Shift Pause **
|
---|
1711 | Shift Gray Home 4700
|
---|
1712 | Shift Gray Up Arrow 4800
|
---|
1713 | Shift Gray Page Up 4900
|
---|
1714 | Shift Gray Left Arrow 4B00
|
---|
1715 | Shift Gray Right Arrow 4D00
|
---|
1716 | Shift Gray End 4F00
|
---|
1717 | Shift Gray Down Arrow 5000
|
---|
1718 | Shift Gray Page Down 5100
|
---|
1719 | Shift Gray Insert 5200
|
---|
1720 | Shift Gray Delete 5300
|
---|
1721 |
|
---|
1722 | Ctrl Esc 011B
|
---|
1723 | Ctrl 1 --
|
---|
1724 | Ctrl 2 (NUL) 0300
|
---|
1725 | Ctrl 3 --
|
---|
1726 | Ctrl 4 --
|
---|
1727 | Ctrl 5 --
|
---|
1728 | Ctrl 6 (RS) 071E
|
---|
1729 | Ctrl 7 --
|
---|
1730 | Ctrl 8 --
|
---|
1731 | Ctrl 9 --
|
---|
1732 | Ctrl 0 --
|
---|
1733 | Ctrl - 0C1F
|
---|
1734 | Ctrl = --
|
---|
1735 | Ctrl Backspace (DEL) 0E7F
|
---|
1736 | Ctrl Tab 9400
|
---|
1737 | Ctrl q (DC1) 1011
|
---|
1738 | Ctrl w (ETB) 1117
|
---|
1739 | Ctrl e (ENQ) 1205
|
---|
1740 | Ctrl r (DC2) 1312
|
---|
1741 | Ctrl t (DC4) 1414
|
---|
1742 | Ctrl y (EM) 1519
|
---|
1743 | Ctrl u (NAK) 1615
|
---|
1744 | Ctrl i (HT) 1709
|
---|
1745 | Ctrl o (SI) 180F
|
---|
1746 | Ctrl p (DEL) 1910
|
---|
1747 | Ctrl [ (ESC) 1A1B
|
---|
1748 | Ctrl ] (GS) 1B1D
|
---|
1749 | Ctrl Enter (LF) 1C0A
|
---|
1750 | Ctrl a (SOH) 1E01
|
---|
1751 | Ctrl s (DC3) 1F13
|
---|
1752 | Ctrl d (EOT) 2004
|
---|
1753 | Ctrl f (ACK) 2106
|
---|
1754 | Ctrl g (BEL) 2207
|
---|
1755 | Ctrl h (Backspace) 2308
|
---|
1756 | Ctrl j (LF) 240A
|
---|
1757 | Ctrl k (VT) 250B
|
---|
1758 | Ctrl l (FF) 260C
|
---|
1759 | Ctrl ; --
|
---|
1760 | Ctrl ' --
|
---|
1761 | Ctrl ` --
|
---|
1762 | Ctrl Shift **
|
---|
1763 | Ctrl \ (FS) 2B1C
|
---|
1764 | Ctrl z (SUB) 2C1A
|
---|
1765 | Ctrl x (CAN) 2D18
|
---|
1766 | Ctrl c (ETX) 2E03
|
---|
1767 | Ctrl v (SYN) 2F16
|
---|
1768 | Ctrl b (STX) 3002
|
---|
1769 | Ctrl n (SO) 310E
|
---|
1770 | Ctrl m (CR) 320D
|
---|
1771 | Ctrl , --
|
---|
1772 | Ctrl . --
|
---|
1773 | Ctrl / --
|
---|
1774 | Ctrl Gray * 9600
|
---|
1775 | Ctrl Alt **
|
---|
1776 | Ctrl Space 3920
|
---|
1777 | Ctrl Caps Lock --
|
---|
1778 | Ctrl F1 5E00
|
---|
1779 | Ctrl F2 5F00
|
---|
1780 | Ctrl F3 6000
|
---|
1781 | Ctrl F4 6100
|
---|
1782 | Ctrl F5 6200
|
---|
1783 | Ctrl F6 6300
|
---|
1784 | Ctrl F7 6400
|
---|
1785 | Ctrl F8 6500
|
---|
1786 | Ctrl F9 6600
|
---|
1787 | Ctrl F10 6700
|
---|
1788 | Ctrl F11 8900
|
---|
1789 | Ctrl F12 8A00
|
---|
1790 | Ctrl Num Lock --
|
---|
1791 | Ctrl Scroll Lock --
|
---|
1792 | Ctrl White Home 7700
|
---|
1793 | Ctrl White Up Arrow 8D00
|
---|
1794 | Ctrl White PgUp 8400
|
---|
1795 | Ctrl Gray - 8E00
|
---|
1796 | Ctrl White Left Arrow 7300
|
---|
1797 | Ctrl 5 (number pad) 8F00
|
---|
1798 | Ctrl White Right Arrow 7400
|
---|
1799 | Ctrl Gray + 9000
|
---|
1800 | Ctrl White End 7500
|
---|
1801 | Ctrl White Down Arrow 9100
|
---|
1802 | Ctrl White PgDn 7600
|
---|
1803 | Ctrl White Ins 9200
|
---|
1804 | Ctrl White Del 9300
|
---|
1805 | Ctrl SysReq **
|
---|
1806 | Ctrl Key 45 [1] --
|
---|
1807 | Ctrl Enter (number pad) 1C0A
|
---|
1808 | Ctrl / (number pad) 9500
|
---|
1809 | Ctrl PrtSc 7200
|
---|
1810 | Ctrl Break 0000
|
---|
1811 | Ctrl Gray Home 7700
|
---|
1812 | Ctrl Gray Up Arrow 8DE0
|
---|
1813 | Ctrl Gray Page Up 8400
|
---|
1814 | Ctrl Gray Left Arrow 7300
|
---|
1815 | Ctrl Gray Right Arrow 7400
|
---|
1816 | Ctrl Gray End 7500
|
---|
1817 | Ctrl Gray Down Arrow 91E0
|
---|
1818 | Ctrl Gray Page Down 7600
|
---|
1819 | Ctrl Gray Insert 92E0
|
---|
1820 | Ctrl Gray Delete 93E0
|
---|
1821 |
|
---|
1822 | Alt Esc 0100
|
---|
1823 | Alt 1 7800
|
---|
1824 | Alt 2 7900
|
---|
1825 | Alt 3 7A00
|
---|
1826 | Alt 4 7B00
|
---|
1827 | Alt 5 7C00
|
---|
1828 | Alt 6 7D00
|
---|
1829 | Alt 7 7E00
|
---|
1830 | Alt 8 7F00
|
---|
1831 | Alt 9 8000
|
---|
1832 | Alt 0 8100
|
---|
1833 | Alt - 8200
|
---|
1834 | Alt = 8300
|
---|
1835 | Alt Backspace 0E00
|
---|
1836 | Alt Tab A500
|
---|
1837 | Alt q 1000
|
---|
1838 | Alt w 1100
|
---|
1839 | Alt e 1200
|
---|
1840 | Alt r 1300
|
---|
1841 | Alt t 1400
|
---|
1842 | Alt y 1500
|
---|
1843 | Alt u 1600
|
---|
1844 | Alt i 1700
|
---|
1845 | Alt o 1800
|
---|
1846 | Alt p 1900
|
---|
1847 | Alt [ 1A00
|
---|
1848 | Alt ] 1B00
|
---|
1849 | Alt Enter 1C00
|
---|
1850 | Alt Ctrl **
|
---|
1851 | Alt a 1E00
|
---|
1852 | Alt s 1F00
|
---|
1853 | Alt d 2000
|
---|
1854 | Alt f 2100
|
---|
1855 | Alt g 2200
|
---|
1856 | Alt h 2300
|
---|
1857 | Alt j 2400
|
---|
1858 | Alt k 2500
|
---|
1859 | Alt l 2600
|
---|
1860 | Alt ; 2700
|
---|
1861 | Alt ' 2800
|
---|
1862 | Alt ` 2900
|
---|
1863 | Alt Shift **
|
---|
1864 | Alt \ 2B00
|
---|
1865 | Alt z 2C00
|
---|
1866 | Alt x 2D00
|
---|
1867 | Alt c 2E00
|
---|
1868 | Alt v 2F00
|
---|
1869 | Alt b 3000
|
---|
1870 | Alt n 3100
|
---|
1871 | Alt m 3200
|
---|
1872 | Alt , 3300
|
---|
1873 | Alt . 3400
|
---|
1874 | Alt / 3500
|
---|
1875 | Alt Gray * 3700
|
---|
1876 | Alt Space 3920
|
---|
1877 | Alt Caps Lock **
|
---|
1878 | Alt F1 6800
|
---|
1879 | Alt F2 6900
|
---|
1880 | Alt F3 6A00
|
---|
1881 | Alt F4 6B00
|
---|
1882 | Alt F5 6C00
|
---|
1883 | Alt F6 6D00
|
---|
1884 | Alt F7 6E00
|
---|
1885 | Alt F8 6F00
|
---|
1886 | Alt F9 7000
|
---|
1887 | Alt F10 7100
|
---|
1888 | Alt F11 8B00
|
---|
1889 | Alt F12 8C00
|
---|
1890 | Alt Num Lock **
|
---|
1891 | Alt Scroll Lock **
|
---|
1892 | Alt Gray - 4A00
|
---|
1893 | Alt Gray + 4E00
|
---|
1894 | Alt 7 (number pad) #
|
---|
1895 | Alt 8 (number pad) #
|
---|
1896 | Alt 9 (number pad) #
|
---|
1897 | Alt 4 (number pad) #
|
---|
1898 | Alt 5 (number pad) #
|
---|
1899 | Alt 6 (number pad) #
|
---|
1900 | Alt 1 (number pad) #
|
---|
1901 | Alt 2 (number pad) #
|
---|
1902 | Alt 3 (number pad) #
|
---|
1903 | Alt Del --
|
---|
1904 | Alt SysReq **
|
---|
1905 | Alt Key 45 [1] --
|
---|
1906 | Alt Enter (number pad) A600
|
---|
1907 | Alt / (number pad) A400
|
---|
1908 | Alt PrtSc **
|
---|
1909 | Alt Pause **
|
---|
1910 | Alt Gray Home 9700
|
---|
1911 | Alt Gray Up Arrow 9800
|
---|
1912 | Alt Gray Page Up 9900
|
---|
1913 | Alt Gray Left Arrow 9B00
|
---|
1914 | Alt Gray Right Arrow 9D00
|
---|
1915 | Alt Gray End 9F00
|
---|
1916 | Alt Gray Down Arrow A000
|
---|
1917 | Alt Gray Page Down A100
|
---|
1918 | Alt Gray Insert A200
|
---|
1919 | Alt Gray Delete A300
|
---|
1920 |
|
---|
1921 | -------------------------------------------------------------------------
|
---|
1922 |
|
---|
1923 | Footnotes
|
---|
1924 |
|
---|
1925 | [1] In the United States, the 101/102-key keyboard is shipped
|
---|
1926 | with 101 keys. Overseas versions have an additional key
|
---|
1927 | sandwiched between the left Shift key and the Z key. This
|
---|
1928 | additional key is identified by IBM (and in this table) as
|
---|
1929 | "Key 45."
|
---|
1930 |
|
---|
1931 | [**] Keys and key combinations marked ** are used by the ROM BIOS
|
---|
1932 | but do not put values into the keyboard buffer.
|
---|
1933 |
|
---|
1934 | [--] Keys and key combinations marked -- are ignored by the ROM
|
---|
1935 | BIOS.
|
---|
1936 |
|
---|
1937 |
|
---|
1938 |
|
---|
1939 |
|
---|
1940 | 3. From "http://heim.ifi.uio.no/~stanisls/helppc/make_codes.html":
|
---|
1941 |
|
---|
1942 |
|
---|
1943 | INT 9 - Hardware Keyboard Make/Break Codes
|
---|
1944 |
|
---|
1945 | Key Make Break Key Make Break
|
---|
1946 |
|
---|
1947 | Backspace 0E 8E F1 3B BB
|
---|
1948 | Caps Lock 3A BA F2 3C BC
|
---|
1949 | Enter 1C 9C F3 3D BD
|
---|
1950 | Esc 01 81 F4 3E BE
|
---|
1951 | Left Alt 38 B8 F7 41 C1
|
---|
1952 | Left Ctrl 1D 9D F5 3F BF
|
---|
1953 | Left Shift 2A AA F6 40 C0
|
---|
1954 | Num Lock 45 C5 F8 42 C2
|
---|
1955 | Right Shift 36 B6 F9 43 C3
|
---|
1956 | Scroll Lock 46 C6 F10 44 C4
|
---|
1957 | Space 39 B9 F11 57 D7
|
---|
1958 | Sys Req (AT) 54 D4 F12 58 D8
|
---|
1959 | Tab 0F 8F
|
---|
1960 |
|
---|
1961 | Keypad Keys Make Break
|
---|
1962 |
|
---|
1963 | Keypad 0 (Ins) 52 D2
|
---|
1964 | Keypad 1 (End) 4F CF
|
---|
1965 | Keypad 2 (Down arrow) 50 D0
|
---|
1966 | Keypad 3 (PgDn) 51 D1
|
---|
1967 | Keypad 4 (Left arrow) 4B CB
|
---|
1968 | Keypad 5 4C CC
|
---|
1969 | Keypad 6 (Right arrow) 4D CD
|
---|
1970 | Keypad 7 (Home) 47 C7
|
---|
1971 | Keypad 8 (Up arrow) 48 C8
|
---|
1972 | Keypad 9 (PgUp) 49 C9
|
---|
1973 | Keypad . (Del) 53 D3
|
---|
1974 | Keypad * (PrtSc) 37 B7
|
---|
1975 | Keypad - 4A CA
|
---|
1976 | Keypad + 4E CE
|
---|
1977 |
|
---|
1978 | Key Make Break Key Make Break
|
---|
1979 |
|
---|
1980 | A 1E 9E N 31 B1
|
---|
1981 | B 30 B0 O 18 98
|
---|
1982 | C 2E AE P 19 99
|
---|
1983 | D 20 A0 Q 10 90
|
---|
1984 | E 12 92 R 13 93
|
---|
1985 | F 21 A1 S 1F 9F
|
---|
1986 | G 22 A2 T 14 94
|
---|
1987 | H 23 A3 U 16 96
|
---|
1988 | I 17 97 V 2F AF
|
---|
1989 | J 24 A4 W 11 91
|
---|
1990 | K 25 A5 X 2D AD
|
---|
1991 | L 26 A6 Y 15 95
|
---|
1992 | M 32 B2 Z 2C AC
|
---|
1993 |
|
---|
1994 | Key Make Break Key Make Break
|
---|
1995 |
|
---|
1996 | 1 02 82 - 0C 8C
|
---|
1997 | 2 03 83 = 0D 8D
|
---|
1998 | 3 04 84 [ 1A 9A
|
---|
1999 | 4 05 85 ] 1B 9B
|
---|
2000 | 5 06 86 ; 27 A7
|
---|
2001 | 6 07 87 ' 28 A8
|
---|
2002 | 7 08 88 ` 29 A9
|
---|
2003 | 8 09 89 \ 2B AB
|
---|
2004 | 9 0A 8A , 33 B3
|
---|
2005 | 0 0B 8B . 34 B4
|
---|
2006 | / 35 B5
|
---|
2007 |
|
---|
2008 |
|
---|
2009 | Enhanced Keyboard Keys (101/102 keys)
|
---|
2010 |
|
---|
2011 | Control Keys Make Break
|
---|
2012 |
|
---|
2013 | Alt-PrtSc (SysReq) 54 D4
|
---|
2014 | Ctrl-PrtSc E0 37 E0 B7
|
---|
2015 | Enter E0 1C E0 9C
|
---|
2016 | PrtSc E0 2A E0 37 E0 B7 E0 AA
|
---|
2017 | Right Alt E0 38 E0 B8
|
---|
2018 | Right Ctrl E0 1D E0 9D
|
---|
2019 | Shift-PrtSc E0 37 E0 B7
|
---|
2020 | / E0 35 E0 B5
|
---|
2021 | Pause E1 1D 45 E1 9D C5 (not typematic)
|
---|
2022 | Ctrl-Pause (Ctrl-Break) E0 46 E0 C6 (not typematic)
|
---|
2023 |
|
---|
2024 | - Keys marked as "not typematic" generate one stream of bytes
|
---|
2025 | without corresponding break scan code bytes (actually the
|
---|
2026 | break codes are part of the make code).
|
---|
2027 |
|
---|
2028 |
|
---|
2029 | Normal Mode or
|
---|
2030 | Shift w/Numlock
|
---|
2031 | Key Make Break |----- Numlock on ------.
|
---|
2032 | Make Break
|
---|
2033 | Del E0 53 E0 D3 E0 2A E0 53 E0 D3 E0 AA
|
---|
2034 | Down arrow E0 50 E0 D0 E0 2A E0 50 E0 D0 E0 AA
|
---|
2035 | End E0 4F E0 CF E0 2A E0 4F E0 CF E0 AA
|
---|
2036 | Home E0 47 E0 C7 E0 2A E0 47 E0 C7 E0 AA
|
---|
2037 | Ins E0 52 E0 D2 E0 2A E0 52 E0 D2 E0 AA
|
---|
2038 | Left arrow E0 4B E0 CB E0 2A E0 4B E0 CB E0 AA
|
---|
2039 | PgDn E0 51 E0 D1 E0 2A E0 51 E0 D1 E0 AA
|
---|
2040 | PgUp E0 49 E0 C9 E0 2A E0 49 E0 C9 E0 AA
|
---|
2041 | Right arrow E0 4D E0 CD E0 2A E0 4D E0 CD E0 AA
|
---|
2042 | Up arrow E0 48 E0 C8 E0 2A E0 48 E0 C8 E0 AA
|
---|
2043 |
|
---|
2044 | Key |--Left Shift Pressed--. |--Right Shift Pressed--.
|
---|
2045 | Make Break Make Break
|
---|
2046 | Del E0 AA E0 53 E0 D3 E0 2A E0 B6 E0 53 E0 D3 E0 36
|
---|
2047 | Down arrow E0 AA E0 50 E0 D0 E0 2A E0 B6 E0 50 E0 D0 E0 36
|
---|
2048 | End E0 AA E0 4F E0 CF E0 2A E0 B6 E0 4F E0 CF E0 36
|
---|
2049 | Home E0 AA E0 47 E0 C7 E0 2A E0 B6 E0 47 E0 C7 E0 36
|
---|
2050 | Ins E0 AA E0 52 E0 D2 E0 2A E0 B6 E0 52 E0 D2 E0 36
|
---|
2051 | Left arrow E0 AA E0 4B E0 CB E0 2A E0 B6 E0 4B E0 CB E0 36
|
---|
2052 | PgDn E0 AA E0 51 E0 D1 E0 2A E0 B6 E0 51 E0 D1 E0 36
|
---|
2053 | PgUp E0 AA E0 49 E0 C9 E0 2A E0 B6 E0 49 E0 C9 E0 36
|
---|
2054 | Right arrow E0 AA E0 4D E0 CD E0 2A E0 B6 E0 4D E0 CD E0 36
|
---|
2055 | Up arrow E0 AA E0 48 E0 C8 E0 2A E0 B6 E0 48 E0 C8 E0 36
|
---|
2056 | / E0 AA E0 35 E0 B5 E0 2A E0 B6 E0 35 E0 B5 E0 36
|
---|
2057 |
|
---|
2058 |
|
---|
2059 | - The PS/2 models have three make/break scan code sets. The first
|
---|
2060 | set matches the PC & XT make/break scan code set and is the one
|
---|
2061 | listed here. Scan code sets are selected by writing the value F0
|
---|
2062 | to the keyboard via the 8042 (port 60h). The following is a brief
|
---|
2063 | description of the scan code sets (see the PS/2 Technical Reference
|
---|
2064 | manuals for more information on scan code sets 2 and 3):
|
---|
2065 |
|
---|
2066 | / set 1, each key has a base scan code. Some keys generate
|
---|
2067 | extra scan codes to generate artificial shift states. This
|
---|
2068 | is similar to the standard scan code set used on the PC and XT.
|
---|
2069 | / set 2, each key sends one make scan code and two break scan
|
---|
2070 | codes bytes (F0 followed by the make code). This scan code
|
---|
2071 | set is available on the IBM AT also.
|
---|
2072 | / set 3, each key sends one make scan code and two break scan
|
---|
2073 | codes bytes (F0 followed by the make code) and no keys are
|
---|
2074 | altered by Shift/Alt/Ctrl keys.
|
---|
2075 | / typematic scan codes are the same as the make scan code
|
---|
2076 |
|
---|
2077 | - Some Tandy 1000's do not handle Alt key combinations when multiple
|
---|
2078 | shift keys are pressed. The Alt-Shift-H combination loses the Alt.
|
---|
2079 | - extended keys like (F11, F12) can only be read with systems that
|
---|
2080 | have extended keyboard BIOS support (or INT 9 extensions); to
|
---|
2081 | read these special keys on these systems INT 16,10 must be used
|
---|
2082 |
|
---|
2083 |
|
---|
2084 | ******************************************************************************
|
---|
2085 | *** GRLDR Error messages ***
|
---|
2086 | ******************************************************************************
|
---|
2087 |
|
---|
2088 | 1. Missing MBR-helper.
|
---|
2089 |
|
---|
2090 | The helper function in the sectors that immediately follow the MBR is
|
---|
2091 | not present, or it has been erased by a virus or by Windows XP/Vista.
|
---|
2092 |
|
---|
2093 | Run the bootlace.com utility to fix the problem.
|
---|
2094 |
|
---|
2095 | 2. Buggy BIOS!
|
---|
2096 |
|
---|
2097 | Your BIOS is too buggy. It even has no support for INT13/AH=8.
|
---|
2098 |
|
---|
2099 | No solution except flashing your BIOS. Buggy BIOSes will encounter
|
---|
2100 | more and more problems with grub4dos in the future.
|
---|
2101 |
|
---|
2102 | 3. This partition is NTFS but with unknown boot record. Please install
|
---|
2103 | Microsoft NTFS boot sectors to this partition correctly, or create an
|
---|
2104 | FAT12/16/32 partition and place the same copy of GRLDR and MENU.LST there.
|
---|
2105 |
|
---|
2106 | The boot record was changed or erased by Microsoft Windows XP Service
|
---|
2107 | Pack 2.
|
---|
2108 |
|
---|
2109 | You may install the old boot record introduced with the original clean
|
---|
2110 | Windows 2K/XP. As another solution, you may create an FAT partition
|
---|
2111 | for your system, and copy GRLDR and your MENU.LST to its root dir.
|
---|
2112 |
|
---|
2113 | While the startup code of grldr might fail to load GRLDR in NTFS
|
---|
2114 | partitions, it always successfully loads GRLDR in FAT partitions(and
|
---|
2115 | even in ext2/ext3 partitions).
|
---|
2116 |
|
---|
2117 | Note that NTLDR only loads the startup code of grldr(i.e., the leading
|
---|
2118 | 16 sectors of grldr), not the whole grldr file.
|
---|
2119 |
|
---|
2120 | Thus, C:\GRLDR must exist(here C: can be NTFS), since it is used for
|
---|
2121 | BOOT.INI and NTLDR. If C: is NTFS, X:\GRLDR should exist as well,
|
---|
2122 | where X: stands for a certain FAT partition.
|
---|
2123 |
|
---|
2124 |
|
---|
2125 | ******************************************************************************
|
---|
2126 | *** Known BIOS bugs ***
|
---|
2127 | ******************************************************************************
|
---|
2128 |
|
---|
2129 | 1. Some newer Dell machines have no int13/AH=43h support. You may encounter
|
---|
2130 | failure when trying to write-access an emulated disk.
|
---|
2131 |
|
---|
2132 | Note: This bug is serious! The old "root+setup" installation method
|
---|
2133 | (in real mode grub environment) uses INT13 to write the first sector
|
---|
2134 | of stage2. It will fail for the buggy DELL machine when stage2 is
|
---|
2135 | accessed with LBA mode.
|
---|
2136 |
|
---|
2137 | 2. Some buggy BIOSes won't boot bootable.iso(See above).(qemu can boot it fine)
|
---|
2138 |
|
---|
2139 | 3. Some newer Dell machines violently destroyed the interrupt vectors for
|
---|
2140 | hardware IRQs and will hang the machine when running GRUB.EXE
|
---|
2141 | from DOS. You may try again with BADGRUB.EXE.
|
---|
2142 |
|
---|
2143 | 4. Reports say some BIOSes will function abnormally after GRUB.EXE is started
|
---|
2144 | by kexec of Linux. Some machines reportedly hang. Some others
|
---|
2145 | reportedly cannot access USB drives.
|
---|
2146 |
|
---|
2147 |
|
---|
2148 | ******************************************************************************
|
---|
2149 | *** Known Problems ***
|
---|
2150 | ******************************************************************************
|
---|
2151 |
|
---|
2152 | 1. Running GRUB.EXE from a DOS box of Windows 9x/Me could hang the
|
---|
2153 | machine, especially for some systems with USB support. You may
|
---|
2154 | encounter the same problem when running GRUB.EXE through KEXEC under
|
---|
2155 | Linux.
|
---|
2156 |
|
---|
2157 | Note: You don't have to run GRUB.EXE from protected mode of Win9x, which
|
---|
2158 | could hang the machine; Instead, you usually want to run GRUB.EXE
|
---|
2159 | after you have done a "Restart the computer in MS-DOS mode", which
|
---|
2160 | is safe enough.
|
---|
2161 |
|
---|
2162 | 2. The default chainloader action will keep A20 on. Some buggy DOS XMS
|
---|
2163 | memory managers could hang the machine. You may use the --disable-a20
|
---|
2164 | option in the chainloader line and try again. Anyway, you should avoid
|
---|
2165 | using those buggy memory managers.
|
---|
2166 |
|
---|
2167 | 3. THTF BIOS L4S5M Ver 1.1a(dated 2002-1-10) has a buggy int15 which
|
---|
2168 | causes hang at the boot of a multi boot kernel(memdisk for example).
|
---|
2169 |
|
---|
2170 | 4. A Chinese DOS system software, the TechWay SCS, will not work with
|
---|
2171 | newer versions of GRUB.EXE. In general, TSRs that take antitracking
|
---|
2172 | measures will not work with GRUB.EXE any more.
|
---|
2173 |
|
---|
2174 |
|
---|
2175 | ******************************************************************************
|
---|
2176 | *** List of binary files and their corresponding source files ***
|
---|
2177 | ******************************************************************************
|
---|
2178 |
|
---|
2179 | binary file main source file other included source or binary files
|
---|
2180 | ------------- ---------------- -------------------------------------
|
---|
2181 |
|
---|
2182 | bootlace.com bootlacestart.S bootlace.inc, grldrstart.S
|
---|
2183 |
|
---|
2184 | grldr grldrstart.S pre_stage2(binary, See note below)
|
---|
2185 |
|
---|
2186 | grldr.mbr mbrstart.S grldrstart.S
|
---|
2187 |
|
---|
2188 | grub.exe dosstart.S pre_stage2(binary, See note below)
|
---|
2189 |
|
---|
2190 | hmload.com hmloadstart.S
|
---|
2191 |
|
---|
2192 | -----------------------------------------------------------------------------
|
---|
2193 |
|
---|
2194 | Note: pre_stage2 is the main body of GNU GRUB and it is simply appended to
|
---|
2195 | grldrstart/dosstart in binary format to form our grldr/grub.exe.
|
---|
2196 |
|
---|
2197 | Note: The GRUB file(WITHOUT .EXE suffix) is a static-linked ELF executable
|
---|
2198 | program for Linux, normally called the GRUB Shell. The GRUB Shell is a boot-
|
---|
2199 | manager, but not a boot-loader(the "boot" command won't work in GRUB Shell).
|
---|
2200 | GRUB.EXE(with KEXEC) can be used as a bootloader running directly under Linux.
|
---|
2201 |
|
---|
2202 | ******************************************************************************
|
---|
2203 | *** Memory Layout for Quiting to DOS from GRUB.EXE ***
|
---|
2204 | ******************************************************************************
|
---|
2205 |
|
---|
2206 | The quit command is implemented to return to DOS in the instance that GRUB.EXE
|
---|
2207 | is started off DOS.
|
---|
2208 |
|
---|
2209 | 1. Before GRUB.EXE transfers control to pre_stage2, it will copy 640KB of
|
---|
2210 | conventional memory to physical address 0x200000(i.e., 2MB), and write 4 long
|
---|
2211 | integers immediately follows the backup copy of the conventional memory:
|
---|
2212 | At 0x2A0000: 0x50554B42, it is the "BKUP" signature.
|
---|
2213 |
|
---|
2214 | At 0x2A0004: Gate A20 status under DOS: non-zero means A20 on;
|
---|
2215 | zero means A20 off. Update: A20 always on, see below.
|
---|
2216 |
|
---|
2217 | At 0x2A0008: high word is boot-CS, low word is boot-IP. The quit
|
---|
2218 | command uses this entry point to return to DOS.
|
---|
2219 |
|
---|
2220 | At 0x2A000C: CheckSum: the sum of all long integers in the memory
|
---|
2221 | range from 0x200000 to 0x2A000F is 0.
|
---|
2222 |
|
---|
2223 | 2. If the above memory structure is corrupted by a grub command, the quit
|
---|
2224 | command will issue an error message and refuse to exit from grub.
|
---|
2225 |
|
---|
2226 | 3. Because GRUB may corrupt extended memory, you should better avoid using
|
---|
2227 | extended memory under DOS before running GRUB.EXE.
|
---|
2228 |
|
---|
2229 | 4. Gate A20 will be enabled by GRUB.EXE. Hopefully this would hurt nothing.
|
---|
2230 |
|
---|
2231 |
|
---|
2232 | ******************************************************************************
|
---|
2233 | *** Memory usage in conventional/low memory area ***
|
---|
2234 | ******************************************************************************
|
---|
2235 |
|
---|
2236 | 1. boot.c, fsys_reiserfs.c: 8K below 0x68000.
|
---|
2237 |
|
---|
2238 | 2. fsys_ext2fs.c, fsys_minix.c: 1K below 0x68000.
|
---|
2239 |
|
---|
2240 | 3. fsys_jfs.c: 4K + 256 bytes below 0x68000.
|
---|
2241 |
|
---|
2242 | 4. fsys_reiserfs.c: 202 bytes at 0x600.
|
---|
2243 |
|
---|
2244 | 5. fsys_xfs.c: 188 bytes at 0x600.
|
---|
2245 |
|
---|
2246 | 6. fsys_xfs.c: (logical block size) bytes below 0x68000.
|
---|
2247 |
|
---|
2248 | 7. geometry tune: 0x50000 - 0x5ffff.
|
---|
2249 |
|
---|
2250 | ******************************************************************************
|
---|
2251 | *** Command-line Length about GRUB.EXE ***
|
---|
2252 | ******************************************************************************
|
---|
2253 |
|
---|
2254 | GRUB.EXE now can be started in CONFIG.SYS with the **DEVICE** command:
|
---|
2255 |
|
---|
2256 | DEVICE=grub.exe [--config-file="FILENAME_OR_COMMANDS"]
|
---|
2257 |
|
---|
2258 | 1. If GRUB.EXE is invoked with DEVICE command and FILENAME_OR_COMMANDS is a
|
---|
2259 | collection of some GRUB commands separated by semi-colon, then the length of
|
---|
2260 | FILENAME_OR_COMMANDS can be nearly 4KB ----Supprise? But true! MS-DOS 7+
|
---|
2261 | even allows a much longer line, but 4KB seems enough for our use of GRUB.EXE.
|
---|
2262 | This is very useful when we want to embed a big menu into the command line.
|
---|
2263 | Note that GRLDR hasn't yet supported any command-line arguments.
|
---|
2264 |
|
---|
2265 | 2. If GRUB.EXE is invoked with INSTALL command, the option length has a limit
|
---|
2266 | of 80 characters(including the leading "--config-file=" part). An overflow may
|
---|
2267 | hang up MS-DOS immediately.
|
---|
2268 |
|
---|
2269 | 3. If GRUB.EXE is invoked with SHELL command, the option length has a limit of
|
---|
2270 | 126 characters(including the leading "--config-file=" part). Overflow won't
|
---|
2271 | hang up MS-DOS, but the line will be cut short. This limit is the same as that
|
---|
2272 | in the console-DOS-prompt or in a BAT file.
|
---|
2273 |
|
---|
2274 | 4. The DOS editor EDIT does not allow to create a line of 4KB long. So use
|
---|
2275 | another editor, for example, vi for Linux, please.
|
---|
2276 |
|
---|
2277 | 5. The DEVICE=GRUB.EXE line can be used together with other DEVICE commands
|
---|
2278 | such as DEVICE=HIMEM.SYS and DEVICE=EMM386.EXE. The GRUB.EXE line should
|
---|
2279 | occur before the EMM386.EXE line in order to avoid the rejection by EMM386.
|
---|
2280 | Update: Since 0.4.2, GRUB.EXE works well even after EMM386.EXE is loaded.
|
---|
2281 |
|
---|
2282 | 6. In any case mentioned above, you can return back to DOS by quit command.
|
---|
2283 |
|
---|
2284 | 7. Memory usage about command-line menu: The 4KB command-line menu starts at
|
---|
2285 | physical address 0x0800 and ends at 0x17FF.
|
---|
2286 |
|
---|
2287 | ******************************************************************************
|
---|
2288 | *** New Syntax for the DEFAULT/SAVEDEFAULT Commands ***
|
---|
2289 | ******************************************************************************
|
---|
2290 |
|
---|
2291 | In addition to the original usage of "default NUM" and "default saved", now
|
---|
2292 | there is a new usage of "default FILE", like this:
|
---|
2293 |
|
---|
2294 | default (hd0,0)/default
|
---|
2295 |
|
---|
2296 | Note that FILE must have a valid DEFAULT file format. A sample DEFAULT file
|
---|
2297 | is included in the release. You may copy it to wherever you like, but you
|
---|
2298 | should avoid modifying its content manually. The DEFAULT file may be used
|
---|
2299 | in this way:
|
---|
2300 |
|
---|
2301 | (1) First, you should copy a default file with valid format to somewhere in
|
---|
2302 | your operating system.
|
---|
2303 |
|
---|
2304 | (2) Secondly, you should use the "default FILE" command of GRUB to announce
|
---|
2305 | the use of FILE as our new default file for being written by "savedefault".
|
---|
2306 |
|
---|
2307 | (3) Then, you may use "savedefault" command to save the desired entry number
|
---|
2308 | into this new default file.
|
---|
2309 |
|
---|
2310 | (4) OK, at next boot, you may read the saved entry number by using the same
|
---|
2311 | "default FILE" command as mentioned in above (2).
|
---|
2312 |
|
---|
2313 | And the SAVEDEFAULT command now accept an options `--wait=T', like this:
|
---|
2314 |
|
---|
2315 | savedefault --wait=5
|
---|
2316 |
|
---|
2317 | If `--wait=T' is specified and T is non-zero, savedefault will prompt
|
---|
2318 | the user with a message just before it writes to disk. The write operation
|
---|
2319 | will be cancelled in T seconds if the `Y' key was not pressed.
|
---|
2320 |
|
---|
2321 | Here is a sample menu.lst file:
|
---|
2322 |
|
---|
2323 | #--------------------begin menu.lst---------------------------------------
|
---|
2324 | color black/cyan yellow/cyan
|
---|
2325 | timeout 30
|
---|
2326 | default /default
|
---|
2327 |
|
---|
2328 | title find and load NTLDR of Windows NT/2K/XP
|
---|
2329 | find --set-root /ntldr
|
---|
2330 | chainloader /ntldr
|
---|
2331 | savedefault --wait=2
|
---|
2332 |
|
---|
2333 | title find and load CMLDR, the Recovery Console of Windows NT/2K/XP
|
---|
2334 | fallback 2
|
---|
2335 | find --set-root /cmldr
|
---|
2336 | chainloader /cmldr
|
---|
2337 | #####################################################################
|
---|
2338 | # write string "cmdcons" to memory 0000:7C03 in 2 steps:
|
---|
2339 | #####################################################################
|
---|
2340 | # step 1. Write 4 chars "cmdc" at 0000:7C03
|
---|
2341 | write 0x7C03 0x63646D63
|
---|
2342 | # step 2. Write 3 chars "ons" and an ending null at 0000:7C07
|
---|
2343 | write 0x7C07 0x00736E6F
|
---|
2344 | savedefault --wait=2
|
---|
2345 |
|
---|
2346 | title find and load IO.SYS of Windows 9x/Me
|
---|
2347 | find --set-root /io.sys
|
---|
2348 | chainloader /io.sys
|
---|
2349 | savedefault --wait=2
|
---|
2350 |
|
---|
2351 | title floppy (fd0)
|
---|
2352 | chainloader (fd0)+1
|
---|
2353 | rootnoverify (fd0)
|
---|
2354 | savedefault --wait=2
|
---|
2355 |
|
---|
2356 | title find and boot Linux with menu.lst already installed
|
---|
2357 | find --set-root /sbin/init
|
---|
2358 | savedefault --wait=2
|
---|
2359 | configfile /boot/grub/menu.lst
|
---|
2360 |
|
---|
2361 | title find and boot Mandriva with menu.lst already installed
|
---|
2362 | find --set-root /etc/mandriva-release
|
---|
2363 | savedefault --wait=2
|
---|
2364 | configfile /boot/grub/menu.lst
|
---|
2365 |
|
---|
2366 | title back to dos
|
---|
2367 | savedefault --wait=2
|
---|
2368 | quit
|
---|
2369 |
|
---|
2370 | title commandline
|
---|
2371 | savedefault --wait=2
|
---|
2372 | commandline
|
---|
2373 |
|
---|
2374 | title reboot
|
---|
2375 | savedefault --wait=2
|
---|
2376 | reboot
|
---|
2377 |
|
---|
2378 | title halt
|
---|
2379 | savedefault --wait=2
|
---|
2380 | halt
|
---|
2381 | #--------------------end menu.lst---------------------------------------
|
---|
2382 |
|
---|
2383 | Note 1: The file DEFAULT must exist and have a proper format as stated above.
|
---|
2384 | Or else, the default/savedefault commands won't function well.
|
---|
2385 |
|
---|
2386 | Note 2: The file DEFAULT which is in the same dir as a certain MENU.LST file
|
---|
2387 | is called associated with the MENU.LST file.
|
---|
2388 |
|
---|
2389 | Note 3: The associated DEFAULT file will take effect automatically if there
|
---|
2390 | are no `default' commands present.
|
---|
2391 |
|
---|
2392 | Note 4: Just before a menu file gains control(e.g., it is the associated
|
---|
2393 | MENU.LST of a GRLDR file, or it was specified via
|
---|
2394 | `grub.exe --config-file=(DEVICE)/PATH/YOUR_MENU_FILE', or it was
|
---|
2395 | specified by the `configfile' command of grub), its associated
|
---|
2396 | DEFAULT file will be used if present, until an explicit `default'
|
---|
2397 | command is encountered.
|
---|
2398 |
|
---|
2399 | ******************************************************************************
|
---|
2400 | *** The New `cdrom' Command Syntax ***
|
---|
2401 | ******************************************************************************
|
---|
2402 |
|
---|
2403 | 1. Initialize the ATAPI CDROM devices:
|
---|
2404 |
|
---|
2405 | grub> cdrom --init
|
---|
2406 |
|
---|
2407 | This will display the number of atapi cdroms found: atapi_dev_count
|
---|
2408 |
|
---|
2409 | 2. Stop the ATAPI CDROM devices:
|
---|
2410 |
|
---|
2411 | grub> cdrom --stop
|
---|
2412 |
|
---|
2413 | This will set atapi_dev_count to 0.
|
---|
2414 |
|
---|
2415 | 3. Add IO ports for searching the atapi cdrom devices. For example:
|
---|
2416 |
|
---|
2417 | grub> cdrom --add-io-ports=0x03F601F0
|
---|
2418 |
|
---|
2419 | After running `cdrom --init' and `map --hook', the cdroms can be accessed
|
---|
2420 | through devices (cd0), (cd1), ...
|
---|
2421 |
|
---|
2422 | Note 1: If the system does not fully support the ATAPI CD-ROM specifications,
|
---|
2423 | you will encounter failure when trying to access the (cdX) devices.
|
---|
2424 |
|
---|
2425 | Note 2: After doing a `cdrom --stop', you should do a `map --unhook'. Of
|
---|
2426 | course you may `map --hook' again if there are mapped drives.
|
---|
2427 |
|
---|
2428 | Note 3: After adding IO ports, you should do a `map --unhook' followed by a
|
---|
2429 | `cdrom --init' and then followed by a `map --hook'.
|
---|
2430 |
|
---|
2431 | By default, these ports are used for searching cdroms(so they needn't
|
---|
2432 | be added):
|
---|
2433 |
|
---|
2434 | 0x03F601F0, 0x03760170, 0x02F600F0,
|
---|
2435 | 0x03860180, 0x6F006B00, 0x77007300.
|
---|
2436 |
|
---|
2437 | Note 4: The BIOS might have offered a cdrom interface. It would be (cd). After
|
---|
2438 | `cdrom --init' and `map --hook', we might have our (cd0), (cd1), ...
|
---|
2439 | available. It is likely that one of them could access the same media
|
---|
2440 | as the BIOS-offered (cd).
|
---|
2441 |
|
---|
2442 | Note 5: You may access the (cd) and (cdX)'es in the blocklist way. Example:
|
---|
2443 |
|
---|
2444 | cat --hex (cd0)16+2
|
---|
2445 |
|
---|
2446 | The cdrom sectors are big sectors with a size of 2048 bytes.
|
---|
2447 |
|
---|
2448 | Note 6: The iso9660 filesystem driver has Rock-Ridge extension support, but
|
---|
2449 | has no Joliet extension support. So you may encounter failure when
|
---|
2450 | you attempt to read files on a Joliet CD.
|
---|
2451 |
|
---|
2452 | Note 7: The (cd) or (cdX)'es can be booted now. Examples:
|
---|
2453 |
|
---|
2454 | chainloader (cd)
|
---|
2455 | boot
|
---|
2456 |
|
---|
2457 | chainloader (cd0)
|
---|
2458 | boot
|
---|
2459 |
|
---|
2460 | chainloader (cd1)
|
---|
2461 | boot
|
---|
2462 |
|
---|
2463 | You should already have access to the CD sectors before you can
|
---|
2464 | chainload it.
|
---|
2465 |
|
---|
2466 | ******************************************************************************
|
---|
2467 | *** About the New `setvbe' Command ***
|
---|
2468 | ******************************************************************************
|
---|
2469 |
|
---|
2470 | Gerardo Richarte contributed the `setvbe' code and the following comment:
|
---|
2471 |
|
---|
2472 | New command is `setvbe', and can be used to change the video mode
|
---|
2473 | before executing the kernel.
|
---|
2474 |
|
---|
2475 | For example, you can do
|
---|
2476 |
|
---|
2477 | setvbe 1024x768x32
|
---|
2478 |
|
---|
2479 | this will scan the list of available modes and set it, and
|
---|
2480 | automatically append a `video=' option to each subsequent kernel
|
---|
2481 | command-line. The appended `video=' option is like this:
|
---|
2482 |
|
---|
2483 | video=1024x768x32@0xf0000000,4096
|
---|
2484 |
|
---|
2485 | where 0xf0000000 is the video framebuffer address as reported by vbe,
|
---|
2486 | and 4096 is the size of a scanline in bytes (also as reported by vbe).
|
---|
2487 |
|
---|
2488 | This is really useful if you want to give some graphics support to your
|
---|
2489 | OS, but you don't want to implement any video functionality other than
|
---|
2490 | writing a pixel to video memory.
|
---|
2491 |
|
---|
2492 |
|
---|
2493 | ******************************************************************************
|
---|
2494 | *** About the DOS utility `hmload' ***
|
---|
2495 | ******************************************************************************
|
---|
2496 |
|
---|
2497 | This program was written by John Cobb (Queen Mary, University of London).
|
---|
2498 |
|
---|
2499 | John Cobb's note:
|
---|
2500 |
|
---|
2501 | To make use of the ram drive feature I wrote a program `hmload' to load
|
---|
2502 | an arbitrary file to an arbitrary address in high memory. The program
|
---|
2503 | is not very sophisticated and relies on XMS to turn on the A20 line.
|
---|
2504 | (Also one must be very careful to steer clear of any areas of memory
|
---|
2505 | already in use).
|
---|
2506 |
|
---|
2507 | Under Linux we generated a disk image `dskimg' (with the kernel and
|
---|
2508 | Initrd and a partition table).
|
---|
2509 |
|
---|
2510 | Using this our boot procedure looked something like this:
|
---|
2511 |
|
---|
2512 | hmload -fdskimg -a128
|
---|
2513 | fixrb
|
---|
2514 | <unload network drivers>
|
---|
2515 | grub
|
---|
2516 |
|
---|
2517 | map --ram-drive=0x81
|
---|
2518 | map --rd-base=0x8000000
|
---|
2519 | map --rd-size=0x400000
|
---|
2520 | root (rd,0)
|
---|
2521 | kernel /kernel root=/dev/ram0 rw ip=bootp ramdisk_size=32768 ...
|
---|
2522 | initrd /initrd
|
---|
2523 | boot
|
---|
2524 |
|
---|
2525 | See http://sysdocs.stu.qmul.ac.uk/sysdocs/Comment/GrubForDOS/ for details.
|
---|
2526 |
|
---|
2527 | Update 2007-12-05:
|
---|
2528 |
|
---|
2529 | Now the MAP command can handle gzipped (rd) image. One can use this
|
---|
2530 | feature with the hmload utility. For example,
|
---|
2531 |
|
---|
2532 | step 1. Load the gzipped image under DOS at a relatively low address:
|
---|
2533 |
|
---|
2534 | hmload -fdskimg.gz -a16
|
---|
2535 |
|
---|
2536 | step 2. Unload network drivers.
|
---|
2537 |
|
---|
2538 | step 3. Run GRUB.EXE.
|
---|
2539 |
|
---|
2540 | step 4. At the grub prompt, run these commands:
|
---|
2541 |
|
---|
2542 | map --rd-base=0x1000000 # set rd-base address to be 16M
|
---|
2543 | map --rd-size=<the accurate size of dskimg.gz in bytes>
|
---|
2544 | map (rd)+1 (hd0) # This will decompress (rd) and place
|
---|
2545 | # the decompressed image at the top end
|
---|
2546 | # of the extended memory. The (rd)+1
|
---|
2547 | # here has special meaning and stands
|
---|
2548 | # for the whole (rd) device. You must
|
---|
2549 | # use (rd)+1 instead of (rd).
|
---|
2550 | map --hook
|
---|
2551 | root (hd0,0)
|
---|
2552 | kernel /kernel root=/dev/ram0 rw ip=bootp ramdisk_size=32768 ...
|
---|
2553 | initrd /initrd
|
---|
2554 | map --unhook
|
---|
2555 | map (hd0) (hd0) # Delete the map; this is needed.
|
---|
2556 | boot
|
---|
2557 |
|
---|
2558 |
|
---|
2559 | ******************************************************************************
|
---|
2560 | *** Notes on the use of stack ***
|
---|
2561 | ******************************************************************************
|
---|
2562 |
|
---|
2563 | The protected-mode and real-mode stack are merged at physical address 0x2000.
|
---|
2564 |
|
---|
2565 | All functions should use at most 2K stack space(0x1800-0x2000). So each
|
---|
2566 | subfunction should use as little stack as possible to avoid stack-overflow.
|
---|
2567 |
|
---|
2568 | Don't use recursive functions because they could expend too much stack space.
|
---|
2569 |
|
---|
2570 | The original protected mode stack at 0x68000(expand-down) is free now and can
|
---|
2571 | be reused for any purposes.
|
---|
2572 |
|
---|
2573 |
|
---|
2574 | ******************************************************************************
|
---|
2575 | *** A bug was found in the CDROM driver ***
|
---|
2576 | ******************************************************************************
|
---|
2577 |
|
---|
2578 | It seems the cdrom must be connected as the master device of an IDE controller.
|
---|
2579 |
|
---|
2580 | If cdrom is slave, the driver will fail to read the cdrom sectors. Hope someone
|
---|
2581 |
|
---|
2582 | could fix this problem.
|
---|
2583 |
|
---|
2584 |
|
---|
2585 | ******************************************************************************
|
---|
2586 | *** BIOS and the (cd) drive ***
|
---|
2587 | ******************************************************************************
|
---|
2588 |
|
---|
2589 | When BIOS boots a no-emulation-mode bootable CD-ROM, it allocates a BIOS drive
|
---|
2590 | number to the CD. If the boot image of the CD-ROM is grldr or stage2_eltorito,
|
---|
2591 | then GRUB can access the CD-ROM media through the drive number allocated by
|
---|
2592 | BIOS. The device name of the CD-ROM is (cd).
|
---|
2593 |
|
---|
2594 | BIOS can allocate a BIOS drive number to a no-emulation-mode CDROM even when
|
---|
2595 | the CDROM is not bootable. QEMU has done so. At boot time, GRUB4DOS will
|
---|
2596 | search drives 0x80-0xFF for a possible no-emulation-mode CDROM drive allocated
|
---|
2597 | by BIOS. So if BIOS offered a CDROM interface of int13 EBIOS functions 41h-4Eh,
|
---|
2598 | then the (cd) device will be automatically available in GRUB4DOS.
|
---|
2599 |
|
---|
2600 |
|
---|
2601 | ******************************************************************************
|
---|
2602 | *** The way of disk emulation changed greatly ***
|
---|
2603 | ******************************************************************************
|
---|
2604 |
|
---|
2605 | The way of disk emulation has changed greatly since 0.4.2 final. Please don't
|
---|
2606 | mix newer versions with older versions when disk emulation features are used.
|
---|
2607 |
|
---|
2608 | The newer versions won't automatically unhook emulations established in a
|
---|
2609 | previous grub4dos environment. The GRUB.EXE of an older version will
|
---|
2610 | automatically dismiss emulations established earlier, before transferring
|
---|
2611 | control to the main grub program(i.e., pre_stage2).
|
---|
2612 |
|
---|
2613 |
|
---|
2614 | ******************************************************************************
|
---|
2615 | *** FreeDOS EMM386 v2.26 (2006-08-27) VCPI problem ***
|
---|
2616 | ******************************************************************************
|
---|
2617 |
|
---|
2618 | The VCPI function "AX=DE0Ch - Switch From Protected Mode to V86 Mode" of
|
---|
2619 | FreeDOS EMM386 v2.26 was not implemented properly(it always hangs). As an
|
---|
2620 | alternative, you can use Microsoft's EMM386 instead.
|
---|
2621 |
|
---|
2622 | Even while emm386 is running, grub.exe can be started. But if you try to quit
|
---|
2623 | to DOS from grub4dos by using the `quit' command, the VCPI function DE0C will
|
---|
2624 | be called. If EMM386 is of Microsoft, everything goes ok. If EMM386 is of
|
---|
2625 | FreeDOS, the machine will hang.
|
---|
2626 |
|
---|
2627 |
|
---|
2628 | ******************************************************************************
|
---|
2629 | *** New options for map were added ***
|
---|
2630 | ******************************************************************************
|
---|
2631 |
|
---|
2632 | Along with 0.4.2 final, there are two new options for the map command. They
|
---|
2633 | are --safe-mbr-hook=SMH and --int13-scheme=SCH. Both are related with disk
|
---|
2634 | emulation for use(as smoothly as possible) in the Win9x environment.
|
---|
2635 |
|
---|
2636 | SMH can take either of the two values 0 and 1. By default, SMH is 1. If you
|
---|
2637 | encountered problems of disk emulation under Win9x, you may insert a line of
|
---|
2638 |
|
---|
2639 | map --safe-mbr-hook=0
|
---|
2640 |
|
---|
2641 | before the `boot' command and try again.
|
---|
2642 |
|
---|
2643 | Also SCH may take either 0 or 1 at present. By default, SCH is 1. If you
|
---|
2644 | encountered disk emulation problems under Win9x, you may insert a line of
|
---|
2645 |
|
---|
2646 | map --int13-scheme=0
|
---|
2647 |
|
---|
2648 | before the `boot' command and try again.
|
---|
2649 |
|
---|
2650 | Note by the way. Like --safe-mbr-hook and --int13-scheme, the MAP command has
|
---|
2651 | a few other options that are used for setting global variables. They are here:
|
---|
2652 |
|
---|
2653 | map --floppies=M
|
---|
2654 |
|
---|
2655 | M can be 0, 1, or 2. MAP will set a proper value at 0040:0010 by using M.
|
---|
2656 |
|
---|
2657 | map --harddrives=N
|
---|
2658 |
|
---|
2659 | N can be between 0 and 127(inclusive). MAP will set 0040:0075 to N.
|
---|
2660 |
|
---|
2661 | map --memdisk-raw=RAW
|
---|
2662 |
|
---|
2663 | RAW default to 1. If RAW=0, `int15/ah=87h' will be used to access memdrives.
|
---|
2664 |
|
---|
2665 | map --ram-drive=RD
|
---|
2666 |
|
---|
2667 | RD default to 0x7F which is a floppy. If the RAM DRIVE is a hard drive image
|
---|
2668 | (with partition table in the first sector), you should set RD >= 0x80 and RD
|
---|
2669 | < 0xA0.If the RAM DRIVE is a cdrom image, you should set 0xA0<= RD <= 0xff.
|
---|
2670 |
|
---|
2671 | map --rd-base=ADDR
|
---|
2672 |
|
---|
2673 | map --rd-size=SIZE
|
---|
2674 |
|
---|
2675 | ADDR specifies the physical base address of the ramdisk image. SIZE specifies
|
---|
2676 | the size in bytes of the ramdisk image. ADDR default to 0. SIZE is also default
|
---|
2677 | to 0, but a size of 0 means 4GB, not a zero-long disk. The RAM DRIVE can be
|
---|
2678 | accessed in the GRUB environment using the (rd) device.
|
---|
2679 |
|
---|
2680 |
|
---|
2681 | ******************************************************************************
|
---|
2682 | *** About the new map option --in-situ ***
|
---|
2683 | ******************************************************************************
|
---|
2684 |
|
---|
2685 | --in-situ is used with hard drive images or hardrive partitions. With an
|
---|
2686 | in-situ map, we can typically use a logical partition as a primary partition.
|
---|
2687 |
|
---|
2688 | In-situ map is a whole drive map. It only virtualize the partition table and
|
---|
2689 | the number of hidden sectors in the BPB of the DOS Boot Record.
|
---|
2690 |
|
---|
2691 | While disk emulation may encounter various problems with win9x, the in-situ map
|
---|
2692 | works fine with win9x.
|
---|
2693 |
|
---|
2694 | Note that --in-situ will not change the real partition table.
|
---|
2695 |
|
---|
2696 | Example:
|
---|
2697 |
|
---|
2698 | map --in-situ (hd0,4)+1 (hd0)
|
---|
2699 |
|
---|
2700 |
|
---|
2701 | ******************************************************************************
|
---|
2702 | *** The PARTNEW Command Syntax ***
|
---|
2703 | ******************************************************************************
|
---|
2704 |
|
---|
2705 | Besides the mappings in the above section, you may instead choose to create a
|
---|
2706 | new primary partition with the PARTNEW command. PARTNEW can generate a primary
|
---|
2707 | partition entry (in the partition table) for a logical partition.
|
---|
2708 |
|
---|
2709 | For example,
|
---|
2710 |
|
---|
2711 | partnew (hd0,3) 0x07 (hd0,4)+1
|
---|
2712 |
|
---|
2713 | where the file (hd0,4)+1 stands for the whole partition (hd0,4). This command
|
---|
2714 | will create a new primary partition (hd0,3) whose type is 0x07 and whose
|
---|
2715 | contents/data is the same as that of the logical partition (hd0,4).
|
---|
2716 |
|
---|
2717 | Just like a whole logical partition, a contiguous partition image file can
|
---|
2718 | also be used with PARTNEW:
|
---|
2719 |
|
---|
2720 | partnew (hd0,3) 0x00 (hd0,0)/my_partition.img
|
---|
2721 |
|
---|
2722 | The type 0x00 indicates a type-auto-detection of the image MY_PARTITION.IMG.
|
---|
2723 | The above command will create a new primary partition (hd0,3) with a proper
|
---|
2724 | type and with contents/data being exactly that of the contiguous file
|
---|
2725 | (hd0,0)/my_partition.img.
|
---|
2726 |
|
---|
2727 | PARTNEW will automatically correct the "hidden sectors" in the BPB and the
|
---|
2728 | modification will be permanent. And PARTNEW modifies the partition table
|
---|
2729 | permanently.
|
---|
2730 |
|
---|
2731 | In addition to creating new partition entries, PARTNEW can also be used to
|
---|
2732 | delete(erase, or wipe) a primary partition entry. For example,
|
---|
2733 |
|
---|
2734 | partnew (hd0,3) 0 0 0
|
---|
2735 |
|
---|
2736 | which will empty the last entry in the partition table in MBR. Generally,
|
---|
2737 | you should use the form of "partnew PARTITION 0 0 0" to erase the entry.
|
---|
2738 | Note that only the entry would be erased, and the data stored in the partition
|
---|
2739 | will not be touched.
|
---|
2740 |
|
---|
2741 | ******************************************************************************
|
---|
2742 | *** Newly implemented operators `&&' and `||' ***
|
---|
2743 | ******************************************************************************
|
---|
2744 |
|
---|
2745 | This implementation is very simple. It does not handle operator nesting.
|
---|
2746 |
|
---|
2747 | Usage of `&&':
|
---|
2748 |
|
---|
2749 | command1 && command2
|
---|
2750 |
|
---|
2751 | Description:
|
---|
2752 |
|
---|
2753 | If command1 returns true, then command2 will be executed.
|
---|
2754 |
|
---|
2755 | Usage of `||':
|
---|
2756 |
|
---|
2757 | command1 || command2
|
---|
2758 |
|
---|
2759 | Description:
|
---|
2760 |
|
---|
2761 | If command1 returns false, then command2 will be executed.
|
---|
2762 |
|
---|
2763 | Examples:
|
---|
2764 |
|
---|
2765 | is64bit && default 0
|
---|
2766 | is64bit || default 1
|
---|
2767 |
|
---|
2768 | 2010-11-04
|
---|
2769 | Add new operators "|", ">" , ">>"
|
---|
2770 | Usage:
|
---|
2771 | command1 | command2
|
---|
2772 |
|
---|
2773 | command > file
|
---|
2774 | or
|
---|
2775 | command >> file
|
---|
2776 |
|
---|
2777 | Node: The file must already exist, GRUB4DOS can not create file or change the file size.
|
---|
2778 | Examples:
|
---|
2779 | cat /test.txt > /abcd.txt
|
---|
2780 |
|
---|
2781 |
|
---|
2782 | ******************************************************************************
|
---|
2783 | *** Three new commands is64bit, errnum and errorcheck ***
|
---|
2784 | ******************************************************************************
|
---|
2785 |
|
---|
2786 | is64bit and errnum retrieve the value of is64bit and errnum respectively.
|
---|
2787 |
|
---|
2788 | errorcheck controls whether or not the error will be handled. By default,
|
---|
2789 | errorcheck is on, and menu script execution will stop on error. If errorcheck
|
---|
2790 | is off, the script will continue to execute upto a boot command. A boot command
|
---|
2791 | will turn the errorcheck on.
|
---|
2792 |
|
---|
2793 |
|
---|
2794 | ******************************************************************************
|
---|
2795 | *** Use numeric keys to select a menu entry ***
|
---|
2796 | ******************************************************************************
|
---|
2797 |
|
---|
2798 | If, for example, you intend to goto entry #25, you may press 2 followed by 5.
|
---|
2799 |
|
---|
2800 |
|
---|
2801 | ******************************************************************************
|
---|
2802 | *** Use the INSERT key to debug step by step at startup ***
|
---|
2803 | ******************************************************************************
|
---|
2804 |
|
---|
2805 | Some buggy machines could fail to enter grub4dos environment. They might hang
|
---|
2806 | or reboot unexpectedly. Press INSERT as quickly as possible on startup, and
|
---|
2807 | you can get a chance to single-step the boot process and see how far it can
|
---|
2808 | go, and then report bugs.
|
---|
2809 |
|
---|
2810 |
|
---|
2811 | ******************************************************************************
|
---|
2812 | *** The debug command syntax has been changed ***
|
---|
2813 | ******************************************************************************
|
---|
2814 |
|
---|
2815 | The DEBUG command now can be used to control the verbosity of command output:
|
---|
2816 |
|
---|
2817 | debug [ on | off | normal | status | INTEGER ]
|
---|
2818 |
|
---|
2819 | 0 or off for silent
|
---|
2820 | 1 or normal for normal
|
---|
2821 | 2 to 0x7FFFFFFF or on for verbose
|
---|
2822 |
|
---|
2823 |
|
---|
2824 | ******************************************************************************
|
---|
2825 | *** GRUB4DOS and Windows Vista ***
|
---|
2826 | ******************************************************************************
|
---|
2827 |
|
---|
2828 | First, use the following command to create a boot entry:
|
---|
2829 |
|
---|
2830 | bcdedit /create /d "GRUB for DOS" /application bootsector
|
---|
2831 |
|
---|
2832 | The result will look like this:
|
---|
2833 |
|
---|
2834 | The entry {05d33150-3fde-11dc-a457-00021cf82fb0} was successfully created.
|
---|
2835 |
|
---|
2836 | The long string {05d33150-3fde-11dc-a457-00021cf82fb0} is the id for this
|
---|
2837 | entry.
|
---|
2838 |
|
---|
2839 | Then, use the following commands to set boot parameters:
|
---|
2840 |
|
---|
2841 | bcdedit /set {id} device boot
|
---|
2842 | bcdedit /set {id} path \grldr.mbr
|
---|
2843 | bcdedit /displayorder {id} /addlast
|
---|
2844 |
|
---|
2845 | Please replace {id} with the actual id returned from the previous command.
|
---|
2846 |
|
---|
2847 | Finally, copy GRLDR.MBR to C:\ or wherever your boot drive is, and copy GRLDR
|
---|
2848 | and menu.lst to the root directory of any FAT16/FAT32/EXT2/NTFS partition.
|
---|
2849 |
|
---|
2850 | Note: A boot partition should be the active primary partition with BOOTMGR
|
---|
2851 | inside. The `device boot' indicates grldr.mbr should be in the boot
|
---|
2852 | partition.
|
---|
2853 |
|
---|
2854 | Lianjiang has written down a script to automate the tasks:
|
---|
2855 |
|
---|
2856 | @echo off
|
---|
2857 | rem by lianjiang
|
---|
2858 | cls
|
---|
2859 | echo.
|
---|
2860 | echo Please run as administrator
|
---|
2861 | echo.
|
---|
2862 | pause
|
---|
2863 | set gname=GRUB for DOS
|
---|
2864 | set vid=
|
---|
2865 | set timeout=5
|
---|
2866 | bcdedit >bcdtemp.txt
|
---|
2867 | type bcdtemp.txt | find "\grldr.mbr" >nul && echo. && echo BCD entry existing, no need to install. && pause && goto exit
|
---|
2868 | bcdedit /export "Bcd_Backup" >nul
|
---|
2869 | bcdedit /create /d "%gname%" /application bootsector >vid.ini
|
---|
2870 | for,/f,"tokens=2 delims={",%%i,In (vid.ini) Do (
|
---|
2871 | set vida=%%i
|
---|
2872 | )
|
---|
2873 | for,/f,"tokens=1 delims=}",%%i,In ("%vida%") Do (
|
---|
2874 | set vid={%%i}
|
---|
2875 | )
|
---|
2876 | echo %vid%>vid.ini
|
---|
2877 | bcdedit /set %vid% device boot >nul
|
---|
2878 | bcdedit /set %vid% path \grldr.mbr >nul
|
---|
2879 | bcdedit /displayorder %vid% /addlast >nul
|
---|
2880 | bcdedit /timeout %timeout% >nul
|
---|
2881 | if exist grldr.mbr copy grldr.mbr %systemdrive%\ /y && goto exit
|
---|
2882 | echo.
|
---|
2883 | echo Please copy grldr.mbr to %systemdrive%\
|
---|
2884 | echo.
|
---|
2885 | pause
|
---|
2886 | :exit
|
---|
2887 | del bcdtemp.txt >nul
|
---|
2888 | -------------------------------------------------------------------
|
---|
2889 | Update: Fujianabc pointed out that
|
---|
2890 |
|
---|
2891 | bcdedit /set %vid% device boot >nul
|
---|
2892 |
|
---|
2893 | should be changed to
|
---|
2894 |
|
---|
2895 | bcdedit /set %vid% device partition=%SystemDrive% >nul
|
---|
2896 | -------------------------------------------------------------------
|
---|
2897 |
|
---|
2898 | You still need to copy grldr yourself.
|
---|
2899 |
|
---|
2900 | Notice: It's possible to modify the BCD entry from a different OS, you just
|
---|
2901 | need to specify the location of BCD:
|
---|
2902 |
|
---|
2903 | bcdedit /store D:\boot\BCD ...
|
---|
2904 |
|
---|
2905 | Notice: These commands need elevated privileges, they should be used inside
|
---|
2906 | cmd.exe which is started with "Run as administrator".
|
---|
2907 |
|
---|
2908 | Notice: People has reported that some version of Vista doesn't support
|
---|
2909 | creating file in C:\ with no extension, even with administrator privileges.
|
---|
2910 | This means grldr can't be placed in C:\. You can solve this by either copy
|
---|
2911 | grldr to another partition, or rename grldr to something like grub.bin. Please
|
---|
2912 | see the following section on how to do this.
|
---|
2913 |
|
---|
2914 |
|
---|
2915 | ******************************************************************************
|
---|
2916 | *** How to rename grldr ***
|
---|
2917 | ******************************************************************************
|
---|
2918 |
|
---|
2919 | grldr and grldr.mbr use internal boot file name to decide which file to load,
|
---|
2920 | so if you want to change the name, you must also change the embeded setting.
|
---|
2921 | You can do this with the help of grubinst, which can be downloaded at:
|
---|
2922 |
|
---|
2923 | http://download.gna.org/grubutil/
|
---|
2924 |
|
---|
2925 | grubinst can generate customized grldr.mbr:
|
---|
2926 |
|
---|
2927 | grubinst -o -b=mygrldr C:\mygrldr.mbr
|
---|
2928 |
|
---|
2929 | grubinst can also edit existing grldr/grldr.mbr:
|
---|
2930 |
|
---|
2931 | grubinst -e -b=mygrldr C:\mygrldr
|
---|
2932 |
|
---|
2933 | grubinst -e -b=mygrldr C:\mygrldr.mbr
|
---|
2934 |
|
---|
2935 | In this case, you must use a grubinst that is compatible with the version of
|
---|
2936 | grub4dos, otherwise the edit will fail.
|
---|
2937 |
|
---|
2938 | So, in order to load mygrldr instead of grldr, you can use one of the
|
---|
2939 | following methods:
|
---|
2940 |
|
---|
2941 | 1. Use customized grldr.mbr to load mygrldr. In this case, you need to change
|
---|
2942 | the embeded boot file name in grldr.mbr. The name of grldr.mbr can be changed
|
---|
2943 | at will.
|
---|
2944 |
|
---|
2945 | 2. Use mygrldr directly. In this case, you need to change the embeded boot
|
---|
2946 | file name in mygrldr to match its new name.
|
---|
2947 |
|
---|
2948 | Notice: The boot file name must conform to the 8.3 naming convention.
|
---|
2949 |
|
---|
2950 |
|
---|
2951 | ******************************************************************************
|
---|
2952 | *** PXE device ***
|
---|
2953 | ******************************************************************************
|
---|
2954 |
|
---|
2955 | If PXE service is found at startup, GRUB4DOS will create a virtual device
|
---|
2956 | (pd), through which files from the tftp server can be accessed. You can setup
|
---|
2957 | a diskless boot environment using the following steps:
|
---|
2958 |
|
---|
2959 | Client side
|
---|
2960 |
|
---|
2961 | You need to boot from PXE ROM.
|
---|
2962 |
|
---|
2963 | Server side
|
---|
2964 |
|
---|
2965 | You need to configure a dhcp server and a tftp server. In the dhcp server, use
|
---|
2966 | grldr as boot file.
|
---|
2967 |
|
---|
2968 | You may also want to load a different menu.lst for different client. GRUB4DOS
|
---|
2969 | will scan the following location for configuration file:
|
---|
2970 |
|
---|
2971 | [/mybootdir]/menu.lst
|
---|
2972 | [/mybootdir]/menu.lst/01-88-99-AA-BB-CC-DD
|
---|
2973 | [/mybootdir]/menu.lst/C000025B
|
---|
2974 | [/mybootdir]/menu.lst/C000025
|
---|
2975 | [/mybootdir]/menu.lst/C00002
|
---|
2976 | [/mybootdir]/menu.lst/C0000
|
---|
2977 | [/mybootdir]/menu.lst/C000
|
---|
2978 | [/mybootdir]/menu.lst/C00
|
---|
2979 | [/mybootdir]/menu.lst/C0
|
---|
2980 | [/mybootdir]/menu.lst/C
|
---|
2981 | [/mybootdir]/menu.lst/default
|
---|
2982 |
|
---|
2983 | Here, we assume the network card mac for the client machine is
|
---|
2984 | 88:99:AA:BB:CC:DD, and the ip address is 192.0.2.91 (C000025B). /mybootdir is
|
---|
2985 | the directory of the boot file, for example, if boot file is /tftp/grldr, then
|
---|
2986 | mybootdir=tftp.
|
---|
2987 |
|
---|
2988 | If none of the above files is present, grldr will use its embeded menu.lst.
|
---|
2989 |
|
---|
2990 | This is a menu.lst to illustrate how to use files from the tftp server.
|
---|
2991 |
|
---|
2992 | title Create ramdisk using map
|
---|
2993 | map --mem (pd)/floppy.img (fd0)
|
---|
2994 | map --hook
|
---|
2995 | rootnoverify (fd0)
|
---|
2996 | chainloader (fd0)+1
|
---|
2997 |
|
---|
2998 | title Create ramdisk using memdisk
|
---|
2999 | kernel (pd)/memdisk
|
---|
3000 | initrd (pd)/floppy.img
|
---|
3001 |
|
---|
3002 | You can see that the menu.lst is very similar to normal disk boot, you just
|
---|
3003 | need to replace device like (hd0,0) with (pd).
|
---|
3004 |
|
---|
3005 | There are some differences between disk device and pxe device:
|
---|
3006 |
|
---|
3007 | 1. You can't list files in the pxe device.
|
---|
3008 |
|
---|
3009 | 2. The blocklist command will not work with a file in the pxe device.
|
---|
3010 |
|
---|
3011 | 3. You must use --mem option if you want to map a file in the pxe device.
|
---|
3012 |
|
---|
3013 | When you use chainloader to load file from the pxe device, there is a option
|
---|
3014 | you can use:
|
---|
3015 |
|
---|
3016 | chainloader --raw (pd)/BOOT_FILE
|
---|
3017 |
|
---|
3018 | Option --raw works just like --force, but it load file in one go. This can
|
---|
3019 | improve performance in some situation.
|
---|
3020 |
|
---|
3021 | You can use the pxe command to control the pxe device.
|
---|
3022 |
|
---|
3023 | 1. pxe
|
---|
3024 |
|
---|
3025 | If used without any parameter, pxe command will display current
|
---|
3026 | settings.
|
---|
3027 |
|
---|
3028 | 2. pxe blksize N
|
---|
3029 |
|
---|
3030 | Set the packet size for tftp transmission. Minimum value is 512,
|
---|
3031 | maximum value is 1432. This parameter is used primarily for very old
|
---|
3032 | tftp server where packet larger than 512 byte is not supported.
|
---|
3033 |
|
---|
3034 | 3. pxe basedir /dir
|
---|
3035 |
|
---|
3036 | Set the base directory for files in the tftp server. If
|
---|
3037 |
|
---|
3038 | pxe basedir /tftp
|
---|
3039 |
|
---|
3040 | then all files in the pxe device is related to directory /tftp, for
|
---|
3041 | example, (pd)/aa.img correspond to /tftp/aa.img in the server.
|
---|
3042 |
|
---|
3043 | The default value of base directory is the directory of the boot file,
|
---|
3044 | for example, if boot file is /tftp/grldr, then default base directory
|
---|
3045 | is /tftp.
|
---|
3046 |
|
---|
3047 | 4. pxe keep
|
---|
3048 |
|
---|
3049 | Keep the PXE stack. The default behaviour of GRUB4DOS is to unload
|
---|
3050 | the PXE stack just before it exits.
|
---|
3051 |
|
---|
3052 | 5. pxe unload
|
---|
3053 |
|
---|
3054 | Unload the PXE stack immediately.
|
---|
3055 |
|
---|
3056 |
|
---|
3057 |
|
---|
3058 | ******************************************************************************
|
---|
3059 | *** New Feature of Relative Path Support ***
|
---|
3060 | ******************************************************************************
|
---|
3061 |
|
---|
3062 | Use the `root' or `rootnoverify' command to specify the `working directory'.
|
---|
3063 |
|
---|
3064 | For example:
|
---|
3065 |
|
---|
3066 | root (hd0,0)/boot/grub
|
---|
3067 |
|
---|
3068 | This specifies that the working dir is (hd0,0)/boot/grub. So all subsequent
|
---|
3069 | filenames of the form "/..." will actually refer to (hd0,0)/boot/grub/...
|
---|
3070 |
|
---|
3071 | That is to say:
|
---|
3072 |
|
---|
3073 | cat /menu.lst
|
---|
3074 |
|
---|
3075 | will be equivalent to
|
---|
3076 |
|
---|
3077 | cat (hd0,0)/boot/grub/menu.lst
|
---|
3078 |
|
---|
3079 |
|
---|
3080 |
|
---|
3081 | ******************************************************************************
|
---|
3082 | *** Notation For The Current Root Device ***
|
---|
3083 | ******************************************************************************
|
---|
3084 |
|
---|
3085 |
|
---|
3086 | The notation `()' can be used to access the current root device. You may use
|
---|
3087 | `find --set-root ...' to set the current root device, but the find command
|
---|
3088 | does not set the `working dir' of the root device. In this case you should
|
---|
3089 | use `()' to set the working dir after the find command:
|
---|
3090 |
|
---|
3091 | root ()/boot/grub
|
---|
3092 |
|
---|
3093 | Update 2008-05-01:
|
---|
3094 |
|
---|
3095 | FIND can also set the `working directory' now. For example:
|
---|
3096 |
|
---|
3097 | find --set-root=/tmp /boot/grub/menu.lst
|
---|
3098 |
|
---|
3099 | It is equivalent to this pair of commands:
|
---|
3100 |
|
---|
3101 | find --set-root /boot/grub/menu.lst
|
---|
3102 | root ()/tmp
|
---|
3103 |
|
---|
3104 |
|
---|
3105 | ******************************************************************************
|
---|
3106 | *** The new map option --a20-keep-on ***
|
---|
3107 | ******************************************************************************
|
---|
3108 |
|
---|
3109 |
|
---|
3110 | Along with 0.4.3 final, map has a new option --a20-keep-on which is related to
|
---|
3111 | A20 control after a memdrive sector access. Usage:
|
---|
3112 |
|
---|
3113 | map --a20-keep-on=0
|
---|
3114 |
|
---|
3115 | It should be used before the "map --hook" command.
|
---|
3116 |
|
---|
3117 | By default, A20 will be always on after an RAM INT13 sector access. If
|
---|
3118 | "map --a20-keep-on=0" is used, the A20 status after the INT13 call will be the
|
---|
3119 | same as that before the INT13 call.
|
---|
3120 |
|
---|
3121 |
|
---|
3122 | ******************************************************************************
|
---|
3123 | *** The CDROM emulation (virtualization) ***
|
---|
3124 | ******************************************************************************
|
---|
3125 |
|
---|
3126 | The CDROM emulation is sometimes called ISO emulation. Here is an example:
|
---|
3127 |
|
---|
3128 | map (hd0,0)/myiso.iso (hd32)
|
---|
3129 | map --hook
|
---|
3130 | chainloader (hd32)
|
---|
3131 | boot
|
---|
3132 |
|
---|
3133 | if myiso.iso is not contiguous and you have enough memory, add a --mem option:
|
---|
3134 |
|
---|
3135 | map --mem (hd0,0)/myiso.iso (hd32)
|
---|
3136 | map --hook
|
---|
3137 | chainloader (hd32)
|
---|
3138 | boot
|
---|
3139 |
|
---|
3140 | Note: (hd32) is a grub drive number equivalent to (0xA0). If a virtual drive is
|
---|
3141 | specified with a drive number greater than or equal to 0xA0, then it will be
|
---|
3142 | treated as a cdrom (i.e., with 2048-byte big sectors).
|
---|
3143 |
|
---|
3144 | Like normal disk emulations, the CDROM emulation also (mainly) works with
|
---|
3145 | real-mode OSes. After a protected-mode OS kernel (such as
|
---|
3146 | WinNT/2K/XP/VISTA/LINUX) gains control, the OS would have no ability to access
|
---|
3147 | the virtual CDROM through BIOS int13.
|
---|
3148 |
|
---|
3149 | DOS/Win9x users may google for ELTORITO.SYS and use it in CONFIG.SYS as a
|
---|
3150 | device driver for the virtual cdrom.
|
---|
3151 |
|
---|
3152 | Example usage of eltorito.sys in CONFIG.SYS:
|
---|
3153 |
|
---|
3154 | device=eltorito.sys /D:oemcd001
|
---|
3155 |
|
---|
3156 | Corresponding MSCDEX command which can be placed in AUTOEXEC.BAT:
|
---|
3157 |
|
---|
3158 | MSCDEX /D:oemcd001 /L:D
|
---|
3159 |
|
---|
3160 |
|
---|
3161 | Due to some bugs found in eltorito.sys, the driver could fail to load. If you
|
---|
3162 | encounter such problems, then you may replace (hd32) with (0xFF) for the
|
---|
3163 | virtual cdrom drive number and try again.
|
---|
3164 |
|
---|
3165 |
|
---|
3166 | ******************************************************************************
|
---|
3167 | *** The New Command CHECKRANGE ***
|
---|
3168 | ******************************************************************************
|
---|
3169 |
|
---|
3170 | Checkrange checks whether or not the return value of a command is in the
|
---|
3171 | specified range or ranges.
|
---|
3172 |
|
---|
3173 | Usage: checkrange RANGE COMMAND
|
---|
3174 |
|
---|
3175 | Here are some examples for RANGE:
|
---|
3176 |
|
---|
3177 | 3 is a range containing only the number 3
|
---|
3178 | 3:3 is equivalent to 3
|
---|
3179 | 3:8 is a range containing the numbers 3, 4, 5, 6, 7, 8
|
---|
3180 | 3,4,5,6,7,8 is equivalent to 3:8
|
---|
3181 | 3:5,6:8 is also equivalent to 3:8
|
---|
3182 | 3,4:7,8 is also equivalent to 3:8
|
---|
3183 |
|
---|
3184 | Note: You should not insert spaces into a range.
|
---|
3185 |
|
---|
3186 | Here is an example showing where the checkrange can be used:
|
---|
3187 |
|
---|
3188 | checkrange 0x05,0x0F,0x85 parttype (hd0,1) || hide (hd0,1)
|
---|
3189 |
|
---|
3190 | which means: if (hd0,1) is not an extended partition, then hide it.
|
---|
3191 |
|
---|
3192 |
|
---|
3193 | ******************************************************************************
|
---|
3194 | *** The New Command TPM ***
|
---|
3195 | ******************************************************************************
|
---|
3196 |
|
---|
3197 | The "tpm --init" uses 512-byte data at 0000:7C00 as buffer to initialise TPM.
|
---|
3198 |
|
---|
3199 | Before you boot VISTA's BOOTMGR, you might have to use the "tpm --init"
|
---|
3200 | command on some machines. Normally you want to issue the "tpm --init" command
|
---|
3201 | after a CHAINLOADER command.
|
---|
3202 |
|
---|
3203 |
|
---|
3204 | ******************************************************************************
|
---|
3205 | *** Delimitors or comments between titles ***
|
---|
3206 | ******************************************************************************
|
---|
3207 |
|
---|
3208 | It is possible to use titles as delimitors or comments. A title(or menu item)
|
---|
3209 | is called unbootable if all of its menu commands are not boot-sensitive.
|
---|
3210 |
|
---|
3211 | The following commands are boot-sensitive(and others are not boot-sensitive):
|
---|
3212 |
|
---|
3213 | boot
|
---|
3214 | bootp
|
---|
3215 | chainloader
|
---|
3216 | configfile
|
---|
3217 | embed
|
---|
3218 | commandline
|
---|
3219 | halt
|
---|
3220 | install
|
---|
3221 | kernel
|
---|
3222 | pxe
|
---|
3223 | quit
|
---|
3224 | reboot
|
---|
3225 | setup
|
---|
3226 |
|
---|
3227 | An unbootable title will be skipped when the user presses the Up Arrow or Down
|
---|
3228 | Arrow keys. Even the unbootable menu item can get accessed(and executed) by
|
---|
3229 | using the Left Arrow and/or Right Arrow keys. Examples:
|
---|
3230 |
|
---|
3231 | title This is an UNBOOTABLE entry(so this line is also a comment)
|
---|
3232 | pause --wait=0 This title is a comment. Nothing to do.
|
---|
3233 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3234 | pause --wait=0 of any kind and as many as you would like.
|
---|
3235 | help
|
---|
3236 | help root
|
---|
3237 | help chainloader
|
---|
3238 | help parttype
|
---|
3239 | clear
|
---|
3240 | title ------------------------------------------------------------
|
---|
3241 | pause --wait=0 This title is a delimitor. Nothing to do.
|
---|
3242 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3243 | pause --wait=0 of any kind and as many as you would like.
|
---|
3244 | clear
|
---|
3245 | help
|
---|
3246 | help boot
|
---|
3247 | title ============================================================
|
---|
3248 | pause --wait=0 This title is a delimitor. Nothing to do.
|
---|
3249 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3250 | pause --wait=0 of any kind and as many as you would like.
|
---|
3251 | help
|
---|
3252 | clear
|
---|
3253 | help pause
|
---|
3254 | title ************************************************************
|
---|
3255 | pause --wait=0 This title is a delimitor. Nothing to do.
|
---|
3256 | pause --wait=0 You can use non-boot-sensitive commands here
|
---|
3257 | pause --wait=0 of any kind and as many as you would like.
|
---|
3258 | help kernel
|
---|
3259 | help
|
---|
3260 | clear
|
---|
3261 |
|
---|
3262 | Note: An unbootable menu item must contain at least one command. If there
|
---|
3263 | are no commands for a title, the title will be simply discarded and disappear.
|
---|
3264 |
|
---|
3265 |
|
---|
3266 | ******************************************************************************
|
---|
3267 | *** Bifurcate drives ***
|
---|
3268 | ******************************************************************************
|
---|
3269 |
|
---|
3270 | Some machines apply different actions to a drive between CHS and LBA mode.
|
---|
3271 | When you read sectors using standard BIOS call int13/AH=02h, you might find
|
---|
3272 | out the drive is a floppy. But when you read sectors using extended BIOS
|
---|
3273 | call(EBIOS) int13/AH=42h, you could know the drive is a cdrom. Such a drive
|
---|
3274 | is called bifurcate.
|
---|
3275 |
|
---|
3276 | A bifurcate drive can have two drive numbers: one is the normal BIOS drive
|
---|
3277 | number between 00 and FF in hexa, and this drive uses only CHS mode disk
|
---|
3278 | access(standard BIOS int13/AH=02h); the other is the normal BIOS drive number
|
---|
3279 | (Bitwise) OR'ed by 0x100(i.e., 256 in decimal), and this drive uses only
|
---|
3280 | LBA mode disk access(EBIOS int13/AH=42h). For example, if the drive 0x00
|
---|
3281 | (i.e., the first floppy) is bifurcate, then the drive (0x00) uses CHS mode
|
---|
3282 | to access its sectors, and the drive (0x100) uses LBA (meaning EBIOS) mode
|
---|
3283 | to access its sectors.
|
---|
3284 |
|
---|
3285 | The geometry command can report the disk access mode for bifurcate drives as
|
---|
3286 | BIF instead of the conventional CHS or LBA.
|
---|
3287 |
|
---|
3288 | Known bifurcate drives. Virtual PC and some real machines are found to create
|
---|
3289 | a bifurcate floppy drive when they boot from a floppy-emulation mode bootable
|
---|
3290 | cdrom. The "geometry (fd0)" will show
|
---|
3291 |
|
---|
3292 | drive 0x00(BIF): C/H/S=...Sector Count/Size=.../512
|
---|
3293 |
|
---|
3294 | and "geometry (0x100)" will show
|
---|
3295 |
|
---|
3296 | drive 0x100(BIF): C/H/S=...Sector Count/Size=.../2048
|
---|
3297 |
|
---|
3298 | Actually (0x100) can access the whole cdrom, you may "ls (0x100)/" and find
|
---|
3299 | your files on the cdrom(not the files inside the booted floppy image). Of
|
---|
3300 | course "ls (fd0)/" will list the files inside the booted floppy image.
|
---|
3301 |
|
---|
3302 | Note that only some (real or virtual) machines have this action, others
|
---|
3303 | will not produce bifurcate drives.
|
---|
3304 |
|
---|
3305 |
|
---|
3306 | ******************************************************************************
|
---|
3307 | *** GRLDR as PXE boot file ***
|
---|
3308 | ******************************************************************************
|
---|
3309 |
|
---|
3310 | GRLDR can be used as the PXE boot file on a remote/network server. The (pd)
|
---|
3311 | device is used to access files on the server. When GRLDR is booted through
|
---|
3312 | network, it will use its preset menu as the config file. However, you may use
|
---|
3313 | a "pxe detect" command, which acts this way:
|
---|
3314 |
|
---|
3315 | * First, it will search for the config file "menu.lst" in the same dir as
|
---|
3316 | grldr.
|
---|
3317 |
|
---|
3318 | * Second, it will search for the config file using the hardware type (using
|
---|
3319 | its ARP type code) and address, all in hexadecimal with dash separators;
|
---|
3320 | for example, for an Ethernet (ARP type 1) with address 88:99:AA:BB:CC:DD
|
---|
3321 | it would search for the filename 01-88-99-AA-BB-CC-DD.
|
---|
3322 |
|
---|
3323 | * Next, it will search for the config file using its own IP address in
|
---|
3324 | upper case hexadecimal, e.g. 192.0.2.91 -> C000025B. If that file is not
|
---|
3325 | found, it will remove one hex digit and try again. At last, it will try
|
---|
3326 | looking for a file named default (in lower case). As an example, if the
|
---|
3327 | boot file name is /mybootdir/grldr, the Ethernet MAC address is
|
---|
3328 | 88:99:AA:BB:CC:DD and the IP address 192.0.2.91, it will try following
|
---|
3329 | files (in that order):
|
---|
3330 |
|
---|
3331 | /mybootdir/menu.lst
|
---|
3332 | /mybootdir/menu/01-88-99-AA-BB-CC-DD
|
---|
3333 | /mybootdir/menu/C000025B
|
---|
3334 | /mybootdir/menu/C000025
|
---|
3335 | /mybootdir/menu/C00002
|
---|
3336 | /mybootdir/menu/C0000
|
---|
3337 | /mybootdir/menu/C000
|
---|
3338 | /mybootdir/menu/C00
|
---|
3339 | /mybootdir/menu/C0
|
---|
3340 | /mybootdir/menu/C
|
---|
3341 | /mybootdir/menu/default
|
---|
3342 |
|
---|
3343 | You cannot directly map an image file on (pd). You must map it in memory using
|
---|
3344 | the --mem option. For example,
|
---|
3345 |
|
---|
3346 | map --mem (pd)/images/floppy.img (fd0)
|
---|
3347 | map --hook
|
---|
3348 | chainloader (fd0)+1
|
---|
3349 | rootnoverify (fd0)
|
---|
3350 | boot
|
---|
3351 |
|
---|
3352 | One more example,
|
---|
3353 |
|
---|
3354 | map --mem (pd)/images/cdimage.iso (0xff)
|
---|
3355 | map --hook
|
---|
3356 | chainloader (0xff)
|
---|
3357 | boot
|
---|
3358 |
|
---|
3359 |
|
---|
3360 | ******************************************************************************
|
---|
3361 | *** New program badgrub.exe ***
|
---|
3362 | ******************************************************************************
|
---|
3363 |
|
---|
3364 | The new program badgrub.exe is intended to serve 'bad' machines(typically some
|
---|
3365 | DELL models) that cannot run the normal grub.exe.
|
---|
3366 |
|
---|
3367 |
|
---|
3368 | ******************************************************************************
|
---|
3369 | *** Conditional find ***
|
---|
3370 | ******************************************************************************
|
---|
3371 |
|
---|
3372 | The new find syntax allows to find a device conditionally.
|
---|
3373 |
|
---|
3374 | find [OPTIONS] [FILENAME] [CONDITION]
|
---|
3375 |
|
---|
3376 | CONDITION is a normal grub command which returns TRUE or FALSE.
|
---|
3377 |
|
---|
3378 | OPTIONS:
|
---|
3379 | --set-root set the current root device.
|
---|
3380 | --set-root=DIR set current root device and working directory to DIR.
|
---|
3381 | please also see "Notation For The Current Root Device".
|
---|
3382 | --ignore-cd skip search on (cd).
|
---|
3383 | --ignore-floppies bypass all floppies.
|
---|
3384 | --devices=DEVLIST specify the search devices and order.
|
---|
3385 | DEVLIST u->(ud)
|
---|
3386 | n->(nd)
|
---|
3387 | p->(pd)
|
---|
3388 | h->(hdx)
|
---|
3389 | c->(cd)
|
---|
3390 | f->(fdx)
|
---|
3391 | default: upnhcf
|
---|
3392 |
|
---|
3393 | Example 1:
|
---|
3394 |
|
---|
3395 | find
|
---|
3396 |
|
---|
3397 | This will list all partitions, all floppies and the (cd).
|
---|
3398 |
|
---|
3399 | Example 2:
|
---|
3400 |
|
---|
3401 | find +1
|
---|
3402 |
|
---|
3403 | This will list all devices with a known filesystem.
|
---|
3404 |
|
---|
3405 | Example 3:
|
---|
3406 |
|
---|
3407 | find checkrange 0xAF parttype
|
---|
3408 |
|
---|
3409 | This will list all partitions with ID=0xAF.
|
---|
3410 |
|
---|
3411 | Example 4:
|
---|
3412 |
|
---|
3413 | find /ntldr checkrange 0x07 parttype
|
---|
3414 |
|
---|
3415 | This will list all partitions with ID=0x07 and existing /ntldr.
|
---|
3416 |
|
---|
3417 | Example 5:
|
---|
3418 | find --set-root /ntldr
|
---|
3419 | This will set the first device it finds to current root device.
|
---|
3420 |
|
---|
3421 | Example 6:
|
---|
3422 | find --set-root --devices=h /bootmgr
|
---|
3423 | Same of Example 5.but search on hard disk only.
|
---|
3424 |
|
---|
3425 | Example 7:
|
---|
3426 | find --set-root --devices=h makeactive --status
|
---|
3427 | This will set current root device to first active partition.
|
---|
3428 |
|
---|
3429 | ******************************************************************************
|
---|
3430 | *** How to build grldr boot images ***
|
---|
3431 | ******************************************************************************
|
---|
3432 |
|
---|
3433 | 1. build 1.44M floppy image ext2grldr.img
|
---|
3434 |
|
---|
3435 | dd if=/dev/zero of=ext2grldr.img bs=512 count=2880
|
---|
3436 | mke2fs ext2grldr.img
|
---|
3437 | mkdir ext2tmp
|
---|
3438 | mount -o loop ext2grldr.img ext2tmp
|
---|
3439 | cp default ext2tmp
|
---|
3440 | cp menu.lst ext2tmp
|
---|
3441 | cp grldr ext2tmp
|
---|
3442 | umount ext2tmp
|
---|
3443 | bootlace.com --floppy --chs --sectors-per-track=18 --heads=2 --start-sector=0 --total-sectors=2880 ext2grldr.img
|
---|
3444 |
|
---|
3445 | 2. build 1.44M floppy image fat12grldr.img
|
---|
3446 |
|
---|
3447 | dd if=/dev/zero of=fat12grldr.img bs=512 count=2880
|
---|
3448 | mkdosfs fat12grldr.img
|
---|
3449 | mkdir fat12tmp
|
---|
3450 | mount -o loop fat12grldr.img fat12tmp
|
---|
3451 | cp default fat12tmp
|
---|
3452 | cp menu.lst fat12tmp
|
---|
3453 | cp grldr fat12tmp
|
---|
3454 | umount fat12tmp
|
---|
3455 | bootlace.com --floppy --chs fat12grldr.img
|
---|
3456 |
|
---|
3457 | 3. build iso9660 CDROM image grldr.iso
|
---|
3458 |
|
---|
3459 | mkdir iso_root
|
---|
3460 | cp grldr iso_root
|
---|
3461 | cp menu.lst iso_root
|
---|
3462 | mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root
|
---|
3463 |
|
---|
3464 |
|
---|
3465 | ******************************************************************************
|
---|
3466 | *** Use bootlace.com to install partition boot record ***
|
---|
3467 | ******************************************************************************
|
---|
3468 |
|
---|
3469 | Since bootlace.com has not implemented the --install-partition option, you
|
---|
3470 | need to use the already implemented --floppy=PartitionNumber option instead.
|
---|
3471 |
|
---|
3472 | Hear is a way you might want to follow:
|
---|
3473 |
|
---|
3474 | Step 1. Get the boot sectors of the partition and save to a file MYPART.TMP.
|
---|
3475 | For NTFS, you need to get the beginning 16 sectors. For other type of
|
---|
3476 | filesystems, you only need to get one sector, but getting more sectors
|
---|
3477 | is also ok.
|
---|
3478 |
|
---|
3479 | Step 2. Run this:
|
---|
3480 |
|
---|
3481 | bootlace.com --floppy=Y --sectors-per-track=S --heads=H --start-sector=B --total-sectors=C --vfat --ext2 --ntfs MYPART.TMP
|
---|
3482 |
|
---|
3483 | where we suppose MYPART.TMP is for (hdX,Y) and the partition number Y
|
---|
3484 | should be specified as in the --floppy=Y option.
|
---|
3485 |
|
---|
3486 | Note that for FAT12/16/32/NTFS partitions, you can omit these options:
|
---|
3487 |
|
---|
3488 | --sectors-per-track, --heads, --start-sector, --total-sectors,
|
---|
3489 | --vfat and --ext2.
|
---|
3490 |
|
---|
3491 | For NTFS partitions, you must specify --ntfs option.
|
---|
3492 |
|
---|
3493 | For ext2 partitions, you can omit --vfat, --ntfs and --ext2 options,
|
---|
3494 | but other options should be specified.
|
---|
3495 |
|
---|
3496 | Step 3. Put MYPART.TMP back on to the boot sector(s) of your original partition
|
---|
3497 | (hdX,Y).
|
---|
3498 |
|
---|
3499 |
|
---|
3500 | Note: Only a few file systems(FAT12/16/32/NTFS/ext2/ext3) are supported by now.
|
---|
3501 |
|
---|
3502 | Note2: Under Linux you may directly write the partition. That is to say, Step
|
---|
3503 | 1 and Step 3 are not needed. Simply use its device name instead of
|
---|
3504 | MYPART.TMP.
|
---|
3505 |
|
---|
3506 | Note3: grubinst has the feature of installing grldr boot code onto a
|
---|
3507 | partition boot area.
|
---|
3508 |
|
---|
3509 | ******************************************************************************
|
---|
3510 | *** Use a single key to select menu item ***
|
---|
3511 | ******************************************************************************
|
---|
3512 |
|
---|
3513 | Some machines have a simplified keyboard. The keyborad might have only the
|
---|
3514 | number keys 0 .. 9 plus a few other keys. When the menu displayed, the user
|
---|
3515 | can strike a key for 8 times. When the menu handler detects the continuous
|
---|
3516 | single keypress, it will assume the user want to use this key to select a menu
|
---|
3517 | item and boot. This single key will act as the RIGHT-ARROW key for the user to
|
---|
3518 | select a menu item. And 5 seconds later after the user stops the keypress,
|
---|
3519 | the selected menu item will automatically boot. Any normal keys can be used as
|
---|
3520 | a single key for this purpose, except for a few functional keys like b, e,
|
---|
3521 | Enter, etc. Once another key is pressed, the feature of Single-Key-Selection
|
---|
3522 | will disappear immediately.
|
---|
3523 |
|
---|
3524 |
|
---|
3525 | ******************************************************************************
|
---|
3526 | *** Parameter file for bootlace running under DOS ***
|
---|
3527 | ******************************************************************************
|
---|
3528 |
|
---|
3529 | You may move all or part of the command-line arguments into a file. The file
|
---|
3530 | can have multi lines. Just like SPACEs and TABs, the CRs and LFs can also
|
---|
3531 | delimit the commandline arguments in the parameter file.
|
---|
3532 |
|
---|
3533 | Example:
|
---|
3534 |
|
---|
3535 | bootlace < my_parafile
|
---|
3536 | bootlace --read-only my_mbr < my_other_options
|
---|
3537 |
|
---|
3538 | Note: Pipes do not work. You have to use the input-redirection operator(<).
|
---|
3539 |
|
---|
3540 |
|
---|
3541 | ******************************************************************************
|
---|
3542 | *** Use bootlace to create a triple MBR ***
|
---|
3543 | ******************************************************************************
|
---|
3544 |
|
---|
3545 | This is typically used for USB drives, though it also works with hard drives.
|
---|
3546 |
|
---|
3547 | Steps to create triple MBR:
|
---|
3548 |
|
---|
3549 | 1. Do a fresh FDISK to create a FAT12/16/32 partition starting at sector 95
|
---|
3550 | (in LBA, that is, the begginning sector(MBR) is sector 0).
|
---|
3551 |
|
---|
3552 | 2. Install grldr boot sector onto the boot sector of this partition. See
|
---|
3553 | section "Use bootlace.com to install partition boot record" above.
|
---|
3554 |
|
---|
3555 | 3. Get 96 sectors of the drive starting at sector 0(MBR), and save to file
|
---|
3556 | MYMBR96.TMP.
|
---|
3557 |
|
---|
3558 | 4. Run bootlace.com:
|
---|
3559 |
|
---|
3560 | bootlace.com MYMBR96.TMP
|
---|
3561 |
|
---|
3562 | 5. Put MYMBR96.TMP back onto the drive starting at MBR(sector 0).
|
---|
3563 |
|
---|
3564 | Note: If the drive already has a triple MBR, then bootlace will cancel it
|
---|
3565 | and restore the original partition layout.
|
---|
3566 |
|
---|
3567 |
|
---|
3568 | ******************************************************************************
|
---|
3569 | *** Use 'pxe detect' in preset-menu ***
|
---|
3570 | ******************************************************************************
|
---|
3571 |
|
---|
3572 | Now the "pxe" command has a new subcommand "detect":
|
---|
3573 |
|
---|
3574 | pxe detect [BLOCK_SIZE] [MENU_FILE]
|
---|
3575 |
|
---|
3576 | BLOCK_SIZE specifies the block size for PXE. If it is not specified or it is
|
---|
3577 | 0, then grub4dos will go through a probing process and get a proper value
|
---|
3578 | for data transfer.
|
---|
3579 |
|
---|
3580 | MENU_FILE specifies the config file on the PXE server. If omitted, a standard
|
---|
3581 | config file in the menu.lst sub-dir will gain control. For a description on
|
---|
3582 | the config files in the menu.lst sub-dir, please refer to the section
|
---|
3583 | "GRLDR as PXE boot file" above.
|
---|
3584 | If MENU_FILE starts in a "/", then the MENU_FILE on the PXE server will gain
|
---|
3585 | control, else(if MENU_FILE does not start in a "/") no menu will be executed.
|
---|
3586 |
|
---|
3587 | Normally you want to use a "pxe blksize ..." or a "pxe detect ..." command
|
---|
3588 | before you access the (pd) device, since the default blocksize of 512 might
|
---|
3589 | not work on your system.
|
---|
3590 |
|
---|
3591 |
|
---|
3592 | ******************************************************************************
|
---|
3593 | *** Use 'configfile' in preset-menu ***
|
---|
3594 | ******************************************************************************
|
---|
3595 |
|
---|
3596 | Now the preset menu holds the highest priority. It will gain control prior to
|
---|
3597 | the menu.lst on the boot device. If a 'configfile' command(without specifying
|
---|
3598 | any file as the parameter) occurs in the menu init command group of the preset
|
---|
3599 | menu, then control will go to the menu.lst on the boot device.
|
---|
3600 |
|
---|
3601 | Note: You should better not use "configfile ANOTHER_MENU" frequently in your
|
---|
3602 | menu.lst file, because it could create infinite loop and thus hang your
|
---|
3603 | computer.
|
---|
3604 |
|
---|
3605 |
|
---|
3606 | ******************************************************************************
|
---|
3607 | *** New command 'dd' to copy files ***
|
---|
3608 | ******************************************************************************
|
---|
3609 |
|
---|
3610 | Usage:
|
---|
3611 |
|
---|
3612 | dd if=IF of=OF [bs=BS] [count=C] [skip=IN] [seek=OUT] [buf=ADDR] [buflen=SIZE]
|
---|
3613 |
|
---|
3614 | Copy file IF to OF. BS is blocksize in bytes, default to 512. C is blocks to
|
---|
3615 | copy, default is total blocks in IF. IN specifies number of blocks to skip
|
---|
3616 | when read, default is 0. OUT specifies number of blocks to skip when write,
|
---|
3617 | default is 0. Skipped blocks are not touched. Both IF and OF must exist.
|
---|
3618 |
|
---|
3619 | Both IF and OF must have a leading device name, i.e., of the form `(...)'.
|
---|
3620 | You may use `()' for the current root device.
|
---|
3621 |
|
---|
3622 | dd can neither enlarge nor reduce the size of OF, the leftover tail of IF
|
---|
3623 | will be discarded. OF cannot be a gzipped file. If IF is a gzipped file,
|
---|
3624 | it will be decompressed automatically when copying.
|
---|
3625 |
|
---|
3626 | dd is dangerous, use at your own risk. To be on the safe side, you should
|
---|
3627 | only use dd to write a file in memory.
|
---|
3628 |
|
---|
3629 | In some cases when writing a file in a NTFS volume, dd might fail.
|
---|
3630 |
|
---|
3631 | If you attempt to write a device or a block file that is not in memory by
|
---|
3632 | starting dd in a menu, you will safely be refused :-) (Update: no restrictions
|
---|
3633 | now)
|
---|
3634 |
|
---|
3635 | Update: New options are implemented for user defined buffer. By default,
|
---|
3636 | the buffer is at address 0x50000, and length is 0x10000(=64KB). You cannot
|
---|
3637 | specify ADDR to be lower than 0x100000(=1MB). Besides, you must specify SIZE
|
---|
3638 | larger than 0x10000(=64KB). Normally you want ADDR >= 0x1000000(=16MB), and
|
---|
3639 | SIZE also >= 16MB. A large SIZE could speed up the progression of dd.
|
---|
3640 |
|
---|
3641 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3642 | !!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!
|
---|
3643 | !!!! Caution! Both IF and OF can be a device name which stands for !!!!
|
---|
3644 | !!!! all the sectors on the device. Take utmost care! !!!!
|
---|
3645 | !!!!______________________________________________________________________!!!!
|
---|
3646 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3647 |
|
---|
3648 |
|
---|
3649 | ******************************************************************************
|
---|
3650 | *** New command 'uuid' to identify partitions ***
|
---|
3651 | ******************************************************************************
|
---|
3652 |
|
---|
3653 | Usage:
|
---|
3654 |
|
---|
3655 | uuid [DEVICE] [UUID]
|
---|
3656 |
|
---|
3657 | If DEVICE is not specified, search for filesystem with UUID in all partitions
|
---|
3658 | and set the partition containing the filesystem as new root (if UUID is
|
---|
3659 | specified), or just list uuid's of all filesystems on all devices (if UUID is
|
---|
3660 | not specified). If DEVICE is specified, return true or false according to
|
---|
3661 | whether or not the DEVICE matches the specified UUID (if UUID is specified),
|
---|
3662 | or just list the uuid of DEVICE (if UUID is not specified).
|
---|
3663 |
|
---|
3664 | Example 1:
|
---|
3665 |
|
---|
3666 | find --set-root uuid () 7f95820f-5e33-4e6c-8f50-0760bf06d79c
|
---|
3667 |
|
---|
3668 | which will find a partition with uuid=7f95820f-5e33-4e6c-8f50-0760bf06d79c
|
---|
3669 | and set the partition as root if found.
|
---|
3670 |
|
---|
3671 | Example 2:
|
---|
3672 |
|
---|
3673 | uuid ()
|
---|
3674 |
|
---|
3675 | which will print the uuid of the current root device.
|
---|
3676 |
|
---|
3677 |
|
---|
3678 | ******************************************************************************
|
---|
3679 | *** gfxmenu support in grub4dos ***
|
---|
3680 | ******************************************************************************
|
---|
3681 |
|
---|
3682 | Gfxmenu support has been added to grub4dos. To use it, you must first find the
|
---|
3683 | message file you need, then load it in menu.lst with command like this:
|
---|
3684 |
|
---|
3685 | gfxmenu /message
|
---|
3686 |
|
---|
3687 | This should be a gloabl command, that is, not inside any menu item. Also, it
|
---|
3688 | can only be used in configure file, running it in console mode does not work.
|
---|
3689 |
|
---|
3690 | gfxmenu does not work in conjunction with the password feature.
|
---|
3691 |
|
---|
3692 | There are two major format of message file. Old format is created with gfxboot
|
---|
3693 | 3.2.* or older (size of message file is normally about 150K), while new format
|
---|
3694 | is created with gfxboot 3.3.* and later (size of message file is normally above
|
---|
3695 | 300K). Both format are supported in grub4dos.
|
---|
3696 |
|
---|
3697 |
|
---|
3698 | ******************************************************************************
|
---|
3699 | *** Use 'write' to write a string into a device or file ***
|
---|
3700 | ******************************************************************************
|
---|
3701 |
|
---|
3702 | Usage:
|
---|
3703 |
|
---|
3704 | write [--offset=SKIP] ADDR_OR_FILE INTEGER_OR_STRING
|
---|
3705 |
|
---|
3706 | SKIP is an integer and defaults to 0.
|
---|
3707 |
|
---|
3708 | If ADDR_OR_FILE is an integer, then it is treated as a memory address, and
|
---|
3709 | INTEGER_OR_STRING must be an integer value. The integer INTEGER_OR_STRING
|
---|
3710 | will be written to address (ADDR_OR_FILE + SKIP).
|
---|
3711 |
|
---|
3712 | If ADDR_OR_FILE is a device or a file, then INTEGER_OR_STRING is treated as
|
---|
3713 | a string which will be written to ADDR_OR_FILE at offset SKIP (in bytes).
|
---|
3714 |
|
---|
3715 | The string is quoted with nothing, that is, neither with the single quote
|
---|
3716 | char(') nor with the double quote char(").
|
---|
3717 |
|
---|
3718 | Space char must be quoted with back slash(\). (Update: need not now)
|
---|
3719 |
|
---|
3720 | Single quote char(') and double quote char(") are not interpreted specially
|
---|
3721 | and can be used directly in the string.
|
---|
3722 |
|
---|
3723 | Some C-style quote sequences are interpreted as follows:
|
---|
3724 |
|
---|
3725 | \NNN character with octal value NNN (1 to 3 digits)
|
---|
3726 |
|
---|
3727 | \\ backslash
|
---|
3728 |
|
---|
3729 | \a alert (BEL)
|
---|
3730 |
|
---|
3731 | \b backspace
|
---|
3732 |
|
---|
3733 | \f form feed
|
---|
3734 |
|
---|
3735 | \n new line
|
---|
3736 |
|
---|
3737 | \r carriage return
|
---|
3738 |
|
---|
3739 | \t horizontal tab
|
---|
3740 |
|
---|
3741 | \v vertical tab
|
---|
3742 |
|
---|
3743 | \xHH byte with hexadecimal value HH (1 to 2 digits)
|
---|
3744 |
|
---|
3745 | Just like dd, the write can neither enlarge nor reduce the size of the
|
---|
3746 | destination file, the leftover tail of the string will be discarded.
|
---|
3747 | The destination file cannot be a gzipped file.
|
---|
3748 |
|
---|
3749 | Again like dd, the write command is also dangerous, use at your own risk.
|
---|
3750 | And to be on the safe side, you should only write to memory files.
|
---|
3751 |
|
---|
3752 | In some cases when writing a file in a NTFS volume, the write might fail.
|
---|
3753 |
|
---|
3754 | If you attempt to write a device or a block file that is not in memory by
|
---|
3755 | using write in a menu, you will safely be refused :-) (Update: no restrictions
|
---|
3756 | now)
|
---|
3757 |
|
---|
3758 |
|
---|
3759 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3760 | !!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!
|
---|
3761 | !!!! Caution! The file to write can be a device name which stands !!!!
|
---|
3762 | !!!! for all the sectors on the device. Take utmost care! !!!!
|
---|
3763 | !!!!______________________________________________________________________!!!!
|
---|
3764 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
3765 |
|
---|
3766 |
|
---|
3767 | ******************************************************************************
|
---|
3768 | *** Item-by-item help text for menu entries ***
|
---|
3769 | ******************************************************************************
|
---|
3770 |
|
---|
3771 |
|
---|
3772 | The help message at the bottom of the screen will vary as you choose the menu.
|
---|
3773 |
|
---|
3774 | You may append your help text to the title line. The help text must begin
|
---|
3775 | with "\n", for example:
|
---|
3776 |
|
---|
3777 | title This is the title\nThis is the help text.\nAnd this is the 2nd line of the help text.
|
---|
3778 |
|
---|
3779 | Some C-style quote sequences are interpreted as stated in the section above.
|
---|
3780 |
|
---|
3781 |
|
---|
3782 | ******************************************************************************
|
---|
3783 | *** initrd can load multiple cpio files for Linux 2.6 kernels ***
|
---|
3784 | ******************************************************************************
|
---|
3785 |
|
---|
3786 | Usage:
|
---|
3787 |
|
---|
3788 | initrd FILE [FILE ...]
|
---|
3789 |
|
---|
3790 | Note 1: You should not load more than one oldstyle disk images in this way,
|
---|
3791 | because this is not supported by Linux kernel.
|
---|
3792 |
|
---|
3793 | Note 2: The FILEs should be specified in the same order as with syslinux.
|
---|
3794 |
|
---|
3795 | ******************************************************************************
|
---|
3796 | *** access some internel variables at a fixed location ***
|
---|
3797 | ******************************************************************************
|
---|
3798 |
|
---|
3799 | Address Length Description
|
---|
3800 | ========= ======== ==============================================
|
---|
3801 | 0000:8208 4 (DWORD) install_partition (the boot partition)
|
---|
3802 | 0000:8280 4 (DWORD) boot_drive (the boot drive)
|
---|
3803 | 0000:8284 4 (DWORD) pxe_yip (your ip)
|
---|
3804 | 0000:8288 4 (DWORD) pxe_sip (server ip)
|
---|
3805 | 0000:828C 4 (DWORD) pxe_gip (gateway ip)
|
---|
3806 | 0000:8290 8 (QWORD) filesize (file size by last "cat --length=0")
|
---|
3807 | 0000:8298 4 (DWORD) saved_mem_upper (extended memory size in KB)
|
---|
3808 | 0000:829C 4 (DWORD) saved_partition (current root partition)
|
---|
3809 | 0000:82A0 4 (DWORD) saved_drive (current root drive)
|
---|
3810 | 0000:82A4 4 (DWORD) no_decompression (no auto gunzip)
|
---|
3811 | 0000:82A8 8 (QWORD) part_start (start sector of last partition)
|
---|
3812 | 0000:82B0 8 (QWORD) part_length (total sectors of last partition)
|
---|
3813 |
|
---|
3814 | Note 1: Filesize can be initialised/modified by using "cat --length=0 FILE".
|
---|
3815 | Note 2: You should not write these variables by hand(should read only).
|
---|
3816 | Note 3: You may use 1K at 6000:0000 for your own varibles(See note 4).
|
---|
3817 | Note 4: The read command now returns the integer value at the given address.
|
---|
3818 | Note 5: Grub4dos does not have the variable expansion feature. You can only
|
---|
3819 | use integer variables. You need not declare them, but use the memory
|
---|
3820 | address directly. Usually you want to use variables as a logical
|
---|
3821 | value or in a command for conditional test, e.g., of this form:
|
---|
3822 | "checkrange RANGE read ADDR"
|
---|
3823 | Note 6: no_decompression, saved_drive and saved_partition are writable.
|
---|
3824 |
|
---|
3825 |
|
---|
3826 | ******************************************************************************
|
---|
3827 | *** possibility to run another menu.lst after gfxmenu ***
|
---|
3828 | ******************************************************************************
|
---|
3829 |
|
---|
3830 | Notice the use of CONFIGFILE after GFXMENU in the following example:
|
---|
3831 |
|
---|
3832 | # The menu.lst file for gfxmenu
|
---|
3833 | default=0
|
---|
3834 | timeout=5
|
---|
3835 | gfxmenu /message
|
---|
3836 | configfile /another.lst
|
---|
3837 | title 0..........
|
---|
3838 | ................
|
---|
3839 | title 1..........
|
---|
3840 | ................
|
---|
3841 | title 2..........
|
---|
3842 | ................
|
---|
3843 | # End of menu.lst
|
---|
3844 |
|
---|
3845 | # Begin another.lst
|
---|
3846 | default=0
|
---|
3847 | timeout=5
|
---|
3848 | title 0..........
|
---|
3849 | ................
|
---|
3850 | title 1..........
|
---|
3851 | ................
|
---|
3852 | title 2..........
|
---|
3853 | ................
|
---|
3854 | # End of another.lst
|
---|
3855 |
|
---|
3856 | This will try gfxmenu command first. On exit(or on failure) control will go
|
---|
3857 | to another.lst file.
|
---|
3858 |
|
---|
3859 |
|
---|
3860 | ******************************************************************************
|
---|
3861 | *** a range of drives can be unmapped ***
|
---|
3862 | ******************************************************************************
|
---|
3863 |
|
---|
3864 | Usage:
|
---|
3865 |
|
---|
3866 | map --unmap=RANGE
|
---|
3867 |
|
---|
3868 | RANGE is a range of BIOS drive numbers to be unmapped. BIOS drive number 0
|
---|
3869 | is for the first floppy, 1 is for the second floppy; 0x80 is for the first
|
---|
3870 | hard drive, 0x81 is for the second hard drive, etc; virtual cdrom (hd32)
|
---|
3871 | corresponds to BIOS drive number 0xA0, (hd33) corresponds to 0xA1, etc.
|
---|
3872 |
|
---|
3873 | For description on RANGE, please refer to section `The New Command CHECKRANGE'
|
---|
3874 | above.
|
---|
3875 |
|
---|
3876 | Example 1:
|
---|
3877 |
|
---|
3878 | map --unmap=0,0x80,0xff
|
---|
3879 |
|
---|
3880 | This will unmap virtual floppy (fd0), virtual hard drive (hd0) and virtual
|
---|
3881 | cdrom (0xff).
|
---|
3882 |
|
---|
3883 | Example 2:
|
---|
3884 |
|
---|
3885 | map --unmap=0:0xff
|
---|
3886 |
|
---|
3887 | This will unmap all virtual floppies, all virtual hard drives and all virtual
|
---|
3888 | cdroms.
|
---|
3889 |
|
---|
3890 | Note 1: Normally a `map' command will add an item in the drive map table for
|
---|
3891 | a virtual drive. But `--unmap' means items in the drive map table
|
---|
3892 | (for the specified virtual drives) will be deleted.
|
---|
3893 | Note 2: The --unhook option only breaks the INT13 hook(to the inerrupt
|
---|
3894 | vector table). It will not affect the drive map table. And later on
|
---|
3895 | execution of a `boot' command, the INT13 disk emulation routine will
|
---|
3896 | automatically get hooked(to the interrupt vector table) when needed
|
---|
3897 | (e.g., the drive map table is non-empty) even if it has been unhooked.
|
---|
3898 | Note 3: Usually you want to do a `map --rehook' after you have changed the
|
---|
3899 | drive map table.
|
---|
3900 |
|
---|
3901 |
|
---|
3902 | ******************************************************************************
|
---|
3903 | *** geometry tune and sync ***
|
---|
3904 | ******************************************************************************
|
---|
3905 |
|
---|
3906 | When a USB storage device is connected to a (or another) machine, the geometry
|
---|
3907 | in the partition table or in the BPB of the volume could be invalid, and the
|
---|
3908 | machine could hang at boot time. So you need to find out the correct geometry
|
---|
3909 | for the drive (use `geometry --tune'), and then update the geometry in
|
---|
3910 | partition table and BPB of the drive(use `geometry --sync').
|
---|
3911 |
|
---|
3912 | The above steps are required if you are going to boot DOS, because DOS
|
---|
3913 | requires the right geometry in the partition table and BPB. Windows/Linux may
|
---|
3914 | also require it, since the boot process could run in real-mode.
|
---|
3915 |
|
---|
3916 |
|
---|
3917 | ******************************************************************************
|
---|
3918 | *** Version numbering ***
|
---|
3919 | ******************************************************************************
|
---|
3920 |
|
---|
3921 | Now we append a letter 'a', 'b', 'c' or 'p' to the version number(e.g., 0.4.5).
|
---|
3922 | So the version will become 0.4.5a, 0.4.5b, 0.4.5c, 0.4.5 or 0.4.5p.
|
---|
3923 |
|
---|
3924 | 'a' - alpha test. unstable, especially when there are known bugs.
|
---|
3925 | 'b' - beta test. the developers think it has no bugs and want a widely testing.
|
---|
3926 | 'c' - release candidate.
|
---|
3927 | ''(nothing) - official release.
|
---|
3928 | 'p' - patched versions to the official release.
|
---|
3929 |
|
---|
3930 |
|
---|
3931 | ******************************************************************************
|
---|
3932 | *** Running User Programs ***
|
---|
3933 | ******************************************************************************
|
---|
3934 |
|
---|
3935 | From 0.4.5 on, user programs can be developed for running under grub4dos. The
|
---|
3936 | executable program file must end with the 8-byte grub4dos EXEC signature:
|
---|
3937 |
|
---|
3938 | 0x05, 0x18, 0x05, 0x03, 0xBA, 0xA7, 0xBA, 0xBC
|
---|
3939 |
|
---|
3940 | The executable must have no relocations, and the entry point is at the very
|
---|
3941 | beginning of the file, just like a DOS .com file(but the grub4dos executable
|
---|
3942 | is 32-bit).
|
---|
3943 |
|
---|
3944 | Here is a sample file echo.c:
|
---|
3945 |
|
---|
3946 | /*================ begin echo.c ================*/
|
---|
3947 |
|
---|
3948 | /*
|
---|
3949 | * compile:
|
---|
3950 |
|
---|
3951 | gcc -nostdlib -fno-zero-initialized-in-bss -fno-function-cse -fno-jump-tables -Wl,-N -fPIE echo.c
|
---|
3952 |
|
---|
3953 | * disassemble: objdump -d a.out
|
---|
3954 | * confirm no relocation: readelf -r a.out
|
---|
3955 | * generate executable: objcopy -O binary a.out b.out
|
---|
3956 | *
|
---|
3957 | * and then the resultant b.out will be grub4dos executable.
|
---|
3958 | */
|
---|
3959 |
|
---|
3960 | /*
|
---|
3961 | * This is a simple ECHO command, running under grub4dos.
|
---|
3962 | */
|
---|
3963 |
|
---|
3964 | int i = 0x66666666; /* this is needed, see the following comment. */
|
---|
3965 |
|
---|
3966 | /* gcc treat the following as data only if a global initialization like the
|
---|
3967 | * above line occurs.
|
---|
3968 | */
|
---|
3969 |
|
---|
3970 | /* a valid executable file for grub4dos must end with these 8 bytes */
|
---|
3971 | asm(".long 0x03051805");
|
---|
3972 | asm(".long 0xBCBAA7BA");
|
---|
3973 | /* thank goodness gcc will place the above 8 bytes at the end of the b.out
|
---|
3974 | * file. Do not insert any other asm lines here.
|
---|
3975 | */
|
---|
3976 |
|
---|
3977 | int
|
---|
3978 | main()
|
---|
3979 | {
|
---|
3980 | void *p = &main;
|
---|
3981 |
|
---|
3982 | return
|
---|
3983 | /* the following line is calling the grub_sprintf function. */
|
---|
3984 | ((int (*)(char *, const char *, ...))((*(int **)0x8300)[0]))
|
---|
3985 | /* the following line includes arguments passed to grub_sprintf. */
|
---|
3986 | (0, p - (*(int *)(p - 8)));
|
---|
3987 | }
|
---|
3988 |
|
---|
3989 | /*================ end echo.c ================*/
|
---|
3990 |
|
---|
3991 | 0x8300 is a pointer to the grub4dos system funtions(API). The system_functions
|
---|
3992 | variable is defined in asm.S.
|
---|
3993 |
|
---|
3994 | More function can use in user programs:
|
---|
3995 | http://grubutils.googlecode.com/svn/trunk/src/include/grub4dos.h
|
---|
3996 | note: After 2010-11-16 version of grub4dos,you can use like below.
|
---|
3997 | /////////////////echo.c start///////////////////////////////////////////////
|
---|
3998 | #define sprintf ((int (*)(char *, const char *, ...))((*(int **)0x8300)[0]))
|
---|
3999 |
|
---|
4000 | #define printf(...) sprintf(NULL, __VA_ARGS__)
|
---|
4001 | int i = 0x66666666;
|
---|
4002 | asm(".long 0x03051805");
|
---|
4003 | asm(".long 0xBCBAA7BA");
|
---|
4004 | int main(char *arg,int flags)
|
---|
4005 | {
|
---|
4006 |
|
---|
4007 | return printf("%s\n",arg);
|
---|
4008 | }
|
---|
4009 | /////////////////echo.c end/////////////////////////////////////////////////
|
---|
4010 |
|
---|
4011 | ******************************************************************************
|
---|
4012 | *** Map options added by Karyonix ***
|
---|
4013 | ******************************************************************************
|
---|
4014 |
|
---|
4015 | (from boot-land.net) Karyonix's note:
|
---|
4016 |
|
---|
4017 | map --add-mbt= option to be used with --mem. If =0 master boot track will not
|
---|
4018 | be added automatically.
|
---|
4019 | map --top option to be used with --mem. map --mem will try to allocate memory
|
---|
4020 | at highest available address.
|
---|
4021 | map --mem-max=, map --mem-min options to be used before map --mem. Allow user
|
---|
4022 | to manually limit range of address that map --mem can use.
|
---|
4023 |
|
---|
4024 | safe_parse_maxint_with_suffix function parses K,M,G,T suffix after number.
|
---|
4025 |
|
---|
4026 |
|
---|
4027 | ******************************************************************************
|
---|
4028 | *** Graphics mode 6A: 800x600 with 16 colors ***
|
---|
4029 | ******************************************************************************
|
---|
4030 |
|
---|
4031 | Graphics mode now has 2 possibilities, one is the default 640x480 mode, and the
|
---|
4032 | other is 800x600 mode.
|
---|
4033 |
|
---|
4034 | To enter 800x600 mode, follow this way:
|
---|
4035 |
|
---|
4036 | 1. Be sure you are in console text mode. You may execute "terminal console".
|
---|
4037 | 2. Set graphics mode to 0x6A by using command "graphicsmode 0x6A".
|
---|
4038 | 3. Enter graphics mode. You may execute command "terminal graphics".
|
---|
4039 |
|
---|
4040 | To return to 640x480 mode, follow this way:
|
---|
4041 |
|
---|
4042 | 1. Be sure you are in console text mode. You may execute "terminal console".
|
---|
4043 | 2. Set graphics mode to 0x12 by using command: "graphicsmode 0x12".
|
---|
4044 | 3. Enter graphics mode. You may execute command "terminal graphics".
|
---|
4045 |
|
---|
4046 | ******************************************************************************
|
---|
4047 | ***** GRUB4DOS variable support *****
|
---|
4048 | ******************************************************************************
|
---|
4049 |
|
---|
4050 | From now we supports variables, the same usage of MSDOS.
|
---|
4051 |
|
---|
4052 | commands:
|
---|
4053 | set [/p] [/a|/A] [/l|/u] [VARIABLE=[STRING]]
|
---|
4054 | variable specifies the variable name (up to 8 characters).
|
---|
4055 | string Specifies a string assigned to the variable (up to 512 characters.)
|
---|
4056 |
|
---|
4057 | SET command without parameters will display the current variables.
|
---|
4058 |
|
---|
4059 | with "=",if the string is empty.
|
---|
4060 | set myvar=
|
---|
4061 | Will delete the variable myvar
|
---|
4062 |
|
---|
4063 | Show the name has been used for all variable. For example:
|
---|
4064 | set ex_
|
---|
4065 | Will display all variables beginning with ex_, returns 0 if no match.
|
---|
4066 |
|
---|
4067 | Note: 1. the same of MSDOS.
|
---|
4068 | a full line of command will be conducted before the implementation of variable substitution.
|
---|
4069 | 2. Variable names must beginning with letter or "_".
|
---|
4070 | Otherwise you will not be able to access your variables.
|
---|
4071 | 3. See the previous description for length limit.
|
---|
4072 | 3. To reset all used variable enter command "set *"
|
---|
4073 |
|
---|
4074 | the new command if
|
---|
4075 | if [/I] [NOT] STRING1==STRING2 [COMMAND]
|
---|
4076 | if [NOT] exist VARIABLE|FILENAME [COMMAND]
|
---|
4077 |
|
---|
4078 | STRING1==STRING2
|
---|
4079 | Specifies a true condition if the specified text strings match.
|
---|
4080 | COMMAND
|
---|
4081 | Specifies the command to carry out if the condition is met.
|
---|
4082 | /I
|
---|
4083 | if specified, says to do case insensitive string compares.
|
---|
4084 | NOT
|
---|
4085 | Specifies that should carry out the command only if the condition is false.
|
---|
4086 |
|
---|
4087 | Example:
|
---|
4088 | 1. To determine whether strings are equal, and not case sensitive.
|
---|
4089 | if /i test==%myvar% echo this is a test
|
---|
4090 | 2. To determine the character is empty.
|
---|
4091 | if %myvar%#==# echo variable myvar not defined.
|
---|
4092 | Usage example:
|
---|
4093 | 1. Displays a string including the variable.
|
---|
4094 | echo myvar=%myvar%
|
---|
4095 | 2. Using a variable instead of command.
|
---|
4096 | set print = echo
|
---|
4097 | %print% This a test.
|
---|
4098 | 3. You can use a "^" to stop extended, example
|
---|
4099 | echo %myvar^%
|
---|
4100 | Or
|
---|
4101 | echo %my^var%
|
---|
4102 | Will be displayed %myvar% rather than the extended character after myvar.
|
---|
4103 | Note: We only deal the ^ between the symbols %%.
|
---|
4104 |
|
---|
4105 | ******************************************************************************
|
---|
4106 | ***** GRUB4DOS batch scripting support *****
|
---|
4107 | ******************************************************************************
|
---|
4108 |
|
---|
4109 | The new version supports running a batch script,It very like MS-DOS batch.
|
---|
4110 | Yes!you needn't to learn a new language.
|
---|
4111 |
|
---|
4112 | Example of a simple script:
|
---|
4113 | ========= GRUB4DOS BATCH SCRIPT START ===============================
|
---|
4114 | !BAT #Note: The file header !BAT is necessary to identify this is a batch
|
---|
4115 | echo %0
|
---|
4116 | echo Your type:%1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
4117 | call :Label1 This is a test string
|
---|
4118 | goto :label2
|
---|
4119 | :Label1
|
---|
4120 | echo %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
4121 | goto :eof
|
---|
4122 | :Label2
|
---|
4123 | echo end of batch script.
|
---|
4124 | ========= GRUB4DOS BATCH SCRIPT END ===============================
|
---|
4125 |
|
---|
4126 | Some differences:
|
---|
4127 | 1. Batch will stop when an error occurs.
|
---|
4128 | 2. Use command "exit 1",if you need to stop a running batch script.
|
---|
4129 | 3. %9 refers to all the remaining parameters.
|
---|
4130 | 5. extensions
|
---|
4131 | %~d0 expands %0 to a drive letter.e.g: (hd0,0) ,()
|
---|
4132 | %~p0 expands %0 to a path only
|
---|
4133 | %~n0 expands %0 to a file name only
|
---|
4134 | %~x0 expands %0 to a file extension only
|
---|
4135 | %~f0 expands %0 to a fully qualified path name
|
---|
4136 | %~z0 expands %0 to size of file
|
---|
4137 | 6.You can find some script in below site.
|
---|
4138 | http://chenall.net/post/tag/grub4dos/
|
---|