LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By saikee at 2005-12-01 16:37
In booting an operating system can be booted directly by naming its kernel (always called vmlinuz with possible a long tail attached) and the ram disk file initrd.

The alternative is to boot the system indirectly. This involves asking the boot loader of system A to boot the boot loader of system B and let the system B booted by it boot loader. The technique is known as "chainloading".

Linux always boots a DOS or Windows by chain loading as they haven't got a formal kernel. However the same technique can be used to boot fellow Linux.
--------------------------------------
Advantage of chainloading

You can boot any DOS, Windows, Linux, BSD and Solaris with the same commands comprising just 3 lines in Grub's /boot/grub/menu.lst, using an example that it is in a partition hda7 (or 7th partition of first disk and remember Grub counts from 0)
Quote:
title Linux @ hda7
root (hd0,6)
chainlader +1
similarly in Lilo only 2 lines needed in its /etc/lilo.conf
Quote:
other=/dev/hda7
label=Linux_hda7
root (hd0,6)
Any operating system becomes "chainloadable" if it has a boot loader inside its root partition. To put a boot loader inside its partition in Linux you type
Quote:
lilo -b /dev/hda7
for Lilo and
Quote:
grub-install /dev/hda7
for Grub where hda7 is the root partition of the Linux(replace 7 with a number to suit your case)

For any system just quote the relevant partition number in the chainloading commands.
-------------------------------
[b]Chainloading for non-Linux systems[/]

Life has been made easier with all Microsoft systems, all versions of Dos and Windows, because each of them has to be installed in an active primary partition and so hence will always has a boot loader in the root partition.

BSD and Solaris also need to be installed in primary partitions. Their boot loaders can either be instructed to take over the MBR or inside the root partition. It seems to be a characteristic of these systems that the boot loader will automatically placed inside the root partition if access to the MBR is denied.

To boot any of them just put in the correct partition reference for the "root" statement for Grub or "other=" statement for Lilo
--------------------------------
[b]Maximum number of systems handled by the boot loaders[/]

(1) NTldr of Win2k or XP = 10 systems including self
(2) Lilo = 15 systems
(3) Grub = unlimited

The above is of academic interest only as boot loaders can do relays with one boot loader passing control to another and hence the number of systems bootable is unlimited..
---------------------------------
Notes

(1) The "label" of Lilo is same as "title" for Grub. Both are for description of the system except Lilo uses a fixed field limiting the number of characters. Grub permits any characters in title statement.

(2) The Lilo's "other= " is the same as Grub's "root" combining with "chainloader +1". Indeed one can use

chainloader (hd0,?)+1

to save typing one extra line.

(3) Lilo use a static screen and permit a maximum of 15 booting entries. Grub does not seem to have a limit. My longest /boot/grub/menu.lst has over 100 entries as I use 4x 200Gb disks with a total of over 120 partitions.

(4) The limit of maximum partition number for a Sata or SCSI disk is 15. For IDE disk 63 is the maximum partition number.

(5) Lilo checks every line in lilo.conf and makes sure every system can be booted before implementing any change in lilo.conf. Grub doesn't. Therefore if you pre-partition the hard disk say into 50 partitions you can build a menu.lst with entries booting every empty partition "before" you even install a Linux in it!!!!! The Linux is of course bootable the moment its installation is completed. That is how my menu.lst looks like

title empty @ hdc39
root (hd1,38)
chainloader +1

title empty @ hdc40
root (hd1,39)
chainloader +1

title empty @ hdc41
root (hd1,40)
chainloader +1

..............and so on

by archtoad6 on Fri, 2006-01-20 12:19
Content is good -- I do most of this myself.

It would be nice see a distinction made between a boot loader & a boot manager (such as GAG). We get so used to the fact that the common bootloaders we encounter also function as boot manager's, that we forget the distinction.

Any chance this can be edited to fix the following:
  • "chainlader +1" (1st occurence)
  • make the "Quote:"'s into Code blocks
  • make the bold tags work instead of being visible as text.

by witE.fellow on Thu, 2007-09-20 10:05
Quote:
Originally Posted by archtoad6 View Post
Content is good -- I do most of this myself.

It would be nice see a distinction made between a boot loader & a boot manager (such as GAG). We get so used to the fact that the common bootloaders we encounter also function as boot manager's, that we forget the distinction.

Any chance this can be edited to fix the following:
  • "chainlader +1" (1st occurence)
  • make the "Quote:"'s into Code blocks
  • make the bold tags work instead of being visible as text.
This thread was very good in explaining chainloading. However, how does bootloader of System A actually find the bootloader of System B? How does it read it in an execute it?

Since Windows is in a fixed location, is the boot.ini file executed?

I have been using Grub for years now and I never really understood how chainloading actually worked. I am interested in chainloading other Linux distros but I thought I would try to understand what chainloading actually is before I do so.

Thanks
-Wit

by alaskazimm on Thu, 2007-09-20 14:05
Quote:
Originally Posted by witE.fellow View Post
This thread was very good in explaining chainloading. However, how does bootloader of System A actually find the bootloader of System B? How does it read it in an execute it?

Since Windows is in a fixed location, is the boot.ini file executed?
The bootloader of System A finds the bootloader of System B because you tell it where to look. An example of GRUB:

Code:
title Linux @ hda7
root (hd0,6)
chainlader +1
The root section tells GRUB where the / of System B is. / of System B is also where the bootloader of B resides. So in practice the first bootloader comes up and you point it to B, then the second bootloader comes up and you choose what to boot from there.
One advantage to this setup, if you have multiple Linux installs or you are testing new distros, is that you can boot into the new install right away without booting first into your main install to reconfigure the bootloader.

Hope that makes some kind of sense.

by archtoad6 on Sun, 2007-09-23 08:49
If that isn't clear, you might want to look at the on-line manual for GRUB: http://www.gnu.org/software/grub/manual/grub.html


13.3.31 root
explains "root".


11.1 How to specify devices
explains "(hd0,6)".

13.3.4 chainloader explains "chainloader +1".


FWIW, 11.3 How to specify block lists suggests that the 2 commands could be combined as "chainloader (hd0,6)+1"

by djgerbavore on Wed, 2008-05-14 12:27
Quote:
Chainloading for non-Linux systems..
if the os' file system is not supported (like in opensolaris with ZFS) you need to replace root with rootnoverify. Because you will get Unsupported File System error when grub tries to mount the partition.

Other then that, nice guide this helped alot!

thanks,

djgerbavore

by archtoad6 on Thu, 2008-05-15 08:52
Good reminder, I almost never need rootnoverify, so I forget that it's sometimes necessary.

by rsimpson on Fri, 2010-07-09 17:16
Very nice info, lots of stuff I tend to forget.


  



All times are GMT -5. The time now is 01:13 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration