Skip to content

Commit bab05eb

Browse files
committed
start
0 parents  commit bab05eb

17 files changed

+2328
-0
lines changed

classes/boot_catalog.class.php

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
/**
3+
* \class CBootCatalog
4+
* \brief The EL TORITO validation's entry
5+
* \see http://download.intel.com/support/motherboards/desktop/sb/specscdrom.pdf
6+
* \author Christian SCHROETTER, (http://www.quatilfait.fr)
7+
* \example examples/BootCatalog_test.php
8+
* \copyright Creative Commons (BY NC SA)
9+
* The holder allows the use of the original in non-commercial work and the creation of derived works provided they are distributed in a manner identical to the one that governs the original work license.
10+
*/
11+
class CBootCatalog
12+
{
13+
/**
14+
* \public
15+
* \param int $header (MUST be 0x01)
16+
*/
17+
var $header;
18+
/**
19+
* \public
20+
* \param int $platformID
21+
* \see PlatformIDToName
22+
* \brief The platform identifier
23+
*
24+
* 0 = 80x86
25+
* 1 = Power PC
26+
* 2 = Mac
27+
*
28+
*/
29+
var $platformID;
30+
/**
31+
* \public
32+
* \param int $reserved (MUST be 0)
33+
*/
34+
var $reserved;
35+
/**
36+
* \public
37+
* \param string $manufacturerID
38+
* \brief The manufacturer/developer of the CD-ROM.
39+
*
40+
* This is intended to identify the manufacturer/developer of the CD-ROM.
41+
*
42+
*/
43+
var $manufacturerID;
44+
/**
45+
* \public
46+
* \param int $checksum
47+
* \brief Check the entry validation integrity
48+
*
49+
* This sum of all the words in this record should be 0.
50+
*
51+
*/
52+
var $checksum;
53+
/**
54+
* \public
55+
* \param int $key1 (MUST be 0x55)
56+
*/
57+
var $key1;
58+
/**
59+
* \public
60+
* \param int $key2 (MUST be 0xAA)
61+
*/
62+
var $key2;
63+
64+
/**
65+
* \fn static public function PlatformIDToName($platformID)
66+
* \param int $platformID The platform identifier number.
67+
* \see $platformID
68+
* \brief Convert platformID to string
69+
* Convert the platform identifier (int) to a human readable string.
70+
* \return string The readable platform identifier
71+
*/
72+
static public function PlatformIDToName($platformID)
73+
{
74+
switch($platformID)
75+
{
76+
case 0: return '80x86';
77+
case 1: return 'Power PC';
78+
case 2: return 'Mac';
79+
}
80+
81+
return 'ID inconnu: ' . $platformID;
82+
}
83+
/**
84+
* \fn public function IsValid()
85+
* \brief Check is this validation entry is 'valid'
86+
* Check all the member's of the "validation entry"
87+
* The \a $header, \a $key1 and \a $key2 param and also the \a $cheksum value
88+
* \see $header
89+
* \see $checksum
90+
* \see $key1
91+
* \see $key2
92+
* \todo Implemente the checksum validation algo...
93+
* \return boolean true OR false
94+
*/
95+
public function IsValid()
96+
{
97+
if($this->header != 0x01 || $this->key1 != 0x55 || $this->key2 != 0xaa) {
98+
return false;
99+
}
100+
/*
101+
$word = 0;
102+
$len = strlen($this->manufacturerID);
103+
for($i = 0 ; $i < $len ; $i += 2) {
104+
$word += (int)hexdec(dechex(ord($this->manufacturerID[$i + 0])) . dechex(ord($this->manufacturerID[$i + 1])));
105+
}
106+
*/
107+
return true;
108+
}
109+
}
110+
?>

