making an image with grub to test iut with bochs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

making an image with grub to test iut with bochs

Post 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!!"
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

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

Post 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.
My OS is Perception.
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

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

Post 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.
speal
Member
Member
Posts: 43
Joined: Wed Mar 07, 2007 10:09 am
Location: Minneapolis, Minnesota
Contact:

Post 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.
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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.
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post 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 ??
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

Post 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...
kubeos
Member
Member
Posts: 138
Joined: Tue Jan 30, 2007 2:31 pm
Location: Kamloops BC, CANADA
Contact:

bran's kernel

Post by kubeos »

http://www.osdever.net/downloads.php

Theres a grub fat12 floppy image there.
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post 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 :((
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

Post 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.
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post 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 :(
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post 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.
Every good solution is obvious once you've found it.
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

Post 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.
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post 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
Post Reply