Putting multiple files in one image?

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
theelitenoob
Posts: 16
Joined: Wed Aug 24, 2011 11:19 am

Putting multiple files in one image?

Post 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?
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: Putting multiple files in one image?

Post by VolTeK »

You sure are an elite.

Google search it. You may find something like "Winimage"
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Putting multiple files in one image?

Post by Brynet-Inc »

VolTeK wrote:You sure are an elite.
You're not exactly all that clever yourself, GhostXoPCorp.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
theelitenoob
Posts: 16
Joined: Wed Aug 24, 2011 11:19 am

Re: Putting multiple files in one image?

Post 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.
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: Putting multiple files in one image?

Post 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
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: Putting multiple files in one image?

Post by VolTeK »

Brynet-Inc wrote:You're not exactly all that clever yourself, GhostXoPCorp.
Stay on topic with your posts.
theelitenoob
Posts: 16
Joined: Wed Aug 24, 2011 11:19 am

Re: Putting multiple files in one image?

Post 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?
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: Putting multiple files in one image?

Post 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)
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
theelitenoob
Posts: 16
Joined: Wed Aug 24, 2011 11:19 am

Re: Putting multiple files in one image?

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