PDA

View Full Version : w32grub.exe question



socalgail
09-01-2003, 09:52 AM
garyng has kindly contributed directions for using ntldr to dual boot into
the poor man's HD Knoppix copy of the cd image using grub.

The directions are at http://www.skyjammer.com/files/knoppix

My question is what exactly does w32grub.exe do to "patch" the necessary files?

Thanks!

garyng
09-01-2003, 11:49 AM
A little background on how these loaders work(including LILO).

1. BIOS load the first 512 byte of a boot DISK's MBR and jump to the code there
2. The MBR code either find the active partition and load the first 512 byte and jump there(standard DOS MBR) or would execute its own code(LILO/GRUB).
3. Because 512 byte is too small for any meaningful code, LILO/GRUB needs to find where the rest of the code is by reading the disk sector number(s) of the rest which is being 'stored' in the specific location in that 512 byte(this is what is done when you run lilo/GRUB on linux)

w32grub does the last operation. It read the GRUB file (stage2, the guts is here) and create the sector number arrays and stored back to it(first sector of that file). It also stores the first sector number of stage2 into the specific location in stage1.

The result :

1. NT loader load stage1 and jump to it(stage1 code takes over)
2. stage1 load the first sector of stage2(information provided by w32grub)
3. using that information, load the rest of stage2 then jump to it(stage2 takes control which is what GRUB really is).

LILO operates in a similar fashion but since LILO doesn't understand file system(yes the loader doesn't, only the installer does), it has everything(including menu info) stored in its 'stage2' equivalent.

I switched to GRUB because it is more flexible as I only need to run it once and then can change my partition/configuration as many times as I like, which is not the case in LILO. But there is some nice feature in LILO that makes it better for servers stored in a locked room.

socalgail
09-02-2003, 02:26 AM
I understand the basics of booting-
BIOS loads the MBR which in turn, in my case, loads ntldr.

ntldr gives a choice of boot sectors.

However, following your clear and complete directions, the stage1,
stage2 method does not bring up the grub promt. (Interestingly, before running w32grub, I got the grub prompt but it did nothing. After running w32grub, the system simply reboots itself completely. I assume it was supposed to offer the items in the menu.lst)

Also, after booting KNOPPIX with a floppy to the hd-based installation I have on /dev/hdb3, I tried to install lilo. First I made /mnt/hdb3 writable. Then I edited the lilo.conf file to change the boot = /dev/hdb3. I also set root=/dev/hdb3. I then ran /sbin/lilo. But after warning that the boot sector was beyond the BPB (BIOS Parameter Block), it had a fatal error since it could not create /boot/map~. Just for fun I tried to dd the bootsector to a file but got the same bytes as I had before I tried the lilo install.

I realize you say you are running the iso image from a hard drive and booting with ntldr. So if you can add any more info that would be great.

I think Jorge has also done a lot of work here. Also, if anyone has successfully followed the directions in the HdBased HowTo section 1.1, I would appreciate hearing about it. It is one of the harder howtos to follow for a newbie such as myself.

Thanks K-Team all around.

garyng
09-02-2003, 08:49 AM
If you have installed GRUB before, you don't need w32grub at all as all you need to do is just grab that 512 byte from wherever you installed it.

Back to w32grub, the problem you described seems to be a bug to me. Can I see the output of what w32grub produce ?

socalgail
09-02-2003, 06:19 PM
I don't have grub installed. I don't want to put anything in my MBR. I am still basically an NT user :( and just learning Linux so Knoppix is like training wheels. I am learning a lot in the process of this effort so that makes it worthwhile, although a bit frustrating. I have heard too many sad stories about people who can't get back online after installing grub or lilo and I am going to be sure I understand what I am doing before I do anything major.

I still want to try to install Lilo on my second drive, in the boot sector of the vfat partition, and get it to boot the HD image of Knoppix. If I could get the stage1, stage2 of grub to work, would I just have to add an entry in the menu.lst to point to the vmlinuz image in the vfat partition or would I still need to have Lilo installed?

Anyway, I knew you would be interested in the output of w32grub so here it is:
C:\boot\grub>w32grub
stage1(28235679)
version=3.2
boot_drive=ff
force_lba=0
stage2_address=0x8000
stage2_sector=28235679
stage2_segment=0x800
stage2(28235679+223)
menu (hd0,0)/boot/grub/menu.lst

Thanks for the help. I am going to do another post with the subject of the HdBasedInstall to see if any one else has tried this successfully.

Thanks so much for the help.

garyng
09-03-2003, 12:22 AM
The out indicates it is running fine and there shouldn't be any problem.

Do you mean when you add c:\boot\stage1="GRUB" in BOOT.INI and select it in the boot loader, the machine immediately reboot ?

If you don't have \boot\grub\menu.lst, the proper thing you see is the GRUB command prompt.

socalgail
09-03-2003, 03:36 AM
Do you mean when you add c:\boot\stage1="GRUB" in BOOT.INI and select it in the boot loader, the machine immediately reboot ?

Initially, I just copied the boot folder to my C: drive and added
c:\boot\stage1="GRUB" to the BOOT.INI file. I DID NOT run w32grub since I didn't know what that would do. Then, I rebooted, and
selected the GRUB option. The grub command prompt displayed but
did not respond to commands or carriage returns.

After I read your reply about w32grub, I ran it and rebooted the machine.
This time the grub prompt did not come up at all. The machine simply acted as if I had pressed the reset button :shock: and rebooted itself.


If you don't have \boot\grub\menu.lst, the proper thing you see is the GRUB command prompt.

I have only the menu.lst that you included in your xip distribution.

Any further ideas?

garyng
09-03-2003, 04:11 AM
Do you mean when you add c:\boot\stage1="GRUB" in BOOT.INI and select it in the boot loader, the machine immediately reboot ?

Initially, I just copied the boot folder to my C: drive and added
c:\boot\stage1="GRUB" to the BOOT.INI file. I DID NOT run w32grub since I didn't know what that would do. Then, I rebooted, and
selected the GRUB option. The grub command prompt displayed but
did not respond to commands or carriage returns.

After I read your reply about w32grub, I ran it and rebooted the machine.
This time the grub prompt did not come up at all. The machine simply acted as if I had pressed the reset button :shock: and rebooted itself.


If you don't have \boot\grub\menu.lst, the proper thing you see is the GRUB command prompt.

I have only the menu.lst that you included in your xip distribution.

Any further ideas?

That is an miracle that you can see the prompt without patching it as it relies on specific sector numbers to find stage2 :-)

