Page 1 of 2

making an image with grub to test iut with bochs

Posted: Tue Sep 18, 2007 7:02 pm
by mohammed
i have the file kernel.bin witch have the multiboot header for grub - it is bran's kernel - how can i use grub to make an image that i can test it with bochs i never used grub before and i am using windows i assure you that google was gonna tell me "That's enough you are searching for hours!!"

Re: making an image with grub to test iut with bochs

Posted: Tue Sep 18, 2007 10:08 pm
by AndrewAPrice
mohammed wrote:i have the file kernel.bin witch have the multiboot header for grub - it is bran's kernel - how can i use grub to make an image that i can test it with bochs i never used grub before and i am using windows i assure you that google was gonna tell me "That's enough you are searching for hours!!"
Either, find a grub FAT12-formatted floppy image and use that, or get find a Windows port of grub (I think I recall a projected called WinGRUB or something similar) and create a floppy disk, then use a imaging tool (I'd use WinImage) to turn the disk into an image.

Once you have your image, use a program which allows you to either edit or mount a floppy image (again, I use WinImage, but look on the Wiki for other tools) and copy kernel.bin onto the floppy image. Unmount/save the image then run bochs.

Re: making an image with grub to test iut with bochs

Posted: Tue Sep 18, 2007 10:14 pm
by raevin
MessiahAndrw wrote:
mohammed wrote:i have the file kernel.bin witch have the multiboot header for grub - it is bran's kernel - how can i use grub to make an image that i can test it with bochs i never used grub before and i am using windows i assure you that google was gonna tell me "That's enough you are searching for hours!!"
Either, find a grub FAT12-formatted floppy image and use that, or get find a Windows port of grub (I think I recall a projected called WinGRUB or something similar) and create a floppy disk, then use a imaging tool (I'd use WinImage) to turn the disk into an image.

Once you have your image, use a program which allows you to either edit or mount a floppy image (again, I use WinImage, but look on the Wiki for other tools) and copy kernel.bin onto the floppy image. Unmount/save the image then run bochs.
There's also a "makeboot.exe" program that comes with a release of BartPE that will do this kinda stuff too...I used that when I'd do anything that required booting on Windows.

Not sure if you can use GRUB with it...but, meh.

Posted: Tue Sep 18, 2007 10:49 pm
by speal
I've found it easier to work with CD images, since mkisofs is available for cygwin. Assuming you're not attached to using floppies, you can get mkisofs in the cdrtools package here: http://freshmeat.net/projects/cdrecord/

When I was still working with floppies, I didn't have a physical floppy drive in my development machine, and used FileDisk to mount floppy images as drives. This is a convenient way to do things if you use a linux (cygwin) build environment, since you can just write a bash script to create the distributable floppy image (or just stick it in your makefile). Read more about filedisk here: http://www.osdev.org/wiki/File_Disk

I wasn't terribly pleased with WinImage, since it advertises itself as a trial. You also have to click through their GUI every time you want to test your new build, when filedisk or mkisofs could be automated with a script. Just a convenience thing, but when you're already stuck on something, that extra convenience is always helpful.

On an unrelated note, you may like Qemu (as an alternative to bochs). Again, just a personal preference, but it's much easier to configure than bochs if you use any of the front-ends that are available (I use qemu manager), and provides a gdb-like console mode that is handy for tracking down bugs.

Posted: Tue Sep 18, 2007 11:02 pm
by raevin
speal wrote:I've found it easier to work with CD images, since mkisofs is available for cygwin. Assuming you're not attached to using floppies, you can get mkisofs in the cdrtools package here: http://freshmeat.net/projects/cdrecord/

When I was still working with floppies, I didn't have a physical floppy drive in my development machine, and used FileDisk to mount floppy images as drives. This is a convenient way to do things if you use a linux (cygwin) build environment, since you can just write a bash script to create the distributable floppy image (or just stick it in your makefile). Read more about filedisk here: http://www.osdev.org/wiki/File_Disk

I wasn't terribly pleased with WinImage, since it advertises itself as a trial. You also have to click through their GUI every time you want to test your new build, when filedisk or mkisofs could be automated with a script. Just a convenience thing, but when you're already stuck on something, that extra convenience is always helpful.

On an unrelated note, you may like Qemu (as an alternative to bochs). Again, just a personal preference, but it's much easier to configure than bochs if you use any of the front-ends that are available (I use qemu manager), and provides a gdb-like console mode that is handy for tracking down bugs.
If I remember correctly, there's a Windows port of mkisofs as well...

Supposed to do everything mkisofs can do for Linux...I don't have any looks though, but Google might.

Posted: Wed Sep 19, 2007 1:34 am
by JamesM
http://www.jamesmolloy.co.uk/downloads/floppy.img

That's an ext2 formatted disk image with a file called 'kernel' on it, grub installed and menu.lst set up.

Posted: Wed Sep 19, 2007 9:51 am
by mohammed
thank you all i thought it will be something like this
grub input:kernel.bin output:kernel.image that i can use with bochs
i was extremely wrong what is the use of grub then ???????
i am going to try programs that you mentioned and if i faced a problem you are there right ? :D
is it okay to use VFD ??

Posted: Wed Sep 19, 2007 10:21 am
by raevin
mohammed wrote:thank you all i thought it will be something like this
grub input:kernel.bin output:kernel.image that i can use with bochs
i was extremely wrong what is the use of grub then ???????
i am going to try programs that you mentioned and if i faced a problem you are there right ? :D
is it okay to use VFD ??
Short story shorter, GRUB's purpose is to handle all the dirty work of setting your kernel up to be in 32-bit protected mode.

Use GRUB to load your kernel loader, then that calls your kernel, etc...

bran's kernel

Posted: Wed Sep 19, 2007 10:40 am
by kubeos
http://www.osdever.net/downloads.php

Theres a grub fat12 floppy image there.

Posted: Thu Sep 20, 2007 6:12 pm
by mohammed
i am really sorry dudes for being dump
look!
when you want to assemble your bootsector you type
nasm so and so
whne you want to compile your kernel
you type
gcc so and so
i assembled and compiled and linked them all with the result kernel.bin
now i want to test it with bochs
next step is to type
grub so and so in order to have a result like this kernel.img
so i can test it with bochs i have the configuration file already what al i want is one by one steps to have the file that i can test :((

Posted: Thu Sep 20, 2007 6:48 pm
by raevin
mohammed wrote:i am really sorry dudes for being dump
look!
when you want to assemble your bootsector you type
nasm so and so
whne you want to compile your kernel
you type
gcc so and so
i assembled and compiled and linked them all with the result kernel.bin
now i want to test it with bochs
next step is to type
grub so and so in order to have a result like this kernel.img
so i can test it with bochs i have the configuration file already what al i want is one by one steps to have the file that i can test :((
Well, if you want to do a CD ISO boot (which is simplest in my opinion for doing GRUB), just look at the GRUB documentation.

Posted: Thu Sep 20, 2007 8:50 pm
by mohammed
now i want to know your problem more than mine
i have kernel.bin
i want to convert it to kernel.img that i can use with bochs
we have two cases you know the answer and thank you for it
the second one os wasting both my time and yours by offering me google
do you think that i didn't try it
i setup cygwin so i can use linux commands but i failed to have a result also :(

Posted: Thu Sep 20, 2007 9:55 pm
by Solar
Insufficient input.
Redo from start.

Honestly. JamesM and kubeos linked a ready-made floppy image for your convenience. You might also want to check the various wiki pages (Disk Image Utilities, GRUB, Bochs) on the subject.

And if that really does not help you, it will certainly help if you provide a proper error description instead of "I failed to have an result". That way, we could try to solve your problem instead of having to defend against an attitude.

Posted: Thu Sep 20, 2007 10:28 pm
by raevin
mohammed wrote:now i want to know your problem more than mine
i have kernel.bin
i want to convert it to kernel.img that i can use with bochs
we have two cases you know the answer and thank you for it
the second one os wasting both my time and yours by offering me google
do you think that i didn't try it
i setup cygwin so i can use linux commands but i failed to have a result also :(
Well, if you'd have read the GRUB manual, it gives you step-by-step directions on how to create an ISO, which works just as well (but better in some aspects) as an IMG file for floppy disks.

I gave you the link to Google because if you aren't going to take the time to research keywords people here give you, then why should we give you a step-by-step tutorial on how to do your work?

Like I said, just to reiterate my point...the GRUB manual has a section on creating bootable images and discs...which also includes a guide on creating a bootable CD ISO, step-by-step in the baby-way.

Posted: Fri Sep 21, 2007 4:33 pm
by mohammed
i reviewed the faq and downloaded the file grub_disk.img
now i have kernel.bin (that is boot.asm+main.c)
grub_disk.img (i still don'tknow what it is exactly)
bochsrc.txt (that allow me to emulate with bochs)
see? i have alot of things what i need is less than what i have
how can i add kernel.bin and grub_disk.img to test it with bochs
i swear i wasted the whole night trying tar dd mount and so on but i figured out that i am not clever in linux stuff anyway are you gonna tell me or should i kill myself to end this miserable scene!!
don't be stingy God will punish you for hiding knowledge