![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
King of Portal
|
In order to load up an O/S the BIOS has to read contents of a binary file from the first sector of either the floppy or the harddrive. I downloaded the BOCHS IA-32 emulator which uses an image file of one of the two devices. My question is the following, after I create my particular binary file, how do I write to the first sector of the image? Or how do I create an image file for a floppy/harddrive for that matter.
Any help is appreciated.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis |
|
|
|
|
|
#2 |
|
Professional Programmer
|
The first sector is the first 512 bytes; you should be able to use something like a hex editor. You can use dd if=/dev/input_device of=/img on Unices or I believe rawrite and rawread on Windows for the same effect.
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;} |
|
|
|
|
|
#3 |
|
King of Portal
|
I tried rawrite but apparently that particular program writes image files to actual drives (implying that the actual image file has to already exist). I need to create the image file with the first 512 bytes written to, so I still have no clue as to how to do that.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis |
|
|
|
|
|
#4 |
|
Professional Programmer
|
Well like I said, the boot sector is just the first 512 bytes of the image. Open the boot record you want and the image file in a hex editor (HexEdit on Windows is good for a couple basic things) and overwrite the first 512 bytes of the bochs disk image with the first (and only) 512 bytes of the boot record.
If the deal is that you don't even have an image of a system yet, bochs should run just on hard drive images. In the Unix world, this is all so much easier. A hard drive image is just a bunch of bytes arranged into a file. If that doesn't get you anywhere, maybe you can tell me your hard drive setup, i.e, what you want to copy, and how much storage you have available on your drives.
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|