Multi-boot with OS loader

Source: Internet
Author: User

There are many tools to implement multi-boot, such as system commander, Lilo of Linux, and OS loader of WindowsNT. There are two principles: Modify the MBR (Master Boot Record) and use the JMP command to jump to your own code at the end of the MBR to control the guiding process; another method is to modify the Boot Code of the first sector in the primary partition to implement multiple boot operations.

Here the MBR, that is, the primary Boot Record, refers to the 0th sector (sector) of The 0th track of The 0th cylinder of the hard disk ). Primary partition: for DOS, windows, and other operating systems that use fat file systems, it is a drive C; in Linux, It is the partition where the root file system is located.

System commander and Lilo use the MBR modification method, while OS loader uses the latter method. I don't like to modify MBR, so I usually use OS loader. The following describes how to use OS loader to implement multiple guidance:

For example, if I want to install windows98, WindowsNT, and RedHat Linux on a hard disk, how can I implement multiple boot?

You can install Windows 98 first and then Windows snt. After WindowsNT is installed, the OS loader is automatically installed. At this time, your system can actually perform multiple guidance.

However, if you want to add more operating systems on this basis, you still need to do some work.

If you are careful enough, after installing WindowsNT, you will find another name named bootsect in the root directory of drive C. the DOS file size is 512 bytes. This is the Boot Code installed in the first sector of the primary partition in Windows98.

When installing WindowsNT, NT first saves the content of this sector to a file (bootsect. Dos), and then changes it into its own boot code, that is, OS loader.

During Multi-boot, if you choose to enter windows98, OS loader reads bootsect. Dos into the memory and then executes the command to boot to Windows98.

Here, we have to do a very simple job, that is, to read the OS loader code and store it in the file, that is, to read the 512 bytes of the first sector of the primary partition. In dos, this can be done using debug or a small program.

However, if Linux is installed, the problem is very simple. There is a ready-made utility in Linux that can be used to directly read and write sectors.

There are two points to note when installing Linux.

First, do not install lilo into MBR when installing Lilo, because I want to use OS loader for multiple boot. You should install lilo in the first sector of the primary partition (note that the primary partition here is not the C disk, but the partition where Linux is installed ).

Second, you should make a boot disk so that you can access Linux. Because lilo is not installed in MBR, it cannot be directly booted from the hard disk to Linux.

 

Now, after installing Linux, start it with the Linux boot floppy disk and boot it to the Linux system.

If Linux is installed in the sixth partition of the first hard disk, you can press the following command at the prompt:

Dd If =/dev/hda6 of = bootsect. lnx COUNT = 1 Press ENTER

This statement reads data from the first sector of the first hard disk in the sixth partition (/dev/hda6) to the bootsect. lnx file.

Parameter description:

If: In file (input file)

Of: Out file (output file)

Count: read/write count

You can also read data from the first sector of drive C to the file bootsect. WSS:

Dd If =/dev/hda1 of = bootsect. wss count = 1

This is the OS loader Boot Code./dev/hda1 is the c disk under DOS.

Copy these two files to the root directory of drive C (or somewhere else.

Find boot. ini in the root directory of the C drive. Remove the read-only attribute and use the text editing tool to open it. In the [operating systems] section, add:

C:/bootsect. lnx = "Linux"

Save the disk and exit. Add the read-only attribute of boot. ini. In this way, OS loader is used to guide Linux.

When other operating systems are installed later, the OS loader may be overwritten,

In this case, run the DD command again in Linux:

Dd If =/dev/hda1 of = bootsect. New COUNT = 1

Store the Boot Code of the newly installed operating system in bootsect. New, and then:

Dd If = bootsect. WSS of =/dev/hda1 COUNT = 1

Restore the OS loader. Add a line like this in Boot. ini:

C:/bootsect. New = "New System"

The newly installed operating system can be guided.

By the way, every time we re-compile the Linux kernel (kernel), we should read lilo again:

Dd If =/dev/hda6 of = bootsect. lnx COUNT = 1

Copy bootsect. lnx to the c root directory. Otherwise, the boot of Linux with the new kernel may fail.

To use OS loader, you do not have to install WindowsNT. You can directly write bootsect. WSS to the first sector of drive C, and then copy boot. ini, ntldr, ntdetect.com to the root directory of drive C.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.