All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] fixup section problem.
@ 2006-11-02  9:21 Txema Lopez
  2006-11-02 11:31 ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Txema Lopez @ 2006-11-02  9:21 UTC (permalink / raw)
  To: u-boot

Hi,

We are working in a MPC5200B based custom board and we are developping a 
tool to relocate a U-Boot (1.1.4 version) binary file to a different 
address in flash that it was linked. So, we have to change  the GOT and 
FIXUP entries in the original file to point at the new address. Doing 
this work, we have found that, surprisingly, the FIXUP section in U-Boot 
is empty. When U-Boot is relocated from flash to sdram these lines in 
the file start.S have no effect:
    /*
     * Now adjust the fixups and the pointers to the fixups
     * in case we need to move ourselves again.
     */
2:    li    r0,__fixup_entries at sectoff@l
    lwz    r3,GOT(_FIXUP_TABLE_)
    cmpwi    r0,0
    mtctr    r0
    addi    r3,r3,-4
    beq    4f
3:    lwzu    r4,4(r3)
    lwzux    r0,r4,r11
    add    r0,r0,r11
    stw    r10,0(r3)
    stw    r0,0(r4)
    bdnz    3b
4:
Looking into the sources we have found some places where the fixup 
elements seem to be relocated manually, i.e.:
void malloc_bin_reloc (void)
{
    DECLARE_GLOBAL_DATA_PTR;

    unsigned long *p = (unsigned long *)(&av_[2]);
    int i;
   
    for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
        *p++ += gd->reloc_off;
    }
}
Is there any reason to leave the FIXUP section empty in U-Boot? Is it a 
bug?.

Checking the u-boot.lds file for the IceCube board we have found that 
fhe fixup section is included in the TEXT section and in the RELOC 
section, but the linker generate code only for the TEXT section. If we 
put it only in the RELOC section the FIXUP is not empty, the pointers 
adjustement in the start.S seems to work properly and the 
malloc_bin_reloc() function would be not necessary. Does anynone know if 
I'am missing something?

Any clue will be welcomed.
Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlopez.vcf
Type: text/x-vcard
Size: 324 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20061102/6d27a20a/attachment.vcf 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
  2006-11-02  9:21 [U-Boot-Users] fixup section problem Txema Lopez
@ 2006-11-02 11:31 ` Wolfgang Denk
  2006-11-03  7:15   ` Txema Lopez
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2006-11-02 11:31 UTC (permalink / raw)
  To: u-boot

Hello,

in message <4549B883.7050309@aotek.es> you wrote:
> 
> Looking into the sources we have found some places where the fixup 
> elements seem to be relocated manually, i.e.:

Yes, all statically initialized pointers need to be relocated
manually.

> Is there any reason to leave the FIXUP section empty in U-Boot? Is it a 
> bug?.

This is probably a side-effect of  my  limited  untestanding  of  the
linker magic. Please feel free to call it a bug.

> Checking the u-boot.lds file for the IceCube board we have found that 
> fhe fixup section is included in the TEXT section and in the RELOC 
> section, but the linker generate code only for the TEXT section. If we 
> put it only in the RELOC section the FIXUP is not empty, the pointers 
> adjustement in the start.S seems to work properly and the 
> malloc_bin_reloc() function would be not necessary. Does anynone know if 
> I'am missing something?

Most probably you know more about these things than me, so any fix to
make relocation simpler and more reliable are welcome.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The last thing one knows in constructing a work is what to put first.
- Blaise Pascal

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
  2006-11-02 11:31 ` Wolfgang Denk
@ 2006-11-03  7:15   ` Txema Lopez
  2006-11-03  8:16     ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Txema Lopez @ 2006-11-03  7:15 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:

