Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Tuesday, August 18, 2009

Use and Edit Boot.ini in Windows XP

Source

Boot.ini is an important system file with crucial boot functions. Here we discuss what it does and how to edit it.
Function and Purpose of Boot.ini
Boot.ini is one of the very first files that come into play when a Windows XP system is started up. It is a plain text file that is kept in the system root, so it is usually C:\boot.ini. Because it is an essential system file, the attributes are set to hidden, system, read-only to protect it. That means that it will not appear in the file lists in My Computer or Windows Explorer unless the default Windows settings are changed to show hidden files.
Boot.ini contains the location of the Windows XP operating system on the computer. If there is a multi-boot system, the locations of of any other operating systems are also contained. During the startup process, functions from the Windows XP file named "Ntldr" are in charge of getting the proper operating system loaded and Ntldr looks at boot.ini to find out where the operating systems are located and whether a menu should be displayed. Boot.ini can also include entries giving boot options such as Safe Mode or the Recovery Console.
Boot Menus
If more than one option is available in boot.ini, a menu will be displayed at boot up listing the choices. An example of the boot menu for a dual-boot system with the added option of Safe Mode in Windows XP is shown below. These entries are determined by the contents of boot.ini.
Example of a boot display menu
Please select the operating system to start:


Microsoft Windows XP Professional
Safe Mode
Microsoft Windows Me


Use the up and down arrow keys to move the highlight to your choice.
Press ENTER to choose.
Seconds until highlighted choice will be started automatically: 26

For troubleshooting and advanced startup options for Windows, press F8.

