source: client/shared/lib/grub4dos/README_GRUB4DOS.txt @ 1d1e06d

Last change on this file since 1d1e06d was 7bb3fbde, checked in by adv <adv@…>, 14 years ago

version 1.0.1 #406 actualizar version grub4dos

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2001 a21b9725-9963-47de-94b9-378ad31fedc9

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