Linux MIPS Architecture development
 help / color / mirror / Atom feed
* uboot for MIPS: need help to skip relocate uboot and start uboot from RAM
@ 2011-03-03 10:16 Pandurang Kale
  2011-03-03 12:46 ` Ray Dudu
  2011-03-03 12:50 ` Sergei Shtylyov
  0 siblings, 2 replies; 3+ messages in thread
From: Pandurang Kale @ 2011-03-03 10:16 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 1548 bytes --]

Hello Everyone,

We have MIPS based development board and I am trying to get the uboot up and
running on it.
We have a primary bootloader which check for the valid mod-image stored on
the flash. This mod-image consist of header, uboot and linux kernel.
Depending on the recent, active and stable imagethe primary bootloader first
copies the uboot image. and later on we would copy the kernel image from
uboot.

But when primary bootloader copies the uboot image to the RAM and passes the
control to the uboot, uboot (MIPS version of start.S and
arch/mips/lib/borad.c) tries to relocate the
already copied image from RAM (the primary bootloader copied it to start of
the RAM+1MB address) to top of the RAM (0x87fc0000) region thinking that the
uboot image is stored in flash.

All I need to do is skip the uboot relocate code in MIPS version of uboot
startup as the primary bootloader has already relocated the uboot from Flash
to RAM and set up the stack pointer and other global data appropriately,
which it does after relocation.
I can see there is a switch for ARM processor, CONFIG_SKIP_RELOCATE_UBOOT,
which skips the relocation of uboot code and tries to run the uboot from
RAM. I
cannot see a similar switch implemented for MIPS and didnt find any related
thread anywhere in mailing list or on net.

Do we have similar ARM like switch to SKIP the RELOCATION? If not has anyone
done this before?

I would really appreciate if you can guide me to overcome this issue to run
the uboot cleanly skipping the relocation.

Thanks in advance,
Pandu

[-- Attachment #2: Type: text/html, Size: 1617 bytes --]

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

* Re: uboot for MIPS: need help to skip relocate uboot and start uboot from RAM
  2011-03-03 10:16 uboot for MIPS: need help to skip relocate uboot and start uboot from RAM Pandurang Kale
@ 2011-03-03 12:46 ` Ray Dudu
  2011-03-03 12:50 ` Sergei Shtylyov
  1 sibling, 0 replies; 3+ messages in thread
From: Ray Dudu @ 2011-03-03 12:46 UTC (permalink / raw)
  To: linux-mips

Hi,
I'm not so familira with uboot, however, I done proprietary booter
implementation for my company. Similar functionality was required, for
different purposes actually, but it doesn't change the idea.

So in my booter code I done simple check of code location. In case when
the code detects that it is already in RAM, it skips memory/caches
initialization and self coping. Some useful pieces of code:
Supporting function.

------CUT-HERE--------
LEAF(set_ra)

        jr      ra
        nop

END(set_ra)
------CUT-HERE--------
Actually the check:
------CUT-HERE--------
        bal     set_ra      /* first get the current program counter */
        nop

        move    t0, ra

        li      t1, 0x10000000
        and     t1, t1, t0
        bne     zero, t1, 1f                /* code in ROM/flash */
        nop

        li      s3,0                    /* code in RAM */
        b  	2f
        nop
1:
	/* jump to system initialization and code coping routine here */
2:
	/* continue normal boot */
------CUT-HERE--------

I suppose you can do similar in u-boot and it will be quite generic
solution. Such code can be executed from RAM and FLASH without need to
reconfigure and rebuild.


03.03.11 12:16, Pandurang Kale написав(ла):
> Hello Everyone,
> 
> We have MIPS based development board and I am trying to get the uboot up
> and running on it.
> We have a primary bootloader which check for the valid mod-image stored
> on the flash. This mod-image consist of header, uboot and linux kernel.
> Depending on the recent, active and stable imagethe primary bootloader
> first copies the uboot image. and later on we would copy the kernel
> image from uboot.
> 
> But when primary bootloader copies the uboot image to the RAM and passes
> the control to the uboot, uboot (MIPS version of start.S and
> arch/mips/lib/borad.c) tries to relocate the
> already copied image from RAM (the primary bootloader copied it to start
> of the RAM+1MB address) to top of the RAM (0x87fc0000) region thinking
> that the uboot image is stored in flash.
> 
> All I need to do is skip the uboot relocate code in MIPS version of
> uboot startup as the primary bootloader has already relocated the uboot
> from Flash to RAM and set up the stack pointer and other global data
> appropriately, which it does after relocation.
> I can see there is a switch for ARM processor,
> CONFIG_SKIP_RELOCATE_UBOOT, which skips the relocation of uboot code and
> tries to run the uboot from RAM. I
> cannot see a similar switch implemented for MIPS and didnt find any
> related thread anywhere in mailing list or on net.
> 
> Do we have similar ARM like switch to SKIP the RELOCATION? If not has
> anyone done this before?
> 
> I would really appreciate if you can guide me to overcome this issue to
> run the uboot cleanly skipping the relocation.
> 
> Thanks in advance,
> Pandu

-- 
Best regards,
RD18-UANIC

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

* Re: uboot for MIPS: need help to skip relocate uboot and start uboot from RAM
  2011-03-03 10:16 uboot for MIPS: need help to skip relocate uboot and start uboot from RAM Pandurang Kale
  2011-03-03 12:46 ` Ray Dudu
@ 2011-03-03 12:50 ` Sergei Shtylyov
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2011-03-03 12:50 UTC (permalink / raw)
  To: Pandurang Kale; +Cc: linux-mips

Hello.

On 03-03-2011 13:16, Pandurang Kale wrote:

> We have MIPS based development board and I am trying to get the uboot up and
> running on it.

    There's U-Boot mailing list (u-boot@lists.denx.de), why don't you ask 
there instead?

> Thanks in advance,
> Pandu

WBR, Sergei

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

end of thread, other threads:[~2011-03-03 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-03 10:16 uboot for MIPS: need help to skip relocate uboot and start uboot from RAM Pandurang Kale
2011-03-03 12:46 ` Ray Dudu
2011-03-03 12:50 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox