如何制作grub启动光盘
综合技术 Anonymous写著 '网上不少文章讲述了如何将grub装在软盘上,当硬盘引导信息被破坏时,这张软盘就可以派上用场。但是对于一些没有软驱的用户,或者使用软驱不方便的笔记本用户,如果能用光盘引导系统,则会方便很多。本文将说明如何制作这张光盘。
如何制作grub启动光盘
daweicheng
leo@nj165.com
网上不少文章讲述了如何将grub装在软盘上,当硬盘引导信息被破坏时,这张软盘就可以派上用场。但是对于一些没有软驱的用户,或者使用软驱不方便的笔记本用户,如果能用光盘引导系统,则会方便很多。本文将说明如何制作这张光盘。
首先假设我们有一个运作良好的linux发行版(含cdrtools软件包),cd或dvd刻录机(已经配置好,可以在linux运作正常,关于如何设置,网上的文章很多),grub软件包。
我的系统是redhat linux 9.0,但这个发行版的grub包中不含有我们最需要的stage2_eltorito文件(这个文件是制作grub启动光盘的最重要的文件)所以我下载了0.95版的grub,地址:ftp://alpha.gnu.org/gnu/grub/grub-0.95.tar.gz
接下来是安装grub,和多数源码包安装的方式一样,我们需要:
tar zxvf grub-0.95.tar.gz
cd grub-0.95
./configure
make
make install
好了,grub安装完成(得到了stage2_eltorito,为了节省大家的时间,我提取了这个文件,如果哪位可以上传供大家下载,mail我)
现在我们这样做,可以得到自己的grub光盘镜像:
mkdir iso
mkdir -p iso/boot/grub
cp /stage2_eltorito所在的路径/stage2_eltorito iso/boot/grub
cp /boot/grub/menu.lst iso/boot/grub
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso
好了,现在grub.iso就是你所需要的镜像了
然后用cdrecord或者前端把镜像刻在cdr/rw就可以了
cdrecord -v dev=0,0,0 /grub.iso的路径/grub.iso speed=8
上面的命令,根据自己的情况修改
好了,这样我们就得到了一张grub启动光盘。
当然,由于制作grub启动光盘只需要200多k字节,所以在制作iso的时候,你可以放一些其他有用的东西在iso文件夹下,做成镜像。
感谢linuxaid的网友“咱们老百姓”提供的原文地址:
http://www.gnu.org/software/grub/manual/html_node/Making-a-GRUB-bootable-CD-ROM.html
Making a GRUB bootable CD-ROM
GRUB supports the no emulation mode in the El Torito specification1. This means that you can use the whole CD-ROM from GRUB and you don't have to make a floppy or hard disk image file, which can cause compatibility problems.
For booting from a CD-ROM, GRUB uses a special Stage 2 called stage2_eltorito. The only GRUB files you need to have in your bootable CD-ROM are this stage2_eltorito and optionally a config file menu.lst. You don't need to use stage1 or stage2, because El Torito is quite different from the standard boot process.
Here is an example of procedures to make a bootable CD-ROM image. First, make a top directory for the bootable image, say, iso:
$ mkdir iso
Make a directory for GRUB:
$ mkdir -p iso/boot/grub
Copy the file stage2_eltorito:
$ cp /usr/share/grub/i386-pc/stage2_eltorito iso/boot/grub
If desired, make the config file menu.lst under iso/boot/grub (see Configuration), and copy any files and directories for the disc to the directory iso/.
Finally, make a ISO9660 image file like this:
$ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot /
-boot-load-size 4 -boot-info-table -o grub.iso iso
This produces a file named grub.iso, which then can be burned into a CD (or a DVD). mkisofs has already set up the disc to boot from the boot/grub/stage2_eltorito file, so there is no need to setup GRUB on the disc. (Note that the -boot-load-size 4 bit is required for compatibility with the BIOS on many older machines.)
You can use the device (cd) to access a CD-ROM in your config file. This is not required; GRUB automatically sets the root device to (cd) when booted from a CD-ROM. It is only necessary to refer to (cd) if you want to access other drives as well.