I have a bin file from my NASM boot loader. I want to write it to a hard drive img used by Bochs and have it boot up. Can anyone tell me how to do that?

Im on WindowsME. I dont have access to spiffy Linux hehe :).


Posted on 2001-09-04 20:50:16 by Torch
Here are two options that I can think of:
• Use debug to load the image, then do a sector write
• Look up rawrite.exe (DOS port of a Linux utillity.)
Posted on 2001-09-05 13:55:22 by eet_1024
I thought RaWrite only writes imgs to floppies?

I have gotten by with writing the bin to a floppy and then imaging the floppy, but thats alot of work to test small changes. I want to write it to the hd img.. which is 10 megs (I dont need anything big.. it's a small OS right now).

How would I use your suggestions?
Posted on 2001-09-05 17:06:52 by Torch
if you want only to test your bin file, why would u write (or insert) your binary file to "hd.img", why wouldn't u just try to produce a floppy image from a bin file, by appending '\0' or something else, to fit the 1,44 M.

if u want, i'll send u the prog that does it, u just type

prog test.bin

and it will produce a "a.img" file, that u can run in bochs a floppy image.
Posted on 2001-09-05 19:20:46 by Sabeel
Posted on 2001-09-05 19:33:32 by Torch
Try to see if you can find a dos or win32 port of "mtools", that makes
work with images much easier (I think it support HD images as well
as floppy images).
Posted on 2001-09-05 20:58:02 by f0dder
All known links are dead for the dos port.. all thats left is the Linux stuff. I havent found a working link yet.. and Ive been looking for 2 days hehe
Posted on 2001-09-06 05:11:28 by Torch
Partcopy might do the trick.

Just search for "john fine partcopy" or something like that.
Posted on 2001-09-06 06:08:57 by Ahner
I have Partcopy.. Ive only used it to write to floppies.

It does write to img files, but when I write it to offset 0 (I assume thats where..) Bochs crashes. Am I doing something wrong? The bin is a standard 512 bytes.

Could someone show me what to do? :)


Posted on 2001-09-06 17:24:31 by Torch
here is it, check the source it is written in C++(-) though it easy to decipher...
Posted on 2001-09-06 19:11:17 by Sabeel
Its C.. no C++ in it :)

It looks similar to my boot disk writer I wrote.. never thought about having it write to a floppy img *smacks himself on the forehead* hehe :).

My crashing problem with Bochs still hasnt been resolved. Boot floppy images work, partcopying to the hd img doesnt want to work.. Im probably doing something wrong with it though.

Any ideas?

Posted on 2001-09-06 19:31:50 by Torch
Now I dont use bochs, but if the hd.img file is an exact replica of a hd, i.e. if at offset 0 in the img file there is a mbr, you would destroy the partition entries by writing 512 bytes. Try writing only 446 bytes.
Posted on 2001-09-06 19:35:37 by Ahner

You can get it there.

Here is my boot.bin.. It doesnt do anything put show a message heh.. dont laugh :).. Im only starting :).

I also added the bochsrc that Bochs uses to find out what to do.

See what you can come up with when you have time :).
Posted on 2001-09-06 19:52:48 by Torch
in your "bochsrc.txt" i saw this two lines ...

# choose the boot disk.
boot: a

then bochs, will look for "floopya.img" as the config file states
floppya: 1_44=floppya.img, status=inserted

u get to run my proggy, to produce u file called "a.img"

- change this line
floppya: 1_44=floppya.img, status=inserted

- to
floppya: 1_44=a.img, status=inserted

and if your boot sector "boot.bin" is right, u'll get it works

try with my boot file, to see what wrong with yours, it's written in TASM
Posted on 2001-09-06 20:33:30 by Sabeel
I figured out the problem..

I hadnt formatted the img file with fdisk. But what's weird is that when I part copy.. the file is the exact same thing whether I formatted and part copied, or I didnt format and part copied :/.. The formatted and part copied boots, but the other one doesnt even though its the same file heh.. weird :/
Posted on 2001-09-06 20:39:19 by Torch