Page 1 of 1

Putting multiple files in one image?

Posted: Mon Mar 26, 2012 2:21 pm
by theelitenoob
Hey, So I got my bootloader working, and a simple kernel file, with just printing "Hello, World!". But my problem is how do i create a single image file? For example I have a bootloader.bin file, would i link it with a kernel.o object file then use dd to make it into a single bootable image. Or is there a different way to compile my project into one bootable file?

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 2:52 pm
by VolTeK
You sure are an elite.

Google search it. You may find something like "Winimage"

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 3:18 pm
by Brynet-Inc
VolTeK wrote:You sure are an elite.
You're not exactly all that clever yourself, GhostXoPCorp.

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 3:27 pm
by theelitenoob
VolTeK wrote:You sure are an elite.

Google search it. You may find something like "Winimage"
I know that, How would i put it all into one file, like a .bin or something.
Like, linking my project into a final file, like my bootloader and my kernel and so on.

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 3:56 pm
by bubach
You don't link the bootloader to the kernel. I'm guessing you do not use any filesystem and just wants to load the sectors right after the bootsector as your kernel, in that case you can just merge the files to an "image" with DOS command copy - scroll down to see usage example here:
http://ask-leo.com/how_can_i_rejoin_two ... o_one.html

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 4:01 pm
by VolTeK
Brynet-Inc wrote:You're not exactly all that clever yourself, GhostXoPCorp.
Stay on topic with your posts.

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 4:07 pm
by theelitenoob
bubach wrote:You don't link the bootloader to the kernel. I'm guessing you do not use any filesystem and just wants to load the sectors right after the bootsector as your kernel, in that case you can just merge the files to an "image" with DOS command copy - scroll down to see usage example here:
http://ask-leo.com/how_can_i_rejoin_two ... o_one.html
Oh, ok, so if i compile into separate binaries, (.bins) then write them to an image, placing one after another, it would work?

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 4:41 pm
by bubach
if you're trying to do what i think you are, then yes. but you might as well just write them to disk (or mounted img file) one after eachother instead of combining them first - unless you are using the resulting file itself as the image? (might need padding to 1.44mb for that to work)

Either way you must have code in the bootsector to read in the next part (sectors) to memory and jump to it, just putting it together as one file won't work by itself - just in case you didn't know. ;)


For creating and mounting an image file in windows i suggest using imDisk:
http://www.ltr-data.se/opencode.html/#ImDisk


For writing the bootsector (and kernel right after it) - PartCopy:
http://asmhackers.net/geezer/johnfine/pcopy02.zip

Usage for bootsector to mounted drive a:
partcopy boot.bin 0 200 -f0
Syntax:
filename - offset on disk in hex - bytes to write in hex - drive to write to

for a 1kb kernel after the bootsector that would be "partcopy kernel.bin 200 400 -f0"
starting at hex 200 (512 byte) writing hex 400 (1024 byte)

Re: Putting multiple files in one image?

Posted: Mon Mar 26, 2012 4:57 pm
by theelitenoob
bubach wrote:if you're trying to do what i think you are, then yes. but you might as well just write them to disk (or mounted img file) one after eachother instead of combining them first - unless you are using the resulting file itself as the image? (might need padding to 1.44mb for that to work)

Either way you must have code in the bootsector to read in the next part (sectors) to memory and jump to it, just putting it together as one file won't work by itself - just in case you didn't know. ;)


For creating and mounting an image file in windows i suggest using imDisk:
http://www.ltr-data.se/opencode.html/#ImDisk


For writing the bootsector (and kernel right after it) - PartCopy:
http://asmhackers.net/geezer/johnfine/pcopy02.zip

Usage for bootsector to mounted drive a:
partcopy boot.bin 0 200 -f0
Syntax:
filename - offset on disk in hex - bytes to write in hex - drive to write to

for a 1kb kernel after the bootsector that would be "partcopy kernel.bin 200 400 -f0"
starting at hex 200 (512 byte) writing hex 400 (1024 byte)
Oh, i know about jumping to the sectors after it, and thanks for the partcopy and imDisk links, i understand now, thank you!