loadbin是grubutil里的一个新增工具,它可以把各种系统文件转化为Linux内核的格式,从而达到在多个启动管理器里启动的目的。
对于不同的启动文件,loadbin提供相应的头文件,
可以用三种方式启动系统文件,以ntldr为例:
1,直接使用头文件ldntldr.bin。以头文件作为内核,ntldr作为initrd:
kernel ldntldr.bin
initrd ntldr
boot
2,利用mkimage工具把头文件和系统文件结合起来,生成单一的启动文件:
mkimage ldntldr.bin ntldr ntldr.bin
然后把ntldr.bin作为内核就行了:
kernel ntldr.bin
boot
由于不少的启动管理器在启动Linux内核时不会传递正确的DL值,因此需要在头文件里进行设置,你可以使用-x参数在生成单一的启动文件时指定DL值,例如:
mkimage -x 0x80 ldntldr.bin ntldr ntldr.bin
有些系统,例如grub2,还支持分区参数,你可以用以下方式来指定:
mkimage -x 0x80,0 ldgrub2.bin core.img grub2.bin
这样启动后grub2会自动把根设备设为第一只硬盘第一个主分区(hd0,1)。
如果是在CDROM里启动,可以使用设备号0xe0,比如
mkimage -x 0xe0 ldgrub.bin stage2 grub.bin
这样,grub启动后就可以利用(cd)设备来访问文件了。
3,同2一样,先生成单一的启动文件ntldr.bin,然后可以利用grldr.mbr启动:
安装到mbr:
grubinst -b=ntldr.bin DEVICE
生成相应的ntldr.mbr,在boot.ini里启动:
grubinst -o -b=ntldr.bin ntldr.mbr
目前支持的启动文件格式:
1,GRUB Legacy
头文件ldgrub.bin,对应的系统文件是stage2
2,GRUB2
头文件是ldgrub2.bin,对应的系统文件是core.img
3,GRUB4DOS和NTLDR
头文件是ldntldr.bin,对应的系统文件是ntldr和grldr
至于启动管理器,只要它支持Linux内核格式,就可以使用loadbin,这其中包括grub legacy, grub2, grub4dos, syslinux/isolinux/pxelinux, lilo等等。
下载地址:
http://download.gna.org/grubutil/
loadbin is a new tool in grubutil. It can convert various system files into the format of the Linux kernel, so as to achieve the purpose of booting in multiple boot managers.
For different boot files, loadbin provides corresponding header files,
There are three ways to boot the system file. Take ntldr as an example:
1. Directly use the header file ldntldr.bin. Use the header file as the kernel and ntldr as the initrd:
kernel ldntldr.bin
initrd ntldr
boot
2. Use the mkimage tool to combine the header file and the system file to generate a single boot file:
mkimage ldntldr.bin ntldr ntldr.bin
Then use ntldr.bin as the kernel:
kernel ntldr.bin
boot
Since many boot managers do not pass the correct DL value when booting the Linux kernel, it is necessary to set it in the header file. You can use the -x parameter to specify the DL value when generating a single boot file, for example:
mkimage -x 0x80 ldntldr.bin ntldr ntldr.bin
Some systems, such as grub2, also support partition parameters. You can specify it in the following way:
mkimage -x 0x80,0 ldgrub2.bin core.img grub2.bin
After booting, grub2 will automatically set the root device to the first primary partition (hd0,1) of the first hard disk.
If booting from a CDROM, you can use device number 0xe0, for example
mkimage -x 0xe0 ldgrub.bin stage2 grub.bin
In this way, after grub is started, it can use the (cd) device to access files.
3. The same as 2, first generate a single boot file ntldr.bin, and then you can use grldr.mbr to boot:
Install to mbr:
grubinst -b=ntldr.bin DEVICE
Generate the corresponding ntldr.mbr, and start in boot.ini:
grubinst -o -b=ntldr.bin ntldr.mbr
The supported boot file formats are currently:
1. GRUB Legacy
Header file ldgrub.bin, corresponding system file is stage2
2. GRUB2
The header file is ldgrub2.bin, and the corresponding system file is core.img
3. GRUB4DOS and NTLDR
The header file is ldntldr.bin, and the corresponding system files are ntldr and grldr
As for the boot manager, as long as it supports the Linux kernel format, loadbin can be used, including grub legacy, grub2, grub4dos, syslinux/isolinux/pxelinux, lilo, etc.
Download address:
http://download.gna.org/grubutil/