diff mbox

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

Message ID 1310569869-31810-7-git-send-email-daniel.schwierzeck@googlemail.com
State Accepted
Commit 05bad4aa567ccffaac128d9090abde245f8463d1
Headers show

Commit Message

Daniel Schwierzeck July 13, 2011, 3:11 p.m. UTC
From: Aneesh V <aneesh@ti.com>

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/lib/Makefile   |    2 ++
 common/Makefile         |    9 ++++++---
 drivers/serial/Makefile |    3 +++
 fs/fat/Makefile         |    6 +++++-
 lib/Makefile            |   11 +++++++----
 5 files changed, 23 insertions(+), 8 deletions(-)

Comments

Simon Schwarz July 15, 2011, 12:31 p.m. UTC | #1
Hi Daniel,

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
>  LIB    = $(obj)lib$(ARCH).o
>  LIBGCC = $(obj)libgcc.o
>
> +ifndef CONFIG_SPL_BUILD
>  GLSOBJS        += _ashldi3.o
>  GLSOBJS        += _ashrdi3.o
>  GLSOBJS        += _divsi3.o
> @@ -45,6 +46,7 @@ COBJS-y       += interrupts.o
>  COBJS-y        += reset.o
>  SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
>  SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += 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.

I really like the new SPL - good work! ;)

Regards
Simon
Aneesh V July 15, 2011, 12:41 p.m. UTC | #2
Hi Simon,

On Friday 15 July 2011 06:01 PM, Simon Schwarz wrote:
> Hi Daniel,
>
> 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
>>   LIB    = $(obj)lib$(ARCH).o
>>   LIBGCC = $(obj)libgcc.o
>>
>> +ifndef CONFIG_SPL_BUILD
>>   GLSOBJS        += _ashldi3.o
>>   GLSOBJS        += _ashrdi3.o
>>   GLSOBJS        += _divsi3.o
>> @@ -45,6 +46,7 @@ COBJS-y       += interrupts.o
>>   COBJS-y        += reset.o
>>   SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
>>   SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += 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.

best regards,
Aneesh
Simon Schwarz July 15, 2011, 1:10 p.m. UTC | #3
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?

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?

Thanks for answering these - probably dump - questions!

Regards
Simon
Aneesh V July 15, 2011, 1:35 p.m. UTC | #4
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
Daniel Schwierzeck July 15, 2011, 2:43 p.m. UTC | #5
Hi Simon,

On Fri, Jul 15, 2011 at 2:41 PM, Aneesh V <aneesh@ti.com> wrote:
> Hi Simon,
>
> On Friday 15 July 2011 06:01 PM, Simon Schwarz wrote:
>>
>> Hi Daniel,
>>
>> 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
>>>  LIB    = $(obj)lib$(ARCH).o
>>>  LIBGCC = $(obj)libgcc.o
>>>
>>> +ifndef CONFIG_SPL_BUILD
>>>  GLSOBJS        += _ashldi3.o
>>>  GLSOBJS        += _ashrdi3.o
>>>  GLSOBJS        += _divsi3.o
>>> @@ -45,6 +46,7 @@ COBJS-y       += interrupts.o
>>>  COBJS-y        += reset.o
>>>  SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
>>>  SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += 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.
>

I can only speak for MIPS but the regular board.c is too heavy for SPL.
Either you insert a lot of #ifdef CONFIG_SPL_BUILD (ugly) or you create a
simplified board_spl.c. Maybe a common version for ARM, your SoC or your
board only.

Best regards,
Daniel
diff mbox

Patch

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
 LIB	= $(obj)lib$(ARCH).o
 LIBGCC	= $(obj)libgcc.o
 
+ifndef CONFIG_SPL_BUILD
 GLSOBJS	+= _ashldi3.o
 GLSOBJS	+= _ashrdi3.o
 GLSOBJS	+= _divsi3.o
@@ -45,6 +46,7 @@  COBJS-y	+= interrupts.o
 COBJS-y	+= reset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
+endif
 
 SRCS	:= $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
 	   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
diff --git a/common/Makefile b/common/Makefile
index 224b7cc..124a427 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -26,17 +26,15 @@  include $(TOPDIR)/config.mk
 LIB	= $(obj)libcommon.o
 
 # core
+ifndef CONFIG_SPL_BUILD
 COBJS-y += main.o
-COBJS-y += console.o
 COBJS-y += command.o
 COBJS-y += dlmalloc.o
 COBJS-y += exports.o
 COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o
 COBJS-y += image.o
-COBJS-y += memsize.o
 COBJS-y += s_record.o
 COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
-COBJS-y += stdio.o
 COBJS-y += xyzModem.o
 
 # core command
@@ -173,6 +171,11 @@  COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
 COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o
 COBJS-$(CONFIG_UPDATE_TFTP) += update.o
 COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
+endif
+
+COBJS-y += console.o
+COBJS-y += memsize.o
+COBJS-y += stdio.o
 
 
 COBJS	:= $(sort $(COBJS-y))
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 0e171b6..1dcc1c7 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -55,7 +55,10 @@  COBJS-$(CONFIG_S3C44B0_SERIAL) += serial_s3c44b0.o
 COBJS-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o
 COBJS-$(CONFIG_SCIF_CONSOLE) += serial_sh.o
 COBJS-$(CONFIG_TEGRA2) += serial_tegra2.o
+
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_USB_TTY) += usbtty.o
+endif
 
 COBJS	:= $(sort $(COBJS-y))
 SRCS	:= $(COBJS:.o=.c)
diff --git a/fs/fat/Makefile b/fs/fat/Makefile
index bc45966..93b6f07 100644
--- a/fs/fat/Makefile
+++ b/fs/fat/Makefile
@@ -24,7 +24,11 @@  include $(TOPDIR)/config.mk
 LIB	= $(obj)libfat.o
 
 AOBJS	=
-COBJS-$(CONFIG_CMD_FAT)	:= fat.o file.o
+COBJS-$(CONFIG_CMD_FAT)	:= fat.o
+
+ifndef CONFIG_SPL_BUILD
+COBJS-$(CONFIG_CMD_FAT)	+= file.o
+endif
 
 SRCS	:= $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS-y))
diff --git a/lib/Makefile b/lib/Makefile
index afa6914..884f64c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -25,6 +25,7 @@  include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libgeneric.o
 
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_ADDR_MAP) += addr_map.o
 COBJS-$(CONFIG_BZIP2) += bzlib.o
 COBJS-$(CONFIG_BZIP2) += bzlib_crctable.o
@@ -35,9 +36,7 @@  COBJS-$(CONFIG_USB_TTY) += circbuf.o
 COBJS-y += crc7.o
 COBJS-y += crc16.o
 COBJS-y += crc32.o
-COBJS-y += ctype.o
 COBJS-y += display_options.o
-COBJS-y += div64.o
 COBJS-y += errno.o
 COBJS-$(CONFIG_GZIP) += gunzip.o
 COBJS-y += hashtable.o
@@ -48,11 +47,15 @@  COBJS-y += net_utils.o
 COBJS-y += qsort.o
 COBJS-$(CONFIG_SHA1) += sha1.o
 COBJS-$(CONFIG_SHA256) += sha256.o
-COBJS-y += string.o
 COBJS-y	+= strmhz.o
+COBJS-$(CONFIG_RBTREE)	+= rbtree.o
+endif
+
+COBJS-y += ctype.o
+COBJS-y += div64.o
+COBJS-y += string.o
 COBJS-y += time.o
 COBJS-y += vsprintf.o
-COBJS-$(CONFIG_RBTREE)	+= rbtree.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)