Octocontrabass wrote:
amyipdev wrote:
My boot sector code loads the first parts of the bootloader at 0x10000. It's designed to work in 64K chunks because of this.
How big are you expecting your bootloader to be? I've written a lot of bootloader code and I haven't run out of space under 0x10000 yet.
Decently large - I'm loading my bootloader at 0x10000 to ensure I don't run into other tables below 0x7c00. It also allows a much simpler and easier addressing scheme. It's fully possible that my bootloader may be as large as (but definitely not larger than) 384KB, as I want to make it fairly fancy (supporting multi-boot kernels, having some basic filesystem drivers, plus potentially fancy boot-up graphics). I'm also beginning addressing at 0x10000 to make the bootloader's structure much easier to conceptualize. I could shift it downwards to 0x7e00 but where's the fun in that?
Octocontrabass wrote:
amyipdev wrote:
(as cs,ds=1)
You mean 0x1000 and not 1, right? Setting a real-mode segment register to 1 changes the segment base to 0x10, not 0x10000.
Yes, my apologies - I meant 0x1000.
Octocontrabass wrote:
amyipdev wrote:
What linker script do I need to make this possible?
You need to specify the VMA and LMA separately, possibly with overlapping VMA. There's another example
at the bottom of this page that might also help.
But before you get into all of that, why do you want to link it all into a single binary? Do you really need a linker to resolve symbols across the two parts of your bootloader?
It would be preferable to do it all into one, yes. I'd like to be able to safely call functions across segments. In addition, for whatever reason, stuff seems to go haywire when I just shove separate binaries together for boot...
And thank you for that - I'll try to have a look at that. Do you think you could assist a bit more, however? I can't seem to get anything working in terms of a linker script, even just for the initial setup (1 file, loaded at 0x7c00).