Structure and Contents of Boot.ini Files
Some examples of boot.ini files are given in the table below. There are two sections in a boot.ini file. The first is [boot loader], which contains two settings that apply in general. The entry "timeout={ some decimal number}" is the time in seconds that the system waits before it loads the default operating system. This is set to 30 unless you make a change. The default system is determined by the next line "default={address of operating system} For most home PCs the entry is
"default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS"
The entry is used by Ntldr to find where the Windows operating system is located. The rather complicated-looking default line provides for advanced hardware options that are not common in home setups. (It is called the Advanced RISC Computing or ARC naming convention and more discussion can be found at the Microsoft references in the sidebar.) The most likely part that a home user might change is the partition number for systems where a dual-boot system is being used. Normally, a proper installation will make the necessary entries for the default and it is rare that any editing of the disk or partition numbers would be required. In multi-boot systems it is sometimes desirable to switch which operating system is the default but that is easily accomplished by methods discussed in the section on editing below.
The second section of a boot.ini file is [operating systems]. It contains a list of the operating systems and bootable programs and where they are located. It can also include switches that configure a particular operating system or program. There are a number of switches and their use is discussed in the reference in the sidebar.
The names that appear in the boot display menu are taken from this section. The display names are those that are enclosed in quotation marks following an equals sign. The table below will help clarify the contents of boot.ini.
Some examples of boot.ini files
A typical simple example [boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
Example with Recovery Console as an option [boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
C:\CMDCONS\BOOTSECT.DAT="Microsoft Windows Recovery Console" /cmdcons
Example of a dual-boot system with XP on partition 2. Note that the location of Windows Me is given as C:\ [boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
C:\ = "Microsoft Windows Me "
Example with Safe Mode as an option and "timeout" =10 seconds [boot loader]
timeout=10
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Safe Mode" /safeboot:minimal /sos /bootlog

How to Edit Boot.ini Files
Since boot.ini is a text file, it can be edited with a text editor such as Notepad. However, the attributes must first be changed, Also, care must be taken to preserve the correct extension. Since any mistakes in editing might very well render your system unbootable, it is better to use one of the safer methods that are available. Before using any method, be sure to make a backup copy.
One of the most common reasons for editing boot.ini is to reduce the "timeout" setting.in order to speed up booting. This is easily accomplished by using the System Configuration Utility (often called msconfig). Open Start-Run and enter "msconfig". The box shown below will open.

Click the tab "BOOT.INI" and the figure shown next will open. The contents of the boot.ini file are shown and a number of configuration settings are available. In the middle right is a box where the settings for Timeout can be changed. This example is for a dual-boot system and another common reason for editing is to change the default operating system in dual-boot setups. Note that there is a button "Set a Default" as well as buttons "Move Up" and "Move Down" (grayed out here). If there are multiple entries in the boot display, their order can be rearranged here. There are also a number of advanced options that experienced computer users may look at. These other functions are discussed in the Microsoft references in the sidebar.

Another way to configure these two most commonly edited settings is to open the Start menu, right-click on "My Computer" and choose "Properties" from the context menu. The System Properties dialog box will open as shown below. In the section "Startup and Recovery" click the button "Settings".
To add or delete an operating system or program from the boot display menu, use the "Edit" button on the right of the entry "To edit the startup options file manually, click Edit" as shown in the figure below. For example, if it is no longer desired to dual-boot a system, the unwanted operating system can be removed from the boot display menu this way.

The command line tool bootcfg.exe

Windows XP Professional also has a command line utility for manipulating boot.ini called bootcfg.exe. (It may or may not be in a Home Edition installation.) It is described in this Microsoft reference. It can be used in the Recovery Console to repair a damaged boot.ini file or in a command window to edit entries to the file. There are a number of different switches and these are illustrated in the output to a command window shown below.

There is another set of switches for bootcfg when it is being run in the recovery console. These are discussed at this Microsoft reference. A discussion of using the tool to repair a damaged setup is discussed here. For example, a damaged boot.ini file can be scanned or deleted and a new version built.

Addition of DEP switch in Windows XP SP2

The security updates in service pack 2 for Windows XP included the addition of capability for DEP (Data Execution Prevention). DEP configuration for the system is controlled through switches in the boot.ini file. Some features of DEP are turned on by default with a boot.ini switch "/NoExecute=OptIn". There are three other possible values for this switch and they are discussed on another page. Typical entries in boot.ini for a Windows XP SP2 system are shown in the table below.

Simple boot.ini for a Windows XP SP2 system
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn

Most current processors can use DEP although some older systems may not. There have been some reports that these older systems can be slowed down if DEP is enabled. More details on configuring the settings for DEP are given on a separate page.

Note about Windows Vista
It should be noted that Vista uses a different way of managing the boot process. There is no longer a text file called boot.ini. Boot information is stored in a Registry-like file called the Boot Configuration Data (BCD) store. Extensive information on the new boot process can be found at this Microsoft site. Vista comes with a command-line tool bcdedit.com for configuring BCD. However, the command-line tool is rather complicated to use and a free editor called EasyBCD
has a graphical user interface that is simpler to use.

Source
The pathing portion which defines where NT OS is to boot from, uses the ARC convention:default=scsi(0)disk(0)rdisk(0)partition(1)\winnt
where the above is a standard example. Your paths will have either scsi or multi.multi() is used for IDE and also for SCSI drives when int13 is used to find and load the NT kernel file, ntoskrnl.exe. multi(), when used, is normally set to 0 because BIOS can only indentify a single INT 13 controller at a time.
multi() and disk() are not applicable to IDE and are always 0.
If the controller is SCSI and int13 is not enabled, then scsi and drive tell NT which SCSI controller (0=first controller, 1=second) and drive has the active partition. The partition portion specifies which partition is active (1=first partition, 2=second partition).
disk() is set to 0 when using multi() because the disk info is provided through INT 13 and doesn't need to be enumerated.
rdisk() is the ordinal number of the disk on the adapter. With EIDE controllers, this varies from 0 to 3 with the primary boot drive being 0.
Partition() is the partition number which follows the same numbering convention as multi()'s partition numbering.
In both multi() and scsi() the final parm is the pathname to the system files, normally, winnt.
Study Q102873, which has the definitive discussion of the ARC convention and how to interpret it. For more information on int13 and its limitations, see Int 13 x86 boot limitation and C partition
If your need to set the default operating system to boot, the easiest and safest approach is to click
Start : Control Panel : System icon : Startup/Shutdown dropdown : Select default

There is a minor gotcha! if partitions have changed or you edited the boot.ini and the line defining the default is invalid, you will get the existings options and an option labelled default. Fix the defective "default" line and the extra "bad" option will disappear. It something you can't ignore because NT will boot using the info in the defective "default" line until the error is corrected.
Don't mistake the complexity of boot.ini. Microsoft's multi-boot support is very elementary. It can not handle more than one non-NT/W2K operating system, potentially a severe defect, and it is limited to 10 entries in the menu, not a biggie. Want to test the 10 entries limitation. Copy one of the entries and change the label. You will only see the 1st 10 entries displayed.:
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #2" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #3" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #4" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #5" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #6" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #7" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #8" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #9" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #10" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #11" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="W2K #12" /fastdetect
Reboot and you should only see the 1st 10 entries displayed. Any entry beyond 10 will not display.
Mark Russinovich has a good writeup covering all the switches in boot.ini at www.sysinternals.com/bootini.htm. They include :
/NOSERIALMICE ( NOSERIALMICE : disables serial mouse detection),
/PCILOCK ( PCILOCK : lets BIOS configure PCI devices),
/WIN95DOS ( WIN95DOS : directs NTLDR to boot the DOS boot sector stored in BOOTSECT.DOS),
/WIN95 ( WIN95 : directs NTLDR to boot the Win9x boot sector stored in BOOTSECT.W40),
/3GB ( 3G : give applications more memory),
/KERNEL and/or /HAL= (specify kernel and/or hal image file),
/BREAK ( BREAK : stop at breakpoint in HAL),
/BAUDRATE= and /DEBUGPORT= (used in remote kernel debugger),
/CRASHDEBUG ( CRASHDEBUG: kernel debugger is loaded),
/NODEBUG ( NODEBUG overrides /baudrate and /debugport),
/BASEVIDEO ( BASEVIDEO : use standard vga),
/SOS ( SOS : show drivers being loaded),
/NUMPROC= (NUMPROC : only use set number of processors),
/ONECPU ( ONECPU : only use 1 processor),
/BURNMEMORY (don't use x amount of memory - BURNMEMORY),
/MAXMEM= (use as maxmem),
/USE8254 ( use8254 timer chip as its base timer),
/CLKLVL ( CLKLVL : use level-sensitive system clock),
/YEAR= (use year specified as system year),
/TIMERES= (TIMERES : sets the resolution of the system timer),
/MAXPROCSPERCLUSTER= ( MAXPROCSPERCLUSTER : max cpus to use in cluster),
/INTAFFINITY ( INTAFFINITY : sets interrupt affinity),
/BOOTLOG ( BOOTLOG : writes boot log to %SystemRoot%\NTBTLOG.TXT),
/FASTDETECT ( FASTDETECT : causes NTDETECT to skip parallel and serial device enumeration)

No comments: