Page 1 of 2
Trying to reason out a way to load my kernel from grub.
Posted: Mon Mar 24, 2008 6:59 pm
by Bobbias
Ok, here's the deal: I'm following Bran's tutorial, and I've compiled a really basic kernel. I've got the kernel.bin file ready to load, and I've got VMWare running a bootable GRUB ISO. Here's where the trouble starts: I don't have a floppy drive in this computer.
(I should also point out I'm running Windows.)
I've tried creating a floppy image and setting my virtual machine to load that along with the GRUB CD, but that seemed just to crash. GRUB never loaded.
I can get GRUB to load right now, but I'm using a virtual floppy drive program, which doesn't show up as a floppy drive to my computer. It shows up as a removable drive (like a USB storage drive would). GRUB can't see it from VMWare.
does anyone have a better solution?
I also don't know how to install grub onto the otherwise empty hard drive in VMWare. I'm not very experienced with GRUB...
(Yeah, I'm a noob, but I'm doing this so I can hopefully learn a lot more.)
Posted: Mon Mar 24, 2008 7:08 pm
by thomasloven
Hi.
I can recommend VFD for windows.
I think this is it...
http://chitchat.at.infoseek.co.jp/vmware/vfd.html
...no way of checking myself right now.
It loads a floppy image as a floppy drive, not as removable media.
It can also be controlled by command line which is very convenient if you want to make say a .bat file to update your image.
Also, I think the easiest way to do things would be installing grub on the same floppy and boot directly from it.
You should be able to find an image with GRUB installed for FAT12 somewhere I think.
There ought to be one in the wiki (if not, there realy should be IMO)
Posted: Mon Mar 24, 2008 7:12 pm
by t0xic
That is the correct link. VFD is what I use, and it works great.
Posted: Mon Mar 24, 2008 7:36 pm
by Bobbias
Ok, I uninstalled the default Floppy drivers and reinstalled/started VFD and it finally showed up as a floppy, instead of as a removable drive.
I'm following the wiki right now. I've got cygwin installed and I'm about to make the Auxiliary GRUB install.
Ok, problem: the dd commands don't work. It complains about of=/dev/fd0 not existing.
Posted: Tue Mar 25, 2008 2:30 am
by JamesM
Bobbias wrote:
Ok, problem: the dd commands don't work. It complains about of=/dev/fd0 not existing.
Yeah they wouldn't - dd is unix only. You'd have to use a cygwin shell.
Posted: Tue Mar 25, 2008 3:02 am
by Bobbias
Well, I've got the cygwin shell, but I don't have much experience with this level of interaction with linux stuff, so I don't exactly know what to do from here.
Some parts of this, I can find my own way through, and other parts, I'm a complete noob with.
My experience with Linux is either basic commands through SSH, or playing around with it in one of the GUIs, so I don't have much experience under the hood.
Is there another way other than using DD to get the desired result? (well, I assume there is, but I don't know it...)
Posted: Tue Mar 25, 2008 3:08 am
by JamesM
Is there another way other than using DD to get the desired result? (well, I assume there is, but I don't know it...)
Not with unix commands -- dd is the one you need. Post the command you are using and the resulting error message.
Posted: Tue Mar 25, 2008 3:15 am
by Bobbias
I used the same lines that are supplied by the wiki page on grub:
$> dd if=<stage1> of=/dev/fd0 bs=512 count=1
$> dd if=<stage2> of=/dev/fd0 bs=512 seek=1
I don't have anything except fd sdterr stdin and stdout in /dev according to cygwin bash.
The other aspect of this problem is that I've booted VMWare with the "SuperGRUBDisk" iso I found online (because I had no way to build grub in windows/didn't want to spend a year trying to figure out how to) doesn't seem to recognize the floppy drive. Hell, I don't even know how to get it installed on the "Hard drive" in VMWare.
I'm too tired to be doing this right now, I'll be back when I'm not feeling like a total zombie. (I'll try to get on during the day time, instead of starting all this crap at 2 in the morning)
Posted: Tue Mar 25, 2008 3:25 am
by AJ
Hi,
In cygwin, the first floppy drive is not found under /dev/fd0 - it's found under /cygdrive/a.
Cheers,
Adam
Posted: Tue Mar 25, 2008 3:45 am
by egos
Bobbias, install GRUB on your hard drive or use emulator to boot from the floppy image. For quick making and changing a floppy image you can use fasm and special include file. For example,
Code: Select all
include "mkfloppy.inc"
file "bootcode.bin", 512
; fat1
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0
; fat2
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0
; root
dent io, "IO SYS", FA_RO or FA_HID or FA_SYS or FA_ARC
dent msdos, "MSDOS SYS", FA_RO or FA_HID or FA_SYS or FA_ARC
dent command, "COMMAND COM", FA_ARC
dent drvspace, "DRVSPACEBIN", FA_RO or FA_HID or FA_SYS or FA_ARC
dent autoexec, "AUTOEXECBAT", FA_ARC
dent command2, "COMMAND", FA_DIR
rb 33*512-$
; data
stof io, "content/IO.SYS"
stof msdos, "content/MSDOS.SYS"
stof command, "content/COMMAND.COM"
stof drvspace, "content/DRVSPACE.BIN"
stof autoexec, "content/AUTOEXEC.BAT"
defdir command2
{
dent fdisk, "FDISK EXE", FA_ARC
dent format, "FORMAT COM", FA_ARC
dent sys, "SYS COM", FA_ARC
dent defrag, "DEFRAG EXE", FA_ARC
dent scandisk1, "SCANDISKEXE", FA_ARC
dent scandisk2, "SCANDISKINI", FA_ARC
}
stod command2, root
stof fdisk, "content/COMMAND/FDISK.EXE"
stof format, "content/COMMAND/FORMAT.COM"
stof sys, "content/COMMAND/SYS.COM"
stof defrag, "content/COMMAND/DEFRAG.EXE"
stof scandisk1, "content/COMMAND/SCANDISK.EXE"
stof scandisk2, "content/COMMAND/SCANDISK.INI"
rb 2*80*18*512-$
LFN not yet supported.
Posted: Tue Mar 25, 2008 2:19 pm
by Bobbias
The reason I didn't want to install GRUB on my computer is because I've already seriously messed up my boot system. NTLDR on my main drive (a320 GB) refuses to find hal32.dll despite the file being right where it should, so now I have to manually supply my 80 GB with NTLDR installed and use boot.ini to point to my 320 GB. That happened after I had installed linux and stuff. I forget exactly what I was trying to do in grub when that happened, but it took a long time to get windows accessible again. (and no attempts at repairing/replacing the messed up ntldr worked.)
I tried using a new dd command:
$> dd if=<stage1> of=/cygdrive/a bs=512 count=1
$> dd if=<stage2> of=/cygdrive/a bs=512 seek=1
Still complaining that /cygdrive/a doesn't exist when I know it does...
Why is it every time I become involved with GRBU, I end up with a massive headache when I now it shouldn't be that hard?
Posted: Tue Mar 25, 2008 3:12 pm
by inx
Windows recovery console could probably fix your boot problems just with "fixboot" and, if that doesn't work, "fixboot /mbr"
Posted: Tue Mar 25, 2008 3:25 pm
by Bobbias
Tried it. Tried fixboot, and fixmbr, I've tried copying a different version of ntldr, I've tried installing a clean copy of windows over the old one (without formatting, because I don't back stuff up, and don't want to lose everthing). None of it worked.
Posted: Fri Mar 28, 2008 8:52 pm
by kscguru
Bobbias wrote:I used the same lines that are supplied by the wiki page on grub:
$> dd if=<stage1> of=/dev/fd0 bs=512 count=1
$> dd if=<stage2> of=/dev/fd0 bs=512 seek=1
If you've got dd running, you're most of the way to creating a floppy image. Instead of writing to /dev/fd0, write directly to a file, e.g. myfloppy.flp. Then attach that image to your emulator of choice.
(Some emulators need the floppy image file to be exactly 1.44MB in size, but dd can do that too, dd if=/dev/zero of=<image> bs=512 seek=2 count=foo, where foo is 1.44MB / 512B and I don't have a calculator handy.)
Posted: Sat Mar 29, 2008 7:11 am
by binutils
Just out of curiosity, what kind of dd do you use? cygwin?
i doubt it works same as below dd.
http://www.chrysocome.net/dd