[U-Boot] [RFC][PATCH 02/19] relocation: fixup cmdtable
Peter Tyser
ptyser at xes-inc.com
Fri Jul 30 16:46:16 CEST 2010
On Fri, 2010-07-30 at 08:00 +0200, Heiko Schocher wrote:
> Hello Peter,
>
> Peter Tyser wrote:
> >> +#if !defined(CONFIG_RELOC_FIXUP_WORKS)
> >> +DECLARE_GLOBAL_DATA_PTR;
> >> +
> >> +void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
> >> +{
> >> + int i;
> >> +
> >> + if (gd->reloc_off == 0)
> >> + return;
> >> +
> >> + for (i = 0; i < size; i++) {
> >> + ulong addr;
> >> +
> >> + addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
> >> + cmdtp->cmd =
> >> + (int (*)(struct cmd_tbl_s *, int, int, char * const []))addr;
> >> + addr = (ulong)(cmdtp->name) + gd->reloc_off;
> >> + cmdtp->name = (char *)addr;
> >> + if (cmdtp->usage) {
> >> + addr = (ulong)(cmdtp->usage) + gd->reloc_off;
> >> + cmdtp->usage = (char *)addr;
> >> + }
> >> +#ifdef CONFIG_SYS_LONGHELP
> >> + if (cmdtp->help) {
> >> + addr = (ulong)(cmdtp->help) + gd->reloc_off;
> >> + cmdtp->help = (char *)addr;
> >> + }
> >> +#endif
> >> + cmdtp++;
> >> + }
> >> +}
> >
> > A number of other arches have this same logic in arch-specific code, eg
> > arch/mips/lib/board.c. Could you also convert them to use the new
> > fixup_cmdtable() in this patch?
>
> Ah, Ok, I can try it. This will then result, that this patch can go
> direct to mainline, right?
Yes, I'd think this patch would be accepted regardless of the other ARM
relocation changes as its a general improvement.
> As I see in the code, this should be possible for the following
> architectures:
>
> avr32
> m68k
> mips
I believe sparc should also be included.
Best,
Peter
More information about the U-Boot
mailing list