>Most probably you know more about these things than me, so any fix to
>make relocation simpler and more reliable are welcome.
>  
>
Hi Wolfgang,
OK, I will try to do it. But I only can check the changes in the 
Lite5200B and IceCube boards. My idea, to not disturb the rest of 
platforms, is to define a new  configuration word, CFG_FIXUP_RELOCATION 
, and only define it for these boards. What do you thing?
If you agree I can submit a patch for the 1.1.6 version.

>Best regards,
>
>Wolfgang Denk
>
>  
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlopez.vcf
Type: text/x-vcard
Size: 324 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20061103/4773adc2/attachment.vcf 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
  2006-11-03  7:15   ` Txema Lopez
@ 2006-11-03  8:16     ` Wolfgang Denk
  2006-11-03 11:18       ` Txema Lopez
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2006-11-03  8:16 UTC (permalink / raw)
  To: u-boot

Dear Txema,

in message <454AEC9E.9000808@aotek.es> you wrote:
>
> OK, I will try to do it. But I only can check the changes in the 
> Lite5200B and IceCube boards. My idea, to not disturb the rest of 
> platforms, is to define a new  configuration word, CFG_FIXUP_RELOCATION 
> , and only define it for these boards. What do you thing?
> If you agree I can submit a patch for the 1.1.6 version.

Relocation is not board dependent, so if  it  works  onone  board  it
should  work  for all. Please create your patch for all boards, i. e.
without CFG_FIXUP_RELOCATION etc., and post it here.  Me  and  others
will help testing it.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Lots of folks confuse bad management with destiny.   -- Frank Hubbard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
  2006-11-03  8:16     ` Wolfgang Denk
@ 2006-11-03 11:18       ` Txema Lopez
  2007-02-12  4:45         ` Grant Likely
  0 siblings, 1 reply; 9+ messages in thread
From: Txema Lopez @ 2006-11-03 11:18 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:

>Dear Txema,
>
>  
>
>Relocation is not board dependent, so if  it  works  onone  board  it
>should  work  for all. Please create your patch for all boards, i. e.
>without CFG_FIXUP_RELOCATION etc., and post it here.  Me  and  others
>will help testing it.
>
>Best regards,
>
>Wolfgang Denk
>
>  
>
Hi Wolfgang,

I'm not sure if this patch could work for not PowerPC based 
architectures. Taking a look in the U-Boot starting files for mips and 
bf533 cpu's, it seems that only the GOT section is relocated in ram, so 
the patch probably won't work. Furthermore, there is some fpga's 
relocations that I can't understand, and I don't know what is the effect 
of my patch for boards with a fpga. I mean I can't supply a patch valid 
for all architectures without doing some bugs.

I think the method I suggest you using a new define It's quite 
reasonable. I'll summit the patch for the Lite5200's and the rest of 
boards will be not affected. If someone want to use or test the fixup 
relocation for his board only has to do two changes:
            - cleanup the fixup section from the text section in  the 
u-boot.lds file.
            - define CFG_FIXUP_RELOCATION in the board configuration file.

I believe this is the safest way to do it. What do you think?

Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlopez.vcf
Type: text/x-vcard
Size: 324 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20061103/8b6fc61a/attachment.vcf 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
  2006-11-03 11:18       ` Txema Lopez
@ 2007-02-12  4:45         ` Grant Likely
  0 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2007-02-12  4:45 UTC (permalink / raw)
  To: u-boot

On 11/3/06, Txema Lopez <tlopez@aotek.es> wrote:
> I think the method I suggest you using a new define It's quite
> reasonable. I'll summit the patch for the Lite5200's and the rest of
> boards will be not affected. If someone want to use or test the fixup
> relocation for his board only has to do two changes:
>             - cleanup the fixup section from the text section in  the
> u-boot.lds file.
>             - define CFG_FIXUP_RELOCATION in the board configuration file.

Txema,

