extipl::Extended-IPL.doc October 25 1997 takamiti@tsden.org extipl@tsden.org http://www.tsden.org/takamiti/extipl/ (translated into English by Ryutaroh Matsumoto ) ============================================================================== 1. Introduction Extended-IPL is an OS boot selector, which has following nice features: (1) You can boot OS in 2nd, 3rd and 4th hard disk if these disks can be read through BIOS and target OS support it. *BSD and Linux are known to boot from second or later HD. (2) You can boot OS whose partition isn't marked bootable (active). (3) You can mark a partition bootable with Extended-IPL. (4) You can select and boot OS without installing Extended-IPL to HD. (5) Extended-IPL is upper compatible with original IBM IPL. Extended-IPL resides in first 512 bytes of HD and does not use any other space. Thus its operation does not depend any OS though its installation needs MS-DOS. Once you installed it, you can continue to use it even after you delete all OS partition and repartition your HD. You do not have to reinstall Extended-IPL unless first 512 bytes of HD is destroyed for some reason. 1.2 Copyright, etc. Copyright (C) 1997 Takamiti Kimura. All rights reserved. Redistribution and use with or without modification are permitted provided that the following conditions are met: 1. Redistributions contain all file contained in the original distribution. In particular, binary only distribution is not allowed. 2. Modifications are documented. 3. The copyright notice and this list of conditions are maintained. 1.3 Warranties THIS SOFTWARE IS PROVIDED BY TAKAMITI KIMURA ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TAKAMITI KIMURA OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.4 Support Enhancements and bug fixes of Extended-IPL will be distributed at http://www.tsden.org/takamiti/extipl/. If you have comments, bug reports, etc., feel free to email them to extipl@tsden.org. Although we do not make any guarantees, we will make the best effort to response your report. 1.5 Technical information If you have interest in internal structure of Extended-IPL or IPL in general, refer to develop.eng included in this package. 2. Before Installation First 512 bytes of HD is called Master Boot Record, abbreviated as MBR. MBR has three parts. Please *REMEMBER* the role and structure of MBR to understand Extended-IPL functionality. First 446 bytes is program code. It load first 512 bytes of booting partition and execute it. Program code in booting partition (not MBR) does OS specific task to boot its OS. This part in MBR is the only part in HD changed by Extended-IPL installation. Next 64 bytes is partition table. 4 entries are in it. Each entry has information of whether its partition is bootable or not, starting sector and number of sectors of partition, OS identification number, etc. Partition marked bootable is also called "active partition" in fdisk program in MS-DOS and Windows95. Last 2 bytes is always 0xaa55. If last 2 bytes is not 0xaa55, MBR is considered corrupted. Extended-IPL installation replace MBR with its own. It is safe to back up MBR. To back up MBR with extipl.exe, follow these steps. (1) Prepare formatted disk which can boot MS-DOS or Windows. What you have to do in this step depends on which MS-DOS or Windows you use. (2) Copy extipl.exe to disk prepared in (1). (3) Insert the floppy disk in A: and do "a:\extipl save a:\master.ipl" in MS-DOS. Now current MBR is saved in a:\master.ipl. If you want to restore MBR to backed up one, boot with the floppy disk and do extipl restore master.ipl 3. Installation You might hesitate rewrite MBR of HD. You can try Extended-IPL without making any change to your HD. Extended-IPL can be installed in floppy disk. If you want to install Extended-IPL to HD now, go to 3.2. 3.1 Using Extended-IPL on floppy disk Floppy booting is made for debugging. So Extended-IPL does not make any change to HD if it is installed in floppy. To install to floppy, insert formatted disk to A: and type extipl fdtest in MS-DOS. Then Extended-IPL will be installed to floppy. Let's use Extended-IPL on floppy. Make sure floppy drive is tried for booting before hard disk. Otherwise you cannot boot from floppy disk. Insert the floppy disk and reboot your computer. You should see your computer boot as usual. Extended-IPL boot OS as original MBR does unless shift key is pressed down. Reboot your computer and see when floppy disk is accessed for booting. Push down shift key when floppy drive starts reading. Then partition information and prompt "Boot#0:2" are displayed. In this prompt, 0 stands for hard disk unit 0 (first HD) and 2 stands for partition 2 (second partition) being marked bootable. You can select booting partition by typing 1--4. Hitting enter key boots OS in selected partition. Some OS require that their partition is marked bootable. Booting such OS boot selector must mark their partition bootable. Extended-IPL has such function. But Extended-IPL on floppy restricted not making any change to HD. Thus you cannot boot such OS with floppy Extended-IPL. Linux, *BSD, MS-DOS, Windows95 are known to be bootable with floppy Extended-IPL. 3.2 Installing Extended-IPL onto hard disk Booting from floppy is inconvenient. You may want to install Extended-IPL to HD once you convince it is safe. To install it to HD, type extipl install Then you are asked what file MBR is backed up. After backing up, you asked for final confirmation. Hitting enter key allows Extended-IPL replace MBR with its own. If you stop installation, type Control-C. Some BIOS can disable modification to MBR with CMOS setup. If you disable it, you cannot install Extended-IPL. Enable it to install Extended-IPL. 3.3 Booting with Extended-IPL Extended-IPL exactly do same thing as original MBR does unless shift key is pressed down, i.e. it boot OS in the partition marked bootable. To select booting OS, press down shift key when booting. Then Extended-IPL displays contents of partition table and wait for your instruction. Below is an example. ------------------- Part. System 1 s01 ;; partition NO. and partition ID (DOS) 2 sA5 ;; same as above (FreeBSD) 3 s83 ;; same as above (Linux) 4 ;; empty partition Boot #0:2 ;; prompt ------------------- | | | +---- partition NO. +------ HD unit NO. Partition ID below "System" depends on what OS you install in HD. First selected partition is the partition marked bootable. In this step you can select booting partition by number 1--4 and hitting enter key starts booting. If you try to boot empty partition (4 in this case), you here beep sound and booting does not start. Booting also does not start if selected partition does not have 0xaa55 in 511th byte, which indicates it is a bootable partition. Some OS does not boot if its partition is not marked bootable. Extended-IPL can mark selected partition bootable before booting. It can be done hitting end key instead of enter key. Extended-IPL has 3 kinds of booting key. They are boot OS in selected partition. mark selected partition bootable and boot OS in it. If you do not press shift key in next booting, this partition is booted. Extended-IPL can mark partitions bootable only in first HD. You cannot mark partitions in second or later HD bootable. + boot OS without checking validity of partition. Validity checking examines if 511th bytes of the partition is 0xaa55. You have risk that you try booting garbage partition. So you must take care to use this function. 3.4 Booting OS in second or later hard disk Booting OS in non-first HD is not official function of PC/AT compatible computers. Thus not all OS can boot from second or later HD. In stage of partition selecting, you can select them by inputting number 1 to 4. You can switch target HD by inputting 0. If you input 0, Extended-IPL displays contents of partition table of next HD. You can do same thing with currently selected HD as first HD except end key. You cannot mark partitions in second or later HD bootable by end key. When you see the contents of partition table of second HD and hit 0, you will see that of third HD if you have it. Otherwise you will return to first HD. 3.5 Tricky use of Extended-IPL If there are no partitions marked bootable, Extended-IPL enters partition selection even if shift key is not pressed. If you want not to press shift key, you can exploit this feature. You can mark all partition not bootable by "extipl clrboot" command. 4. Command Reference In this chapter command reference of extipl.exe is given. Most readers do not have to read this chapter. Parameters in [] indicates they are optional. (1) extipl save [file] Current content of MBR is backed up in "file." Content of MBR can be restored by "extipl restore" described below. If filename is omitted, default value "master.ipl" is used. Back up file is made read-only and cannot be deleted unless you make it writable. (2) extipl fdtest Install Extended-IPL to floppy disk A:. You cannot use Extended-IPL installed floppy for any other purpose. (3) extipl install Install Extended-IPL to first HD. Before installation, you are forced to back up MBR to some file. You are asked the filename as Enter file name to save: If you only hit enter, MBR is save in "fdiskipl.000". Back up file is made read-only and cannot be deleted unless you make it writable. (4) extipl restore file MBR contains partition information and OS booter. This command writes OS booter part in "file" to MBR and does not change partition information. It is not examined whether specified file is valid copy of MBR. Filename cannot be omitted. 4.5 clrboot marks all partition in first HD not bootable. This force Extended-IPL to enter partition selection even if shift key is pressed down. Original booter in MBR does not any OS if all partition is marked non-bootable. You have to use Extended-IPL to boot something. 5 Error messages Extended-IPL display an error message stop processing only if DISK BIOS returns an error. Error messages of Extended-IPL are "?" followed by hexadecimal number of BIOS error code. In tight 446 bytes of program space allowed to Extended-IPL, returning descriptive error message is impossible. BIOS error codes are defined as follows. 0x01 Bad command 0x02 Bad address mark detected 0x04 Record not found 0x05 reset fail 0x07 Cannot drive initialize 0x09 DMA boundary error 0x0B Bad track flag detected 0x10 Uncorrectable ECC error 0x11 Correctable ECC error 0x20 Bad controller 0x40 Seek error 0x80 Time out 0xBB Undefined error 0xFF Sense operation fail