zoukankan      html  css  js  c++  java
  • A Guide to the Multiboot Process

    A Guide to the Multiboot Process

    The XP and Vista boot process in general.
    The Windows dual and multiboot method of operation.
    The limitations of the Windows method and some alternatives.
    How third-party bootmanagers operate.

    The information on this page also applies to Windows 7 - except where indicated.

    Multibooting

    I have learned from experience that most people will consider the computer boot sequence as something that is almost beyond their comprehension. Many guides or examinations are often overly technical and will just confuse the issue even further, or sap the reader's will to live. This guide will try to explain only what you really need to know. I believe it is not necessary to understand the finer details of everything that is going on, that simply being aware of the general flow of the boot sequence is more than enough to allow you to make the correct choices when setting up or reconfiguring your multiboot system. What follows may seem over simplified, but it is just about all you really need to understand.

    The boot process is one small program doing its job and then starting the next program in the sequence. Typically there will be either 4 or 5 small programs, the last being the one that actually starts the operating system.Most problems arise quite simply because one program cannot find the next one in the chain.If you know where each program is, which one it needs to find next, then if necessary point it to that next program, then you have mastered multibooting. There’s nothing really complicated or mystical about it. We really are talking about a few small programs that have to start in the correct order. Anyone who has used a computer for more than 5 minutes will know what programs are and will be perfectly comfortable using them. The boot sequence programs hold no secrets or magical powers, they are just like any other program, coded ones and zeros that tell the computer what to do. Some do have strange names that have almost passed into legend and are often uttered with a sense of reverence and wonderment. They conjure up visions of unknowable secrets, even among some seasoned IT pros. I don’t want to shatter anyone’s beliefs, but here is the truth.

    The Boot Sequence Programs

     

    The first program is built into your computer's motherboard. It is on a small chip and so is always in the same place so that when the computer is turned on it knows where to find it. This program is called the BIOS. It will do its job and then look for and start the next program. The BIOS is pretty clever and can actually search for the next program and look in various places for it. Normally it will find it all by itself, so you don’t usually have to do anything, but you do have the option if need be of setting the BIOS boot order so that it will look in the place you want it to – floppy, CD, hard drive, etc.

    If you are booting an OS on the hard drive then the next program is, unsurprisingly, on the hard drive. To make it easy for the bios to find the second program it is always put in the same place and the bios will only look in that place. It is always right at the very beginning of the drive, starting on the first bytes of the very first sector. This program is commonly called the MBR (Master Boot Record), but this is a little misleading because the MBR is actually the bootprogram and the partition table. The most common name for the bootprogram part of the MBR is the Initial Program Loader (IPL). Just like the BIOS program the IPL is often not specific to any OS, so it won't care if it’s Windows or Linux that is on the hard drive, it only wants to start the next little program. The Microsoft IPL is very small and quite limited and its main job is just to find and start that next program in the chain. It looks at the partition table to see if any of the entries there is waving a flag in the air and shouting - Pick Me! If the IPL sees a partition that is pointing to itself then it goes to the first bytes of that partition and starts the little program that it finds there. If you take the flag away from one partition and give it to another then the IPL will then pick that partition and start that one’s little program. When you move the flag you are not changing anything else about a partition or its details in the partition table, you are literally just moving a pointer that tells the IPL which partition to pick. The partition with the flag is called the Active partition, so changing or setting the active partition is simply moving a pointer, (the correct tech-speak is actually flag).      

     

    The third little program in the chain is at the very beginning of the partition. This one is called the PBR(partition boot record) or in some cases it can be called the VBR (volume boot record). Now the PBR will do its job and then start the next program. However, unlike the BIOS and IPL, the PBR is operating system specific and needs to know the name and location of the file it has to start. This next file will be different for various operating systems, so during the install of an OS the PBR will be written with the information necessary to find the correct file. For WinNT before Vista this will be ntldr, which will always just be in the root of the partition. That is it will not be inside any folder or directory, but just right there on its own, next to the Windows and Program Files folders.

    For all WinNT before Vista the ntldr will be the 4th and last program in the boot sequence chain. It's called the bootloader and it is the one that does the actual job of starting Windows from the System32 folder. (The ntldr also has the auxiliary function of a bootmanager which can with the aid of a partition list held in the boot.ini start a Windows OS on a different partition to the one it is itself on).

    For Win 2K/XP etc the boot sequence is:- BIOS - IPL - PBR - ntldr – Windows

     

                           

    In these graphics the MBR is shown as a separate section at the very start of the hard drive. It is indeed separate and not connected in any way to the following partitions. Convention is to reserve a small section of the drive specifically for the MBR to reside on. I’ve shown the PBR as a separate section but it is actually a part of the partition it is in. Windows reserves the first 16 sectors of its partition to be used exclusively for the partition boot record.

    The Vista and Win7 boot sequence is slightly different because ntldr has been superseded. In old WinNT the ntldr was both bootmanager and bootloader, but from Vista these two functions have been separated out into two different programs. The bootmanager function of finding and selecting the OS to be started is now called bootmgr. The bootloader function of actually starting the OS is now a new file called winload.exe. The bootmgr program stays in the root of the partition and winload.exe has been placed inside the System32 folder alongside the Windows OS it has to start. This has added an extra step to the boot sequence chain, so in Vista it is the 5th program that starts Windows.

    Vista boot sequence:- BIOS - IPL - PBR - bootmgr - winload.exe - Windows.

     

    Given free reign at install time Windows 7 may create a separate small partition just for the BCD and bootmgr files. See – Installing Win7. This is not essential for the operation of Win7 and Microsoft have said it was only introduced now so we can become familiar with the concept ahead of them making it standard practice for Windows on EFI firmware machines.
    http://en.wikipedia.org/wiki/Extensible_Firmware_Interface
    http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/windows-nt-6-boot-process.html

    Dual-Boot Sequence

    If you install Vista to a computer that already has a legacy WinNT installed on it and you don't take precautions to the contrary, then the Microsoft bootmanager will be automatically configured for dual booting. The previous Windows install will be modified to accommodate the method of operation necessary for bootmgr and ntldr to coexist. The boot sequence for Vista will be just as it was in the example above when Vista was the only OS on the hard drive. The same 5 programs run in the same order.

    Vista dual boot sequence:- BIOS - IPL - PBR - bootmgr - winload.exe - Windows.

     

    Notice however that the Vista install has placed bootmgr and the BCD file on the partition of the previous Windows install. Also that the XP partition's PBR has been replaced with a Vista one, so that it knows to look for bootmgr instead of ntldr. On bootup it will be bootmgr that will halt the process and offer the boot menu. On selecting Vista, bootmgr will jump directly to winload.exe in the Vista System32 folder, skipping the Vista partition PBR. The Vista partition may or may not get a valid PBR but this won’t be used anyway as part of the boot sequence chain. If you did at this point change the Active partition so the IPL would directly start the Vista partition's PBR, you would just get an error message that something was missing.

    When you select the XP install from the dual boot menu the boot process will have changed slightly from the sole XP install shown above because bootmgr will have inserted itself in the chain. This adds an extra step and so XP now also has 5 programs in the sequence.

    XP dual boot sequence:- BIOS - IPL - PBR - bootmgr - ntldr - Windows.

     

    In old WinNT the ntldr consults the boot.ini file to find out which hard drive and partition it needs to look on for the Windows/System32 folder it has to target. The ntldr then uses the BIOS to locate the hard drive and the Partition Table to locate the partition. In Vista and Win7 the bootmgr consults the BCD file to find out which hard drive and partition it should go to, but it does not use the BIOS or the partition table to locate the drive or partition. See Vista's Boot Files

     

    Multi-Boot Sequence

     

    If you already have a Windows dualboot and then add Vista as a third OS then you will not get three choices from the new Vista boot menu, because the original ntldr will continue to be used to select which of the old OSes to boot. Each of the bootmanagers in the chain will offer separate boot menus. Vista's bootmgr will offer 2 choices of Vista and previous OSes, then ntldr will display your original boot menu. Overall the multiboot sequence is no different to the dualboot one. Both bootmgr and ntldr will always be on the active partition of the boot hard drive and both will ignore PBRs and jump directly to Windows in the System32 folder. (The ntldr has also always skipped PBRs).

    In the example below the sequence for the first and third partitions will be as the last two examples above. The middle partition Windows will be started as it originally was by the ntldr on the active first partition, except of course with bootmgr now in the chain.

    Sequence for all old WinNT is the same:- BIOS - IPL - PBR - bootmgr - ntldr - Windows.

     

    No matter how many Windows OSes or hard drives you have the boot sequence will always be the same and only the boot drive active partition will have an ntldr and bootmgr, through which all the others must be booted. Each Vista and will be started by bootmgr and each of the older WinNT will be started by ntldr.

    Vista sequence is the same as always:- BIOS - IPL - PBR - bootmgr - winload - Windows

     

    With no ntldr or bootmgr on the second hard drive then it cannot be made the boot drive in the computer and have any of its OSes directly started. An install of Vista to a second or higher drive will only write a Vista IPL to that drive's MBR if there is no IPL already present, so an older WinNT IPL will be left in place. If you do need to get such a drive to be bootable then any Windows IPL since Win9x is capable of starting a Vista PBR. The main thing to be aware of is that there might not be any partitions on the drive flagged as active, so the IPL will stall when it does not know where to look for a PBR.

     

    Vista partitions on any hard drive might not actually have valid Vista PBRs which have been written correctly to look for bootmgr. If a PBR was present on the partition during the Vista install then it may be left in place. I haven’t tested all scenarios but an old WinNT PBR on an NTFS partition always seems to be left alone, which of course will point to ntldr instead of bootmgr. If you want to avoid this either make sure the partition is not formatted before the Vista install and so won't have a PBR, or format it only from Vista.

    The Limitations of the Microsoft Bootmanager

    Microsoft calls the all important active partition on the boot drive the System partition. Perhaps they choose to call it this because it holds complete control over your entire system. Lose the system partition and you lose your whole system. From now on I will refer to this active partition as the System Partition.

    Once you have a grasp of how the boot sequence chain progresses then you should be able to see what will break the chain and so have a much better awareness of what you can and cannot do. You obviously cannot format the system partition and do a fresh install of any OS there without losing all the other boot options. A fresh install on the system partition will not detect anything that has gone before and so will not configure the bootmanager to include any of the other OSes on the computer. You also can't install or reinstall old WinNT on any of the other partitions as this will rewrite the system partition PBR to look for ntldr, which will mean the boot sequence chain of any Vista install will be broken. You should be able to reinstall a Vista to any of the other partitions as this will reuse any current bootmgr and ntldr it finds on the system partition.

    Perhaps you can now understand why Microsoft say you have to install your operating systems in the order of the oldest first. A newer OS will ensure the changes it makes to the boot components on the system partition are backward compatible for all the older OSes. With Vista that change should be obvious to you now, for Windows 2000, XP and 2003 it is the ntldr that causes the problem, as a fresh or repair install of Windows will always replace any existing ntldr on the system partition with its own, which won't be forward compatible to the newer Windows OSes. The 2K ntldr cannot boot XP and the XP one cannot boot 2003. When it comes to Win9x it is a somewhat different situation for a dual or multiboot set up. You can only natively have one install of Win9x on the computer when using the Microsoft bootmanager and this install has to be on the system partition. So obviously you will have major problems trying to do this and retain any current dual or multiboot arrangement. (I'm not covering Win9x here as there are plenty of other guides around for that and this guide is long enough already). 

     

    Repairing a broken boot sequence chain can often be done with tools on the Windows CD or Vista DVD. The more complex the multiboot you have the less likely these tools will be successful in doing it all for you. I've found they only seem to be able to handle simple and common setups. You may have to resort to doing it manually and this is not always straight forward, especially with the new BCD in Vista. I'm not going to cover how to do any of this because I would probably end up being the one who would lose the will to live. Besides, I would have to research much of it again as I gave up doing such things many years ago. There are other easier ways that can produce a system that is more flexible, reliable and infinitely simpler to manage and reconfigure.

    I Don't Think I Should

     

    The first obstacle to tackle before I go any further is I believe simply one of attitude. The first obstacle to tackle before I go any further is I believe simply one of attitude. I'm constantly frustrated by people saying that they don't think they should tamper with the Microsoft way of doing things. This response always perplexes me somewhat because there will hardly be one amongst us who has not already chosen a different path for some area of our computing experience. When you choose to use a different firewall, or browser, or whatever, you do so because you recognise that Microsoft cannot always produce the best software in all areas. That sometimes third party apps can be better developed and supported, can offer features you want and not do things you don't want. When we replace bundled software like Media Player we may do so because it does things we don't like for reasons that might not be in our interests. Now I'm not a Microsoft hater, far from it, I just like to be in control and I like to improve on something if it can be improved. The bootmanager bundled with Windows does not do what I want and does things I don't want.

    There is a general belief that multibooting is difficult and can cause you so many problems and headaches that it is just not worth the effort or the risk. If you have understood this article till now then you should certainly be able to see the many problems that could be encountered when using the Microsoft bootmanager with its requirement of a single system partition.  I believe most people's misgivings about multibooting stem from the fact that the boot process is generally a mystery to them and so they don't want to mess with something they don’t understand. The purpose of this article is to try and illuminate the subject and hopefully give you an understanding of what is actually going on. With that knowledge I hope you will see that multibooting need not be as hard as Microsoft has made it.

    A Smarter IPL

     

    The cleanest way to multiboot would be to have an IPL that allows you to choose which PBR you would like to start next in the boot sequence. If each Windows install has its own specific PBR and its own ntldr or bootmgr on its own partition, then each install of Windows can be booted just as it would be if it were the only OS on the computer.

     

     

    Above shows the IPL starting the PBR of the XP install on the second partition of the hard drive. Each Windows install on the drive is entirely independent and has no links to a system partition or a bootmanager that is inside another OS. All are started by their own PBR and each one has an ntldr or bootmgr that is set to only start its own OS. The immediate advantage of this is that you can do whatever you like with each OS without affecting any other. You can make changes on one partition without breaking the boot sequence chain of others, so you can install or reinstall any Windows OS in any order you like. You can image and clone individual Windows installs without having to worry about how they are connected to a system partition. If you use a clever enough IPL you can start any PBR on any hard drive and if you put that IPL in the MBR of every hard drive then you can swap drives around and still immediately boot any OS on your computer.

    The lack of a system partition means that drive letters will no longer be jumbled and you won’t have a drive showing that you can’t remove or change the letter of. All Windows installs will see themselves as the C: drive and you can set your common data partition to whatever next letter you prefer. If you set this the same in each of your Windows then no matter which one you are booted into you will always know that Windows is C: and your data partition is D: or E: or whatever.

    To make all your OSes independent and with their own boot programs on their own partition then you do of course have to install Windows in the correct manner. See "How to Install Vista and Avoid Changes to Other Operating Systems" on this page. (Similar rules apply for most WinNT OSes).

     

    MBR Bootmanager

     

    As mentioned earlier the Microsoft IPL is small and very limited in its capabilities, but it can be easily replaced with one that can give you many more functions and features. There are several around and they are commonly referred to as MBR bootmanagers. They will halt the boot sequence at the IPL stage to give you a boot menu. When you make your choice the active partition flag will be handed to that partition and then its PBR will be loaded. Different MBR bootmanagers offer varying options for hiding other partitions, booting logical partitions and second or higher hard drives, password protecting particular OSes, or even hiding the bootmanager so only you know you have a multiboot machine.  Some can even auto-detect partition, drive and OS changes and update and correct the boot menu for you. It's up to you to decide which meets the needs of your own particular setup. Most can be installed from floppy or CD or from inside Windows. The four I have tested so far with Vista are OSL2000, Boot-US, GAG and ParagonBM. In the event of anything messing up your multiboot system then these types of bootmanagers can usually manage a full recovery by simply reinstalling them, which is a simple and quick task, unlike reinstalling and reconfiguring a damaged Microsoft bootmanager.

    When you install a Windows OS it will rather inconveniently always write a new IPL into the MBR, which means that you will have to reinstall your MBR boot manager. This can usually be done from the desktop in your new Windows or from the other available means of floppy or CD. (Personally I will often replace the Windows IPL with my bootmanager at the first reboot during a Windows install). You should always make sure you have the ability to reinstall your bootmanager from other than inside Windows. If a Windows install fails for some reason and you can’t get to the desktop, then putting your bootmanager back on the drive from floppy or CD etc will restore access to all your other OSes.

     

    A word of caution about MBR bootmanagers.

     

    There are some other utilities around that either use the same disk space as MBR bootmanagers or hook themselves into the Microsoft IPL. You need to know that you don't have something already in there that an MBR bootmanager might change. The most common thing would be a Dynamic Drive Overlay (DDO) which is used to compensate for a hard drive that is larger than the computer can natively handle. If you have fitted a larger hard drive and used any of the manufacturer's apps to get it set up and working, then you might have an Overlay in your MBR. Scroll about half way down this page to 'Software Translation'.

    The other common thing might be a computer manufacturer's recovery system being hooked into the Microsoft IPL, so that you can press a key at bootup and go to their recovery utility. Most times if you are multibooting you will have already disabled this feature by partitioning the hard drive or installing another OS. If you do currently have such a feature and wish to retain it then your options will be limited. Any changes to the IPL or original partition layout will most likely disable or damage it, perhaps beyond easy repair. It is not impossible in some cases to configure a multiboot system and retain the manufacturer's recovery facility, but you will need to be good and know what you are doing. There are many wildly different systems employed and new ones introduced with Vista that are still little examined. A better use of your time would be to organise your own backup and recovery system, which typically can be much more comprehensive and flexible.

    There are also some third party recovery apps that hook into or change the IPL, so if you do use any rollback or system recovery software you should check how it operates or uninstall it. Norton’s GoBack is one example of software that changes the IPL and even the partition table, which can result in an unbootable system if the IPL is further altered.

    Microsoft’s new BitLocker drive encryption system requires the Microsoft IPL for the secure boot process. Currently available third-party bootmanagers that change the IPL will disrupt the trusted sequence, but I've found in some circumstances supplying the bitlocker key at Vista boot will allow the changes to be accepted. There are other options and workarounds, but I’m sure most corporate machines running bitlocker won’t be multibooting and the few that are will be happy with Microsoft’s own bootmanager.

    Dedicated Partition.

     

    The next best option is a bootmanager that you keep on its own small dedicated partition, often at the start of the boot hard drive, but some will use a logical partition. Even though this may sound similar to the way ntldr and bootmgr operate it does not usually require the partition to become a system partition, so each Windows install can still be independent with its own ntldr or bootmgr and loaded by its own PBR. The bootmanager partition will always be the one started by the IPL. Be aware however that most bootmanagers of this type still replace the Microsoft IPL in the MBR so that it will always target the bootmanager partition at computer startup. The Active status of partitions will be ignored by the new IPL and will instead be controlled and changed by the bootmanager itself when you make your booting choice. Many of the issues relevant to pure IPL bootmanagers can also therefore apply to dedicated partition bootmanagers.

     

    The size of the bootmanager partition shown above is of course not to any scale and in reality is usually very small. There are several of these types of bootmanagers around, each offering varying features. I've tested XOSL, BootMagic, Acronis OSS and BootIT-NG, all of which can work with Vista, but a couple have serious issues you need to be aware of. See the bootmanager page for specific details.

    Inside a Current OS.

     

    Most dedicated partition bootmanagers can also be installed inside a current OS. They will change the PBR of that OS so that it will load the bootmanager instead of the operating system's own boot files, they also of course change the IPL in the same way as a dedicated partition bootmanager. When you select a boot option they will either start the boot files of the OS they are in, or the PBRs of the other OSes on the computer. Again there is usually no system partition and each Windows install can be independent.

    On a Floppy.

    It is of course perfectly possible to only have your bootmanager on floppy, but it is also an excellent idea as a temporary or recovery measure. I would recommend everyone to have GAG available to them on a floppy disk. It has the great feature of being configurable from the boot menu, so if something has changed on your system you can from the floppy alone find and boot any good OS you have. Each OS can again be independent and will be loaded by their own PBR. I've tested the floppy versions of both GAG and Boot-Uswith Vista and both do an excellent job and display the boot menu in about 2 seconds of the floppy being accessed. If you just have OSes on boot drive primary partitions then without the floppy in the drive the computer will always default to the last OS that was booted, which means you can have a dual or multiboot that only you know about or can access.

    GAG can also be installed and reinstalled from its own boot CD, but like the floppy version it also makes an excellent recovery tool you can use when something has gone wrong. It is not really practical as a full time bootmanager because of the time it takes for the CD to load, plus you can’t save your set up and would have to configure it each time to add items to the boot menu.

    USB flash drive bootmanagers are the way forward and a review of these will eventually follow.

    Linux and Lilo/Grub

    When you install Linux you will usually get an option during setup of where to place Lilo or Grub. The choices will include to the MBR of the boot hard drive or to the Linux partition. If you choose the MBR then part of Lilo/Grub will replace the Microsoft IPL and the other part will remain on the Linux partition and be configured to operate as a bootmanager for the other OSes on the computer. If you already have a Windows dual/multiboot using the Microsoft bootmanager then Linux may only add the Windows system partition to its boot menu. If you have various independent Windows installs you may still have to add most of them yourself to the Linux bootmanager.

     

     

    If you instead choose to have Lilo or Grub installed entirely to the Linux partition then you can use your preferred bootmanager to start Linux by way of its own PBR, in exactly the same way as you start independent Windows by their PBRs. It's a cleaner method of doing things and also removes the certainty of breaking the boot sequence chain to your Windows OSes if you later decide to reinstall or remove the Linux OS. Unlike Windows an independent Linux install will not overwrite your MBR bootmanager. 

    It's Not Logical

    If you want to have more than three Windows OSes and an extended partition per hard drive then you will need to put Windows onto a logical partition. With Linux you are able to install a fully independent and stand alone OS directly to a logical partition or to a second or higher hard drive, because the Linux IPL is clever enough to be able to pass control to that OS. Unfortunately Microsoft have never introduced such abilities in their IPL and so have never seen the need to allow you to do a fully independent install of Windows to a logical partition or other drive. Their IPL can only work with primary partitions on its own boot hard drive, so if you want to install to anything other than one of these primaries then you can only do it by allowing a boot drive primary to become a system partition where ntldr or bootmgr will operate as a bootmanager. The Windows setup will simply refuse to continue if there is not a suitable boot drive primary that it can use.

    This of course means that getting an independent install of Windows on a logical partition or another hard drive requires a little work around. For a second or higher hard drive it only requires making that drive the boot drive during the install. For a logical partition the easiest and cleanest way is to simply clone it there. See Dan Goodell's excellent guide to Booting Windows from an Extended Partition.The Windows logical partition PBR needs one small tweak to make it bootable, but you may not have to do this as many recent cloning tools will do it automatically and Vista and Win7 don't appear to require it. After cloning XP/2K etc you have to make a simple edit to the boot.ini file in notepad so that it points to the changed drive and/or partition. With Vista you have to edit the new BCD file, which is explained on the cloning page.

     

  • 相关阅读:
    随机生成4位验证码(包含数字, 字母)
    eval注册和登录
    51单片机中断机制(定时器/计数器)
    CS106B
    机器学习算法之旅(转载)
    Ubuntu系统使用记录
    2. 自然语言处理预备知识
    1. 自然语言处理描述
    前端学习网站
    2016年总结,2017年计划
  • 原文地址:https://www.cnblogs.com/wangaohui/p/3553853.html
Copyright © 2011-2022 走看看