Info on NAND-SPL
Hello,
?
I was trying to understand how NAND-SPL works. What I could understand after seeing the code is that
1) NAND-SPL is a standalone application which will load the U-boot in the main memory.
2) After doing the clock and DRAM initialization it will relocate itself in the DRAM.
3) Then it will copy the u-boot from the nand into the RAM and execute the u-boot.
?
If my understanding is proper, then I have one doubt
1) Since the nand_spl is making use of the same Start.S and lowlevel_init.S, the u-boot code will also perform relocation? So is it not a overhead doing relocation twice? ?
Also is there any similar implementation for MMC-SPL?
?
Thanks
Hatim
Dear Hatim Ali,
Quoted 4 lines · In message <[email protected]> you wrote:
I was trying to understand how NAND-SPL works. What I could understand after seeing the code is that
1) NAND-SPL is a standalone application which will load the U-boot in the main memory.
You probably mean the right thing, but use inappropriate terms.
In U-Boot context, a "standalone application" is a program that runs under control of U-Boot, using U-Boot provided features like I/O functions.
^The nand_spl code is no such application. It is a minimzed configuration of U-Boot code.
Quoted 2 lines
2) After doing the clock and DRAM initialization it will relocate itself in the DRAM.
I'm not sure what you mean - the code does not relocate itself (keep in mind that relocation and copying are two different things).
Quoted 2 lines
3) Then it will copy the u-boot from the nand into the RAM and execute the u-boot.
This is the actual purposse.
Quoted 4 lines
If my understanding is proper, then I have one doubt
1) Since thenand_splis making use of the sameStart.Sandlowlevel_init.S, the u-boot code will also perform relocation? So is it not a overhead doing relocation twice?
nand_spl loads the U-Boot code into RAM, and then relocates it (which includes copying it to the final location). There is no relocation done twice, only the copying, and this cannot be avoided as the bootstrap loader cannot determine the final position of the image yet. If you are sure that you have a static system with a fixed memory map you can configure nand_spl such that it copies U-Boot to the final location, one copy operation can be saved (you still need the relocation, though).
Quoted 1 line
Also is there any similar implementation for MMC-SPL?
Not yet. Patches welcome.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Suffocating together ... would create heroic camaraderie. -- Khan Noonian Singh, "Space Seed", stardate 3142.8
Hi Wolfgang,
Le 27/02/2011 19:11, Wolfgang Denk a ?crit :
Quoted 8 lines
nand_splloads the U-Boot code into RAM, and then relocates it (which includes copying it to the final location). There is no relocation done twice, only the copying, and this cannot be avoided as the bootstrap loader cannot determine the final position of the image yet. If you are sure that you have a static system with a fixed memory map you can configurenand_splsuch that it copies U-Boot to the final location, one copy operation can be saved (you still need the relocation, though).
Note that in the case of ARM -- don't know about other archs -- if the final U-Boot location is known in advance, then one could try linking U-boot to that final location, in which case the relocation would not be needed either and should normally be skipped by the code currently in start.S.
Amicalement,
Signature · 1 line
Albert.
Quoted 8 lines · On Sun, 27 Feb 2011 19:11:28 +0100 Wolfgang Denk <[email protected]> wrote:
Dear Hatim Ali,
Quoted 2 lines · In message <[email protected]> you wrote:
2) After doing the clock and DRAM initialization it will relocate itself in the DRAM.
I'm not sure what you mean - the code does not relocate itself (keep in mind that relocation and copying are two different things).
The SPL does relocate itself, at least on 83xx/85xx, so it can continue running after copied to RAM (which must happen before it loads anything more from NAND).
It's not "done twice", though -- it's done once each on two different images.
-Scott
Hello Hatim,
Quoted 9 lines · Hatim Ali
Hello,
I was trying to understand how NAND-SPL works. What I could understand after seeing the code is that
1) NAND-SPL is a standalone application which will load the U-boot in the main memory.
2) After doing the clock and DRAM initialization it will relocate itself in the DRAM.
3) Then it will copy the u-boot from the nand into the RAM and execute the u-boot.If my understanding is proper, then I have one doubt
1) Since thenand_splis making use of the sameStart.Sandlowlevel_init.S, the u-boot code will also perform relocation? So is it not a overhead doing relocation twice?
As Albert mentioned in another mail, image copying and relocation can be suppressed by using your linked address as the target address when you call relocate_code.
This is easier to achieve in SPL because we have a custom and simpler board_init_f. This is much more difficult to achieve in regular U-Boot because the target address is calculated at run-time in board_init_f and also depends on the U-Boot size.
Quoted 2 lines
Also is there any similar implementation for MMC-SPL?
You might want to have a look at the series I posted yesterday for OMAP4. Please note that relocation and image copying has been suppressed in this SPL.
Br,
Aneesh