All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] Fixup relocation patch.
@ 2007-02-13  9:25 Txema Lopez
  2007-02-13 15:06 ` Grant Likely
  2007-02-13 16:25 ` Joakim Tjernlund
  0 siblings, 2 replies; 3+ messages in thread
From: Txema Lopez @ 2007-02-13  9:25 UTC (permalink / raw)
  To: u-boot

Hi all,
This is a patch to make relocation simpler and more reliable. It's for a 
1.1.6 U-Boot version.

The FIXUP section in U-Boot is empty so 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:
Because of it, in some places of U-Boot the relocation must be done 
manually: i.e malloc_bin_reloc().

I submit the patch only for the Lite5200 boards 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'm not sure if this patch could work for not PowerPC based 
architectures. By example, 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.

Signed-off-by: Jose Maria Lopez <tlopez@aotek.es>

CHANGELOG

* Make relocation simpler and more reliable for Lite5200 boards:
    Patch by Jose Maria Lopez, 13 February 2007




Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixup.patch
Type: text/x-patch
Size: 6074 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070213/330e7104/attachment.bin 
-------------- 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/20070213/330e7104/attachment.vcf 

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

* [U-Boot-Users] [PATCH] Fixup relocation patch.
  2007-02-13  9:25 [U-Boot-Users] [PATCH] Fixup relocation patch Txema Lopez
@ 2007-02-13 15:06 ` Grant Likely
  2007-02-13 16:25 ` Joakim Tjernlund
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Likely @ 2007-02-13 15:06 UTC (permalink / raw)
  To: u-boot

On 2/13/07, Txema Lopez <tlopez@aotek.es> wrote:
> Hi all,
> This is a patch to make relocation simpler and more reliable. It's for a
> 1.1.6 U-Boot version.
>
> The FIXUP section in U-Boot is empty so 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:
> Because of it, in some places of U-Boot the relocation must be done
> manually: i.e malloc_bin_reloc().
>
> I submit the patch only for the Lite5200 boards 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'm not sure if this patch could work for not PowerPC based
> architectures. By example, 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.
>
> Signed-off-by: Jose Maria Lopez <tlopez@aotek.es>

Txema,

Thanks for this patch; it's good work!  I've got it working for my
ml403 target (ppc405).  Static pointers are now updated appropriately
in my build.  No manual fixup needed.

I needed to add the -mrelocatable flag to the linker flags in
cpu/ppc4xx/config.mk (I did not remove the -fPIC flag when I did
this).  Without -mrelocatable, the .fixup section would remain empty.

However, -mrelocatable is a powerpc-only flag.  I don't know what the
magic flag is to do the same on arm/mips/etc.  It would be great if
this can get sorted out for all u-boot targets.  It's an invasive
change though.  I think your right that having it wrapped in a
conditional is the right way to start, but I would start with a
patchset that fixes up all powerpc targets first and get it out for
comments/testing before it gets merged to mainline.  Once powerpc is
proven, then turn to look at the other architectures.  I'll happily
help you with this task.

Thanks again,
g.

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

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

* [U-Boot-Users] [PATCH] Fixup relocation patch.
  2007-02-13  9:25 [U-Boot-Users] [PATCH] Fixup relocation patch Txema Lopez
  2007-02-13 15:06 ` Grant Likely
@ 2007-02-13 16:25 ` Joakim Tjernlund
  1 sibling, 0 replies; 3+ messages in thread
From: Joakim Tjernlund @ 2007-02-13 16:25 UTC (permalink / raw)
  To: u-boot

Hi

I tested this on my mpc832x based board and it worked for me as well.
I had to add -mrelocatable too though.

Tools is:
powerpc-softfloat-linux-gnu-gcc --version
powerpc-softfloat-linux-gnu-gcc (GCC) 3.4.6 (Gentoo 3.4.6-r2,
ssp-3.4.6-1.0, pie-8.7.9)

powerpc-softfloat-linux-gnu-ld --version 
GNU ld version 2.16.1


Question, why do remove 83xx here:
-#if defined(CONFIG_IP860) || defined(CONFIG_PCU_E) || \
-       defined (CONFIG_FLAGADM) || defined(CONFIG_MPC83XX)
+#if defined(CONFIG_IP860) || defined(CONFIG_PCU_E) || defined (CONFIG_FLAGADM)
        icache_enable ();       /* it's time to enable the instruction cache */
 #endif

On Tue, 2007-02-13 at 10:25 +0100, Txema Lopez wrote:
> Hi all,
> This is a patch to make relocation simpler and more reliable. It's for a 
> 1.1.6 U-Boot version.
> 
> The FIXUP section in U-Boot is empty so 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:
> Because of it, in some places of U-Boot the relocation must be done 
> manually: i.e malloc_bin_reloc().
> 
> I submit the patch only for the Lite5200 boards 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'm not sure if this patch could work for not PowerPC based 
> architectures. By example, 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.
> 
> Signed-off-by: Jose Maria Lopez <tlopez@aotek.es>
> 
> CHANGELOG
> 
> * Make relocation simpler and more reliable for Lite5200 boards:
>     Patch by Jose Maria Lopez, 13 February 2007
> 
> 
> 
> 
> Best regards,
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________ U-Boot-Users mailing list U-Boot-Users at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users

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

end of thread, other threads:[~2007-02-13 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-13  9:25 [U-Boot-Users] [PATCH] Fixup relocation patch Txema Lopez
2007-02-13 15:06 ` Grant Likely
2007-02-13 16:25 ` Joakim Tjernlund

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.