Development problem

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

Development problem

Post by beyondsociety »

For a year or so, I have been using DJGPP as my compiler suite on Windows 2000. I have currently switched over to Cygwin and like it very much. I was wondering if I still could use my previous batch file for compiling my operating system? I have a previous makefile that works on linux.

The only problems I see are: How do I copy my binary image to a floppy disk? I was originally using: mount floppy, cp to floppy. umount in linux.

Also: How would I create a image for testing in bochs? I am currently using a program called makeboot that runs from my batch file. Its syntax is: makeboot test.img bootpm.bin kernel.bin
Curufir

Re:Development problem

Post by Curufir »

It's been quite a while since I used Cygwin, but I seem to remember that it comes with a port of dd. That's what I'd use for dumping sectors onto a disk (Or image).
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Development problem

Post by Pype.Clicker »

another trick that works fine independently of the system is to use NASM's incbin and padding features to create one single file you'll then use with rawrite or something ...
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Development problem

Post by Solar »

As for writing files to floppy (i.e., using the standard file system), just do:

Code: Select all

cp <filename> /cygdrive/a/
As for dd, that's affirmative, and the way I made my first GRUB floppies. ;-)

As for the bochs image... let me quote an older posting of mine:
On http://www.acc.umu.se/~bosse/, you will find a tool named "filedisk".

Make an image from your floppy drive. (The how-to on that should be somewhere in the Bochs manuals IIRC.)

Then, you can mount that image:

filedisk /mount 0 'C:\Path\To\Your\ImageFile.img' z:

Now you can access your image at drive letter z:. Copy your kernel image there, unmount the drive with

filedisk /umount z:

...and boot the image with bochs.

Hint: I wrote a target "image" in my makefile, which builds the kernel image, and does the mount/copy/unmount. That way, all I have to do is a "make image", there you go. ;-)
Every good solution is obvious once you've found it.
Tim

Re:Development problem

Post by Tim »

Filedisk is almost brilliant.

A couple of snags:
-- You can't have a filedisk mounted while Bochs is running, and vice versa. So you need to mount, copy, unmount, Bochs every time you want to test your code.
-- It will only work on uncompressed files. A trick I use is to compress disk images so that all the zero bytes of unused space at the end aren't wasting disk space. Filedisk doesn't like this.
Curufir

Re:Development problem

Post by Curufir »

Tim Robinson wrote: -- You can't have a filedisk mounted while Bochs is running, and vice versa. So you need to mount, copy, unmount, Bochs every time you want to test your code.
Huh? It works fine for me so long as I setup Bochs to use the virtual drive instead of the disk image.
Tim

Re:Development problem

Post by Tim »

OK. Maybe I was thinking of Virtual PC, which doesn't allow sharing of disk images while it's running.
Post Reply