diff mbox

[v2,03/11] Keystone2: Use OpenEM helper libraries

Message ID 1397735782-31924-4-git-send-email-taras.kondratiuk@linaro.org
State Superseded
Headers show

Commit Message

Taras Kondratiuk April 17, 2014, 11:56 a.m. UTC
Include OpenEM headers and pack static libraries content into libodp.a.

Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 platform/linux-keystone2/Makefile |   35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

Comments

David Nyström April 17, 2014, 1:17 p.m. UTC | #1
On 2014-04-17 13:56, Taras Kondratiuk wrote:
> Include OpenEM headers and pack static libraries content into libodp.a.
>
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
>   platform/linux-keystone2/Makefile |   35 +++++++++++++++++++++++++++++++----
>   1 file changed, 31 insertions(+), 4 deletions(-)
>
> diff --git a/platform/linux-keystone2/Makefile b/platform/linux-keystone2/Makefile
> index 15e2a2c..1965d1d 100644
> --- a/platform/linux-keystone2/Makefile
> +++ b/platform/linux-keystone2/Makefile
> @@ -32,10 +32,27 @@ ODP_ROOT = ../..
>   LIB_DIR  = ./lib
>   DOC_DIR  = ./doc
>
> +OPENEM_ROOT       ?= $(ODP_ROOT)/../openem_keystone
> +OPENEM_TARGET_DIR ?= c6638/arm-linux
> +OPENEM_LIB_DIR     = $(abspath $(OPENEM_ROOT)/lib/$(OPENEM_TARGET_DIR))

Perhaps dependent projects install paths could be made FHS compatible to 
work with f.ex. gcc --sysroot, which would make above unnecessary.

ref: http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

> +
> +MY_PLATFORM  = DEVICE_K2K
> +
> +PLAT_CFLAGS  = -D$(MY_PLATFORM)
> +PLAT_CFLAGS += -D_GNU_SOURCE -DEM_32_BIT -DTI_EM_CENTRAL_SCHED

<snip>
> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)
> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/keystone2
> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/osal
> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/rh
<snip>

And this could be avoided by adhering to FHS.

