Leo Posted February 24, 2004 Report Share Posted February 24, 2004 I recently installed Slackware on a pc with windows and did not want to write over the Master Boot Record (MBR) or so needed an alternative way to boot into Linux. Since the machine did not have a floppy drive a floppy bootdisk was not the answer and I want to bugger about with the kernel so using the install cd was not an option either as it would use the kernel image on the disk. I wanted to install a boot loader onto a CD that I could boot from and which would allow me to select the kernel from the hard disk. After Googling for a bit (alright, bloody ages!) I came across LinuxQuestions.org Which all but answered my questions. So here is what I did (the vast majority of the code and method comes from homey at linuxquestions.org) This was all done on a second machine that has a floppy drive, cd writer and boots Linux (Mandrake 9.0) using Grub. First (as root) I copied the existing /boot/grub/menu.lst to a temporary file. #cp /boot/grub/menu.lst /boot/grub/menu.lst.copy next using vi I amended menu.lst to add an option boot my Slackware partition as though it were on the current machine (it exists on hda3 on the other machine) title linux kernel (hd0,2)/boot/vmlinuz root=/dev/hda3 devfs=mount hdc=ide-scsi having saved the changes I then formatted a floppy and created a /boot/grub directory on it before copying my existing /boot/grub directory contents into it. #fdformat /dev/fd0 #mke2fs -m 0 /dev/fd0 #mount -t ext2 /dev/fd0 /mnt/floppy #mkdir -p /mnt/floppy/boot/grub #cp -pa /boot/grub/* /mnt/floppy/boot/grub #umount /mnt/floppy Next I created a text file /home/stuff using vi #vi /home/stuff and wrote the following grub install script into it: root (fd0) #the following is all on one line install /boot/grub/stage1 d (fd0) (fd0)/boot/grub/stage2 0x8000 p (fd0)/boot/grb/menu.lst # quit The next step was to install grub onto the floppy disk using: #grep -v ^# /home/stuff | grub --batch this ran the install script by ignoring any line beginning with a # This gave me a floppy bootdisk. I now copied the contents of the bootdisk into a file boot.img #dd if=/dev/fd0 of=boot.img bs=10k count=144 and created an iso image using the boot.img file and using the El-Torrito option (-r) that let me make my cd look like a bootable floppy to the bios. I also had to specify the pathname of the boot.img #mkisofs -r -b boot.img -o bootcd.iso /home I was then able to create the bootable cd by copying the iso image to a cd(remembering to get the correct device using cdrecord -scanbus): #cdrecord -v speed=4 dev=0,2,0 -data bootcd.iso Finally I replace the amended version of /boot/grub/menu.lst with my original (no really, I did, I didn't forget and try rebooting my machine with the wrong version in it ): #cp -f /boot/grub/menu.lst.copy /boot/grub/menu.lst I was then able to boot my pc with the Slackware distro using the cd so now when it boots I get presented with the Grub loader screen. If you have any suggestions for improvements to this please feel free to add them. And once again I would like to make clear that the vast majority of this is transposed almost verbatim from a reply by homey on LinuxQuestions .org (linked). Leo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.