?? readme_grub4dos.txt
字號:
if (partition_start + total_sectors_in_partition) exceeds the
CHS addressing ability(especially when it is greater than
1024*256*63), the caller should set this byte to 0x0e,
otherwise, set to 0x90.
Update: this byte of LBA indicator is ignored. The boot
record can probe the LBA support of BIOS.
Update(2006-07-31): Though GRLDR won't use this LBA-indicator
byte, Windows 98 uses it. Usually this byte should be 0x90 for
CHS mode(especially for floppies). If this byte is not set
properly, Windows 98 will not recognize the floppy or
partition. This problem was reported by neiljoy. Many thanks!
03h 8 OEM name string (of OS which formatted the disk).
0Bh 2 Bytes per sector. Must be 512.
0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
and 128. But a cluster size larger than 32K should not occur.
0Eh 2 Reserved sectors(number of sectors before the first FAT,
including the boot sector), usually 1.
10h 1 Number of FATs(nearly always 2).
11h 2 (Maximum number of root directory entries)Must be 0.
13h 2 (Total number of sectors for small disks only)Must be 0.
15h 1 Media descriptor byte, pretty meaningless now (see below).
16h 2 (Sectors per FAT)Must be 0.
18h 2 Sectors per track.
1Ah 2 Total number of heads/sides.
1Ch 4 Number of hidden sectors (those preceding the boot sector).
Also referred to as the starting sector of the partition.
For floppies, it should be 0.
20h 4 Total number of sectors for large disks.
24h 4 FAT32 sectors per FAT.
28h 2 If bit 7 is clear then all FATs are updated, otherwise bits
0-3 give the current active FAT, all other bits are reserved.
2Ah 2 High byte is major revision number, low byte is minor revision
number, currently both are 0.
2Ch 4 Root directory starting cluster.
30h 2 File system information sector.
32h 2 If non-zero this gives the sector which holds a copy of the
boot record, usually 6.
34h 12 Reserved, set to 0.
40h 1 BIOS drive number of the boot device.
80h is first HDD, 00h is first FDD.
Actually this byte is ignored for read. The boot code will
write DL onto this byte. The BIOS or the caller should set
drive number in DL.
We assume all BIOSes pass correct drive number in DL.
Buggy BIOSes are not supported!!
41h 1 Partition number of this filesystem in the boot drive.
This byte is ignored for read. The boot code will write
partition number onto this byte. See offset 5Dh below.
42h 1 Signature (must be 28h or 29h to be recognised by NT).
43h 4 Volume serial number.
47h 11 Volume label.
52h 8 File system ID. "FAT32 ".
5Ah 1 opcode for "cli".
5Bh 1 opcode for "cld".
5Ch 1 opcode for "mov dh, imm8".
5Dh 1 Partition number of this partition on the boot drive.
0, 1, 2, 3 are primary partitions.
4, 5, 6, ... are logical partitions in the extended partition.
0xff is for whole drive. So for floppies, it should be 0xff.
5Eh 414 The rest of the machine code.
1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
4. NTFS Boot Sector/Boot Record Layout (for loading grldr)
------------------------------------------------------------------------------
An NTFS volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
the root dir of the NTFS volume, and build the boot sector based on the
6th-9th sectors of grldr(some fields need to be changed as detailed in the
following table). And then the NTFS volume is GRUB-bootable.
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
record onto the leading 4 sectors of an NTFS volume.
Offset Length Description
====== ====== ==============================================================
00h 2 Machine code for short jump over the data.
02h 1 LBA indicator. Valid values are 0x90 for CHS mode, or 0x0e for
LBA mode.
If the BIOS int13 supports LBA, this byte can be safely set to
0x0e.
Some USB BIOSes might have bugs when using CHS mode, so the
format program should set this byte to 0x0e. It seems that
(generally) all USB BIOSes have LBA support.
If the format program does not know whether the BIOS has LBA
support, it may operate this way:
if (partition_start + total_sectors_in_partition) exceeds the
CHS addressing ability(especially when it is greater than
1024*256*63), the caller should set this byte to 0x0e,
otherwise, set to 0x90.
Update: this byte of LBA indicator is ignored. The boot
record can probe the LBA support of BIOS.
Update(2006-07-31): Though GRLDR won't use this LBA-indicator
byte, Windows 98 uses it. Usually this byte should be 0x90 for
CHS mode(especially for floppies). If this byte is not set
properly, Windows 98 will not recognize the floppy or
partition. This problem was reported by neiljoy. Many thanks!
03h 8 OEM name string (of OS which formatted the disk).
0Bh 2 Bytes per sector. Must be 512.
0Dh 1 Sectors per cluster. Valid values are 1, 2, 4, 8, 16, 32, 64
and 128. But a cluster size larger than 32K should not occur.
0Eh 2 (Reserved sectors)Unused.
10h 1 (Number of FATs)Must be 0.
11h 2 (Maximum number of root directory entries)Must be 0.
13h 2 (Total number of sectors for small disks only)Must be 0.
15h 1 Media descriptor byte, pretty meaningless now (see below).
16h 2 (Sectors per FAT)Must be 0.
18h 2 Sectors per track.
1Ah 2 Total number of heads/sides.
1Ch 4 Number of hidden sectors (those preceding the boot sector).
Also referred to as the starting sector of the partition.
For floppies, it should be 0.
20h 4 (Total number of sectors for large disks)Must be 0.
24h 4 (FAT32 sectors per FAT) - Usually 80 00 80 00, A value of
80 00 00 00 has been seen on a USB thumb drive which is
formatted with NTFS under Windows XP. Note this is removable
media and is not partitioned, the drive as a whole is NTFS
formatted.
28h 8 Number of sectors in the volume.
30h 8 LCN of VCN 0 of the $MFT.
38h 8 LCN of VCN 0 of the $MFTMirr.
40h 4 Clusters per MFT Record.
44h 4 Clusters per Index Record.
48h 8 Volume serial number.
50h 4 Checksum, usually 0.
54h 1 opcode for "cli".
55h 1 opcode for "cld".
56h 1 opcode for "mov dh, imm8".
57h 1 Partition number of this partition on the boot drive.
0, 1, 2, 3 are primary partitions.
4, 5, 6, ... are logical partitions in the extended partition.
0xff is for whole drive. So for floppies, it should be 0xff.
58h 420 The rest of the machine code in the first sector.
1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
200h 1536 The rest of the machine code in the last 3 sectors.
------------------------------------------------------------------------------
Appendix A: File System Information Sector of FAT32(not used by grldr)
Offset Length Description
====== ====== ==============================================================
0h 4 Leading Signature 41615252h.
4h 480 Reserved, set to 0.
1E4h 4 FSI structure signature 61417272h.
1E8h 4 Contains the last known count of free clusters, if this is
equal to FFFFFFFFh, then the count is unknown.
1ECh 4 Cluster number at which you should begin a search for a free
cluster, if this is equal to FFFFFFFFh then the field has not
been set.
1F0h 12 Reserved, set to 0.
1FCh 4 Trailing Signature AA550000h.
------------------------------------------------------------------------------
Appendix B: Media Descriptor Byte(not used by grldr)
The Media descriptor byte is meaningless because of the duplications, F0h for
example.
Byte Type of disk Sectors Heads Tracks Capacity
---- ------------ ------- ----- ------ --------
FFh 5 1/4" 8 2 40 320KB
FEh 5 1/4" 8 1 40 160KB
FDh 5 1/4" 9 2 40 360KB
FCh 5 1/4" 9 1 40 180KB
FBh both 9 2 80 640KB
FAh both 9 1 80 320KB
F9h 5 1/4" 15 2 80 1200KB
F9h 3 1/2" 9 2 80 720KB
F0h 3 1/2" 18 2 80 1440KB
F0h 3 1/2" 36 2 80 2880KB
F8h hard disk NA NA NA NA
******************************************************************************
*** grldr.mbr - How to write it to Master Boot Track of the hard disk ***
******************************************************************************
grldr.mbr contains code that can be used as Master Boot Record. The code is
responsible for searching all partitions for grldr and when found, loading it.
Currently supported partition types are: FAT12/FAT16/FAT32, NTFS, EXT2/EXT3.
Logical partitions in the extended partition are supported, provided that the
extended partition type is Microsoft-compatible. In fact, the Linux extended
partition type(0x85) is not fully tested for the search mechanism.
How to write GRLDR.MBR to the Master Boot Track of a hard disk?
First, read the Windows disk signature and partition information bytes
(72 bytes in total, from offset 0x01b8 to 0x01ff of the MBR sector), and put
them on the same range from offset 0x01b8 to 0x01ff of the beginning sector of
GRLDR.MBR.
Optionally, if the MBR in the hard disk is a single sector MBR created by
Microsoft FDISK, it may be copied onto the second sector of GRLDR.MBR.
The second sector of GRLDR.MBR is called "previous MBR". When GRLDR not found,
"previous MBR" will be started.
No other steps needed, after all necessary changes stated above have been made,
now simply write GRLDR.MBR on to the Master Boot Track. That's all.
Note: The Master Boot Track means the first track of the hard drive.
Note: The bootstrap code of GRLDR.MBR only finds GRLDR file in the root dir of
a partition. You'd better place menu.lst file accompanying with GRLDR(i.e., in
the same root dir of the same partition as GRLDR).
The filename "grldr" in an ext2 partition must be in lower case letters, and
the file type of grldr must be plain regular. Other types, e.g., a symbolic
link, won't work.
Update: bootlace.com is a DOS/Linux utility for installing grldr.mbr to MBR.
The whole grldr.mbr is embedded in the body of the bootlace.com utility, so
bootlace.com can be used independently. See below.
******************************************************************************
*** grldr.mbr - Details about the control bytes ***
******************************************************************************
Six bytes can be used to control the boot process of GRLDR.MBR.
Offset Length Description
====== ====== ==============================================================
02h 1 bit0=1: disable the search for GRLDR on floppy
bit0=0: enable the search for GRLDR on floppy
bit1=1: disable the boot of PREVIOUS MBR with invalid
partition table(usually an OS boot sector)
bit1=0: enable the boot of PREVIOUS MBR with invalid
partition table(usually an OS boot sector)
bit2=1: disable the feature of unconditional entrance to
the command-line(See below `--duce')
bit2=0: enable the feature of unconditional entrance to
the command-line(See below `--duce')
bit3 - bit6: reserved
bit7=1: try to boot PREVIOUS MBR after the search for GRLDR
bit7=0: try to boot PREVIOUS MBR before the search for GRLDR
03h 1 timeout in seconds to wait for a key press. 0xff stands for
waiting all the time(endless).
04h 2 hot-key code. high byte is scan code, low byte is ASCII code.
the default value is 0x3920, which stands for the space bar.
if this key is pressed, GRUB will be started prior to the boot
of previous MBR. See "int 16 keyboard scan codes" below.
06h 1 preferred boot drive number, 0xff for no-drive
07h 1 preferred partition number, 0xff for whole drive
if the preferred boot drive number is 0xff, the order of the
search for GRLDR will be:
(hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
(hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
... ... ... ... ... ... ... ...
(hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
(X=max harddrive number)
(fd0)
otherwise, if the preferred boot drive number is Y(not equal to
0xff) and the preferred partition number is K, then the order of
the search for GRLDR will be:
(Y) if K=0xff; or (Y,K) otherwise
(hd0,0), (hd0,1), ..., (hd0,L),(L=max partition number)
(hd1,0), (hd1,1), ..., (hd1,M),(M=max partition number)
... ... ... ... ... ... ... ...
(hdX,0), (hdX,1), ..., (hdX,N),(N=max partition number)
(X=max harddrive number)
(fd0)
Note: if Y < 0x80, then (Y) is floppy, else (Y) is harddrive,
and (Y,K) is partition number K on harddrive (Y).
******************************************************************************
*** bootlace.com - Install GRLDR.MBR bootstrap code to MBR ***
******************************************************************************
BOOTLACE.COM installs GRLDR.MBR boot record to the MBR of a harddrive or of a
harddrive image file, or to the boot sector of a floppy or a floppy image.
Usage:
bootlace.com [OPTIONS] DEVICE_OR_FILE
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -