Hi,

I've just written a new tool loadbin for the GRUB Utilities project.
It's used to convert various startup files to linux kernel format, so
that they can be loaded in many boot loaders, such as GRUB Legacy,
GRUB2, GRUB4DOS, syslinux/isolinux/pxelinux, lilo, etc.

For each type of startup file, there is a corresponding header, for
example, ldgrub2.bin is the header for grub2.

There are three ways to use the header:

1, Use the header directly as kernel, and the startup file as initrd:

    kernel ldgrub2.bin
    initrd core.img

2, Combine the header and startup file, to create a single boot file.
To do this, you need the tool mkimage from loadbin:

    mkimage ldgrub2.bin core.img grub2.bin

then you can start grub2 by loading grub2.bin

    kernel grub2.bin

3, First create the boot file just as step 2, then you can load it
using the GRLDR boot sector.

To install boot code to MBR:

    grubinst -b=grub2.bin DEVICE

you also need to copy grub2.bin to the root directory of any
FAT/NTFS/EXT2 partition.

To load it using the NT boot manager, first create a boot file using grubinst:

    grubinst -o -b=grub2.bin grub2.mbr

Then add the following line to the bottom of BOOT.INI:
    C:\grub2.mbr=grub2.bin

Because some boot loader doesn't pass the boot drive in %DL to the
linux kernel, so we need to set it inside the header. You can use
mkimage to confiure this parameter, for example:

    mkimage -x 0x80 ldgrub2.bin core.img grub2.bin

For some system, like GRUB2, you can also set the partition number, for example:

    mkimage -x 0x80,0 ldgrub2.bin core.img grub2.bin

After GRUB2 takes over, it will use (hd0,1) as root device to load
menu file and extra modules.

If you are booting from CDROM, you can use 0xe0 as the device number:

    mkimage -x 0xe0 ldgrub.bin stage2 grub.bin

Then, after GRUB takes over, it can access the files in CDROM using device (cd).

Currently, loadbin support the following startup files:

1, GRUB2
The header is ldgrub2.bin, the correspoding startup file is core.img.

2, GRUB Legcy
The header is ldgrub.bin, the correspoding startup file is stage2.

3, NTLDR and GRUB4DOS
The header is ldntldr.bin, the correspoding startup file is ntldr and grldr.

Support for other startup file, such as io.sys (MSDOS) and kernel.sys
(FreeDOS), might be added later.

You can download the source code and win32 binaries at:

http://download.gna.org/grubutil/

Linux user need to compile using the source code:
        make

-- 
Bean


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to