~smartboyhw/wubi/bug-1080090-new

« back to all changes in this revision

Viewing changes to src/grub4dos/.svn/text-base/README_GRUB4DOS.txt.svn-base

  • Committer: Howard Chan
  • Date: 2012-11-20 10:16:05 UTC
  • Revision ID: smartboyhw@gmail.com-20121120101605-qfmjfsdynpzg9an9
Added images

Show diffs side-by-side

added added

removed removed

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