Sorry, but the mailing list seems to keep cutting off half my
message at one of the blank lines - deleting them

I seem to be getting into a habit of (partially) answering my own
questions, but I figure these self answered questions may help
someone in the future...

Firstly, the i386 port definitely does not relocate - Two sources of
proof -1) /cpu/i386/start.S is where bss and data get initialised in
RAM with no copy of .text and 2) the startup banner gives it all away

U-Boot code: 38040000 -> 3805158F  data: 00400000 -> 00400A57
             ^^^^^^^^^^^^^^^^^^^^

        BSS: 00400A58 -> 00404463 stack: 00404464 -> 0040C463


start.S sets up the stack, copies .data & .got to 0x400000, and
clears .bss

>From here, things get a little weird and I don't understand how the
i386 port ever worked. u-boot.lds sets up a real mode trampoline
at 0x000007c0 and some BIOS emulation at 0x0000 - 0x053e. The next
4-byte alignment (0x0540) is where __u_boot_cmd_start is supposed to
end up in memory. Going by u-boot.map, the load address of .bios is
0x3805214e - Add 0x540 gives 0x3805268e which is 0x1268e into
u-boot.bin which is exactly where I found found the command table.

BUT - The command table is never, as far as I can tell, copied into
RAM - .bios is by bios_setup () in /lib_i386/bios_setup.c

So, it looks like I could add:

        _i386boot__u_boot_cmd_start = LOADADDR(.u_boot_cmd);
and
        _i386boot__u_boot_cmd_size = SIZEOF(.u_boot_cmd);

and copy the command table into RAM at 0x0540 and all should be well.
At the same time, I could copy .text into RAM and adjust the target
addresses in the command table (I can grab this code from other
platforms)

QUESTIONS:
 - Where should I relocate to? I have 128MB to play with - should I
   relocate to the highest possible location in RAM and if so,
   should I change to setup of the stack, bss and data segments to
   be high in RAM as well? Is there any advantages, especially when
   loading the linux kernel, in locating U-Boot at any particular
   location in RAM?

 - Should I shuffle the link script a little to that the order of
   segments is .data, .got, .u_boot_cmd then .bss, .realmode and
   .bios and set:

        _i386boot_romdata_size = SIZEOF(.data) + SIZEOF(.got) + 
SIZEOF(.u_boot_cmd)

   This would have the advantage that I could use a single copy
   operation to copy .data, .got and .u_boot_cmd

 - Is the code in .text natively relocatable or do I need to do
   something (gcc or ld options) to make it relocatable?

Thanks for your patience

Regards,


Graeme


 
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to