1
Please refer to http://grub4dos.sourceforge.net/wiki/ for DOCs on GRUB4DOS.
3
Main project page: https://gna.org/projects/grub4dos/
5
Download site: http://download.gna.org/grub4dos/
6
Download site: http://grub4dos.sourceforge.net/
7
Download site: http://sarovar.org/projects/grub4dos/
8
Download site: http://grub4dos.nufans.net/
9
Download site: http://sites.google.com/site/grubdos/
10
Download site: http://grub4dos.jot.com/
12
Get the latest source code by using anonymous svn in this way:
14
svn co svn://svn.gna.org/svn/grub4dos/trunk grub4dos
18
svn co http://svn.gna.org/svn/grub4dos/trunk grub4dos
20
View the source code online with your web browser at:
22
http://svn.gna.org/viewcvs/grub4dos/trunk/
24
GRUB4DOS mailing list:
26
grub4dos-devel@gna.org
30
https://mail.gna.org/listinfo/grub4dos-devel/
32
Discussion forum(Official technical support site):
34
http://www.boot-land.net/forums/index.php?showforum=66
36
------------------------------------------------------------------------------
39
GRUB [--bypass] [--time-out=T] [--hot-key=K] [--config-file=FILE]
41
The FILE, for example, can be (hd0,0)/menu.lst
43
In CONFIG.SYS, the line looks like:
45
install=c:\some\where\grub.exe --config-file=FILE
47
If no options present, GRUB.EXE simply uses
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.)
55
The partition (hd0,0) can be of a Windows partition or a Linux
56
partition, or any other partition type supported by GRUB.
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)
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:
67
GRUB --config-file="root (hd0,0);chainloader +1"
69
This command will boot the system in (hd0,0).
73
GRUB --config-file="reboot"
75
This command will reboot the machine.
79
GRUB --config-file="halt"
81
This command will halt the machine.
83
if --bypass is specified, GRUB will exit to DOS when
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.
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.
95
Each option can be specified only once at most.
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:
101
GRUB --config-file="#@c:\menu.lst"
103
Only the beginning 4KB of the DOS file will be used. The file
104
should be an uncompressed text file.
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.
111
Update 3(2006-12-23): By default, GRUB.EXE will locate its
112
config file in the following order:
114
(DOS file) .\menu.lst, the MENU.LST in the current dir.
116
(DOS file) \menu.lst, the MENU.LST in the root dir of
118
(GRUB file) /menu.lst, the MENU.LST in the root dir of
121
The default boot device is still (hd0,0).
124
--------------------------------------------------------
126
Update 1: Version 0.2.0 also brings out a new thing, GRUB for NTLDR,
127
which could be used to boot into GRUB from the boot menu
128
of Windows NT/2000/XP. Copy GRLDR to the root directory of
129
drive C: of Windows NT/2000/XP and append to C:\BOOT.INI
132
C:\GRLDR="Start GRUB"
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.
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.
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:
150
C:\GRLDR="Start GRUB"
152
and shouldn't use the letter A like this:
154
A:\GRLDR="Start GRUB"
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).
160
Update 2: GRUB for Linux is also introduced along with 0.2.0. You can
161
boot grub using a linux loader KEXEC, LILO, SYSLINUX or another
162
GRUB. (GRUB4LIN has merged into GRUB.EXE)
164
To boot GRUB off Linux, use this pair of commands:
169
To boot GRUB via GRUB, use commands like the following:
171
kernel (hd0,0)/grub.exe
174
To boot GRUB via LILO, use these lines in lilo.conf:
179
To boot GRUB via SYSLINUX, use these lines in syslinux.cfg:
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.
189
Update 3: Beginning at version 0.4.0, GRUB for DOS supports memdrives.
192
# boot into a floppy image
193
map --mem (hd0,0)/floppy.img (fd0)
200
Because the image will be copied to a memory area, the image
201
itself can be non-contiguous and even gzipped.
205
map --mem=-2880 (hd0,0)/floppy.img (fd0)
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
213
map --mem --read-only (hd0,0)/hd.img (hd1)
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).
218
You can use many memdrives and many ordinary virtual emulated
219
disk-based drives at the same time.
221
If the BIOS does not support int15/EAX=e820h, you will not be
222
able to use any memdrives.
224
Update 4: For memdrive emulation, a single-partition image can be used
225
instead of a whole-harddrive image. Example:
227
map --mem (hd0,7)/win98.img (hd0)
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).
238
Update 5: Now GRLDR can be used as a no-emulation-mode bootable CD-ROM
239
boot image. Example for Linux users:
243
mkisofs -R -b grldr -no-emul-boot -boot-load-seg 0x1000 -o bootable.iso iso_root
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
251
mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root
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.
259
The menu.lst file should be placed in the root dir of the CD.
261
Update 6: The Chinese special build is in the "chinese" subdirectory.
262
(patched by Gandalf, 2005-06-27)
264
The Chinese special build also has scdrom builtin.
265
(update: scdrom has been dropped since 2006-07-20)
267
Update 7: Added memory drive (md). Like (nd) for network drive and (cd)
268
for CD-ROM drive, a new drive (md) is implemented for accessing
269
the whole memory as a disk drive. (md) only works for systems
270
with BIOS int15/EAX=E820h support.
272
The cat command now has a few new options: --hex for hexdump,
273
and --locate=STRING for string search in file.
279
It will display the MBR sector in hex form.
283
It will display 1KB of your memory(in fact, it is the real-mode
284
IDT table), also in hexdump form.
286
cat --hex (md)0x800+1
288
It will display 1 sector of your extended memory.
292
It will display the first sector of partition (hd0,0). Usually
293
this sector contains the boot record of an operating system.
295
Update 8: Added ram drive (rd). The (md) device accesses the memory
296
starting at physical address 0. But (rd) accesses memory
297
starting at any base address. The base and length of the ram
298
drive can be specified through the map command. "help map" for
299
details. You can even specify the BIOS drive number used for
300
the (rd) drive, e.g., map --ram-drive=0xf0. The default drive
301
number for (rd) is 0x7F which is a floppy. If (rd) is a hard
302
drive image, you should change the drive number to a value
303
greater than or equal to 0x80(but should avoid using 0xffff,
304
because 0xffff is for the (md) device).
306
Update 9: Directly boot NTLDR of WinNT/2K/XP and IO.SYS of Win9x/ME and
307
KERNEL.SYS of FreeDOS. Examples:
309
chainloader --edx=0xPPYY (hd0,0)/ntldr
312
chainloader --edx=0xYY (hd0,0)/io.sys
315
chainloader --ebx=0xYY (hd0,0)/kernel.sys
318
Hex YY specifies the boot drive number, and hex PP specifies
319
the boot partition number of NTLDR. If the boot drive is
320
floppy, PP should be the hex value ff, i.e., decimal 255.
322
For KERNEL.SYS of FreeDOS, the --edx won't work,
325
The option --edx ( --ebx ) can be omitted if the file is in
326
its normal place. But in some cases, those options are needed.
328
If, e.g., the ntldr file is in an ext2 partition called
329
(hd2,8) while you want it to think of the Windows partition
330
(hd0,7) as the boot partition, then --edx is required:
332
chainloader --edx=0x0780 (hd2,8)/ntldr
334
For DOS kernels(i.e., IO.SYS and KERNEL.SYS), the boot
335
partition number is meaningless, so you only need to specify
336
the correct boot drive number YY(but specifying the boot
337
partition number is harmless).
339
The above PPYY can also be specified by using a root or
340
rootnoverify command after the chainloader command. Examples:
342
chainloader (hd2,6)/kernel.sys
343
rootnoverify (hd0) <-------- YY=80
346
chainloader (hd0,0)/ntldr
347
rootnoverify (hd0,5) <-------- YY=80, PP=05
350
Tip: CMLDR (the ComMand LoaDeR, which is used to load the
351
Windows Fault Recovery Console) can be chainloaded as well
354
Bean has successfully decompressed and booted IO.SYS of WinME.
355
Thanks for the great job!
357
--------------------------------------------------------
359
There is no full documentation in English at present. Here are some
360
examples showing the usage of disk emulation commands:
362
1. Emulates HD partition C: as floppy drive A: and boot win98 from C:
364
map --read-only (hd0,0)+1 (fd0)
365
chainloader (hd0,0)+1
369
In the above example, (hd0,0) is drive C: with win98 on it. After win98
370
boot complete, you will find that A: contains all files of C:, and if
371
you delete files in A:, the files in C: will also disappear.
373
At the map command line, the notation (hdm,n)+1 is interpreted to
374
represent the whole partition (hdm,n), not just the first sector of the
377
2. Emulates HD partition C: as floppy drive A: and boot win98 from A:
379
map --read-only (hd0,0)+1 (fd0)
386
After the "map --hook" command, the emulation takes effect instantly
387
even in the GRUB command line.
389
Note that the (fd0) in "chainloader (fd0)+1" is the emulated virtual
390
floppy A:, not the real floppy diskette(because map is hooked now).
393
3. Emulates an image file as floppy drive A: and boot win98 from C:
395
map --read-only (hd0,0)/floppy.img (fd0)
396
chainloader (hd0,0)+1
402
4. Emulates an HD partition as the first hard disk and boot DOS from it:
404
map --read-only (hd2,6)+1 (hd0)
406
chainloader (hd0,0)+1
411
In this example, (hd2,6)+1 represents an extended logical DOS partition
412
of the third BIOS hard disk (hd2).
414
If a DOS partition is used to emulate a hard disk, GRUB for DOS will
415
first try to locate the partition table, usually 63 sectors ahead of
416
the DOS partition. GRUB for DOS will refuse the emulation if the
417
partition table is not there.
419
5. Emulates an image file as the first hard disk and boot DOS from it:
421
map --read-only (hd0,0)/harddisk.img (hd0)
422
chainloader --load-length=512 (hd0,0)/harddisk.img
427
If an image file is used to emulate a hard disk, the image file must
428
contain an MBR. In other word, the first sector of HARDDISK.IMG must
429
contain the partition table of the emulated virtual hard disk.
431
Note: Counters for floppies and harddrives in the BIOS Data Area remain
432
unchanged during the mapping. You should manually set them to proper
433
values with `map --floppies=' and/or `map --harddrives=', especially,
434
e.g., when there is no real floppy drive attached to the mother board.
435
If not doing so, DOS might fail to start.
437
`map --status' can report the values. Note also that `map --floppies='
438
and `map --harddrives=' can be used independently without the
439
appearance of mappings.
441
0.4.2 has introduced a new variable, memdisk_raw, to simulate the
442
memdisk-like raw mode. If the BIOS has no int15/87h, or if it has
443
buggy int15/87h support, you should set this variable before any
444
memdrives are used. Here is an example:
447
map --mem (hd0,0)/floppy.img (fd0)
453
If you encountered a memdrive failure without using
454
map --memdisk-raw=1, you should have a try with `map --memdisk-raw=1'.
456
If you `map --memdisk-raw=0' later, you should afterwards do a
457
`map --unhook'(and followed by a `map --hook' if needed).
459
Update: memdisk_raw now defaults to 1. You should `map --memdisk-raw=0'
460
if you want to use int15/87h to access memdrives.
462
--------------------------------------------------------
464
Floppies/harddisks of any size can be emulated with GRUB for DOS 0.2.0.
466
Image file must be contiguous, or else GRUB for DOS will refuse it.
468
The `blocklist' command can list fragments or pieces of a file.
470
Type "help map" at the GRUB prompt to get a brief description of the
477
is a floppy emulation, and the form
481
is a hard disk emulation.
483
When a HARD DISK emulation is used, better not start Windows for
484
security reasons. Windows may even destroy all data and all information
485
on all your real hard disks!!!!!!!!
487
Update for --mem: when --mem is used, it seems rather safe even after
488
entering Windows. Win98 can operate the memdrive normally.
490
Windows NT/2000/XP does not recognize the emulated drives no matter
491
whether the --mem option is present.
495
******************************************************************************
496
*** Explanation of the grldr-bootable floppies or harddisk partitions ***
497
******************************************************************************
499
1. Ext2 Boot Sector/Boot Record Layout (for loading grldr)
500
------------------------------------------------------------------------------
501
An EXT2/EXT3 volume can be GRUB-bootable. Copy grldr and an optional menu.lst
502
to the root dir of the EXT2/EXT3 volume, and build the boot sector based on the
503
fifth sector of grldr(some fields need to be changed as detailed in the
504
following table). And then the EXT2/EXT3 volume is GRUB-bootable.
506
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
507
record onto the first sector of an EXT2/EXT3 volume.
509
Offset Length Description
510
====== ====== ==============================================================
511
00h 2 Machine code for short jump over the data.
513
02h 1 LBA indicator. Valid values are 0x02 for CHS mode, or 0x42 for
516
If the BIOS int13 supports LBA, this byte can be safely set to
519
Some USB BIOSes might have bugs when using CHS mode, so the
520
format program should set this byte to 0x42. It seems that
521
(generally) all USB BIOSes have LBA support.
523
If the format program does not know whether the BIOS has LBA
524
support, it may operate this way:
526
if (partition_start + total_sectors_in_partition) exceeds the
527
CHS addressing ability(especially when it is greater than
528
1024*256*63), the caller should set this byte to 0x42,
529
otherwise, set to 0x02.
531
Note that Windows98 uses the value 0x0e as the LBA indicator.
533
Update: this byte of LBA indicator is ignored. The boot
534
record can probe the LBA support of BIOS.
536
03h 10 OEM name string (of OS which formatted the disk).
537
Update: this field is now used for error message of "I/O error"
539
0Dh 1 Sectors per block. Valid values are 2, 4, 8, 16 and 32.
541
0Eh 2 Bytes per block. Valid values are 0x400, 0x800, 0x1000, 0x2000
544
10h 4 Pointers in pointers-per-block blocks, that is, number of
545
blocks covered by a double-indirect block.
547
Valid values are 0x10000, 0x40000, 0x100000, 0x400000 and
550
14h 4 Pointers per block, that is, number of blocks covered by an
553
Valid values are 0x100, 0x200, 0x400, 0x800, 0x1000.
555
18h 2 Sectors per track.
557
1Ah 2 Number of heads/sides.
559
1Ch 4 Number of hidden sectors (those preceding the boot sector).
561
Also referred to as the starting sector of the partition.
563
For floppies, it should be 0.
565
20h 4 Total number of sectors in the filesystem(or in the partition).
567
24h 1 BIOS drive number of the boot device.
569
Actually this byte is ignored for read. The boot code will
570
write DL onto this byte. The BIOS or the caller should set
573
We assume all BIOSes pass correct drive number in DL.
574
Buggy BIOSes are not supported!!
576
25h 1 Partition number of this partition on the boot drive.
578
0, 1, 2, 3 are primary partitions.
579
4, 5, 6, ... are logical partitions in the extended partition.
581
0xff is for whole drive. So for floppies, it should be 0xff.
583
26h 2 inode size in bytes. (Notice! We use the formerly reserved
584
word here for inode size!)
586
28h 4 Number of inodes per group.
588
Normally a 1.44M floppy has only one group, and the total
589
number of inodes is 184. So the value should be 184 or
592
2Ch 4 The block number for group descriptors.
594
Valid values are 2 for 1024-byte blocks, and 1 otherwise.
596
The value here is equal to (s_first_data_block + 1).
598
30h 1 code for "cld"(0xFC).
600
31h 2 code for "xor ax,ax"(0x31, 0xC0).
602
33h 1 code for "nop"(0x90) or "cwd"(0x99)
604
34h 458 The rest of the machine code.
606
1FEh 2 Boot Signature AA55h.
609
2. FAT12/FAT16 Boot Sector/Boot Record Layout (for loading grldr)
610
------------------------------------------------------------------------------
611
A FAT12/16 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
612
the root dir of the FAT12/16 volume, and build the boot sector based on the
613
fourth sector of grldr(some fields need to be changed as detailed in the
614
following table). And then the FAT12/16 volume is GRUB-bootable.
616
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
617
record onto the boot sector of an FAT12/16 volume.
619
Offset Length Description
620
====== ====== ==============================================================
621
00h 2 Machine code for short jump over the data.
623
02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
626
If the BIOS int13 supports LBA, this byte can be safely set to
629
Some USB BIOSes might have bugs when using CHS mode, so the
630
format program should set this byte to 0x0e. It seems that
631
(generally) all USB BIOSes have LBA support.
633
If the format program does not know whether the BIOS has LBA
634
support, it may operate this way:
636
if (partition_start + total_sectors_in_partition) exceeds the
637
CHS addressing ability(especially when it is greater than
638
1024*256*63), the caller should set this byte to 0x0e,
639
otherwise, set to 0x90.
641
Update: this byte of LBA indicator is ignored. The boot
642
record can probe the LBA support of BIOS.
644
Update(2006-07-31): Though GRLDR won't use this LBA-indicator
645
byte, Windows 98 uses it. Usually this byte should be 0x90 for
646
CHS mode(especially for floppies). If this byte is not set
647
properly, Windows 98 will not recognize the floppy or
648
partition. This problem was reported by neiljoy. Many thanks!
650
03h 8 OEM name string (of OS which formatted the disk).
652
0Bh 2 Bytes per sector. Must be 512.
654
0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
655
and 128. But a cluster size larger than 32K should not occur.
657
0Eh 2 Reserved sectors(number of sectors before the first FAT,
658
including the boot sector), usually 1.
660
10h 1 Number of FATs(nearly always 2).
662
11h 2 Maximum number of root directory entries.
664
13h 2 Total number of sectors (for small disks only, if the disk is
665
too big this is set to 0 and offset 20h is used instead).
667
15h 1 Media descriptor byte, pretty meaningless now (see below).
669
16h 2 Sectors per FAT.
671
18h 2 Sectors per track.
673
1Ah 2 Total number of heads/sides.
675
1Ch 4 Number of hidden sectors (those preceding the boot sector).
677
Also referred to as the starting sector of the partition.
679
For floppies, it should be 0.
681
20h 4 Total number of sectors for large disks.
683
24h 1 BIOS drive number of the boot device.
685
Actually this byte is ignored for read. The boot code will
686
write DL onto this byte. The BIOS or the caller should set
689
We assume all BIOSes pass correct drive number in DL.
690
Buggy BIOSes are not supported!!
692
25h 1 Partition number of this filesystem in the boot drive.
694
This byte is ignored for read. The boot code will write
695
partition number onto this byte. See offset 41h below.
697
26h 1 Signature (must be 28h or 29h to be recognised by NT).
699
27h 4 Volume serial number.
703
36h 8 File system ID. "FAT12 ", "FAT16 " or "FAT ".
705
3Eh 1 code for "cli".
707
3Fh 1 code for "cld".
709
40h 1 code for "mov dh, imm8".
711
41h 1 Partition number of this partition on the boot drive.
713
0, 1, 2, 3 are primary partitions.
714
4, 5, 6, ... are logical partitions in the extended partition.
716
0xff is for whole drive. So for floppies, it should be 0xff.
718
42h 442 The rest of the machine code.
720
1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
723
3. FAT32 Boot Sector/Boot Record Layout (for loading grldr)
724
------------------------------------------------------------------------------
725
A FAT32 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
726
the root dir of the FAT32 volume, and build the boot sector based on the
727
third sector of grldr(some fields need to be changed as detailed in the
728
following table). And then the FAT32 volume is GRUB-bootable.
730
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
731
record onto the boot sector of an FAT32 volume.
733
Offset Length Description
734
====== ====== ==============================================================
735
00h 2 Machine code for short jump over the data.
737
02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
740
If the BIOS int13 supports LBA, this byte can be safely set to
743
Some USB BIOSes might have bugs when using CHS mode, so the
744
format program should set this byte to 0x0e. It seems that
745
(generally) all USB BIOSes have LBA support.
747
If the format program does not know whether the BIOS has LBA
748
support, it may operate this way:
750
if (partition_start + total_sectors_in_partition) exceeds the
751
CHS addressing ability(especially when it is greater than
752
1024*256*63), the caller should set this byte to 0x0e,
753
otherwise, set to 0x90.
755
Update: this byte of LBA indicator is ignored. The boot
756
record can probe the LBA support of BIOS.
758
Update(2006-07-31): Though GRLDR won't use this LBA-indicator
759
byte, Windows 98 uses it. Usually this byte should be 0x90 for
760
CHS mode(especially for floppies). If this byte is not set
761
properly, Windows 98 will not recognize the floppy or
762
partition. This problem was reported by neiljoy. Many thanks!
764
03h 8 OEM name string (of OS which formatted the disk).
766
0Bh 2 Bytes per sector. Must be 512.
768
0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
769
and 128. But a cluster size larger than 32K should not occur.
771
0Eh 2 Reserved sectors(number of sectors before the first FAT,
772
including the boot sector), usually 1.
774
10h 1 Number of FATs(nearly always 2).
776
11h 2 (Maximum number of root directory entries)Must be 0.
778
13h 2 (Total number of sectors for small disks only)Must be 0.
780
15h 1 Media descriptor byte, pretty meaningless now (see below).
782
16h 2 (Sectors per FAT)Must be 0.
784
18h 2 Sectors per track.
786
1Ah 2 Total number of heads/sides.
788
1Ch 4 Number of hidden sectors (those preceding the boot sector).
790
Also referred to as the starting sector of the partition.
792
For floppies, it should be 0.
794
20h 4 Total number of sectors for large disks.
796
24h 4 FAT32 sectors per FAT.
798
28h 2 If bit 7 is clear then all FATs are updated, otherwise bits
799
0-3 give the current active FAT, all other bits are reserved.
801
2Ah 2 High byte is major revision number, low byte is minor revision
802
number, currently both are 0.
804
2Ch 4 Root directory starting cluster.
806
30h 2 File system information sector.
808
32h 2 If non-zero this gives the sector which holds a copy of the
809
boot record, usually 6.
811
34h 12 Reserved, set to 0.
813
40h 1 BIOS drive number of the boot device.
815
80h is first HDD, 00h is first FDD.
817
Actually this byte is ignored for read. The boot code will
818
write DL onto this byte. The BIOS or the caller should set
821
We assume all BIOSes pass correct drive number in DL.
822
Buggy BIOSes are not supported!!
824
41h 1 Partition number of this filesystem in the boot drive.
826
This byte is ignored for read. The boot code will write
827
partition number onto this byte. See offset 5Dh below.
829
42h 1 Signature (must be 28h or 29h to be recognised by NT).
831
43h 4 Volume serial number.
835
52h 8 File system ID. "FAT32 ".
837
5Ah 1 opcode for "cli".
839
5Bh 1 opcode for "cld".
841
5Ch 1 opcode for "mov dh, imm8".
843
5Dh 1 Partition number of this partition on the boot drive.
845
0, 1, 2, 3 are primary partitions.
846
4, 5, 6, ... are logical partitions in the extended partition.
848
0xff is for whole drive. So for floppies, it should be 0xff.
850
5Eh 414 The rest of the machine code.
852
1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
855
4. NTFS Boot Sector/Boot Record Layout (for loading grldr)
856
------------------------------------------------------------------------------
857
An NTFS volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
858
the root dir of the NTFS volume, and build the boot sector based on the
859
6th-9th sectors of grldr(some fields need to be changed as detailed in the
860
following table). And then the NTFS volume is GRUB-bootable.
862
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
863
record onto the leading 4 sectors of an NTFS volume.
865
Offset Length Description
866
====== ====== ==============================================================
867
00h 2 Machine code for short jump over the data.
869
02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
872
If the BIOS int13 supports LBA, this byte can be safely set to
875
Some USB BIOSes might have bugs when using CHS mode, so the
876
format program should set this byte to 0x0e. It seems that
877
(generally) all USB BIOSes have LBA support.
879
If the format program does not know whether the BIOS has LBA
880
support, it may operate this way:
882
if (partition_start + total_sectors_in_partition) exceeds the
883
CHS addressing ability(especially when it is greater than
884
1024*256*63), the caller should set this byte to 0x0e,
885
otherwise, set to 0x90.
887
Update: this byte of LBA indicator is ignored. The boot
888
record can probe the LBA support of BIOS.
890
Update(2006-07-31): Though GRLDR won't use this LBA-indicator
891
byte, Windows 98 uses it. Usually this byte should be 0x90 for
892
CHS mode(especially for floppies). If this byte is not set
893
properly, Windows 98 will not recognize the floppy or
894
partition. This problem was reported by neiljoy. Many thanks!
896
03h 8 OEM name string (of OS which formatted the disk).
898
0Bh 2 Bytes per sector. Must be 512.
900
0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
901
and 128. But a cluster size larger than 32K should not occur.
903
0Eh 2 (Reserved sectors)Unused.
905
10h 1 (Number of FATs)Must be 0.
907
11h 2 (Maximum number of root directory entries)Must be 0.
909
13h 2 (Total number of sectors for small disks only)Must be 0.
911
15h 1 Media descriptor byte, pretty meaningless now (see below).
913
16h 2 (Sectors per FAT)Must be 0.
915
18h 2 Sectors per track.
917
1Ah 2 Total number of heads/sides.
919
1Ch 4 Number of hidden sectors (those preceding the boot sector).
921
Also referred to as the starting sector of the partition.
923
For floppies, it should be 0.
925
20h 4 (Total number of sectors for large disks)Must be 0.
927
24h 4 (FAT32 sectors per FAT) - Usually 80 00 80 00, A value of
928
80 00 00 00 has been seen on a USB thumb drive which is
929
formatted with NTFS under Windows XP. Note this is removable
930
media and is not partitioned, the drive as a whole is NTFS
933
28h 8 Number of sectors in the volume.
935
30h 8 LCN of VCN 0 of the $MFT.
937
38h 8 LCN of VCN 0 of the $MFTMirr.
939
40h 4 Clusters per MFT Record.
941
44h 4 Clusters per Index Record.
943
48h 8 Volume serial number.
945
50h 4 Checksum, usually 0.
947
54h 1 opcode for "cli".
949
55h 1 opcode for "cld".
951
56h 1 opcode for "mov dh, imm8".
953
57h 1 Partition number of this partition on the boot drive.
955
0, 1, 2, 3 are primary partitions.
956
4, 5, 6, ... are logical partitions in the extended partition.
958
0xff is for whole drive. So for floppies, it should be 0xff.
960
58h 420 The rest of the machine code in the first sector.
962
1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
964
200h 1536 The rest of the machine code in the last 3 sectors.
966
------------------------------------------------------------------------------
968
Appendix A: File System Information Sector of FAT32(not used by grldr)
970
Offset Length Description
971
====== ====== ==============================================================
972
0h 4 Leading Signature 41615252h.
974
4h 480 Reserved, set to 0.
976
1E4h 4 FSI structure signature 61417272h.
978
1E8h 4 Contains the last known count of free clusters, if this is
979
equal to FFFFFFFFh, then the count is unknown.
981
1ECh 4 Cluster number at which you should begin a search for a free
982
cluster, if this is equal to FFFFFFFFh then the field has not
985
1F0h 12 Reserved, set to 0.
987
1FCh 4 Trailing Signature AA550000h.
989
------------------------------------------------------------------------------
991
Appendix B: Media Descriptor Byte(not used by grldr)
993
The Media descriptor byte is meaningless because of the duplications, F0h for
996
Byte Type of disk Sectors Heads Tracks Capacity
997
---- ------------ ------- ----- ------ --------
998
FFh 5 1/4" 8 2 40 320KB
999
FEh 5 1/4" 8 1 40 160KB
1000
FDh 5 1/4" 9 2 40 360KB
1001
FCh 5 1/4" 9 1 40 180KB
1002
FBh both 9 2 80 640KB
1003
FAh both 9 1 80 320KB
1004
F9h 5 1/4" 15 2 80 1200KB
1005
F9h 3 1/2" 9 2 80 720KB
1006
F0h 3 1/2" 18 2 80 1440KB
1007
F0h 3 1/2" 36 2 80 2880KB
1008
F8h hard disk NA NA NA NA
1010
******************************************************************************
1011
*** grldr.mbr - How to write it to Master Boot Track of the hard disk ***
1012
******************************************************************************
1014
grldr.mbr contains code that can be used as Master Boot Record. The code is
1015
responsible for searching all partitions for grldr and when found, loading it.
1016
Currently supported partition types are: FAT12/FAT16/FAT32, NTFS, EXT2/EXT3.
1017
Logical partitions in the extended partition are supported, provided that the
1018
extended partition type is Microsoft-compatible. In fact, the Linux extended
1019
partition type(0x85) is not fully tested for the search mechanism.
1021
How to write GRLDR.MBR to the Master Boot Track of a hard disk?
1023
First, read the Windows disk signature and partition information bytes
1024
(72 bytes in total, from offset 0x01b8 to 0x01ff of the MBR sector), and put
1025
them on the same range from offset 0x01b8 to 0x01ff of the beginning sector of
1028
Optionally, if the MBR in the hard disk is a single sector MBR created by
1029
Microsoft FDISK, it may be copied onto the second sector of GRLDR.MBR.
1031
The second sector of GRLDR.MBR is called "previous MBR". When GRLDR not found,
1032
"previous MBR" will be started.
1034
No other steps needed, after all necessary changes stated above have been made,
1035
now simply write GRLDR.MBR on to the Master Boot Track. That's all.
1037
Note: The Master Boot Track means the first track of the hard drive.
1039
Note: The bootstrap code of GRLDR.MBR only finds GRLDR file in the root dir of
1040
a partition. You'd better place menu.lst file accompanying with GRLDR(i.e., in
1041
the same root dir of the same partition as GRLDR).
1043
The filename "grldr" in an ext2 partition must be in lower case letters, and
1044
the file type of grldr must be plain regular. Other types, e.g., a symbolic
1047
Update: bootlace.com is a DOS/Linux utility for installing grldr.mbr to MBR.
1048
The whole grldr.mbr is embedded in the body of the bootlace.com utility, so
1049
bootlace.com can be used independently. See below.
1051
******************************************************************************
1052
*** grldr.mbr - Details about the control bytes ***
1053
******************************************************************************
1055
Six bytes can be used to control the boot process of GRLDR.MBR.
1057
Offset Length Description
1058
====== ====== ==============================================================
1059
02h 1 bit0=1: disable the search for GRLDR on floppy
1060
bit0=0: enable the search for GRLDR on floppy
1062
bit1=1: disable the boot of PREVIOUS MBR with invalid
1063
partition table(usually an OS boot sector)
1064
bit1=0: enable the boot of PREVIOUS MBR with invalid
1065
partition table(usually an OS boot sector)
1067
bit2=1: disable the feature of unconditional entrance to
1068
the command-line(See below `--duce')
1069
bit2=0: enable the feature of unconditional entrance to
1070
the command-line(See below `--duce')
1072
bit3=1: disable geometry tune(See below `--chs-no-tune')
1073
bit3=0: enable geometry tune(See below `--chs-no-tune')
1075
bit4 - bit6: reserved
1077
bit7=1: try to boot PREVIOUS MBR after the search for GRLDR
1078
bit7=0: try to boot PREVIOUS MBR before the search for GRLDR
1080
03h 1 timeout in seconds to wait for a key press. 0xff stands for
1081
waiting all the time(endless).
1083
04h 2 hot-key code. high byte is scan code, low byte is ASCII code.
1084
the default value is 0x3920, which stands for the space bar.
1085
if this key is pressed, GRUB will be started prior to the boot
1086
of previous MBR. See "int 16 keyboard scan codes" below.
1088
06h 1 preferred boot drive number, 0xff for no-drive
1089
07h 1 preferred partition number, 0xff for whole drive
1091
if the preferred boot drive number is 0xff, the order of the
1092
search for GRLDR will be:
1094
(hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
1095
(hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
1096
... ... ... ... ... ... ... ...
1097
(hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
1098
(X=max harddrive number)
1101
otherwise, if the preferred boot drive number is Y(not equal to
1102
0xff) and the preferred partition number is K, then the order of
1103
the search for GRLDR will be:
1105
(Y) if K=0xff; or (Y,K) otherwise
1106
(hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
1107
(hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
1108
... ... ... ... ... ... ... ...
1109
(hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
1110
(X=max harddrive number)
1113
Note: if Y < 0x80, then (Y) is floppy, else (Y) is harddrive,
1114
and (Y,K) is partition number K on harddrive (Y).
1117
******************************************************************************
1118
*** bootlace.com - Install GRLDR.MBR bootstrap code to MBR ***
1119
******************************************************************************
1121
BOOTLACE.COM installs GRLDR.MBR boot record to the MBR of a harddrive or of a
1122
harddrive image file, or to the boot sector of a floppy or a floppy image.
1126
bootlace.com [OPTIONS] DEVICE_OR_FILE
1130
--read-only do everything except the actual write to the
1131
specified DEVICE_OR_FILE.
1133
--restore-mbr restore the previous mbr.
1135
--mbr-no-bpb do not copy BPB in the boot sector of the
1136
leading FAT partition to MBR.
1138
--no-backup-mbr do not copy the old MBR to the second sector of
1141
--force-backup-mbr force the copy of old MBR to the second sector
1144
--mbr-enable-floppy enable the search for GRLDR on floppy.
1146
--mbr-disable-floppy disable the search for GRLDR on floppy.
1148
--mbr-enable-osbr enable the boot of PREVIOUS MBR with invalid
1149
partition table(usually an OS boot sector).
1151
--mbr-disable-osbr disable the boot of PREVIOUS MBR with invalid
1152
partition table(usually an OS boot sector).
1154
--duce disable the feature of unconditional entrance
1155
to the command-line.
1157
Normally one can unconditionally get the
1158
command-line console by a keypress of `C',
1159
bypassing all config-files(including the
1160
preset-menu). This is a security hole. So we
1161
need this option to disable the feature.
1163
DUCE is for Disable Unconditional Command-line
1166
--chs-no-tune disable the feature of geometry tune.
1168
--boot-prevmbr-first try to boot PREVIOUS MBR before the search for
1171
--boot-prevmbr-last try to boot PREVIOUS MBR after the search for
1174
--preferred-drive=D preferred boot drive number, 0 <= D < 255.
1176
--preferred-partition=P preferred partition number, 0 <= P < 255.
1178
--serial-number=SN setup a new serial number for the hard drive.
1179
SN must be non-zero.
1181
--time-out=T wait T seconds before booting PREVIOUS MBR. if
1182
T is 0xff, wait forever. The default is 5.
1184
--hot-key=K if the desired key K is pressed, start GRUB
1185
before booting PREVIOUS MBR. K is a word
1186
value, just as the value in AX register
1187
returned from int16/AH=1. The high byte is the
1188
scan code and the low byte is ASCII code. The
1189
default is 0x3920 for space bar. See "int 16
1190
keyboard scan codes" below.
1192
--floppy if DEVICE_OR_FILE is floppy, use this option.
1194
--floppy=N if DEVICE_OR_FILE is a partition on a hard
1195
drive, use this option. N is used to specify
1196
the partition number: 0,1,2 and 3 for the
1197
primary partitions, and 4,5,6,... for the
1200
--sectors-per-track=S specifies sectors per track for --floppy.
1201
1 <= S <= 63, default is 63.
1203
--heads=H specifies number of heads for --floppy.
1204
1 <= H <= 256, default is 255.
1206
--start-sector=B specifies hidden sectors for --floppy=N.
1208
--total-sectors=C specifies total sectors for --floppy.
1211
--lba use lba mode for --floppy. If the floppy BIOS
1212
has LBA support, you can specify --lba here.
1213
It is assumed that all floppy BIOSes have CHS
1214
support. So you would rather specify --chs.
1215
If neither --chs nor --lba is specified, then
1216
the LBA indicator(i.e., the third byte of the
1217
boot sector) will not be touched.
1219
--chs use chs mode for --floppy. You should specify
1220
--chs if the floppy BIOS does not support LBA.
1221
We assume all floppy BIOSes have CHS support.
1222
So it is likely you want to specify --chs.
1223
If neither --chs nor --lba is specified, then
1224
the LBA indicator(i.e., the third byte of the
1225
boot sector) will not be touched.
1227
--fat12 FAT12 is allowed to be installed for --floppy.
1229
--fat16 FAT16 is allowed to be installed for --floppy.
1231
--fat32 FAT32 is allowed to be installed for --floppy.
1233
--vfat FAT12/16/32 are allowed to be installed for
1236
--ntfs NTFS is allowed to be installed for --floppy.
1238
--ext2 EXT2 is allowed to be installed for --floppy.
1240
--install-partition=I Install the boot record onto the boot area of
1241
partition number I of the specified hard drive
1242
or harddrive image DEVICE_OR_FILE.
1244
DEVICE_OR_FILE: Filename of the device or the image file. For DOS, a BIOS drive
1245
number(hex 0xHH or decimal DDD) can be used to access the drive. BIOS drive
1246
number 0 is for the first floppy, 1 is for the second floppy; 0x80 is for the
1247
first hard drive, 0x81 is for the second hard drive, etc.
1249
Note: BOOTLACE.COM writes only the boot code to MBR. The boot code needs to
1250
load GRLDR as the second(and last) stage of the GRUB boot process. Therefore
1251
GRLDR should be copied to the root directory of one of the supported
1252
partitions, either before or after a successful execution of BOOTLACE.COM.
1253
Currently only partitions with filesystem type of FAT12, FAT16, FAT32, NTFS,
1254
EXT2 or EXT3 are supported.
1256
Note 2: If DEVICE_OR_FILE is a harddisk device or a harddisk image file, it
1257
must contain a valid partition table, otherwise, BOOTLACE.COM will fail. If
1258
DEVICE_OR_FILE is a floppy device or a floppy image file, then it must contain
1259
a supported filesystem(i.e., either of FAT12/FAT16/FAT32/NTFS/EXT2/EXT3).
1261
Note 3: If DEVICE_OR_FILE is a floppy device or a floppy image file, and it
1262
was formated EXT2/EXT3, then you should specify --sectors-per-track and
1266
Important!! If you install GRLDR Boot Record to a floppy or a partition, the
1267
floppy or partition will boot solely grldr, and your original
1268
IO.SYS(DOS/Win9x/Me) and NTLDR(WinNT/2K/XP) will become unbootable. This is
1269
because the original boot record of the floppy or partition was overwritten.
1270
There is no such problem when installing GRLDR Boot Record onto the MBR.
1271
Update: Some NTLDR/IO.SYS/KERNEL.SYS files can be directly chainloaded in the
1274
Tip: If the filename begins in a dash(-) or a digit, you may prefix a dirname
1279
Installing GRLDR boot code to MBR under Linux:
1281
bootlace.com /dev/hda
1283
Installing GRLDR boot code to MBR under DOS:
1287
Installing GRLDR boot code to a harddisk image under DOS or Linux:
1291
Installing GRLDR boot code to floppy under Linux:
1293
bootlace.com --floppy --chs /dev/fd0
1295
Installing GRLDR boot code to floppy under DOS:
1297
bootlace.com --floppy --chs 0x00
1299
Installing GRLDR boot code to a floppy image under DOS or Linux:
1301
bootlace.com --floppy --chs floppy.img
1303
BOOTLACE.COM cannot function well under Windows NT/2000/XP/2003. It is expected
1304
(and designed) to run under DOS/Win9x and Linux. Update: For image FILES,
1305
bootlace.com function well under Windows NT/2000/XP/2003. For devices,
1306
bootlace.com will not work under Windows NT/2000/XP/2003 because bootlace.com
1307
is a DOS utility and Windows NT/2000/XP/2003 does not allow bootlace.com to
1310
******************************************************************************
1311
*** kexec-tools should be patched for the 1.101 release ***
1312
******************************************************************************
1314
The file kexec-tools-1.101-patch is a patch to the kexec-tools-1.101 release.
1315
Kexec might fail to load grub.exe without this patch.
1317
The home page of kexec-tools is:
1319
http://www.xmission.com/~ebiederm/files/kexec/
1321
Note: The Linux kernel should be KEXEC enabled before kexec can be run.
1323
!! Important Update !!
1325
The patch `kexec-tools-1.101-patch' is not needed now and has been deleted.
1326
Even worse, it fails in `kexec -l grub.exe --initrd=imgfile'. So please
1327
do not use it any more.
1329
******************************************************************************
1330
*** Direct transition to DOS/Win9x from within Linux ***
1331
******************************************************************************
1333
By using kexec, we can easily boot into DOS/Win9x from a running Linux system.
1335
If WIN98.IMG is a bootable hard-disk image, do as follows:
1337
kexec -l grub.exe --initrd=WIN98.IMG --command-line="--config-file=map (rd) (hd0); map --hook; chainloader (hd0)+1; rootnoverify (hd0)"
1341
If DOS.IMG is a bootable floppy image, do this way:
1343
kexec -l grub.exe --initrd=DOS.IMG --command-line="--config-file=map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
1347
Note that in this manner, we can boot DOS/Win9x without using a real DOS/Win9x
1348
disk. We need no FAT partition but an image file.
1350
We have noticed that Linux itself can act as a big boot manager by using kexec
1351
and grub.exe. This may be convenient to developers who write installation or
1352
bootstrap or initialization programs.
1354
Certainly, grub.exe and the bootable disk image can also be loaded by a running
1355
GRUB or LILO or syslinux. Examples:
1359
kernel (hd0,0)/grub.exe --config-file="map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
1360
initrd (hd0,0)/DOS.IMG
1365
image=/boot/grub.exe
1367
initrd=/boot/DOS.IMG
1368
append="--config-file=map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
1370
3. Loaded by SYSLINUX:
1374
append initrd=DOS.IMG --config-file="map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)"
1376
Note: If the above `map (rd) (...)' failed, you may use `map (rd)+1 (...)'
1377
instead and try again.
1379
******************************************************************************
1380
*** Keyboard BIOS Scan Code/ASCII code tables ***
1381
******************************************************************************
1383
Keyboard bios scan code and ascii character code tables can be obtained from
1384
the web by, for example, googling for "3920 372A 4A2D 4E2B 352F". Here are 2
1387
1. From "http://heim.ifi.uio.no/~stanisls/helppc/scan_codes.html":
1389
INT 16 - Keyboard Scan Codes
1391
Key Normal Shifted w/Ctrl w/Alt
1393
A 1E61 1E41 1E01 1E00
1394
B 3062 3042 3002 3000
1395
C 2E63 2E43 2E03 2E00
1396
D 2064 2044 2004 2000
1397
E 1265 1245 1205 1200
1398
F 2166 2146 2106 2100
1399
G 2267 2247 2207 2200
1400
H 2368 2348 2308 2300
1401
I 1769 1749 1709 1700
1402
J 246A 244A 240A 2400
1403
K 256B 254B 250B 2500
1404
L 266C 264C 260C 2600
1405
M 326D 324D 320D 3200
1406
N 316E 314E 310E 3100
1407
O 186F 184F 180F 1800
1408
P 1970 1950 1910 1900
1409
Q 1071 1051 1011 1000
1410
R 1372 1352 1312 1300
1411
S 1F73 1F53 1F13 1F00
1412
T 1474 1454 1414 1400
1413
U 1675 1655 1615 1600
1414
V 2F76 2F56 2F16 2F00
1415
W 1177 1157 1117 1100
1416
X 2D78 2D58 2D18 2D00
1417
Y 1579 1559 1519 1500
1418
Z 2C7A 2C5A 2C1A 2C00
1420
Key Normal Shifted w/Ctrl w/Alt
1423
2 0332 0340 0300 7900
1427
6 0736 075E 071E 7D00
1433
Key Normal Shifted w/Ctrl w/Alt
1435
- 0C2D 0C5F 0C1F 8200
1437
[ 1A5B 1A7B 1A1B 1A00
1438
] 1B5D 1B7D 1B1D 1B00
1442
\ 2B5C 2B7C 2B1C 2600 (same as Alt L)
1447
Key Normal Shifted w/Ctrl w/Alt
1449
F1 3B00 5400 5E00 6800
1450
F2 3C00 5500 5F00 6900
1451
F3 3D00 5600 6000 6A00
1452
F4 3E00 5700 6100 6B00
1453
F5 3F00 5800 6200 6C00
1454
F6 4000 5900 6300 6D00
1455
F7 4100 5A00 6400 6E00
1456
F8 4200 5B00 6500 6F00
1457
F9 4300 5C00 6600 7000
1458
F10 4400 5D00 6700 7100
1459
F11 8500 8700 8900 8B00
1460
F12 8600 8800 8A00 8C00
1462
Key Normal Shifted w/Ctrl w/Alt
1464
BackSpace 0E08 0E08 0E7F 0E00
1465
Del 5300 532E 9300 A300
1466
Down Arrow 5000 5032 9100 A000
1467
End 4F00 4F31 7500 9F00
1468
Enter 1C0D 1C0D 1C0A A600
1469
Esc 011B 011B 011B 0100
1470
Home 4700 4737 7700 9700
1471
Ins 5200 5230 9200 A200
1473
Keypad * 372A 9600 3700
1474
Keypad - 4A2D 4A2D 8E00 4A00
1475
Keypad + 4E2B 4E2B 4E00
1476
Keypad / 352F 352F 9500 A400
1477
Left Arrow 4B00 4B34 7300 9B00
1478
PgDn 5100 5133 7600 A100
1479
PgUp 4900 4939 8400 9900
1481
Right Arrow 4D00 4D36 7400 9D00
1482
SpaceBar 3920 3920 3920 3920
1483
Tab 0F09 0F00 9400 A500
1484
Up Arrow 4800 4838 8D00 9800
1487
- Some key combinations are not available on all systems. The PS/2
1488
includes many that aren't available on the PC, XT and AT.
1489
- To retrieve the character from a scan code logical AND the word
1491
- see INT 16 MAKE CODES
1495
2. From "http://www.hoppie.nl/ivan/keycodes.txt":
1499
Keystroke Keypress code
1500
--------------------------------------------------
1576
White Left Arrow 4B00
1578
White Right Arrow 4D00
1581
White Down Arrow 5000
1587
Enter (number keypad) 1C0D
1594
Gray Left Arrow 4B00
1595
Gray Right Arrow 4D00
1597
Gray Down Arrow 5000
1615
Shift Backspace 0E08
1616
Shift Tab (Backtab) 0F00
1671
Shift Scroll Lock **
1672
Shift 7 (number pad) 4737
1673
Shift 8 (number pad) 4838
1674
Shift 9 (number pad) 4939
1676
Shift 4 (number pad) 4B34
1677
Shift 5 (number pad) 4C35
1678
Shift 6 (number pad) 4D36
1680
Shift 1 (number pad) 4F31
1681
Shift 2 (number pad) 5032
1682
Shift 3 (number pad) 5133
1683
Shift 0 (number pad) 5230
1684
Shift . (number pad) 532E
1686
Shift Key 45 [1] 567C
1687
Shift Enter (number pad) 1C0D
1691
Shift Gray Home 4700
1692
Shift Gray Up Arrow 4800
1693
Shift Gray Page Up 4900
1694
Shift Gray Left Arrow 4B00
1695
Shift Gray Right Arrow 4D00
1697
Shift Gray Down Arrow 5000
1698
Shift Gray Page Down 5100
1699
Shift Gray Insert 5200
1700
Shift Gray Delete 5300
1715
Ctrl Backspace (DEL) 0E7F
1729
Ctrl Enter (LF) 1C0A
1735
Ctrl h (Backspace) 2308
1772
Ctrl White Home 7700
1773
Ctrl White Up Arrow 8D00
1774
Ctrl White PgUp 8400
1776
Ctrl White Left Arrow 7300
1777
Ctrl 5 (number pad) 8F00
1778
Ctrl White Right Arrow 7400
1781
Ctrl White Down Arrow 9100
1782
Ctrl White PgDn 7600
1787
Ctrl Enter (number pad) 1C0A
1788
Ctrl / (number pad) 9500
1792
Ctrl Gray Up Arrow 8DE0
1793
Ctrl Gray Page Up 8400
1794
Ctrl Gray Left Arrow 7300
1795
Ctrl Gray Right Arrow 7400
1797
Ctrl Gray Down Arrow 91E0
1798
Ctrl Gray Page Down 7600
1799
Ctrl Gray Insert 92E0
1800
Ctrl Gray Delete 93E0
1874
Alt 7 (number pad) #
1875
Alt 8 (number pad) #
1876
Alt 9 (number pad) #
1877
Alt 4 (number pad) #
1878
Alt 5 (number pad) #
1879
Alt 6 (number pad) #
1880
Alt 1 (number pad) #
1881
Alt 2 (number pad) #
1882
Alt 3 (number pad) #
1886
Alt Enter (number pad) A600
1887
Alt / (number pad) A400
1891
Alt Gray Up Arrow 9800
1892
Alt Gray Page Up 9900
1893
Alt Gray Left Arrow 9B00
1894
Alt Gray Right Arrow 9D00
1896
Alt Gray Down Arrow A000
1897
Alt Gray Page Down A100
1898
Alt Gray Insert A200
1899
Alt Gray Delete A300
1901
-------------------------------------------------------------------------
1905
[1] In the United States, the 101/102-key keyboard is shipped
1906
with 101 keys. Overseas versions have an additional key
1907
sandwiched between the left Shift key and the Z key. This
1908
additional key is identified by IBM (and in this table) as
1911
[**] Keys and key combinations marked ** are used by the ROM BIOS
1912
but do not put values into the keyboard buffer.
1914
[--] Keys and key combinations marked -- are ignored by the ROM
1920
3. From "http://heim.ifi.uio.no/~stanisls/helppc/make_codes.html":
1923
INT 9 - Hardware Keyboard Make/Break Codes
1925
Key Make Break Key Make Break
1927
Backspace 0E 8E F1 3B BB
1928
Caps Lock 3A BA F2 3C BC
1929
Enter 1C 9C F3 3D BD
1931
Left Alt 38 B8 F7 41 C1
1932
Left Ctrl 1D 9D F5 3F BF
1933
Left Shift 2A AA F6 40 C0
1934
Num Lock 45 C5 F8 42 C2
1935
Right Shift 36 B6 F9 43 C3
1936
Scroll Lock 46 C6 F10 44 C4
1937
Space 39 B9 F11 57 D7
1938
Sys Req (AT) 54 D4 F12 58 D8
1941
Keypad Keys Make Break
1943
Keypad 0 (Ins) 52 D2
1944
Keypad 1 (End) 4F CF
1945
Keypad 2 (Down arrow) 50 D0
1946
Keypad 3 (PgDn) 51 D1
1947
Keypad 4 (Left arrow) 4B CB
1949
Keypad 6 (Right arrow) 4D CD
1950
Keypad 7 (Home) 47 C7
1951
Keypad 8 (Up arrow) 48 C8
1952
Keypad 9 (PgUp) 49 C9
1953
Keypad . (Del) 53 D3
1954
Keypad * (PrtSc) 37 B7
1958
Key Make Break Key Make Break
1974
Key Make Break Key Make Break
1989
Enhanced Keyboard Keys (101/102 keys)
1991
Control Keys Make Break
1993
Alt-PrtSc (SysReq) 54 D4
1994
Ctrl-PrtSc E0 37 E0 B7
1996
PrtSc E0 2A E0 37 E0 B7 E0 AA
1997
Right Alt E0 38 E0 B8
1998
Right Ctrl E0 1D E0 9D
1999
Shift-PrtSc E0 37 E0 B7
2001
Pause E1 1D 45 E1 9D C5 (not typematic)
2002
Ctrl-Pause (Ctrl-Break) E0 46 E0 C6 (not typematic)
2004
- Keys marked as "not typematic" generate one stream of bytes
2005
without corresponding break scan code bytes (actually the
2006
break codes are part of the make code).
2011
Key Make Break |----- Numlock on ------.
2013
Del E0 53 E0 D3 E0 2A E0 53 E0 D3 E0 AA
2014
Down arrow E0 50 E0 D0 E0 2A E0 50 E0 D0 E0 AA
2015
End E0 4F E0 CF E0 2A E0 4F E0 CF E0 AA
2016
Home E0 47 E0 C7 E0 2A E0 47 E0 C7 E0 AA
2017
Ins E0 52 E0 D2 E0 2A E0 52 E0 D2 E0 AA
2018
Left arrow E0 4B E0 CB E0 2A E0 4B E0 CB E0 AA
2019
PgDn E0 51 E0 D1 E0 2A E0 51 E0 D1 E0 AA
2020
PgUp E0 49 E0 C9 E0 2A E0 49 E0 C9 E0 AA
2021
Right arrow E0 4D E0 CD E0 2A E0 4D E0 CD E0 AA
2022
Up arrow E0 48 E0 C8 E0 2A E0 48 E0 C8 E0 AA
2024
Key |--Left Shift Pressed--. |--Right Shift Pressed--.
2025
Make Break Make Break
2026
Del E0 AA E0 53 E0 D3 E0 2A E0 B6 E0 53 E0 D3 E0 36
2027
Down arrow E0 AA E0 50 E0 D0 E0 2A E0 B6 E0 50 E0 D0 E0 36
2028
End E0 AA E0 4F E0 CF E0 2A E0 B6 E0 4F E0 CF E0 36
2029
Home E0 AA E0 47 E0 C7 E0 2A E0 B6 E0 47 E0 C7 E0 36
2030
Ins E0 AA E0 52 E0 D2 E0 2A E0 B6 E0 52 E0 D2 E0 36
2031
Left arrow E0 AA E0 4B E0 CB E0 2A E0 B6 E0 4B E0 CB E0 36
2032
PgDn E0 AA E0 51 E0 D1 E0 2A E0 B6 E0 51 E0 D1 E0 36
2033
PgUp E0 AA E0 49 E0 C9 E0 2A E0 B6 E0 49 E0 C9 E0 36
2034
Right arrow E0 AA E0 4D E0 CD E0 2A E0 B6 E0 4D E0 CD E0 36
2035
Up arrow E0 AA E0 48 E0 C8 E0 2A E0 B6 E0 48 E0 C8 E0 36
2036
/ E0 AA E0 35 E0 B5 E0 2A E0 B6 E0 35 E0 B5 E0 36
2039
- The PS/2 models have three make/break scan code sets. The first
2040
set matches the PC & XT make/break scan code set and is the one
2041
listed here. Scan code sets are selected by writing the value F0
2042
to the keyboard via the 8042 (port 60h). The following is a brief
2043
description of the scan code sets (see the PS/2 Technical Reference
2044
manuals for more information on scan code sets 2 and 3):
2046
/ set 1, each key has a base scan code. Some keys generate
2047
extra scan codes to generate artificial shift states. This
2048
is similar to the standard scan code set used on the PC and XT.
2049
/ set 2, each key sends one make scan code and two break scan
2050
codes bytes (F0 followed by the make code). This scan code
2051
set is available on the IBM AT also.
2052
/ set 3, each key sends one make scan code and two break scan
2053
codes bytes (F0 followed by the make code) and no keys are
2054
altered by Shift/Alt/Ctrl keys.
2055
/ typematic scan codes are the same as the make scan code
2057
- Some Tandy 1000's do not handle Alt key combinations when multiple
2058
shift keys are pressed. The Alt-Shift-H combination loses the Alt.
2059
- extended keys like (F11, F12) can only be read with systems that
2060
have extended keyboard BIOS support (or INT 9 extensions); to
2061
read these special keys on these systems INT 16,10 must be used
2064
******************************************************************************
2065
*** GRLDR Error messages ***
2066
******************************************************************************
2068
1. Missing MBR-helper.
2070
The helper function in the sectors that immediately follow the MBR is
2071
not present, or it has been erased by a virus or by Windows XP/Vista.
2073
Run the bootlace.com utility to fix the problem.
2077
Your BIOS is too buggy. It even has no support for INT13/AH=8.
2079
No solution except flashing your BIOS. Buggy BIOSes will encounter
2080
more and more problems with grub4dos in the future.
2082
3. This partition is NTFS but with unknown boot record. Please install
2083
Microsoft NTFS boot sectors to this partition correctly, or create an
2084
FAT12/16/32 partition and place the same copy of GRLDR and MENU.LST there.
2086
The boot record was changed or erased by Microsoft Windows XP Service
2089
You may install the old boot record introduced with the original clean
2090
Windows 2K/XP. As another solution, you may create an FAT partition
2091
for your system, and copy GRLDR and your MENU.LST to its root dir.
2093
While the startup code of grldr might fail to load GRLDR in NTFS
2094
partitions, it always successfully loads GRLDR in FAT partitions(and
2095
even in ext2/ext3 partitions).
2097
Note that NTLDR only loads the startup code of grldr(i.e., the leading
2098
16 sectors of grldr), not the whole grldr file.
2100
Thus, C:\GRLDR must exist(here C: can be NTFS), since it is used for
2101
BOOT.INI and NTLDR. If C: is NTFS, X:\GRLDR should exist as well,
2102
where X: stands for a certain FAT partition.
2105
******************************************************************************
2106
*** Known BIOS bugs ***
2107
******************************************************************************
2109
1. Some newer Dell machines have no int13/AH=43h support. You may encounter
2110
failure when trying to write-access an emulated disk.
2112
Note: This bug is serious! The old "root+setup" installation method
2113
(in real mode grub environment) uses INT13 to write the first sector
2114
of stage2. It will fail for the buggy DELL machine when stage2 is
2115
accessed with LBA mode.
2117
2. Some newer machines have no int15/AH=87h support. You may encounter failure
2118
when accessing a memdrive.
2120
3. Some buggy BIOSes won't boot bootable.iso(See above).(qemu can boot it fine)
2122
4. Some BIOSes have no int15/AH=24h(gate A20 control) support. It will
2123
encounter problems with GRUB4DOS in the future.
2125
5. Some USB BIOSes have a buggy int13/AH=08h function which returns incorrect
2126
geometry in CX and DH registers. They will encounter various failure.
2128
Note: The int13/AH=08h function call is very important for the normal
2129
CHS-mode int13 disk access. If there is no other way to determine the
2130
geometry, a USB BIOS programmer should probe the first sector of the
2131
USB storage device and give a right geometry for the int13/AH=08h call.
2132
A good BIOS programmer should implement EBIOS functions for USB storage
2133
devices, especially functions 41h, 42h, 43h and 48h, which are very
2134
important for BIOS-based programs or systems such as GRUB and DOS.
2136
6. Reports say some newer Dell machines violently destroyed the int0d vector
2137
and will cause failure or even hang the machine when running GRUB.EXE
2141
******************************************************************************
2142
*** Known Problems ***
2143
******************************************************************************
2145
1. Running GRUB.EXE from a DOS box of Windows 9x/Me could hang the
2146
machine, especially for some systems with USB support. You may
2147
encounter the same problem when running GRUB.EXE through KEXEC under
2150
Note: You don't have to run GRUB.EXE from protected mode of Win9x, which
2151
could hang the machine; Instead, you usually want to run GRUB.EXE
2152
after you have done a "Restart the computer in MS-DOS mode", which
2155
2. The default chainloader action will keep A20 on. Some buggy DOS XMS
2156
memory managers could hang the machine. You may use the --disable-a20
2157
option in the chainloader line and try again. Anyway, you should avoid
2158
using those buggy memory managers.
2160
3. THTF BIOS L4S5M Ver 1.1a(dated 2002-1-10) has a buggy int15 which
2161
causes hang at the boot of a multi boot kernel(memdisk for example).
2163
4. A Chinese DOS system software, the TechWay SCS, will not work with
2164
newer versions of GRUB.EXE. In general, TSRs that take antitracking
2165
measures will not work with GRUB.EXE any more.
2168
******************************************************************************
2169
*** List of binary files and their corresponding source files ***
2170
******************************************************************************
2172
binary file main source file other included source or binary files
2173
------------- ---------------- -------------------------------------
2175
bootlace.com bootlacestart.S bootlace.inc, grldrstart.S
2177
grldr grldrstart.S pre_stage2(binary, See note below)
2179
grldr.mbr mbrstart.S grldrstart.S
2181
grub.exe dosstart.S pre_stage2(binary, See note below)
2183
hmload.com hmloadstart.S
2185
-----------------------------------------------------------------------------
2187
Note: pre_stage2 is the main body of GNU GRUB and it is simply appended to
2188
grldrstart/dosstart in binary format to form our grldr/grub.exe.
2190
Note: The GRUB file(WITHOUT .EXE suffix) is a static-linked ELF executable
2191
program for Linux, normally called the GRUB Shell. The GRUB Shell is a boot-
2192
manager, but not a boot-loader(the "boot" command won't work in GRUB Shell).
2193
GRUB.EXE(with KEXEC) can be used as a bootloader running directly under Linux.
2195
******************************************************************************
2196
*** Memory Layout for Quiting to DOS from GRUB.EXE ***
2197
******************************************************************************
2199
The quit command is implemented to return to DOS in the instance that GRUB.EXE
2202
1. Before GRUB.EXE transfers control to pre_stage2, it will copy 640KB of
2203
conventional memory to physical address 0x200000(i.e., 2MB), and write 4 long
2204
integers immediately follows the backup copy of the conventional memory:
2205
At 0x2A0000: 0x50554B42, it is the "BKUP" signature.
2207
At 0x2A0004: Gate A20 status under DOS: non-zero means A20 on;
2208
zero means A20 off. Update: A20 always on, see below.
2210
At 0x2A0008: high word is boot-CS, low word is boot-IP. The quit
2211
command uses this entry point to return to DOS.
2213
At 0x2A000C: CheckSum: the sum of all long integers in the memory
2214
range from 0x200000 to 0x2A000F is 0.
2216
2. If the above memory structure is corrupted by a grub command, the quit
2217
command will issue an error message and refuse to exit from grub.
2219
3. Because GRUB may corrupt extended memory, you should better avoid using
2220
extended memory under DOS before running GRUB.EXE.
2222
4. Gate A20 will be enabled by GRUB.EXE. Hopefully this would hurt nothing.
2225
******************************************************************************
2226
*** Memory usage in conventional/low memory area ***
2227
******************************************************************************
2229
1. boot.c, fsys_reiserfs.c: 8K below 0x68000.
2231
2. fsys_ext2fs.c, fsys_minix.c: 1K below 0x68000.
2233
3. fsys_jfs.c: 4K + 256 bytes below 0x68000.
2235
4. fsys_reiserfs.c: 202 bytes at 0x600.
2237
5. fsys_xfs.c: 188 bytes at 0x600.
2239
6. fsys_xfs.c: (logical block size) bytes below 0x68000.
2241
7. geometry tune: 0x50000 - 0x5ffff.
2243
******************************************************************************
2244
*** Command-line Length about GRUB.EXE ***
2245
******************************************************************************
2247
GRUB.EXE now can be started in CONFIG.SYS with the **DEVICE** command:
2249
DEVICE=grub.exe [--config-file="FILENAME_OR_COMMANDS"]
2251
1. If GRUB.EXE is invoked with DEVICE command and FILENAME_OR_COMMANDS is a
2252
collection of some GRUB commands separated by semi-colon, then the length of
2253
FILENAME_OR_COMMANDS can be nearly 4KB ----Supprise? But true! MS-DOS 7+
2254
even allows a much longer line, but 4KB seems enough for our use of GRUB.EXE.
2255
This is very useful when we want to embed a big menu into the command line.
2256
Note that GRLDR hasn't yet supported any command-line arguments.
2258
2. If GRUB.EXE is invoked with INSTALL command, the option length has a limit
2259
of 80 characters(including the leading "--config-file=" part). An overflow may
2260
hang up MS-DOS immediately.
2262
3. If GRUB.EXE is invoked with SHELL command, the option length has a limit of
2263
126 characters(including the leading "--config-file=" part). Overflow won't
2264
hang up MS-DOS, but the line will be cut short. This limit is the same as that
2265
in the console-DOS-prompt or in a BAT file.
2267
4. The DOS editor EDIT does not allow to create a line of 4KB long. So use
2268
another editor, for example, vi for Linux, please.
2270
5. The DEVICE=GRUB.EXE line can be used together with other DEVICE commands
2271
such as DEVICE=HIMEM.SYS and DEVICE=EMM386.EXE. The GRUB.EXE line should
2272
occur before the EMM386.EXE line in order to avoid the rejection by EMM386.
2273
Update: Since 0.4.2, GRUB.EXE works well even after EMM386.EXE is loaded.
2275
6. In any case mentioned above, you can return back to DOS by quit command.
2277
7. Memory usage about command-line menu: The 4KB command-line menu starts at
2278
physical address 0x0800 and ends at 0x17FF.
2280
******************************************************************************
2281
*** New Syntax for the DEFAULT/SAVEDEFAULT Commands ***
2282
******************************************************************************
2284
In addition to the original usage of "default NUM" and "default saved", now
2285
there is a new usage of "default FILE", like this:
2287
default (hd0,0)/default
2289
Note that FILE must have a valid DEFAULT file format. A sample DEFAULT file
2290
is included in the release. You may copy it to wherever you like, but you
2291
should avoid modifying its content manually. The DEFAULT file may be used
2294
(1) First, you should copy a default file with valid format to somewhere in
2295
your operating system.
2297
(2) Secondly, you should use the "default FILE" command of GRUB to announce
2298
the use of FILE as our new default file for being written by "savedefault".
2300
(3) Then, you may use "savedefault" command to save the desired entry number
2301
into this new default file.
2303
(4) OK, at next boot, you may read the saved entry number by using the same
2304
"default FILE" command as mentioned in above (2).
2306
And the SAVEDEFAULT command now accept an options `--wait=T', like this:
2308
savedefault --wait=5
2310
If `--wait=T' is specified and T is non-zero, savedefault will prompt
2311
the user with a message just before it writes to disk. The write operation
2312
will be cancelled in T seconds if the `Y' key was not pressed.
2314
Here is a sample menu.lst file:
2316
#--------------------begin menu.lst---------------------------------------
2317
color black/cyan yellow/cyan
2321
title find and load NTLDR of Windows NT/2K/XP
2322
find --set-root /ntldr
2324
savedefault --wait=2
2326
title find and load CMLDR, the Recovery Console of Windows NT/2K/XP
2328
find --set-root /cmldr
2330
#####################################################################
2331
# write string "cmdcons" to memory 0000:7C03 in 2 steps:
2332
#####################################################################
2333
# step 1. Write 4 chars "cmdc" at 0000:7C03
2334
write 0x7C03 0x63646D63
2335
# step 2. Write 3 chars "ons" and an ending null at 0000:7C07
2336
write 0x7C07 0x00736E6F
2337
savedefault --wait=2
2339
title find and load IO.SYS of Windows 9x/Me
2340
find --set-root /io.sys
2342
savedefault --wait=2
2347
savedefault --wait=2
2349
title find and boot Linux with menu.lst already installed
2350
find --set-root /sbin/init
2351
savedefault --wait=2
2352
configfile /boot/grub/menu.lst
2354
title find and boot Mandriva with menu.lst already installed
2355
find --set-root /etc/mandriva-release
2356
savedefault --wait=2
2357
configfile /boot/grub/menu.lst
2360
savedefault --wait=2
2364
savedefault --wait=2
2368
savedefault --wait=2
2372
savedefault --wait=2
2374
#--------------------end menu.lst---------------------------------------
2376
Note 1: The file DEFAULT must exist and have a proper format as stated above.
2377
Or else, the default/savedefault commands won't function well.
2379
Note 2: The file DEFAULT which is in the same dir as a certain MENU.LST file
2380
is called associated with the MENU.LST file.
2382
Note 3: The associated DEFAULT file will take effect automatically if there
2383
are no `default' commands present.
2385
Note 4: Just before a menu file gains control(e.g., it is the associated
2386
MENU.LST of a GRLDR file, or it was specified via
2387
`grub.exe --config-file=(DEVICE)/PATH/YOUR_MENU_FILE', or it was
2388
specified by the `configfile' command of grub), its associated
2389
DEFAULT file will be used if present, until an explicit `default'
2390
command is encountered.
2392
******************************************************************************
2393
*** The New `cdrom' Command Syntax ***
2394
******************************************************************************
2396
1. Initialize the ATAPI CDROM devices:
2400
This will display the number of atapi cdroms found: atapi_dev_count
2402
2. Stop the ATAPI CDROM devices:
2406
This will set atapi_dev_count to 0.
2408
3. Add IO ports for searching the atapi cdrom devices. For example:
2410
grub> cdrom --add-io-ports=0x03F601F0
2412
After running `cdrom --init' and `map --hook', the cdroms can be accessed
2413
through devices (cd0), (cd1), ...
2415
Note 1: If the system does not fully support the ATAPI CD-ROM specifications,
2416
you will encounter failure when trying to access the (cdX) devices.
2418
Note 2: After doing a `cdrom --stop', you should do a `map --unhook'. Of
2419
course you may `map --hook' again if there are mapped drives.
2421
Note 3: After adding IO ports, you should do a `map --unhook' followed by a
2422
`cdrom --init' and then followed by a `map --hook'.
2424
By default, these ports are used for searching cdroms(so they needn't
2427
0x03F601F0, 0x03760170, 0x02F600F0,
2428
0x03860180, 0x6F006B00, 0x77007300.
2430
Note 4: The BIOS might have offered a cdrom interface. It would be (cd). After
2431
`cdrom --init' and `map --hook', we might have our (cd0), (cd1), ...
2432
available. It is likely that one of them could access the same media
2433
as the BIOS-offered (cd).
2435
Note 5: You may access the (cd) and (cdX)'es in the blocklist way. Example:
2439
The cdrom sectors are big sectors with a size of 2048 bytes.
2441
Note 6: The iso9660 filesystem driver has Rock-Ridge extension support, but
2442
has no Joliet extension support. So you may encounter failure when
2443
you attempt to read files on a Joliet CD.
2445
Note 7: The (cd) or (cdX)'es can be booted now. Examples:
2456
You should already have access to the CD sectors before you can
2459
******************************************************************************
2460
*** About the New `setvbe' Command ***
2461
******************************************************************************
2463
Gerardo Richarte contributed the `setvbe' code and the following comment:
2465
New command is `setvbe', and can be used to change the video mode
2466
before executing the kernel.
2468
For example, you can do
2472
this will scan the list of available modes and set it, and
2473
automatically append a `video=' option to each subsequent kernel
2474
command-line. The appended `video=' option is like this:
2476
video=1024x768x32@0xf0000000,4096
2478
where 0xf0000000 is the video framebuffer address as reported by vbe,
2479
and 4096 is the size of a scanline in bytes (also as reported by vbe).
2481
This is really useful if you want to give some graphics support to your
2482
OS, but you don't want to implement any video functionality other than
2483
writing a pixel to video memory.
2486
******************************************************************************
2487
*** About the DOS utility `hmload' ***
2488
******************************************************************************
2490
This program was written by John Cobb (Queen Mary, University of London).
2494
To make use of the ram drive feature I wrote a program `hmload' to load
2495
an arbitrary file to an arbitrary address in high memory. The program
2496
is not very sophisticated and relies on XMS to turn on the A20 line.
2497
(Also one must be very careful to steer clear of any areas of memory
2500
Under Linux we generated a disk image `dskimg' (with the kernel and
2501
Initrd and a partition table).
2503
Using this our boot procedure looked something like this:
2505
hmload -fdskimg -a128
2507
<unload network drivers>
2510
map --ram-drive=0x81
2511
map --rd-base=0x8000000
2512
map --rd-size=0x400000
2514
kernel /kernel root=/dev/ram0 rw ip=bootp ramdisk_size=32768 ...
2518
See http://sysdocs.stu.qmul.ac.uk/sysdocs/Comment/GrubForDOS/ for details.
2522
Now the MAP command can handle gzipped (rd) image. One can use this
2523
feature with the hmload utility. For example,
2525
step 1. Load the gzipped image under DOS at a relatively low address:
2527
hmload -fdskimg.gz -a16
2529
step 2. Unload network drivers.
2531
step 3. Run GRUB.EXE.
2533
step 4. At the grub prompt, run these commands:
2535
map --rd-base=0x1000000 # set rd-base address to be 16M
2536
map --rd-size=<the accurate size of dskimg.gz in bytes>
2537
map (rd)+1 (hd0) # This will decompress (rd) and place
2538
# the decompressed image at the top end
2539
# of the extended memory. The (rd)+1
2540
# here has special meaning and stands
2541
# for the whole (rd) device. You must
2542
# use (rd)+1 instead of (rd).
2545
kernel /kernel root=/dev/ram0 rw ip=bootp ramdisk_size=32768 ...
2548
map (hd0) (hd0) # Delete the map; this is needed.
2552
******************************************************************************
2553
*** Notes on the use of stack ***
2554
******************************************************************************
2556
The protected-mode and real-mode stack are merged at physical address 0x2000.
2558
All functions should use at most 2K stack space(0x1800-0x2000). So each
2559
subfunction should use as little stack as possible to avoid stack-overflow.
2561
Don't use recursive functions because they could expend too much stack space.
2563
The original protected mode stack at 0x68000(expand-down) is free now and can
2564
be reused for any purposes.
2567
******************************************************************************
2568
*** A bug was found in the CDROM driver ***
2569
******************************************************************************
2571
It seems the cdrom must be connected as the master device of an IDE controller.
2573
If cdrom is slave, the driver will fail to read the cdrom sectors. Hope someone
2575
could fix this problem.
2578
******************************************************************************
2579
*** BIOS and the (cd) drive ***
2580
******************************************************************************
2582
When BIOS boots a no-emulation-mode bootable CD-ROM, it allocates a BIOS drive
2583
number to the CD. If the boot image of the CD-ROM is grldr or stage2_eltorito,
2584
then GRUB can access the CD-ROM media through the drive number allocated by
2585
BIOS. The device name of the CD-ROM is (cd).
2587
BIOS can allocate a BIOS drive number to a no-emulation-mode CDROM even when
2588
the CDROM is not bootable. QEMU has done so. At boot time, GRUB4DOS will
2589
search drives 0x80-0xFF for a possible no-emulation-mode CDROM drive allocated
2590
by BIOS. So if BIOS offered a CDROM interface of int13 EBIOS functions 41h-4Eh,
2591
then the (cd) device will be automatically available in GRUB4DOS.
2594
******************************************************************************
2595
*** The way of disk emulation changed greatly ***
2596
******************************************************************************
2598
The way of disk emulation has changed greatly since 0.4.2 final. Please don't
2599
mix newer versions with older versions when disk emulation features are used.
2601
The newer versions won't automatically unhook emulations established in a
2602
previous grub4dos environment. The GRUB.EXE of an older version will
2603
automatically dismiss emulations established earlier, before transferring
2604
control to the main grub program(i.e., pre_stage2).
2607
******************************************************************************
2608
*** FreeDOS EMM386 v2.26 (2006-08-27) VCPI problem ***
2609
******************************************************************************
2611
The VCPI function "AX=DE0Ch - Switch From Protected Mode to V86 Mode" of
2612
FreeDOS EMM386 v2.26 was not implemented properly(it always hangs). As an
2613
alternative, you can use Microsoft's EMM386 instead.
2615
Even while emm386 is running, grub.exe can be started. But if you try to quit
2616
to DOS from grub4dos by using the `quit' command, the VCPI function DE0C will
2617
be called. If EMM386 is of Microsoft, everything goes ok. If EMM386 is of
2618
FreeDOS, the machine will hang.
2621
******************************************************************************
2622
*** New options for map were added ***
2623
******************************************************************************
2625
Along with 0.4.2 final, there are two new options for the map command. They
2626
are --safe-mbr-hook=SMH and --int13-scheme=SCH. Both are related with disk
2627
emulation for use(as smoothly as possible) in the Win9x environment.
2629
SMH can take either of the two values 0 and 1. By default, SMH is 1. If you
2630
encountered problems of disk emulation under Win9x, you may insert a line of
2632
map --safe-mbr-hook=0
2634
before the `boot' command and try again.
2636
Also SCH may take either 0 or 1 at present. By default, SCH is 1. If you
2637
encountered disk emulation problems under Win9x, you may insert a line of
2639
map --int13-scheme=0
2641
before the `boot' command and try again.
2643
Note by the way. Like --safe-mbr-hook and --int13-scheme, the MAP command has
2644
a few other options that are used for setting global variables. They are here:
2648
M can be 0, 1, or 2. MAP will set a proper value at 0040:0010 by using M.
2652
N can be between 0 and 127(inclusive). MAP will set 0040:0075 to N.
2654
map --memdisk-raw=RAW
2656
RAW default to 1. If RAW=0, `int15/ah=87h' will be used to access memdrives.
2660
RD default to 0x7F which is a floppy. If the RAM DRIVE is a hard drive image
2661
(with partition table in the first sector), you should set RD >= 0x80 and RD
2668
ADDR specifies the physical base address of the ramdisk image. SIZE specifies
2669
the size in bytes of the ramdisk image. ADDR default to 0. SIZE is also default
2670
to 0, but a size of 0 means 4GB, not a zero-long disk. The RAM DRIVE can be
2671
accessed in the GRUB environment using the (rd) device.
2674
******************************************************************************
2675
*** About the new map option --in-situ ***
2676
******************************************************************************
2678
--in-situ is used with hard drive images or hardrive partitions. With an
2679
in-situ map, we can typically use a logical partition as a primary partition.
2681
In-situ map is a whole drive map. It only virtualize the partition table and
2682
the number of hidden sectors in the BPB of the DOS Boot Record.
2684
While disk emulation may encounter various problems with win9x, the in-situ map
2685
works fine with win9x.
2687
Note that --in-situ will not change the real partition table.
2691
map --in-situ (hd0,4)+1 (hd0)
2694
******************************************************************************
2695
*** The PARTNEW Command Syntax ***
2696
******************************************************************************
2698
Besides the mappings in the above section, you may instead choose to create a
2699
new primary partition with the PARTNEW command. PARTNEW can generate a primary
2700
partition entry (in the partition table) for a logical partition.
2704
partnew (hd0,3) 0x07 (hd0,4)+1
2706
where the file (hd0,4)+1 stands for the whole partition (hd0,4). This command
2707
will create a new primary partition (hd0,3) whose type is 0x07 and whose
2708
contents/data is the same as that of the logical partition (hd0,4).
2710
Just like a whole logical partition, a contiguous partition image file can
2711
also be used with PARTNEW:
2713
partnew (hd0,3) 0x00 (hd0,0)/my_partition.img
2715
The type 0x00 indicates a type-auto-detection of the image MY_PARTITION.IMG.
2716
The above command will create a new primary partition (hd0,3) with a proper
2717
type and with contents/data being exactly that of the contiguous file
2718
(hd0,0)/my_partition.img.
2720
PARTNEW will automatically correct the "hidden sectors" in the BPB and the
2721
modification will be permanent. And PARTNEW modifies the partition table
2724
In addition to creating new partition entries, PARTNEW can also be used to
2725
delete(erase, or wipe) a primary partition entry. For example,
2727
partnew (hd0,3) 0 0 0
2729
which will empty the last entry in the partition table in MBR. Generally,
2730
you should use the form of "partnew PARTITION 0 0 0" to erase the entry.
2731
Note that only the entry would be erased, and the data stored in the partition
2732
will not be touched.
2734
******************************************************************************
2735
*** Newly implemented operators `&&' and `||' ***
2736
******************************************************************************
2738
This implementation is very simple. It does not handle operator nesting.
2742
command1 && command2
2746
If command1 returns true, then command2 will be executed.
2750
command1 || command2
2754
If command1 returns false, then command2 will be executed.
2758
is64bit && default 0
2759
is64bit || default 1
2761
******************************************************************************
2762
*** Three new commands is64bit, errnum and errorcheck ***
2763
******************************************************************************
2765
is64bit and errnum retrieve the value of is64bit and errnum respectively.
2767
errorcheck controls whether or not the error will be handled. By default,
2768
errorcheck is on, and menu script execution will stop on error. If errorcheck
2769
is off, the script will continue to execute upto a boot command. A boot command
2770
will turn the errorcheck on.
2773
******************************************************************************
2774
*** Use numeric keys to select a menu entry ***
2775
******************************************************************************
2777
If, for example, you intend to goto entry #25, you may press 2 followed by 5.
2780
******************************************************************************
2781
*** Use the INSERT key to debug step by step at startup ***
2782
******************************************************************************
2784
Some buggy machines could fail to enter grub4dos environment. They might hang
2785
or reboot unexpectedly. Press INSERT as quickly as possible on startup, and
2786
you can get a chance to single-step the boot process and see how far it can
2787
go, and then report bugs.
2790
******************************************************************************
2791
*** The debug command syntax has been changed ***
2792
******************************************************************************
2794
The DEBUG command now can be used to control the verbosity of command output:
2796
debug [ on | off | normal | status | INTEGER ]
2799
1 or normal for normal
2800
2 to 0x7FFFFFFF or on for verbose
2803
******************************************************************************
2804
*** GRUB4DOS and Windows Vista ***
2805
******************************************************************************
2807
First, use the following command to create a boot entry:
2809
bcdedit /create /d "GRUB for DOS" /application bootsector
2811
The result will look like this:
2813
The entry {05d33150-3fde-11dc-a457-00021cf82fb0} was successfully created.
2815
The long string {05d33150-3fde-11dc-a457-00021cf82fb0} is the id for this
2818
Then, use the following commands to set boot parameters:
2820
bcdedit /set {id} device boot
2821
bcdedit /set {id} path \grldr.mbr
2822
bcdedit /displayorder {id} /addlast
2824
Please replace {id} with the actual id returned from the previous command.
2826
Finally, copy GRLDR.MBR to C:\ or wherever your boot drive is, and copy GRLDR
2827
and menu.lst to the root directory of any FAT16/FAT32/EXT2/NTFS partition.
2829
Note: A boot partition should be the active primary partition with BOOTMGR
2830
inside. The `device boot' indicates grldr.mbr should be in the boot
2833
Lianjiang has written down a script to automate the tasks:
2839
echo Please run as administrator
2842
set gname=GRUB for DOS
2845
bcdedit >bcdtemp.txt
2846
type bcdtemp.txt | find "\grldr.mbr" >nul && echo. && echo BCD entry existing, no need to install. && pause && goto exit
2847
bcdedit /export "Bcd_Backup" >nul
2848
bcdedit /create /d "%gname%" /application bootsector >vid.ini
2849
for,/f,"tokens=2 delims={",%%i,In (vid.ini) Do (
2852
for,/f,"tokens=1 delims=}",%%i,In ("%vida%") Do (
2856
bcdedit /set %vid% device boot >nul
2857
bcdedit /set %vid% path \grldr.mbr >nul
2858
bcdedit /displayorder %vid% /addlast >nul
2859
bcdedit /timeout %timeout% >nul
2860
if exist grldr.mbr copy grldr.mbr %systemdrive%\ /y && goto exit
2862
echo Please copy grldr.mbr to %systemdrive%\
2866
del bcdtemp.txt >nul
2867
-------------------------------------------------------------------
2868
Update: Fujianabc pointed out that
2870
bcdedit /set %vid% device boot >nul
2872
should be changed to
2874
bcdedit /set %vid% device partition=%SystemDrive% >nul
2875
-------------------------------------------------------------------
2877
You still need to copy grldr yourself.
2879
Notice: It's possible to modify the BCD entry from a different OS, you just
2880
need to specify the location of BCD:
2882
bcdedit /store D:\boot\BCD ...
2884
Notice: These commands need elevated privileges, they should be used inside
2885
cmd.exe which is started with "Run as administrator".
2887
Notice: People has reported that some version of Vista doesn't support
2888
creating file in C:\ with no extension, even with administrator privileges.
2889
This means grldr can't be placed in C:\. You can solve this by either copy
2890
grldr to another partition, or rename grldr to something like grub.bin. Please
2891
see the following section on how to do this.
2894
******************************************************************************
2895
*** How to rename grldr ***
2896
******************************************************************************
2898
grldr and grldr.mbr use internal boot file name to decide which file to load,
2899
so if you want to change the name, you must also change the embeded setting.
2900
You can do this with the help of grubinst, which can be downloaded at:
2902
http://download.gna.org/grubutil/
2904
grubinst can generate customized grldr.mbr:
2906
grubinst -o -b=mygrldr C:\mygrldr.mbr
2908
grubinst can also edit existing grldr/grldr.mbr:
2910
grubinst -e -b=mygrldr C:\mygrldr
2912
grubinst -e -b=mygrldr C:\mygrldr.mbr
2914
In this case, you must use a grubinst that is compatible with the version of
2915
grub4dos, otherwise the edit will fail.
2917
So, in order to load mygrldr instead of grldr, you can use one of the
2920
1. Use customized grldr.mbr to load mygrldr. In this case, you need to change
2921
the embeded boot file name in grldr.mbr. The name of grldr.mbr can be changed
2924
2. Use mygrldr directly. In this case, you need to change the embeded boot
2925
file name in mygrldr to match its new name.
2927
Notice: The boot file name must conform to the 8.3 naming convention.
2930
******************************************************************************
2932
******************************************************************************
2934
If PXE service is found at startup, GRUB4DOS will create a virtual device
2935
(pd), through which files from the tftp server can be accessed. You can setup
2936
a diskless boot environment using the following steps:
2940
You need to boot from PXE ROM.
2944
You need to configure a dhcp server and a tftp server. In the dhcp server, use
2947
You may also want to load a different menu.lst for different client. GRUB4DOS
2948
will scan the following location for configuration file:
2950
[/mybootdir]/menu.lst/01-88-99-AA-BB-CC-DD
2951
[/mybootdir]/menu.lst/C000025B
2952
[/mybootdir]/menu.lst/C000025
2953
[/mybootdir]/menu.lst/C00002
2954
[/mybootdir]/menu.lst/C0000
2955
[/mybootdir]/menu.lst/C000
2956
[/mybootdir]/menu.lst/C00
2957
[/mybootdir]/menu.lst/C0
2958
[/mybootdir]/menu.lst/C
2959
[/mybootdir]/menu.lst/default
2961
Here, we assume the network card mac for the client machine is
2962
88:99:AA:BB:CC:DD, and the ip address is 192.0.2.91 (C000025B). /mybootdir is
2963
the directory of the boot file, for example, if boot file is /tftp/grldr, then
2966
If none of the above files is present, grldr will use its embeded menu.lst.
2968
This is a menu.lst to illstrate how to use files from the tftp server.
2970
title Create ramdisk using map
2971
map --mem (pd)/floppy.img (fd0)
2976
title Create ramdisk using memdisk
2978
initrd (pd)/floppy.img
2980
You can see that the menu.lst is very similar to normal disk boot, you just
2981
need to replace device like (hd0,0) with (pd).
2983
There are some differences between disk device and pxe device:
2985
1. You can't list files in the pxe device.
2987
2. The blocklist command will not work with a file in the pxe device.
2989
3. You must use --mem option if you want to map a file in the pxe device.
2991
When you use chainloader to load file from the pxe device, there is a option
2994
chainloader --raw (pd)/BOOT_FILE
2996
Option --raw works just like --force, but it load file in one go. This can
2997
improve performance in some situation.
2999
You can use the pxe command to control the pxe device.
3003
If used without any parameter, pxe command will display current
3008
Set the packet size for tftp transmission. Minimum value is 512,
3009
maximum value is 1432. This parameter is used primarily for very old
3010
tftp server where packet larger than 512 byte is not supported.
3014
Set the base directory for files in the tftp server. If
3018
then all files in the pxe device is related to directory /tftp, for
3019
example, (pd)/aa.img correspond to /tftp/aa.img in the server.
3021
The default value of base directory is the directory of the boot file,
3022
for example, if boot file is /tftp/grldr, then default base directory
3027
Keep the PXE stack. The default behaviour of GRUB4DOS is to unload
3028
the PXE stack just before it exits.
3032
Unload the PXE stack immediately.
3036
******************************************************************************
3037
*** New Feature of Relative Path Support ***
3038
******************************************************************************
3040
Use the `root' or `rootnoverify' command to specify the `working directory'.
3044
root (hd0,0)/boot/grub
3046
This specifies that the working dir is (hd0,0)/boot/grub. So all subsequent
3047
filenames of the form "/..." will actually refer to (hd0,0)/boot/grub/...
3053
will be equivalent to
3055
cat (hd0,0)/boot/grub/menu.lst
3059
******************************************************************************
3060
*** Notation For The Current Root Device ***
3061
******************************************************************************
3064
The notation `()' can be used to access the current root device. You may use
3065
`find --set-root ...' to set the current root device, but the find command
3066
does not set the `working dir' of the root device. In this case you should
3067
use `()' to set the working dir after the find command:
3073
FIND can also set the `working directory' now. For example:
3075
find --set-root=/tmp /boot/grub/menu.lst
3077
It is equivalent to this pair of commands:
3079
find --set-root /boot/grub/menu.lst
3083
******************************************************************************
3084
*** The new map option --a20-keep-on ***
3085
******************************************************************************
3088
Along with 0.4.3 final, map has a new option --a20-keep-on which is related to
3089
A20 control after a memdrive sector access. Usage:
3093
It should be used before the "map --hook" command.
3095
By default, A20 will be always on after an RAM INT13 sector access. If
3096
"map --a20-keep-on=0" is used, the A20 status after the INT13 call will be the
3097
same as that before the INT13 call.
3100
******************************************************************************
3101
*** The CDROM emulation (virtualization) ***
3102
******************************************************************************
3104
The CDROM emulation is sometimes called ISO emulation. Here is an example:
3106
map (hd0,0)/myiso.iso (hd32)
3111
if myiso.iso is not contiguous and you have enough memory, add a --mem option:
3113
map --mem (hd0,0)/myiso.iso (hd32)
3118
Note: (hd32) is a grub drive number equivalent to (0xA0). If a virtual drive is
3119
specified with a drive number greater than or equal to 0xA0, then it will be
3120
treated as a cdrom (i.e., with 2048-byte big sectors).
3122
Like normal disk emulations, the CDROM emulation also (mainly) works with
3123
real-mode OSes. After a protected-mode OS kernel (such as
3124
WinNT/2K/XP/VISTA/LINUX) gains control, the OS would have no ability to access
3125
the virtual CDROM through BIOS int13.
3127
DOS/Win9x users may google for ELTORITO.SYS and use it in CONFIG.SYS as a
3128
device driver for the virtual cdrom.
3130
Example usage of eltorito.sys in CONFIG.SYS:
3132
device=eltorito.sys /D:oemcd001
3134
Corresponding MSCDEX command which can be placed in AUTOEXEC.BAT:
3136
MSCDEX /D:oemcd001 /L:D
3139
Due to some bugs found in eltorito.sys, the driver could fail to load. If you
3140
encounter such problems, then you may replace (hd32) with (0xFF) for the
3141
virtual cdrom drive number and try again.
3144
******************************************************************************
3145
*** The New Command CHECKRANGE ***
3146
******************************************************************************
3148
Checkrange checks whether or not the return value of a command is in the
3149
specified range or ranges.
3151
Usage: checkrange RANGE COMMAND
3153
Here are some examples for RANGE:
3155
3 is a range containing only the number 3
3156
3:3 is equivalent to 3
3157
3:8 is a range containing the numbers 3, 4, 5, 6, 7, 8
3158
3,4,5,6,7,8 is equivalent to 3:8
3159
3:5,6:8 is also equivalent to 3:8
3160
3,4:7,8 is also equivalent to 3:8
3162
Note: You should not insert spaces into a range.
3164
Here is an example showing where the checkrange can be used:
3166
checkrange 0x05,0x0F,0x85 parttype (hd0,1) || hide (hd0,1)
3168
which means: if (hd0,1) is not an extended partition, then hide it.
3171
******************************************************************************
3172
*** The New Command TPM ***
3173
******************************************************************************
3175
The "tpm --init" uses 512-byte data at 0000:7C00 as buffer to initialise TPM.
3177
Before you boot VISTA's BOOTMGR, you might have to use the "tpm --init"
3178
command on some machines. Normally you want to issue the "tpm --init" command
3179
after a CHAINLOADER command.
3182
******************************************************************************
3183
*** Delimitors or comments between titles ***
3184
******************************************************************************
3186
It is possible to use titles as delimitors or comments. A title(or menu item)
3187
is called unbootable if all of its menu commands are not boot-sensitive.
3189
The following commands are boot-sensitive(and others are not boot-sensitive):
3205
An unbootable title will be skipped when the user presses the Up Arrow or Down
3206
Arrow keys. Even the unbootable menu item can get accessed(and executed) by
3207
using the Left Arrow and/or Right Arrow keys. Examples:
3209
title This is an UNBOOTABLE entry(so this line is also a comment)
3210
pause --wait=0 This title is a comment. Nothing to do.
3211
pause --wait=0 You can use non-boot-sensitive commands here
3212
pause --wait=0 of any kind and as many as you would like.
3218
title ------------------------------------------------------------
3219
pause --wait=0 This title is a delimitor. Nothing to do.
3220
pause --wait=0 You can use non-boot-sensitive commands here
3221
pause --wait=0 of any kind and as many as you would like.
3225
title ============================================================
3226
pause --wait=0 This title is a delimitor. Nothing to do.
3227
pause --wait=0 You can use non-boot-sensitive commands here
3228
pause --wait=0 of any kind and as many as you would like.
3232
title ************************************************************
3233
pause --wait=0 This title is a delimitor. Nothing to do.
3234
pause --wait=0 You can use non-boot-sensitive commands here
3235
pause --wait=0 of any kind and as many as you would like.
3240
Note: An unbootable menu item must contain at least one command. If there
3241
are no commands for a title, the title will be simply discarded and disappear.
3244
******************************************************************************
3245
*** Bifurcate drives ***
3246
******************************************************************************
3248
Some machines apply different actions to a drive between CHS and LBA mode.
3249
When you read sectors using standard BIOS call int13/AH=02h, you might find
3250
out the drive is a floppy. But when you read sectors using extended BIOS
3251
call(EBIOS) int13/AH=42h, you could know the drive is a cdrom. Such a drive
3252
is called bifurcate.
3254
A bifurcate drive can have two drive numbers: one is the normal BIOS drive
3255
number between 00 and FF in hexa, and this drive uses only CHS mode disk
3256
access(standard BIOS int13/AH=02h); the other is the normal BIOS drive number
3257
(Bitwise) OR'ed by 0x100(i.e., 256 in decimal), and this drive uses only
3258
LBA mode disk access(EBIOS int13/AH=42h). For example, if the drive 0x00
3259
(i.e., the first floppy) is bifurcate, then the drive (0x00) uses CHS mode
3260
to access its sectors, and the drive (0x100) uses LBA (meaning EBIOS) mode
3261
to access its sectors.
3263
The geometry command can report the disk access mode for bifurcate drives as
3264
BIF instead of the conventional CHS or LBA.
3266
Known bifurcate drives. Virtual PC and some real machines are found to create
3267
a bifurcate floppy drive when they boot from a floppy-emulation mode bootable
3268
cdrom. The "geometry (fd0)" will show
3270
drive 0x00(BIF): C/H/S=...Sector Count/Size=.../512
3272
and "geometry (0x100)" will show
3274
drive 0x100(BIF): C/H/S=...Sector Count/Size=.../2048
3276
Actually (0x100) can access the whole cdrom, you may "ls (0x100)/" and find
3277
your files on the cdrom(not the files inside the booted floppy image). Of
3278
course "ls (fd0)/" will list the files inside the booted floppy image.
3280
Note that only some (real or virtual) machines have this action, others
3281
will not produce bifurcate drives.
3284
******************************************************************************
3285
*** GRLDR as PXE boot file ***
3286
******************************************************************************
3288
GRLDR can be used as the PXE boot file on a remote/network server. The (pd)
3289
device is used to access files on the server. When GRLDR is booted through
3290
network, it will use its preset menu as the config file. However, you may use
3291
a "pxe detect" command, which acts the same way as PXELINUX:
3293
* First, it will search for the config file using the hardware type (using
3294
its ARP type code) and address, all in hexadecimal with dash separators;
3295
for example, for an Ethernet (ARP type 1) with address 88:99:AA:BB:CC:DD
3296
it would search for the filename 01-88-99-AA-BB-CC-DD.
3298
* Next, it will search for the config file using its own IP address in
3299
upper case hexadecimal, e.g. 192.0.2.91 -> C000025B. If that file is not
3300
found, it will remove one hex digit and try again. At last, it will try
3301
looking for a file named default (in lower case). As an example, if the
3302
boot file name is /mybootdir/grldr, the Ethernet MAC address is
3303
88:99:AA:BB:CC:DD and the IP address 192.0.2.91, it will try following
3304
files (in that order):
3306
/mybootdir/menu.lst/01-88-99-AA-BB-CC-DD
3307
/mybootdir/menu.lst/C000025B
3308
/mybootdir/menu.lst/C000025
3309
/mybootdir/menu.lst/C00002
3310
/mybootdir/menu.lst/C0000
3311
/mybootdir/menu.lst/C000
3312
/mybootdir/menu.lst/C00
3313
/mybootdir/menu.lst/C0
3314
/mybootdir/menu.lst/C
3315
/mybootdir/menu.lst/default
3317
You cannot directly map an image file on (pd). You must map it in memory using
3318
the --mem option. For example,
3320
map --mem (pd)/images/floppy.img (fd0)
3328
map --mem (pd)/images/cdimage.iso (0xff)
3334
******************************************************************************
3335
*** New program badgrub.exe ***
3336
******************************************************************************
3338
The new program badgrub.exe is intended to serve 'bad' machines(typically some
3339
DELL models) that cannot run the normal grub.exe.
3342
******************************************************************************
3343
*** Conditional find ***
3344
******************************************************************************
3346
The new find syntax allows to find a device conditionally.
3348
find [OPTIONS] [FILENAME] [CONDITION]
3350
CONDITION is a normal grub command which returns TRUE or FALSE.
3356
This will list all partitions, all floppies and the (cd).
3362
This will list all devices with a known filesystem.
3366
find checkrange 0xAF parttype
3368
This will list all partitions with ID=0xAF.
3372
find /ntldr checkrange 0x07 parttype
3374
This will list all partitions with ID=0x07 and existing /ntldr.
3378
******************************************************************************
3379
*** How to build grldr boot images ***
3380
******************************************************************************
3382
1. build 1.44M floppy image ext2grldr.img
3384
dd if=/dev/zero of=ext2grldr.img bs=512 count=2880
3385
mke2fs ext2grldr.img
3387
mount -o loop ext2grldr.img ext2tmp
3392
bootlace.com --floppy --chs --sectors-per-track=18 --heads=2 --start-sector=0 --total-sectors=2880 ext2grldr.img
3394
2. build 1.44M floppy image fat12grldr.img
3396
dd if=/dev/zero of=fat12grldr.img bs=512 count=2880
3397
mkdosfs fat12grldr.img
3399
mount -o loop fat12grldr.img fat12tmp
3401
cp menu.lst fat12tmp
3404
bootlace.com --floppy --chs fat12grldr.img
3406
3. build iso9660 CDROM image grldr.iso
3410
cp menu.lst iso_root
3411
mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root
3414
******************************************************************************
3415
*** Use bootlace.com to install partition boot record ***
3416
******************************************************************************
3418
Since bootlace.com has not implemented the --install-partition option, you
3419
need to use the already implemented --floppy=PartitionNumber option instead.
3421
Hear is a way you might want to follow:
3423
Step 1. Get the boot sectors of the partition and save to a file MYPART.TMP.
3424
For NTFS, you need to get the beginning 16 sectors. For other type of
3425
filesystems, you only need to get one sector, but getting more sectors
3430
bootlace.com --floppy=Y --sectors-per-track=S --heads=H --start-sector=B --total-sectors=C --vfat --ext2 --ntfs MYPART.TMP
3432
where we suppose MYPART.TMP is for (hdX,Y) and the partition number Y
3433
should be specified as in the --floppy=Y option.
3435
Note that for FAT12/16/32/NTFS partitions, you can omit these options:
3437
--sectors-per-track, --heads, --start-sector, --total-sectors,
3440
For NTFS partitions, you must specify --ntfs option.
3442
For ext2 partitions, you can omit --vfat, --ntfs and --ext2 options,
3443
but other options should be specified.
3445
Step 3. Put MYPART.TMP back on to the boot sector(s) of your original partition
3449
Note: Only a few file systems(FAT12/16/32/NTFS/ext2/ext3) are supported by now.
3451
Note2: Under Linux you may directly write the partition. That is to say, Step
3452
1 and Step 3 are not needed. Simply use its device name instead of
3455
Note3: grubinst has the feature of installing grldr boot code onto a partiton
3458
******************************************************************************
3459
*** Use a single key to select menu item ***
3460
******************************************************************************
3462
Some machines have a simplified keyboard. The keyborad might have only the
3463
number keys 0 .. 9 plus a few other keys. When the menu displayed, the user
3464
can strike a key for 8 times. When the menu handler detects the continuous
3465
single keypress, it will assume the user want to use this key to select a menu
3466
item and boot. This single key will act as the RIGHT-ARROW key for the user to
3467
select a menu item. And 5 seconds later after the user stops the keypress,
3468
the selected menu item will automatically boot. Any normal keys can be used as
3469
a single key for this purpose, except for a few functional keys like b, e,
3470
Enter, etc. Once another key is pressed, the feature of Single-Key-Selection
3471
will disappear immediately.
3474
******************************************************************************
3475
*** Parameter file for bootlace running under DOS ***
3476
******************************************************************************
3478
You may move all or part of the command-line arguments into a file. The file
3479
can have multi lines. Just like SPACEs and TABs, the CRs and LFs can also
3480
delimit the commandline arguments in the parameter file.
3484
bootlace < my_parafile
3485
bootlace --read-only my_mbr < my_other_options
3487
Note: Pipes do not work. You have to use the input-redirection operator(<).
3490
******************************************************************************
3491
*** Use bootlace to create a triple MBR ***
3492
******************************************************************************
3494
This is typically used for USB drives, though it also works with hard drives.
3496
Steps to create triple MBR:
3498
1. Do a fresh FDISK to create a FAT12/16/32 partition starting at sector 95
3499
(in LBA, that is, the begginning sector(MBR) is sector 0).
3501
2. Install grldr boot sector onto the boot sector of this partition. See
3502
section "Use bootlace.com to install partition boot record" above.
3504
3. Get 96 sectors of the drive starting at sector 0(MBR), and save to file
3507
4. Run bootlace.com:
3509
bootlace.com MYMBR96.TMP
3511
5. Put MYMBR96.TMP back onto the drive starting at MBR(sector 0).
3513
Note: If the drive already has a triple MBR, then bootlace will cancel it
3514
and restore the original partition layout.
3517
******************************************************************************
3518
*** Use 'pxe detect' in preset-menu ***
3519
******************************************************************************
3521
Now the "pxe" command has a new subcommand "detect":
3523
pxe detect [BLOCK_SIZE] [MENU_FILE]
3525
BLOCK_SIZE specifies the block size for PXE. If it is not specified or it is
3526
0, then grub4dos will go through a probing process and get a proper value
3529
MENU_FILE specifies the config file on the PXE server. If omitted, a standard
3530
config file in the menu.lst sub-dir will gain control. For a description on
3531
the config files in the menu.lst sub-dir, please refer to the section
3532
"GRLDR as PXE boot file" above.
3533
If MENU_FILE starts in a "/", then the MENU_FILE on the PXE server will gain
3534
control, else(if MENU_FILE does not start in a "/") no menu will be executed.
3536
Normally you want to use a "pxe blksize ..." or a "pxe detect ..." command
3537
before you access the (pd) device, since the default blocksize of 512 might
3538
not work on your system.
3541
******************************************************************************
3542
*** Use 'configfile' in preset-menu ***
3543
******************************************************************************
3545
Now the preset menu holds the highest priority. It will gain control prior to
3546
the menu.lst on the boot device. If a 'configfile' command occurs in the menu
3547
init command group, then control will go to the menu.lst on the boot device.