?? readme_grub4dos.txt
字號:
2. Emulates HD partition C: as floppy drive A: and boot win98 from A:
map --read-only (hd0,0)+1 (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
map --floppies=1
boot
After the "map --hook" command, the emulation takes effect instantly
even in the GRUB command line.
Note that the (fd0) in "chainloader (fd0)+1" is the emulated virtual
floppy A:, not the real floppy diskette(because map is hooked now).
3. Emulates an image file as floppy drive A: and boot win98 from C:
map --read-only (hd0,0)/floppy.img (fd0)
chainloader (hd0,0)+1
rootnoverify (hd0)
map --floppies=1
map --harddrives=1
boot
4. Emulates an HD partition as the first hard disk and boot DOS from it:
map --read-only (hd2,6)+1 (hd0)
map --hook
chainloader (hd0,0)+1
rootnoverify (hd0)
map --harddrives=1
boot
In this example, (hd2,6)+1 represents an extended logical DOS partition
of the third BIOS hard disk (hd2).
If a DOS partition is used to emulate a hard disk, GRUB for DOS will
first try to locate the partition table, usually 63 sectors ahead of
the DOS partition. GRUB for DOS will refuse the emulation if the
partition table is not there.
5. Emulates an image file as the first hard disk and boot DOS from it:
map --read-only (hd0,0)/harddisk.img (hd0)
chainloader --load-length=512 (hd0,0)/harddisk.img
rootnoverify (hd0)
map --harddrives=1
boot
If an image file is used to emulate a hard disk, the image file must
contain an MBR. In other word, the first sector of HARDDISK.IMG must
contain the partition table of the emulated virtual hard disk.
Note: Counters for floppies and harddrives in the BIOS Data Area remain
unchanged during the mapping. You should manually set them to proper
values with `map --floppies=' and/or `map --harddrives=', especially,
e.g., when there is no real floppy drive attached to the mother board.
If not doing so, DOS might fail to start.
`map --status' can report the values. Note also that `map --floppies='
and `map --harddrives=' can be used independently without the
appearance of mappings.
0.4.2 has introduced a new variable, memdisk_raw, to simulate the
memdisk-like raw mode. If the BIOS has no int15/87h, or if it has
buggy int15/87h support, you should set this variable before any
memdrives are used. Here is an example:
map --memdisk-raw=1
map --mem (hd0,0)/floppy.img (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
boot
If you encountered a memdrive failure without using
map --memdisk-raw=1, you should have a try with `map --memdisk-raw=1'.
If you `map --memdisk-raw=0' later, you should afterwards do a
`map --unhook'(and followed by a `map --hook' if needed).
Update: memdisk_raw now defaults to 1. You should `map --memdisk-raw=0'
if you want to use int15/87h to access memdrives.
--------------------------------------------------------
Floppies/harddisks of any size can be emulated with GRUB for DOS 0.2.0.
Image file must be contiguous, or else GRUB for DOS will refuse it.
The `blocklist' command can list fragments or pieces of a file.
Type "help map" at the GRUB prompt to get a brief description of the
command.
The form
map ... (fd?)
is a floppy emulation, and the form
map ... (hd?)
is a hard disk emulation.
When a HARD DISK emulation is used, better not start Windows for
security reasons. Windows may even destroy all data and all information
on all your real hard disks!!!!!!!!
Update for --mem: when --mem is used, it seems rather safe even after
entering Windows. Win98 can operate the memdrive normally.
Windows NT/2000/XP does not recognize the emulated drives no matter
whether the --mem option is present.
******************************************************************************
*** Explanation of the grldr-bootable floppies or harddisk partitions ***
******************************************************************************
1. Ext2 Boot Sector/Boot Record Layout (for loading grldr)
------------------------------------------------------------------------------
An EXT2/EXT3 volume can be GRUB-bootable. Copy grldr and an optional menu.lst
to the root dir of the EXT2/EXT3 volume, and build the boot sector based on the
fifth sector of grldr(some fields need to be changed as detailed in the
following table). And then the EXT2/EXT3 volume is GRUB-bootable.
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
record onto the first sector of an EXT2/EXT3 volume.
Offset Length Description
====== ====== ==============================================================
00h 2 Machine code for short jump over the data.
02h 1 LBA indicator. Valid values are 0x02 for CHS mode, or 0x42 for
LBA mode.
If the BIOS int13 supports LBA, this byte can be safely set to
0x42.
Some USB BIOSes might have bugs when using CHS mode, so the
format program should set this byte to 0x42. 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 0x42,
otherwise, set to 0x02.
Note that Windows98 uses the value 0x0e as the LBA indicator.
Update: this byte of LBA indicator is ignored. The boot
record can probe the LBA support of BIOS.
03h 10 OEM name string (of OS which formatted the disk).
Update: this field is now used for error message of "I/O error"
0Dh 1 Sectors per block. Valid values are 2, 4, 8, 16 and 32.
0Eh 2 Bytes per block. Valid values are 0x400, 0x800, 0x1000, 0x2000
and 0x4000.
10h 4 Pointers in pointers-per-block blocks, that is, number of
blocks covered by a double-indirect block.
Valid values are 0x10000, 0x40000, 0x100000, 0x400000 and
0x1000000.
14h 4 Pointers per block, that is, number of blocks covered by an
indirect block.
Valid values are 0x100, 0x200, 0x400, 0x800, 0x1000.
18h 2 Sectors per track.
1Ah 2 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 in the filesystem(or in the partition).
24h 1 BIOS drive number of the boot device.
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!!
25h 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.
26h 2 inode size in bytes. (Notice! We use the formerly reserved
word here for inode size!)
28h 4 Number of inodes per group.
Normally a 1.44M floppy has only one group, and the total
number of inodes is 184. So the value should be 184 or
greater.
2Ch 4 The block number for group descriptors.
Valid values are 2 for 1024-byte blocks, and 1 otherwise.
The value here is equal to (s_first_data_block + 1).
30h 1 code for "cld"(0xFC).
31h 2 code for "xor ax,ax"(0x31, 0xC0).
33h 1 code for "nop"(0x90) or "cwd"(0x99)
34h 458 The rest of the machine code.
1FEh 2 Boot Signature AA55h.
2. FAT12/FAT16 Boot Sector/Boot Record Layout (for loading grldr)
------------------------------------------------------------------------------
A FAT12/16 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
the root dir of the FAT12/16 volume, and build the boot sector based on the
fourth sector of grldr(some fields need to be changed as detailed in the
following table). And then the FAT12/16 volume is GRUB-bootable.
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
record onto the boot sector of an FAT12/16 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(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.
13h 2 Total number of sectors (for small disks only, if the disk is
too big this is set to 0 and offset 20h is used instead).
15h 1 Media descriptor byte, pretty meaningless now (see below).
16h 2 Sectors per FAT.
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 1 BIOS drive number of the boot device.
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!!
25h 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 41h below.
26h 1 Signature (must be 28h or 29h to be recognised by NT).
27h 4 Volume serial number.
2Bh 11 Volume label.
36h 8 File system ID. "FAT12 ", "FAT16 " or "FAT ".
3Eh 1 code for "cli".
3Fh 1 code for "cld".
40h 1 code for "mov dh, imm8".
41h 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.
42h 442 The rest of the machine code.
1FCh 4 Boot Signature AA550000h. (Win9x uses 4 bytes as magic value)
3. FAT32 Boot Sector/Boot Record Layout (for loading grldr)
------------------------------------------------------------------------------
A FAT32 volume can be GRUB-bootable. Copy grldr and an optional menu.lst to
the root dir of the FAT32 volume, and build the boot sector based on the
third sector of grldr(some fields need to be changed as detailed in the
following table). And then the FAT32 volume is GRUB-bootable.
Update: bootlace.com is a DOS/Linux utility that can install the GRLDR boot
record onto the boot sector of an FAT32 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:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -