home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
be.zip
/
mbr.ini
< prev
Wrap
Text File
|
1999-12-20
|
4KB
|
117 lines
//
// mbr.ini - BE initialisation file for decoding master boot records
//
// Under Linux, root can obtain the MBR via a command much like :-
//
// # dd if=/dev/sda of=mbr.dat bs=512 count=1
//
// Then you'd invoke BE via :-
//
// % be -i mbr.ini mbr.dat
//
// The file assumes the drive from which the MBR was obtained has
// 63 sectors per track and 255 heads. These assumptions are used in
// computations of LBAs given CHS information. If the disk geometry is
// actually different (as is likely for <8GB disks), you can override
// the assumptions via a command line much like :-
//
// % be -Ssectors_per_track=32 -Sheads=127 -i mbr.ini mbr.dat
//
// Information obtained mainly from STORAGE.INF.
//
set nspt `sectors_per_track 63`
set nh `heads 255`
map BOOTINDIC
{
"Not Active" 0x80 : 0x80
"Active" 0x00 : 0x80
}
map PARTOWNER
{
"Unused" 0x00
"DOS, 12-bit FAT" 0x01
"XENIX System" 0x02
"XENIX User" 0x03
"DOS, 16-bit FAT" 0x04
"Extended" 0x05
"DOS, >32MB support, <=64KB Allocation unit" 0x06
"OS/2, >32MB partition support" 0x07
"AIX, OS/2 (<= 1.3 only), DELL array, or C= DOS" 0x08
"AIX" 0x09
"OS/2 Boot Manager Partition" 0x0A
"OS/2 Boot Manager: DOS - Inactive type 1" 0x11
"OS/2 Boot Manager: DOS - Inactive type 4" 0x14
"OS/2 Boot Manager: DOS - Inactive type 6" 0x16
"OS/2 Boot Manager: DOS - Inactive type 7" 0x17
"Series/1 Disk" 0x40
"Personal RISC Boot Partition" 0x41
"OnTrack Disk Manager 0x50" 0x50
"OnTrack Disk Manager 0x51" 0x51
"SCO UNIX" 0x63
"Novell/Speedstore" 0x64
"Novell 286 NetWare" 0x65
"Novell 386 NetWare" 0x66
"Novell future use 0x67" 0x67
"Novell future use 0x68" 0x68
"Novell future use 0x69" 0x69
"PC/IX" 0x75
"Linux swap" 0x82
"Linux native" 0x83
"System Hibernation for APM 1.1" 0x84
"HPFS FT mirrored partition" 0x87
"HPFS FT disabled mirrored partition" 0xC7
"CP/M 86" 0xD8
"Speedstore 0xE1" 0xE1
"Storage Dimensions 0xE3" 0xE3
"Speedstore 0xE4" 0xE4
"Storage Dimensions 0xF1" 0xF1
"Storage Dimensions 0xF4" 0xF4
"IBM PS/2 IML" 0xFE
"Bad Block Tables - Must be on cylinder 0" 0xFF
}
def PARTCHS
{
at 1 n8 bits 7:6 hex width 3 suppress "CylinderHigh"
at 2 n8 hex width 4 suppress "CylinderLow"
expr "(CylinderHigh<<8)+CylinderLow" dec width 4 "Cylinder"
at 0 n8 dec width 3 "Head"
at 1 n8 bits 5:0 dec width 2 "Sector"
expr "(Cylinder*nh+Head)*nspt+Sector-1" width 8 dec
suppress "lba"
}
def PART
{
n8 map BOOTINDIC "BootIndicator"
PARTCHS open "PartitionStart"
n8 map PARTOWNER "SystemIndicator"
PARTCHS open "PartitionEnd"
n32 dec width 8 "OffsetFromStartOfDiskInSectors"
n32 dec width 8 "PartitionLengthInSectors"
// By adding these two, you can work out the LBA
// immediately following the partition
expr "OffsetFromStartOfDiskInSectors+PartitionLengthInSectors"
dec width 8 suppress "next_lba"
expr "OffsetFromStartOfDiskInSectors*512" hex ptr MBR
valid "SystemIndicator==Extended" suppress "extended"
}
def MBR
{
buf 446 hex "MasterBootRecordProgram"
4 PART "PartitionTable"
n16 be hex valid "Signature==0x55aa" "Signature"
}
def main
{
MBR "mbr"
}