help on cross-compiling xserver

Jaymz Julian jaymz@artificial-stupidity.net
Fri, 6 Feb 2004 18:50:58 +1100


On Fri, Feb 06, 2004 at 05:17:20AM +0000, Suresh Chandra Mannava wrote:
> The main problem is cross-compiling for static xserver
> with a start address of 0x80001000. I hope I will get
> some pointers regarding this.

Firstly, to make the linker use static libraries instead, pass it
-Bstatic.

This is how I would tackle the address issue.  it is neither the only,
nor probably the best way.

I havn't done this on x86, but I would assume the syntax is the same.
You need to tell the linker to relocate everything there.  There are
a couple of ways of doing this, but given that you wish to do this with
every application, the best way for you to do this, is to modify
your linker script (I am obviously unfamiliar wityh your particular 
but I am going to assume that it is ram and not rom based - if it's
rom based, I can help you more, since that's what I'm used to :)

The linker provides a couple of parameters which you are interested in:

  -e ADDRESS, --entry ADDRESS Set start address

Now, with the default link script, assuming you already have a crt.o,
you should be able to link with

ld -e 0x80001000 blah.o blah.o blah.o -o blah.elf

assuming that you're compiler is set up to target elf, yuo can then
strip this down to a raw image with:

objcopy.elf -v -O binary blah.elf blah.bin

Now, what you probabyl want to actually do, if you're compiling a lot
of binaries for this platform, is have your linker automatically link
to the right place.  the easiest way to do this, of course, is to take
one which already exists (the gnu compiler ships with a pile of them, and
there is more floating around the intenret), and change the addresses to
what you need.  In the case of the elf-i386 one, the number you need to change
is right near the top.  However, it may assume things that are not true in 
on your particular arch, so you're probably better to alter one of the ones
int he gcc source distribution.  (the only ones i have to hand are i386-elf.x
and arm-agb.x, sorry!)

To pass all of this fu to automake, i assume you know how to do that, but
LD="lD string" ./configure --whatever., i guess

hope i'm more help than hinderance, but proably not :)

--jj


-- 
--
Jaymz Julian aka A Life in Hell / Warriors of the Wasteland / Unreal
Coder, Visionary, Fat Ass.
"Hannibal is a serial killer. He only likes to kill and eat people. 
 Very few people have `I want to be killed and eaten' on their cards, 
 so Hannibal is out of a job." - http://cards.sf.net