classes/boot_catalog_entry.class.php

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
<?php
2+
/**
3+
* \class CBootCatalogEntry
4+
* \brief The EL TORITO Initial/Default Entry
5+
* \see http://download.intel.com/support/motherboards/desktop/sb/specscdrom.pdf
6+
* \author Christian SCHROETTER, (http://www.quatilfait.fr)
7+
* \example examples/BootCatalogEntry_test.php
8+
* \copyright Creative Commons (BY NC SA)
9+
* The holder allows the use of the original in non-commercial work and the creation of derived works provided they are distributed in a manner identical to the one that governs the original work license.
10+
*/
11+
class CBootCatalogEntry
12+
{
13+
/**
14+
* \public
15+
* \param int $indicator (MUST be 0x88)
16+
*/
17+
var $indicator;
18+
/**
19+
* \public
20+
* \param int $mediaType
21+
* \brief the type of media emulated
22+
* 0 No Emulation
23+
* 1 1.2 meg diskette
24+
* 2 1.44 meg diskette
25+
* 3 2.88 meg diskette
26+
* 4 Hard Disk (drive 80)
27+
*/
28+
var $mediaType;
29+
/**
30+
* \public
31+
* \param int $loadSegment
32+
* \brief loaded segment.
33+
* This is the load segment for the initial boot image
34+
*/
35+
var $loadSegment;
36+
/**
37+
* \public
38+
* \param int $systemType
39+
* \brief The type of system
40+
* This must be a copy of byte 5 (System Type) from the "Partition Table" found in the boot image
41+
*/
42+
var $systemType;
43+
/**
44+
* \public
45+
* \param int $unused
46+
*/
47+
var $unused;
48+
/**
49+
* \public
50+
* \param int $sectorCount
51+
* This is the number of segment loaded by the BIOS
52+
* But this value is confusing because the microcode store in the entry can load mores block
53+
* \warning ONE sector of the boot image is equal to 512 bytes (not the standart 2048 bytes of a Optical media LBA)
54+
*/
55+
var $sectorCount;
56+
/**
57+
* \public
58+
* \param int $loadRDA
59+
* \brief The location of the boot image
60+
* This is the start address of the virtual disk.
61+
* \warning Optical media use Relative/Logical block addressing
62+
*/
63+
var $loadRDA;
64+
65+
/**
66+
* \fn public function IsValid()
67+
* \brief Check is this Initial/Default Entry is 'valid'
68+
* Check all the member's of the "Initial/Default Entry"
69+
* The \a $indicator value (also correct the \a $loadSegment value)
70+
* \return boolean TRUE OR FALSE
71+
* \see $indicator
72+
* \see $loadSegment
73+
*/
74+
public function IsValid()
75+
{
76+
if($this->indicator != 0x88)
77+
return false;
78+
79+
// set default load segment is not set...
80+
if($this->loadSegment == 0)
81+
$this->loadSegment = 0x7c0;
82+
83+
return true;
84+
}
85+
/**
86+
* \fn static public function BootMediaTypeToName($mediaType)
87+
* \param int $mediaType The media identifier number.
88+
* \see $mediaType
89+
* \brief Convert mediaType to string
90+
* Convert the media identifier (int) to a human readable string.
91+
* \return string The readable media identifier
92+
* \see $mediaType
93+
*/
94+
static public function BootMediaTypeToName($mediaType)
95+
{
96+
switch($mediaType)
97+
{
98+
case 0: return 'No Emulation';
99+
case 1: return '1.2 meg diskette';
100+
case 2: return '1.44 meg diskette';
101+
case 3: return '2.88 meg diskette';
102+
case 4: return 'Hard Disk (drive 80)';
103+
}
104+
105+
return 'ID inconnu: ' . $mediaType;
106+
}
107+
/**
108+
* \fn static public function SystemTypeToName($systemType)
109+
* \param int $systemType The system type number.
110+
* \see $systemType
111+
* \brief Convert systemType to string
112+
* Convert the system identifier (int) to a human readable string.
113+
* \return string The readable system identifier
114+
*/
115+
static public function SystemTypeToName($systemType)
116+
{
117+
switch($systemType)
118+
{
119+
case 0x00: return 'Vide';
120+
case 0x01: return 'FAT12';
121+
case 0x02: return 'XENIX root';
122+
case 0x03: return 'XENIX /usr';
123+
case 0x04: return 'FAT16 <32Mio (adressage CHS)';
124+
case 0x05: return 'Étendue';
125+
case 0x06: return 'FAT16';
126+
case 0x07: return 'NTFS (et son prédécesseur HPFS)';
127+
case 0x08: return 'AIX, voir JFS';
128+
case 0x09: return 'AIX bootable';
129+
case 0x0a: return 'OS/2 Boot Manager';
130+
case 0x0b: return 'Win95 OSR2 FAT32 (adressage CHS)';
131+
case 0x0c: return 'Win95 OSR2 FAT32 (adressage LBA, appelée aussi FAT32X )';
132+
case 0x0e: return 'Win95 FAT16 (adressage LBA)';
133+
case 0x0f: return 'Étendue (adressage LBA)';
134+
case 0x10: return 'OPUS';
135+
case 0x11: return 'Hidden FAT12';
136+
case 0x12: return 'Compaq diagnostic';
137+
case 0x14: return 'Hidden FAT16 <32M';
138+
case 0x16: return 'Hidden FAT16';
139+
case 0x17: return 'Hidden HPFS/NTFS';
140+
case 0x18: return 'AST SmartSleep';
141+
case 0x1b: return 'Hidden Win95 FAT32';
142+
case 0x1c: return 'Hidden Win95 FAT32 (LBA)';
143+
case 0x1e: return 'Hidden Win95 FAT16 (LBA)';
144+
case 0x24: return 'NEC DOS';
145+
case 0x2f: return 'Smart File System';
146+
case 0x30: return 'AROS RDB';
147+
case 0x39: return 'Plan 9';
148+
case 0x3c: return 'PartitionMagic Recoverable Partition (PqRP)';
149+
case 0x40: return 'Venix4 80286';
150+
case 0x41: return 'PPC PReP Boot';
151+
case 0x42: return 'SFS';
152+
case 0x4d: return 'QNX4.x';
153+
case 0x4e: return 'QNX4.x 2nde partition';
154+
case 0x4f: return 'QNX4.x 3e partition';
155+
case 0x50: return 'OnTrack DM';
156+
case 0x51: return 'OnTrack DM6 Aux';
157+
case 0x52: return 'CP/M';
158+
case 0x53: return 'OnTrack DM6 Aux';
159+
case 0x54: return 'OnTrackDM6';
160+
case 0x55: return 'EZ-Drive';
161+
case 0x56: return 'Golden Bow';
162+
case 0x5c: return 'Priam Edisk';
163+
case 0x61: return 'SpeedStor';
164+
case 0x63: return 'GNU HURD or Sys';
165+
case 0x64: return 'Novell Netware';
166+
case 0x65: return 'Novell Netware';
167+
case 0x70: return 'DiskSecure Mult';
168+
case 0x75: return 'PC/IX';
169+
case 0x80: return 'Ancien Minix';
170+
case 0x81: return 'Minix / ancien Linux';
171+
case 0x82: return 'Swap Linux / pool ZFS';
172+
case 0x83: return 'Ce type de partition est utilisé par les systèmes de fichiers ext2, ext3, ext4, ReiserFS et JFS';
173+
case 0x84: return 'OS/2 hidden C:';
174+
case 0x85: return 'Linux étendu';
175+
case 0x86: return 'NTFS volume set';
176+
case 0x87: return 'NTFS volume set';
177+
case 0x8e: return 'Linux LVM';
178+
case 0x93: return 'Amoeba';
179+
case 0x94: return 'Amoeba BBT';
180+
case 0x9d: return 'SDF';
181+
case 0x9f: return 'BSD/OS';
182+
case 0xa0: return 'IBM Thinkpad hi';
183+
case 0xa5: return 'FreeBSD';
184+
case 0xa6: return 'OpenBSD';
185+
case 0xa7: return 'NeXTSTEP';
186+
case 0xa8: return 'Darwin UFS';
187+
case 0xa9: return 'NetBSD';
188+
case 0xab: return 'Darwin boot';
189+
case 0xaf: return 'HFS+';
190+
case 0xb7: return 'BSDI fs';
191+
case 0xb8: return 'BSDI swap';
192+
case 0xbb: return 'Boot Wizard hid / Acronis Hidden';
193+
case 0xbc: return 'Acronis Secure Zone';
194+
case 0xbe: return 'Solaris boot';
195+
case 0xc0: return 'Fichier CrashDump.sys CTOS-III PC (CTOS = système d\'exploitation x86 [i386]';
196+
case 0xc1: return 'DRDOS/sec (FAT-';
197+
case 0xc4: return 'DRDOS/sec (FAT-';
198+
case 0xc6: return 'DRDOS/sec (FAT-';
199+
case 0xc7: return 'Syrinx';
200+
case 0xcd: return 'Système de fichiers (disque système ou disque de données) CTOS-III PC';
201+
case 0xda: return 'Non-FS data';
202+
case 0xdb: return 'CP/M / CTOS /.';
203+
case 0xde: return 'Dell Utility';
204+
case 0xdf: return 'BootIt';
205+
case 0xe1: return 'DOS access';
206+
case 0xe3: return 'DOS lecture seule';
207+
case 0xe4: return 'SpeedStor';
208+
case 0xeb: return 'BeOS file system';
209+
case 0xee: return 'EFI GPT1';
210+
case 0xef: return 'EFI (FAT-12/16/';
211+
case 0xf0: return 'Linux/PA-RISC b';
212+
case 0xf1: return 'SpeedStor';
213+
case 0xf4: return 'SpeedStor';
214+
case 0xf2: return 'DOS secondaire';
215+
case 0xf7: return 'MVTFS';
216+
case 0xfd: return 'Linux raid auto';
217+
case 0xfe: return 'LANstep';
218+
case 0xff: return 'BBT';
219+
}
220+
221+
return 'System inconnu: ' . $systemType;
222+
}
223+
}
224+
?>

0 commit comments

Comments
 (0)