How's your work on this patch coming along?  I've got the same problem
with new code that I've written for the Xilinx virtex boards.  I don't
want to do the manual relocation hack, so I'm very much looking
forward to seeing your fix.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
  2007-02-12 19:26 ` Grant Likely
@ 2007-02-12 19:40   ` Stefan Roese
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2007-02-12 19:40 UTC (permalink / raw)
  To: u-boot

On Monday 12 February 2007 20:26, Grant Likely wrote:
> > My intention is not to submit the patch. It could add some noise in all
> > the U-Boot architectures without add any new functionality or
> > improvement. Furthermore, my impression is that Wolfgang was not very
> > interested in this patch so I gave up this work. Anyway, I can submit the
> > patch to you out of the U-Boot-users list.
>
> Yes please do.  I'm doing a bunch of cleanup to u-boot, and your patch
> becomes *very* important for that work.  :)

And please don't submit it *out* of the mailing list but *in* the list too. 
This is of course an important issue since it fixes a bug dragged with us for 
years.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
=====================================================================

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
  2007-02-12  7:53 TXEMA LOPEZ
@ 2007-02-12 19:26 ` Grant Likely
  2007-02-12 19:40   ` Stefan Roese
  0 siblings, 1 reply; 9+ messages in thread
From: Grant Likely @ 2007-02-12 19:26 UTC (permalink / raw)
  To: u-boot

On 2/12/07, TXEMA LOPEZ <tlopez@aotek.es> wrote:
> Hi Grant,
> My intention is not to submit the patch. It could add some noise in all the U-Boot
> architectures without add any new functionality or improvement. Furthermore, my
> impression is that Wolfgang was not very interested in this patch so I gave up this
> work. Anyway, I can submit the patch to you out of the U-Boot-users list.

Yes please do.  I'm doing a bunch of cleanup to u-boot, and your patch
becomes *very* important for that work.  :)

g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot-Users] fixup section problem.
@ 2007-02-12  7:53 TXEMA LOPEZ
  2007-02-12 19:26 ` Grant Likely
  0 siblings, 1 reply; 9+ messages in thread
From: TXEMA LOPEZ @ 2007-02-12  7:53 UTC (permalink / raw)
  To: u-boot

Hi Grant,
My intention is not to submit the patch. It could add some noise in all the U-Boot architectures without add any new functionality or improvement. Furthermore, my impression is that Wolfgang was not very interested in this patch so I gave up this work. Anyway, I can submit the patch to you out of the U-Boot-users list.

Best regards,

Txema

 -----Mensaje original-----
De: 	glikely at gmail.com [mailto:glikely at gmail.com]  En nombre de Grant Likely
Enviado el:	lunes, 12 de febrero de 2007 5:45
Para:	TXEMA LOPEZ
CC:	Wolfgang Denk; u-boot-users at lists.sourceforge.net
Asunto:	Re: [U-Boot-Users] fixup section problem.

On 11/3/06, Txema Lopez <tlopez@aotek.es> wrote:
> I think the method I suggest you using a new define It's quite
> reasonable. I'll summit the patch for the Lite5200's and the rest of
> boards will be not affected. If someone want to use or test the fixup
> relocation for his board only has to do two changes:
>             - cleanup the fixup section from the text section in  the
> u-boot.lds file.
>             - define CFG_FIXUP_RELOCATION in the board configuration file.

Txema,

How's your work on this patch coming along?  I've got the same problem
with new code that I've written for the Xilinx virtex boards.  I don't
want to do the manual relocation hack, so I'm very much looking
forward to seeing your fix.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-02-12 19:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-02  9:21 [U-Boot-Users] fixup section problem Txema Lopez
2006-11-02 11:31 ` Wolfgang Denk
2006-11-03  7:15   ` Txema Lopez
2006-11-03  8:16     ` Wolfgang Denk
2006-11-03 11:18       ` Txema Lopez
2007-02-12  4:45         ` Grant Likely
2007-02-12  7:53 TXEMA LOPEZ
2007-02-12 19:26 ` Grant Likely
2007-02-12 19:40   ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.