LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to get GRUB from MBR boot the kernel in CD? (https://www.linuxquestions.org/questions/linux-software-2/how-to-get-grub-from-mbr-boot-the-kernel-in-cd-296158/)

DrRider 03-01-2005 03:42 AM

How to get GRUB from MBR boot the kernel in CD?
 
Hi Guys,

The problem started at I've downloaded Ubuntu LiveCD and burn it to a CD. After I've popped it into my CD drive, it booted but stopped at GRUB stage 1.5 and halted.

I use a laptop having 1 HDD and 1 DVD-RW; the optical device is using IDE1 as slave (from BIOS). I have Yoper on my box and I've tried to use my existing GRUB to boot Ubuntu but I haven't found the way (after read the entire GRUB manual).

Has someone known how to get the existing GRUB (in MBR) boot the kernel in the CD?

The way I've tried (but not seccess):
1. Try to Ubuntu section from menu.lst from Ubuntu CD and paste to my grub.conf using (cd) as a device. The GRUB told me that Error 23: Error parsing number. So...

2. Try to edit the /boot/grub/device.map by adding

Code:

(hd2)  /dev/hdc
to the file (my /dev/cdrom is pointing to /dev/hdc). After that, I tried to invoke GRUB shell using grub --device-map=/boot/grub/device.map and Yes! I can mount CD drive to be grub root. But when tried to reboot, it haven't seen my (hd2) or CD and booting error again.

GRRRRR!!! How to get GRUB seeing my CD drive and the kernel image on the CD????

Pleaseeee, anybody, please enlighten me from the dark.

Thank you in advance.

syg00 03-01-2005 04:41 AM

You can't. grub only knows about disk (hd?) and floppy (fd?) as boot devices.

Well, as in everything, there's always someone who said "fsck it - I'll do it".
Have a look at this

DrRider 03-01-2005 05:09 AM

Thanks. I'll try this.

Hmm, actually it looks like those 2 programs will try to read boot image on CD/DVD drive not the kernel. Will I reproduce the same error as when I booted my box from CD?

Thanks anyway. ;)

Lazarus 03-01-2005 06:11 AM

Here is how I make grub bootable cd's

#!/bin/sh
# makes a pseudo 2.88 bootable floppy image for resq diskc etc
#
if [ -z $1 ]; then
echo " "
echo "type:-"
echo "make_grub_boot_image vmlinuz.x.y.z"
echo "Where vmlinuz.x.y.z is the kernel to use"
echo " "
echo "Output image is boot288.img"
exit
fi
dd if=/dev/zero of=boot288.img bs=512 count=11520
# count was 5760
#
# associate the loop device with the image file
#
/sbin/losetup -d /dev/loop0
/sbin/losetup /dev/loop0 boot288.img
#
# set up filesystem
#
/sbin/mke2fs /dev/loop0
#
# mount it
#
mount /dev/loop0 /mnt
#
# set up boot files
#
#
#copy grub files and menu
#
cd /mnt
mkdir boot
cd boot
# copy kernel
cp /boot/$1 /mnt/boot
mkdir grub
cp /boot/grub/* /mnt/boot/grub
cp /home/source/shell/grub.menu.floppy /mnt/boot/grub/grub.conf
cd $h
#
# create the device map file
#
echo "(fd0) /dev/loop0">/tmp/dev.map
cd /home/source/shell
umount /mnt
#
# install grub
#
/sbin/grub --device-map=/tmp/dev.map --no-curses --verbose<<END
root (fd0)
setup (fd0)
END
/sbin/losetup -d /dev/loop0

This makes a 2.88MB floppy image. Modify my script to suit yourself. Burn your cd using this boot image. I use 2.88Mb to suit bigger kernels!.

Here is my grub.conf for good measure

#
# This is copied to grub.conf when makeing boot floppies
#
# written 2nd May 2002
#
title hda1 (linux)
root (fd0)
kernel /boot/vmlinuz ro root=/dev/hda1
title hda2 (linux)
root (fd0)
kernel /boot/vmlinuz ro root=/dev/hda2
title cdrom
root (fd0)
kernel /boot/vmlinuz ro root=/dev/hdc init=/sbin/recover
title windows or dos partition 1
rootnoverify (hd0,0)
chainloader +1
title windows or dos partition 2
rootnoverify (hd0,1)
chainloader +1
title floppy ... hit enter after invalid system disk
# note floppy is set to fd1 because on cd boot
# fd0 is used by the boot image
rootnoverify (fd1)
chainloader +1


I hope this gets you started OK.

syg00 03-01-2005 07:43 AM

Cute.

Gotta try that one day.

DrRider 03-01-2005 11:19 PM

Quote:

Originally posted by Lazarus
Here is how I make grub bootable cd's
....
....
....
I hope this gets you started OK.

Thanks, that's pretty cool! I'll try that some days.

I'm not sure that it'll work on my box. The problem is grub on Ubuntu 4.10 LiveCD booted on my machine but halted at stage 1.5 with error 21 (means no disk found). However, the grub on that CD can boot successfully on other boxes!

So.... my solution is to extract the Ubuntu 4.10 iso file and wash the grub out, replacing with isolinux suite. After that, I've reassembled them and make the iso image using mkisofs and burnt to CD. OK! now I can boot into Ubuntu liveCD.

I've checked the Ubuntu website as well. It states that the grub's error 21 can be found on some certain machines and no solution for this bug.

Thanks for your help anyway.

PS. It should be some ways that make grub (on HDD MBR) boot the CD directly. If this feature is implemented, it would be great!!!! ;) :D


All times are GMT -5. The time now is 07:17 PM.