>   ifeq ($(ODP_HAVE_NETMAP),yes)
>   EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
> @@ -100,8 +117,8 @@ $(OBJ_DIR)/%.o: ./source/%.c
>   #
>   # Lib rule
>   #
> -$(STATIC_LIB): $(OBJS)
> -	$(AR) -cr $@ $(OBJS)
> +$(STATIC_LIB): $(OBJS) extract_prebuilt_libs
> +	$(AR) -cr $@ $(OBJ_DIR)/*.o
>
>   clean:
>   	$(RMDIR) $(OBJ_DIR)
> @@ -124,6 +141,16 @@ docs_install: docs
>   pdf: docs
>   	make --directory doc/latex refman.pdf 1> /dev/null
>
> +.PHONY: extract_prebuilt_libs
> +extract_prebuilt_libs: $(OBJ_DIR)
> +	(cd $(OBJ_DIR) && $(AR) x $(OPENEM_LIB_DIR)/libopenem_osal.a)
> +	(cd $(OBJ_DIR) && $(AR) x $(OPENEM_LIB_DIR)/libopenem_rh.a)
> +
> +.PHONY: openem_mod_install
> +openem_mod_install:
> +	install -d $(DESTDIR)/module
> +	install -m 0644 $(OPENEM_ROOT)/linux/modules/*.ko $(DESTDIR)/module

This should be installed by OpenEM, not ODP.

> +
>   .PHONY: libs
>   libs: $(OBJ_DIR) $(LIB_DIR) $(STATIC_LIB)
>
> @@ -138,4 +165,4 @@ headers_install: libs
>   	$(COPY) $(ODP_ROOT)/include $(DESTDIR)
>   	$(COPY) include/api/* $(DESTDIR)/include/
>
> -install: lib_install headers_install
> +install: lib_install headers_install openem_mod_install
>
Mike Holmes April 17, 2014, 1:27 p.m. UTC | #2
On 17 April 2014 09:17, David Nyström <david.nystrom@enea.com> wrote:

> On 2014-04-17 13:56, Taras Kondratiuk wrote:
>
>> Include OpenEM headers and pack static libraries content into libodp.a.
>>
>> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
>> ---
>>   platform/linux-keystone2/Makefile |   35 ++++++++++++++++++++++++++++++
>> +----
>>   1 file changed, 31 insertions(+), 4 deletions(-)
>>
>> diff --git a/platform/linux-keystone2/Makefile
>> b/platform/linux-keystone2/Makefile
>> index 15e2a2c..1965d1d 100644
>> --- a/platform/linux-keystone2/Makefile
>> +++ b/platform/linux-keystone2/Makefile
>> @@ -32,10 +32,27 @@ ODP_ROOT = ../..
>>   LIB_DIR  = ./lib
>>   DOC_DIR  = ./doc
>>
>> +OPENEM_ROOT       ?= $(ODP_ROOT)/../openem_keystone
>> +OPENEM_TARGET_DIR ?= c6638/arm-linux
>> +OPENEM_LIB_DIR     = $(abspath $(OPENEM_ROOT)/lib/$(OPENEM_TARGET_DIR))
>>
>
> Perhaps dependent projects install paths could be made FHS compatible to
> work with f.ex. gcc --sysroot, which would make above unnecessary.
>
> ref: http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
>
> +1 sysroot for dependant libs like OpenEM, could help with applications as
> well like libpcap/tcpdump  snort, openvswitch builds.
>

--sysroot=dirUse dir as the logical root directory for headers and
libraries. For example, if the compiler normally searches for headers in
/usr/include and libraries in /usr/lib, it instead searches dir/usr/include
 anddir/usr/lib.

If you use both this option and the -isysroot option, then the --sysroot option
applies to libraries, but the -isysroot option applies to header files.
The GNU linker (beginning with version 2.16) has the necessary support for
this option. If your linker does not support this option, the header file
aspect of --sysroot still works, but the library aspect does not.



>  +
>> +MY_PLATFORM  = DEVICE_K2K
>> +
>> +PLAT_CFLAGS  = -D$(MY_PLATFORM)
>> +PLAT_CFLAGS += -D_GNU_SOURCE -DEM_32_BIT -DTI_EM_CENTRAL_SCHED
>>
>
> <snip>
>
>  +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)
>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/keystone2
>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/osal
>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/rh
>>
> <snip>
>
> And this could be avoided by adhering to FHS.
>
>
>    ifeq ($(ODP_HAVE_NETMAP),yes)
>>   EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
>> @@ -100,8 +117,8 @@ $(OBJ_DIR)/%.o: ./source/%.c
>>   #
>>   # Lib rule
>>   #
>> -$(STATIC_LIB): $(OBJS)
>> -       $(AR) -cr $@ $(OBJS)
>> +$(STATIC_LIB): $(OBJS) extract_prebuilt_libs
>> +       $(AR) -cr $@ $(OBJ_DIR)/*.o
>>
>>   clean:
>>         $(RMDIR) $(OBJ_DIR)
>> @@ -124,6 +141,16 @@ docs_install: docs
>>   pdf: docs
>>         make --directory doc/latex refman.pdf 1> /dev/null
>>
>> +.PHONY: extract_prebuilt_libs
>> +extract_prebuilt_libs: $(OBJ_DIR)
>> +       (cd $(OBJ_DIR) && $(AR) x $(OPENEM_LIB_DIR)/libopenem_osal.a)
>> +       (cd $(OBJ_DIR) && $(AR) x $(OPENEM_LIB_DIR)/libopenem_rh.a)
>> +
>> +.PHONY: openem_mod_install
>> +openem_mod_install:
>> +       install -d $(DESTDIR)/module
>> +       install -m 0644 $(OPENEM_ROOT)/linux/modules/*.ko
>> $(DESTDIR)/module
>>
>
> This should be installed by OpenEM, not ODP.
>
>
>  +
>>   .PHONY: libs
>>   libs: $(OBJ_DIR) $(LIB_DIR) $(STATIC_LIB)
>>
>> @@ -138,4 +165,4 @@ headers_install: libs
>>         $(COPY) $(ODP_ROOT)/include $(DESTDIR)
>>         $(COPY) include/api/* $(DESTDIR)/include/
>>
>> -install: lib_install headers_install
>> +install: lib_install headers_install openem_mod_install
>>
>>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Taras Kondratiuk April 17, 2014, 2:19 p.m. UTC | #3
On 04/17/2014 04:17 PM, David Nyström wrote:
> On 2014-04-17 13:56, Taras Kondratiuk wrote:
>> Include OpenEM headers and pack static libraries content into libodp.a.
>>
>> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
>> ---
>>   platform/linux-keystone2/Makefile |   35
>> +++++++++++++++++++++++++++++++----
>>   1 file changed, 31 insertions(+), 4 deletions(-)
>>
>> diff --git a/platform/linux-keystone2/Makefile
>> b/platform/linux-keystone2/Makefile
>> index 15e2a2c..1965d1d 100644
>> --- a/platform/linux-keystone2/Makefile
>> +++ b/platform/linux-keystone2/Makefile
>> @@ -32,10 +32,27 @@ ODP_ROOT = ../..
>>   LIB_DIR  = ./lib
>>   DOC_DIR  = ./doc
>>
>> +OPENEM_ROOT       ?= $(ODP_ROOT)/../openem_keystone
>> +OPENEM_TARGET_DIR ?= c6638/arm-linux
>> +OPENEM_LIB_DIR     = $(abspath $(OPENEM_ROOT)/lib/$(OPENEM_TARGET_DIR))
>
> Perhaps dependent projects install paths could be made FHS compatible to
> work with f.ex. gcc --sysroot, which would make above unnecessary.

Actually it is not a standard use case. I'm using internal OpenEM
helper libraries which normally are not installed by OpenEM.

>> +
>> +MY_PLATFORM  = DEVICE_K2K
>> +
>> +PLAT_CFLAGS  = -D$(MY_PLATFORM)
>> +PLAT_CFLAGS += -D_GNU_SOURCE -DEM_32_BIT -DTI_EM_CENTRAL_SCHED
>
> <snip>
>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)
>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/keystone2
>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/osal
>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/rh
> <snip>
>
> And this could be avoided by adhering to FHS.

The same issue here. These are internal headers which are not copied.

>> +.PHONY: openem_mod_install
>> +openem_mod_install:
>> +    install -d $(DESTDIR)/module
>> +    install -m 0644 $(OPENEM_ROOT)/linux/modules/*.ko $(DESTDIR)/module
>
> This should be installed by OpenEM, not ODP.

Agree.
=?UTF-8?q?David=20Nystr=C3=B6m?= April 17, 2014, 3:30 p.m. UTC | #4
On 2014-04-17 16:19, Taras Kondratiuk wrote:
> On 04/17/2014 04:17 PM, David Nyström wrote:
>> On 2014-04-17 13:56, Taras Kondratiuk wrote:
>>> Include OpenEM headers and pack static libraries content into libodp.a.
>>>
>>> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
>>> ---
>>>   platform/linux-keystone2/Makefile |   35
>>> +++++++++++++++++++++++++++++++----
>>>   1 file changed, 31 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/platform/linux-keystone2/Makefile
>>> b/platform/linux-keystone2/Makefile
>>> index 15e2a2c..1965d1d 100644
>>> --- a/platform/linux-keystone2/Makefile
>>> +++ b/platform/linux-keystone2/Makefile
>>> @@ -32,10 +32,27 @@ ODP_ROOT = ../..
>>>   LIB_DIR  = ./lib
>>>   DOC_DIR  = ./doc
>>>
>>> +OPENEM_ROOT       ?= $(ODP_ROOT)/../openem_keystone
>>> +OPENEM_TARGET_DIR ?= c6638/arm-linux
>>> +OPENEM_LIB_DIR     = $(abspath $(OPENEM_ROOT)/lib/$(OPENEM_TARGET_DIR))
>>
>> Perhaps dependent projects install paths could be made FHS compatible to
>> work with f.ex. gcc --sysroot, which would make above unnecessary.
>
> Actually it is not a standard use case. I'm using internal OpenEM
> helper libraries which normally are not installed by OpenEM.
>

I understand, however,
To be able to interact smoothly with the rest of the FOSS world, there 
are two routes you can choose:
---
1. Make it modular, make a OpenEM non-standard install, which installs 
the currently non-public headers and libs.

2. Merge OpenEM with ODP-keystone2, where OpenEM code is merged and 
"normalized" into the ODP repo.
Most merges are realized with a git submodule merge in the initial stages.
i.e. One build-system to rule it all, no binaries checked in to the GIT 
repo.

Conforming to accepted unix standards will decrease the amount of work 
you have to do in the future, f.ex. if you want to write an OpenEmbedded 
recipe for ODP-keystone in the meta-ti layer.

Br,
David

>>> +
>>> +MY_PLATFORM  = DEVICE_K2K
>>> +
>>> +PLAT_CFLAGS  = -D$(MY_PLATFORM)
>>> +PLAT_CFLAGS += -D_GNU_SOURCE -DEM_32_BIT -DTI_EM_CENTRAL_SCHED
>>
>> <snip>
>>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)
>>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/keystone2
>>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/osal
>>> +EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/rh
>> <snip>
>>
>> And this could be avoided by adhering to FHS.
>
> The same issue here. These are internal headers which are not copied.
>
>>> +.PHONY: openem_mod_install
>>> +openem_mod_install:
>>> +    install -d $(DESTDIR)/module
>>> +    install -m 0644 $(OPENEM_ROOT)/linux/modules/*.ko $(DESTDIR)/module
>>
>> This should be installed by OpenEM, not ODP.
>
> Agree.
>
Taras Kondratiuk April 17, 2014, 5:09 p.m. UTC | #5
On 04/17/2014 06:30 PM, David Nyström wrote:
> On 2014-04-17 16:19, Taras Kondratiuk wrote:
>> On 04/17/2014 04:17 PM, David Nyström wrote:
>>> Perhaps dependent projects install paths could be made FHS compatible to
>>> work with f.ex. gcc --sysroot, which would make above unnecessary.
>>
>> Actually it is not a standard use case. I'm using internal OpenEM
>> helper libraries which normally are not installed by OpenEM.
>>
>
> I understand, however,
> To be able to interact smoothly with the rest of the FOSS world, there
> are two routes you can choose:
> ---
> 1. Make it modular, make a OpenEM non-standard install, which installs
> the currently non-public headers and libs.

Will try this way. I'd like to avoid git submodules.

>
> 2. Merge OpenEM with ODP-keystone2, where OpenEM code is merged and
> "normalized" into the ODP repo.
> Most merges are realized with a git submodule merge in the initial stages.
> i.e. One build-system to rule it all, no binaries checked in to the GIT
> repo.
>
> Conforming to accepted unix standards will decrease the amount of work
> you have to do in the future, f.ex. if you want to write an OpenEmbedded
> recipe for ODP-keystone in the meta-ti layer.
diff mbox

Patch

diff --git a/platform/linux-keystone2/Makefile b/platform/linux-keystone2/Makefile
index 15e2a2c..1965d1d 100644
--- a/platform/linux-keystone2/Makefile
+++ b/platform/linux-keystone2/Makefile
@@ -32,10 +32,27 @@  ODP_ROOT = ../..
 LIB_DIR  = ./lib
 DOC_DIR  = ./doc
 
+OPENEM_ROOT       ?= $(ODP_ROOT)/../openem_keystone
+OPENEM_TARGET_DIR ?= c6638/arm-linux
+OPENEM_LIB_DIR     = $(abspath $(OPENEM_ROOT)/lib/$(OPENEM_TARGET_DIR))
+
+MY_PLATFORM  = DEVICE_K2K
+
+PLAT_CFLAGS  = -D$(MY_PLATFORM)
+PLAT_CFLAGS += -D_GNU_SOURCE -DEM_32_BIT -DTI_EM_CENTRAL_SCHED
+PLAT_CFLAGS += -DTI_EM_TRACE_LEVEL=3 -DEM_CHECK_LEVEL=1
+PLAT_CFLAGS += -DTI_EM_LINUX -DTI_EM_GCC -DTI_EM_ARM_A15 -DTI_EM_C6638
+PLAT_CFLAGS += -D_LITTLE_ENDIAN -DTI_EM_USE_MSM -DTI_EM_XGE_LOOPBACK
+PLAT_CFLAGS += -DTI_ODP
+
+EXTRA_CFLAGS  += $(PLAT_CFLAGS)
 EXTRA_CFLAGS  += -I$(ODP_ROOT)/include
 EXTRA_CFLAGS  += -I./include
 EXTRA_CFLAGS  += -I./include/api
-EXTRA_CFLAGS  += -fPIC
+EXTRA_CFLAGS  += -I$(OPENEM_ROOT)
+EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/keystone2
+EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/osal
+EXTRA_CFLAGS  += -I$(OPENEM_ROOT)/linux/rh
 
 ifeq ($(ODP_HAVE_NETMAP),yes)
 EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
@@ -100,8 +117,8 @@  $(OBJ_DIR)/%.o: ./source/%.c
 #
 # Lib rule
 #
-$(STATIC_LIB): $(OBJS)
-	$(AR) -cr $@ $(OBJS)
+$(STATIC_LIB): $(OBJS) extract_prebuilt_libs
+	$(AR) -cr $@ $(OBJ_DIR)/*.o
 
 clean:
 	$(RMDIR) $(OBJ_DIR)
@@ -124,6 +141,16 @@  docs_install: docs
 pdf: docs
 	make --directory doc/latex refman.pdf 1> /dev/null
 
+.PHONY: extract_prebuilt_libs
+extract_prebuilt_libs: $(OBJ_DIR)
+	(cd $(OBJ_DIR) && $(AR) x $(OPENEM_LIB_DIR)/libopenem_osal.a)
+	(cd $(OBJ_DIR) && $(AR) x $(OPENEM_LIB_DIR)/libopenem_rh.a)
+
+.PHONY: openem_mod_install
+openem_mod_install:
+	install -d $(DESTDIR)/module
+	install -m 0644 $(OPENEM_ROOT)/linux/modules/*.ko $(DESTDIR)/module
+
 .PHONY: libs
 libs: $(OBJ_DIR) $(LIB_DIR) $(STATIC_LIB)
 
@@ -138,4 +165,4 @@  headers_install: libs
 	$(COPY) $(ODP_ROOT)/include $(DESTDIR)
 	$(COPY) include/api/* $(DESTDIR)/include/
 
-install: lib_install headers_install
+install: lib_install headers_install openem_mod_install