[U-Boot] [RFC PATCH v1 6/9] scaled down version of generic libraries for SPL

Aneesh V
2011-07-15T13:35:33Z

On Friday 15 July 2011 06:40 PM, Simon Schwarz wrote:
> Hi Aneesh,
>
>>> at the moment I'am playing a bit with your patch.
>>>
>>> I stumbled over this:
>>>>
>>>> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
>>>> index d31321a..300c8fa 100644
>>>> --- a/arch/arm/lib/Makefile
>>>> +++ b/arch/arm/lib/Makefile
>>>> @@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
>>>> =A0LIB =A0 =A0=3D $(obj)lib$(ARCH).o
>>>> =A0LIBGCC =3D $(obj)libgcc.o
>>>>
>>>> +ifndef CONFIG_SPL_BUILD
>>>> =A0GLSOBJS =A0 =A0 =A0 =A0+=3D _ashldi3.o
>>>> =A0GLSOBJS =A0 =A0 =A0 =A0+=3D _ashrdi3.o
>>>> =A0GLSOBJS =A0 =A0 =A0 =A0+=3D _divsi3.o
>>>> @@ -45,6 +46,7 @@ COBJS-y =A0 =A0 =A0 +=3D interrupts.o
>>>> =A0COBJS-y =A0 =A0 =A0 =A0+=3D reset.o
>>>> =A0SOBJS-$(CONFIG_USE_ARCH_MEMSET) +=3D memset.o
>>>> =A0SOBJS-$(CONFIG_USE_ARCH_MEMCPY) +=3D memcpy.o
>>>> +endif
>>>
>>> Is it really your intention here to exclude board.c from the SPL? Or
>>> do i misinterpret something? Also cache.c I would include to a
>>> standard SPL.
>>
>> Yes, it's intentional. At the moment OMAP spl doesn't need anything
>> from this directory other than the eabi_comapt.o. In the future if
>> somebody needs contents from another file for SPL they may have to
>> bring it out of the '#ifndef CONFIG_SPL_BUILD' block.
>>
>> In all likelihood board.c will always remain out of SPL because board.c
>> defines board_init_f() and board_init_r() that are re-defined for SPL.
>> In the event some SPL has to reuse some content from this file, we may
>> have to make these functions weakly linked in this file. But I don't
>> think that will be ever needed.
>
> Then I think I didn't understand the concept correctly.
>
> In this patch: http://patchwork.ozlabs.org/patch/104534/ you modify
> board.c and add CONFIG_SPL_BUILD. Then this was just automatic search
> and replace and isn't needed anymore for the new SPL?

Yes. That was just a search and replace. I don't think any SPL will
really use the board_init_f() in this file, be it the old framework or
new framework.

>
> So the new board_init_f then is created in the same dir as board.c but
> e.g. named spl-board.c? Or is it preferred to write these functions -
> like in the old system - totally board depended and place it in
> ./board/[BOARDDIR]/spl-[BOARD].c?

Yes, it would be typically board/SoC dependent and written according to
the needs of the board/SoC and much lesser in scope compared to the one
in arch/arm/lib/board.c

For omap I have it at:
arch/arm/cpu/armv7/omap-common/spl.c

best regards,
Aneesh