In removing address conflicts in the process of booting, I keep
wanting to copy the bootloader around, or relocate it in other ways. 

So today I sat down and played with the techniques ld.so uses
to make itself position indpendent.  I took the necessary bits
out of ld.so stripped them down and came up with a binary with a 2308  
byte footprint (bss included).

All the 2308 byte binary does is call brk to get some more memory
and then copy itself there, and then it restarts itself.  

And the code isn't to painful to write or maintain.  For another 300
bytes I can add in printf so I can see what I'm doing.

Holler if you want my test program, but generating a shared object
that can relocate it self definitely works.

I will probably figure out how to deploy this first in memtest86
as it will cut the program size in half (because it won't have to
double compile it's code), and make it more flexible.

Oh yeah, and the active code size is for the relocate is just under
300 lines of code.  So this is small stuff that is fairly easy to deal
with.

A linker that does symbol lookup is still spooky but for relocation
I'm pretty much convinced this is the way to go. 

Eric

Reply via email to