After you run w32grub and boot, have you seen something like loading stage2 at the top of the screen ?

Another thing is, try to delete the menu.lst and see if at least you see the prompt.

socalgail
09-03-2003, 04:43 AM
No, it doesn't show any text on the monitor and starts to reboot after about 3 seconds. I am going to go back to the HdBasedHowTo and play
around some more. I think there is a lot to be learned just from going
through this process. I am interested in the ins and outs of booting.

Once I have this working with Lilo, I will maybe try with grub once more.

Thanks again.

ciscowar
05-19-2005, 04:42 AM
wow, googled, searched, scoured, and this is where I ended up. I have this exact problem...

I have had Knoppix, Auditor, Kanotix, XP, 2K, and Server 2003 all booted/loaded with GRUB, GRUB being in the MBR...
Now I wish to boot XP, 2K, and Whoppix booted/loaded with GRUB, GRUB being on the first NTFS partition and loaded by NTLDR

My Setup:
(primary) (ntfs) hda(0,1) - Windows XP Media Center 2005
(primary) (ntfs) hda(0,2) - Windows 2000 Pro
(primary) (ntfs) hda(0,3) - My Documents
(logical) (ext3) hda (0,5) - Whoppix 2.7
(logical) (swap) hda(0,6) - Linux Swap
(logical) (ntfs) hda(0,7) - Downloads
I multiboot using the default NTLDR, right now just XP and 2K

I have installed Whoppix, but did not install lilo to the MBR.

my boot.ini looked like

timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP Media Center Edition" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(0)partition(2)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
I downloaded w32grub and set it upran c:\boot\grub\w32grub.exe
added [b]"c:\boot\stage1="GRUB Stage 1"" to boot.ini
configured c:\boot\grub\menu.lstmy menu.lst:
# Boot automatically after a minute.
timeout 60

# By default, boot the second entry.
default 1

# Fallback to the first entry.
fallback 0

title Windows XP
unhide (hd0,0)
rootnoverify (hd0,0)
chainloader +1

title Whoppix
root (hd0,4)
kernel /boot/vmlinuz-2.6.11 append="ramdisk_size=100000 init=/etc/init lang=us apm=power-off nomce quiet"
initrd /boot/initrd.img
I rebooted and when the boot menu comes up, I select Whoppix...
Goes to blank screen, and the computer restarts in 3 sec.

I'm not sure if my menu.lst is configured corectly for my distro, but I thought grub would at least load up, anyone know whats wrong?

----------------

[EDIT]

then copy linux26 and miniroot.gz to c:\bootfound at http://knoppix.tnc.edu.tw/modules/newbb/viewtopic.php?topic_id=1435&forum=3
Might I try this?

sakiZ
05-21-2005, 04:52 PM
Grub is powerful but particular. If you are new to Linux, it can be frustrating and intimidating.

For those wishing an easier method to dual boot any NT flavored version of Windoze, there is Bootpart. It is available from www.winimage.com.

It is very easy to use. You run it once to determine where the Linux code for your Knoppix installation resides (code 83) on your hard drive.

It will number all the partitions with codes that are on your system. When you find what number is beside the (code 83) partition that's what you use to enter in the bootpart command line. It could be a number as low a 1 or as high as 15.

Run bootpart one more time to:

1. extract the bootsector code from your Knoppix installation.
2. Auto*magically* place an entry into your boot.ini file.

You decide on what name you want this boot code to be. bootsect.lnx for example.

You also decide on how you want the entry to appear in boot.ini:

"Boot Knoppix"

So the command line would be

C:\Bootpart\ Bootpart 3 bootsect.lnx Boot Knoppix

(if we assume the number to enter is a 3.) Substitute the correct number for your system.

Run that command line and bootpart extracts the bootcode to bootsect.lnx and places the correct menu entry in boot.ini

Wasn't that EASY? :-)

Note: This is the method that Corel Linux used to help it's customers dual boot Windoze products before it got bought out by Xandros.

(If you find you need to add cheat codes, you can add them later to the lilo.conf file after you have determined what they are by hand typing experimentation at the boot prompt when Knoppix starts.)

sakiZ