Skip to contentSkip to conversation

package/openpowerlink: bump to v2.2.2

PATCH Superseded Romain Naour 2 participants 3 messages Feb 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 package/openpowerlink: bump to v2.2.2

From [1]
With version 2.0, the source code has been cleanly split into an application-oriented user library and a time-critical stack driver. The latter may be moved to a dedicated communication processor or into a kernel module to deliver enhanced performance while still keeping the API in user space.

This new version break the API used in the v1.x but this is a complete rewrite of the Powerlink EPSG DS 301 implementation. The v1.x is deprecated anyway.

The now build system has been split in several CMake projects which makes it difficult to package in Buildroot CMake infra. So add a top level CMakeLists.txt to build each openpowerlink component without having to package each of them in a separate Buildroot packages. Also we need to fixes the build system to support the top level CMake build.

[1] http://sourceforge.net/projects/openpowerlink/

---
v7: Improve commit log
update Config.legacy
add a sha256 hash
add a comment about extract cmds
v6: bump to v2.2.2.
Keep C++ dependency since CMake still check it even if it's not used by the openpowerlink stack :(
v5: bump to v2.2.1 and remove upstream patches
There is no change in the packaging
v4: Add a top level CMakeLists.txt to be able to squash all
openpowerlink packages into one and fixes the build system accordingly
Add legacy handling
v3: Add patch info about patches status
bump to v2.2.0
remove old openpowerlink stack (v1.8.5)
Rename openpowerlin2 to openpowerlink
fix build with musl toolchains
v2: switch to tar.gz archive
add hash file
merge openpowerlink2 and openpowerlink2-stack Add a new patch to install headers files
add OPENPOWERLINK2_*_ONOFF

---
 Config.in.legacy                                   |  17 +++
 ...l-the-stack-libraries-to-lib-subdirectory.patch | 133 ++++++++++++++++
 ...a-better-regex-for-cmake-system-processor.patch |  89 -----------
 ...0002-FIX-cmake-install-oplk-headers-files.patch |  34 +++++
 ...-fix-user-space-stack-enable-shared-build.patch |  54 -------
 ...se-CMAKE_CURRENT_SOURCE_DIR-instead-of-CM.patch | 154 +++++++++++++++++++
 ...ROJECT_NAME-instead-of-CMAKE_PROJECT_NAME.patch | 125 +++++++++++++++
 .../0005-FIX-Add-top-level-CMakeLists.txt.patch    | 170 +++++++++++++++++++++
 package/openpowerlink/Config.in                    | 126 +++++++--------
 package/openpowerlink/openpowerlink.hash           |   5 +
 package/openpowerlink/openpowerlink.mk             | 145 +++++++++++++-----
 11 files changed, 807 insertions(+), 245 deletions(-)
 create mode 100644 package/openpowerlink/0001-FIX-install-the-stack-libraries-to-lib-subdirectory.patch
 delete mode 100644 package/openpowerlink/0001-fix-use-a-better-regex-for-cmake-system-processor.patch
 create mode 100644 package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch
 delete mode 100644 package/openpowerlink/0002-fix-user-space-stack-enable-shared-build.patch
 create mode 100644 package/openpowerlink/0003-FIX-cmake-use-CMAKE_CURRENT_SOURCE_DIR-instead-of-CM.patch
 create mode 100644 package/openpowerlink/0004-FIX-Use-PROJECT_NAME-instead-of-CMAKE_PROJECT_NAME.patch
 create mode 100644 package/openpowerlink/0005-FIX-Add-top-level-CMakeLists.txt.patch
 create mode 100644 package/openpowerlink/openpowerlink.hash
Config.in.legacy +17 -0
index b38cf90..0e0c7e8 100644
@@ -145,6 +145,23 @@ endif
 ###############################################################################
 comment "Legacy options removed in 2016.02"
 
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_MODULE
+	bool "openpowerlink package has been updated"
+	select BR2_LEGACY
+	select BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB
+	help
+	  openpowerlink kernel modules are built if the
+	  kernel stack library is selected.
+
+config BR2_PACKAGE_OPENPOWERLINK_LIBPCAP
+	bool "openpowerlink package has been updated"
+	select BR2_LEGACY
+	select BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB
+	help
+	  The user space support has been split in two part:
+	  - a monolitic user space library
+	  - a user spae deamon driver
+
 config BR2_LINUX_KERNEL_SAME_AS_HEADERS
 	bool "using the linux headers version for the kernel has been removed"
 	select BR2_LEGACY
package/openpowerlink/0001-FIX-install-the-stack-libraries-to-lib-subdirectory.patch new file +133 -0

133 lines not on this page · raw message

package/openpowerlink/0001-fix-use-a-better-regex-for-cmake-system-processor.patch deleted +0 -89

89 lines not on this page · raw message

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +34 -0
new file mode 100644
index 0000000..1844906
@@ -0,0 +1,34 @@
+From cf3f84a815fc8ed415fbc9718ec5ae3c97fbe59f Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Mon, 4 May 2015 11:47:05 +0200
+Subject: [PATCH] [FIX] cmake: install oplk headers files
+
+In order to be able to link a third paries application
+with openpowerlink libraries, we need to install oplk
+headers files related to openpowerlink stack.
+
+Install all headers file from STACK_INCLUDE_DIR/oplk.
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+v4: install only include/oplk directory
+---
+ stack/CMakeLists.txt |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/stack/CMakeLists.txt b/stack/CMakeLists.txt
+index 9ff13f4..f4614cd 100644
+--- a/stack/CMakeLists.txt
++++ b/stack/CMakeLists.txt
+@@ -103,3 +103,8 @@ ELSEIF((CMAKE_SYSTEM_NAME STREQUAL "Generic") AND (CMAKE_SYSTEM_PROCESSOR STREQU
+ ELSE()
+     MESSAGE(FATAL_ERROR "Unknown Platform and processor combination ${CMAKE_SYSTEM_NAME} and ${CMAKE_SYSTEM_PROCESSOR}!!")
+ ENDIF()
++
++################################################################################
++# Install oplk headers files
++################################################################################
++INSTALL(DIRECTORY ${STACK_INCLUDE_DIR}/oplk DESTINATION "include")
+-- 
+1.7.10.4
+
package/openpowerlink/0002-fix-user-space-stack-enable-shared-build.patch deleted +0 -54

54 lines not on this page · raw message

package/openpowerlink/0003-FIX-cmake-use-CMAKE_CURRENT_SOURCE_DIR-instead-of-CM.patch new file +154 -0

154 lines not on this page · raw message

package/openpowerlink/0004-FIX-Use-PROJECT_NAME-instead-of-CMAKE_PROJECT_NAME.patch new file +125 -0

125 lines not on this page · raw message

package/openpowerlink/0005-FIX-Add-top-level-CMakeLists.txt.patch new file +170 -0

170 lines not on this page · raw message

package/openpowerlink/Config.in +64 -62

175 lines not on this page · raw message

package/openpowerlink/openpowerlink.hash new file +5 -0
new file mode 100644
index 0000000..6b28be8
@@ -0,0 +1,5 @@
+# From http://sourceforge.net/projects/openpowerlink/files/openPOWERLINK/V2.2.2/
+md5	d7f2b08d332b36fed5427ebc5ec118f2	openPOWERLINK_V2.2.2.tar.gz
+sha1	f565c6a8e10ba320325d120f6030158f4c4278f8	openPOWERLINK_V2.2.2.tar.gz
+# sha256 locally computed
+sha256	4de00eaf8af1ff3877bfa2e878a59989873406845fc8031bd6fc58cb1f7cf7e7	openPOWERLINK_V2.2.2.tar.gz
package/openpowerlink/openpowerlink.mk +105 -40

172 lines not on this page · raw message

Signature · 1 line
2.4.3
#1 lore raw

PATCH v7 1/1 package/openpowerlink: bump to v2.2.2

Dear Romain Naour,

Quoted 7 lines · Romain Naour

From [1]
With version 2.0, the source code has been cleanly split into an application-oriented user library and a time-critical stack driver. The latter may be moved to a dedicated communication processor or into a kernel module to deliver enhanced performance while still keeping the API in user space.

Quoted 5 lines

This new version break the API used in the v1.x but this is a complete rewrite of the Powerlink EPSG DS 301 implementation. The v1.x is deprecated anyway.

The now build system has been split in several CMake projects

now -> new

Quoted 1 line

which makes it difficult to package in Buildroot CMake infra.

in -> with the

Quoted 3 lines

So add a top level CMakeLists.txt to build each openpowerlink component without having to package each of them in a separate Buildroot packages. Also we need to fixes the build system to

fixes -> fix.

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch line 6

Quoted 12 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +6 -0
new file mode 100644
index 0000000..1844906
@@ -0,0 +1,34 @@
+From cf3f84a815fc8ed415fbc9718ec5ae3c97fbe59f Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Mon, 4 May 2015 11:47:05 +0200
+Subject: [PATCH] [FIX] cmake: install oplk headers files
+
+In order to be able to link a third paries application

third paries -> third party

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch line 8

Quoted 2 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +2 -0
+with openpowerlink libraries, we need to install oplk
+headers files related to openpowerlink stack.

*the* oplk header files.

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 3 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +1 -1
 choice
-	prompt "stack implementation"
+	prompt "Select MN/CN mode"

Remove "Select" here, i.e just:

prompt "MN/CN mode"

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 3 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +3 -0
+
+config BR2_PACKAGE_OPENPOWERLINK_MN
+	bool "MN"

Replace with "Managing Node"

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 5 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +5 -0
+	help
+	  Enable Managing Node (master) mode
+
+config BR2_PACKAGE_OPENPOWERLINK_CN
+	bool "CN"

And "Controlled Node"

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 9 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +9 -0
+	help
+	  Enable Controlled Node (slave) mode
+
+endchoice
+
+config BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL
+	string "debug level for openpowerlink stack"
+	default "0xEC000000L"
+	depends on BR2_ENABLE_DEBUG

BR2_ENABLE_DEBUG should not be used by packages anymore, except to enable debugging symbols. We have moved away from the idea of having BR2_ENABLE_DEBUG enable some random debugging mechanism in various packages, it was causing too much problems.

So, if you really want to keep this option, make it empty by default, and only enable debugging when the value is non-empty.

Also, what about using the "hex" kconfig type rather than "string" ? You could then have 0x0 be the default value which means "no debugging".

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 2 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +2 -0
+config BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB
+	bool "the EPL stack is directly linked into application."

All other prompts in this choice start with "build EPL stack ...", but I think it is a bit useless. Please change the prompt of the choice to:

prompt "EPL stack type"

and then three choices should be something like:

bool "linked into application"
bool "user-space pcap daemon"
bool "kernel-space driver"

Quoted 16 lines

endchoice

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +3 -3
-if BR2_PACKAGE_OPENPOWERLINK_KERNEL_MODULE
+if BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB
 
 choice
 	prompt "select Ethernet Powerlink Driver"
 
-config BR2_PACKAGE_OPENPOWERLINK_82573
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_82573
 	bool "Intel 82573"
 
-config BR2_PACKAGE_OPENPOWERLINK_8255x
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_8255x
 	bool "Intel 8255x"
 

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 10 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +5 -2
-config BR2_PACKAGE_OPENPOWERLINK_I210
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_I210
 	bool "Intel I210"
 
-config BR2_PACKAGE_OPENPOWERLINK_RTL8139
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_RTL8111
+	bool "Realtek RTL-8111/8168"
+
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_RTL8139
 	bool "Realtek RTL-8139"

You didn't do any legacy handling here, so I'm not sure renaming the symbols is a good idea. On the other hand, the new name is better (but you should use DRIVER not DRIVERS), and anyway the option to select the kernel stack has been renamed.

So I think it's OK to rename without adding legacy handling, but please fix DRIVERS -> DRIVER.

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 6 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +6 -0
+# Extract the archive using a custom extract cmds to keep a correct directory
+# tree
+define OPENPOWERLINK_EXTRACT_CMDS
+	$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
+		$(TAR) -C $($(PKG)_DIR) $(TAR_OPTIONS) - $($(PKG)_TAR_OPTIONS)
+endef

Please explain in more details what's going on. And use <pkg>_STRIP_COMPONENTS = 0 if possible, as discussed on IRC.

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 9 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +2 -6
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_LIBPCAP),y)
-#  use the user space stack (libpcap)
-OPENPOWERLINK_CONF_OPTS += -DCFG_KERNEL_STACK=OFF
-OPENPOWERLINK_DEPENDENCIES = libpcap
-else
-# use the kernel stack
+# CFG_DEBUG_LVL is taken into account only in Debug
+ifeq ($(BR2_ENABLE_DEBUG),y)

See comments above, don't use BR2_ENABLE_DEBUG.

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 3 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +2 -1
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_82573),y)
+OPENPOWERLINK_MN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK_MN),ON,OFF)
+OPENPOWERLINK_CN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK_CN),ON,OFF)

So it seems like OpenPowerLink allows to be MN and CN at the same time, but you don't allow that in your Config.in. Is this intended ?

Quoted 28 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +28 -0
+#### OPLK LIBRARY ####
+
+# Always build a oplk stack
+OPENPOWERLINK_CONF_OPTS += -DCFG_OPLK_LIB=ON
+
+# All option are ON by default
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += libpcap
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=$(OPENPOWERLINK_MN_ONOFF) \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=$(OPENPOWERLINK_CN_ONOFF) \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += libpcap
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=$(OPENPOWERLINK_MN_ONOFF) \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=$(OPENPOWERLINK_MN_ONOFF) \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=$(OPENPOWERLINK_CN_ONOFF) \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=$(OPENPOWERLINK_CN_ONOFF)

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 10 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +10 -0
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=$(OPENPOWERLINK_MN_ONOFF) \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=$(OPENPOWERLINK_CN_ONOFF) \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF

Ah, it took me a little while to understand how the options were working, but OK.

Quoted 60 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +34 -18
+endif
+
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_COMPILE_SHARED_LIBRARY=$(if $(BR2_STATIC_LIBS),OFF,ON)
+
+#### OPLK KERNEL DRIVERS ####
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += linux
+
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_KERNEL_DRIVERS=ON \
+	-DCFG_KERNEL_DIR="$(LINUX_DIR)" \
+	-DCMAKE_SYSTEM_VERSION="$(LINUX_VERSION)" \
+	-DCFG_OPLK_MN="$(OPENPOWERLINK_MN_ONOFF)" \
+	-DMAKE_KERNEL_ARCH="$(KERNEL_ARCH)" \
+	-DMAKE_KERNEL_CROSS_COMPILE="$(CCACHE) $(TARGET_CROSS)"
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_82573),y)
 OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=82573
-else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_8255x),y)
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_8255x),y)
 OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=8255x
-else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_I210),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=I210
-else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_RTL8139),y)
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_I210),y)
+OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=i210
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_RTL8111),y)
+OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=8111
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_RTL8139),y)
 OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=8139
 endif
-
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_MN),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_MN=ON
-else
-OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_MN=OFF
 endif
 
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_MN_CONSOLE),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_CONSOLE=ON
-else
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_CONSOLE=OFF
+#### OPLK PCAP DAEMON ####
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_PCAP_DAEMON=ON \
+	-DCFG_OPLK_MN=$(OPENPOWERLINK_MN_ONOFF)
 endif
 
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_MN_QT),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_QT=ON
-OPENPOWERLINK_DEPENDENCIES += qt
-else
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_QT=OFF
+#### OPLK DEMO APPS ####
+
+# See apps/common/cmake/configure-linux.cmake for available options list.

package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch

Quoted 10 lines
package/openpowerlink/0002-FIX-cmake-install-oplk-headers-files.patch new file +9 -0
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Link to Application"
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Linux Userspace Daemon"
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Linux Kernel Module"
 endif

What is this string doing ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v7 1/1 package/openpowerlink: bump to v2.2.2

Hi Thomas,

Le 07/02/2016 14:59, Thomas Petazzoni a ?crit :

Quoted 2 lines

Dear Romain Naour,

[snip]

Quoted 10 lines

package/openpowerlink/Config.in config BR2_PACKAGE_OPENPOWERLINK · line 42

Quoted 4 lines
package/openpowerlink/Config.in +4 -0
+config BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL
+	string "debug level for openpowerlink stack"
+	default "0xEC000000L"
+	depends on BR2_ENABLE_DEBUG

BR2_ENABLE_DEBUG should not be used by packages anymore, except to enable debugging symbols. We have moved away from the idea of having BR2_ENABLE_DEBUG enable some random debugging mechanism in various packages, it was causing too much problems.

Quoted 5 lines

So, if you really want to keep this option, make it empty by default, and only enable debugging when the value is non-empty.

Also, what about using the "hex" kconfig type rather than "string" ? You could then have 0x0 be the default value which means "no debugging".

CFG_DEBUG_LVL is only taken into account when CMAKE_BUILD_TYPE is set to Debug. which is only the case when BR2_ENABLE_DEBUG is set.

The string type is used here since the default value end with a "L" (0xEC000000L), I'm not sure this is meaningful.

I tried to override CMAKE_BUILD_TYPE when BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL is non 0x0 but it doesn't work since the debug library name is not the same as for release mode. A "_d" is used as suffix :
-loplkcnapp-kernelintf for release
-loplkcnapp-kernelintf_d for debug

I use It sometime for debuging, but I can modify it manually in the .mk instead. So, I will drop it in the end...

Quoted 48 lines

package/openpowerlink/Config.in config BR2_PACKAGE_OPENPOWERLINK · line 52

Quoted 3 lines
package/openpowerlink/Config.in +2 -0
+config BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB
+	bool "the EPL stack is directly linked into application."

All other prompts in this choice start with "build EPL stack ...", but I think it is a bit useless. Please change the prompt of the choice to:

prompt "EPL stack type"

and then three choices should be something like:

bool "linked into application"
bool "user-space pcap daemon"
bool "kernel-space driver"

Quoted 16 lines

endchoice

package/openpowerlink/Config.in +3 -3
-if BR2_PACKAGE_OPENPOWERLINK_KERNEL_MODULE
+if BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB
 
 choice
 	prompt "select Ethernet Powerlink Driver"
 
-config BR2_PACKAGE_OPENPOWERLINK_82573
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_82573
 	bool "Intel 82573"
 
-config BR2_PACKAGE_OPENPOWERLINK_8255x
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_8255x
 	bool "Intel 8255x"
 

package/openpowerlink/Config.in config BR2_PACKAGE_OPENPOWERLINK · line 102

Quoted 10 lines
package/openpowerlink/Config.in +5 -2
-config BR2_PACKAGE_OPENPOWERLINK_I210
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_I210
 	bool "Intel I210"
 
-config BR2_PACKAGE_OPENPOWERLINK_RTL8139
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_RTL8111
+	bool "Realtek RTL-8111/8168"
+
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVERS_RTL8139
 	bool "Realtek RTL-8139"

You didn't do any legacy handling here, so I'm not sure renaming the symbols is a good idea. On the other hand, the new name is better (but you should use DRIVER not DRIVERS), and anyway the option to select the kernel stack has been renamed.

Quoted 2 lines

So I think it's OK to rename without adding legacy handling, but please fix DRIVERS -> DRIVER.

DRIVERS come from a previous version of this series where the openpowerlink drivers was in different package... thank for noticing.

Quoted 11 lines

package/openpowerlink/openpowerlink.mk line 20

Quoted 8 lines
package/openpowerlink/openpowerlink.mk +6 -0
+# Extract the archive using a custom extract cmds to keep a correct directory
+# tree
+define OPENPOWERLINK_EXTRACT_CMDS
+	$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
+		$(TAR) -C $($(PKG)_DIR) $(TAR_OPTIONS) - $($(PKG)_TAR_OPTIONS)
+endef

Please explain in more details what's going on. And use <pkg>_STRIP_COMPONENTS = 0 if possible, as discussed on IRC.

I simply added:
# The archive has no leading component.
OPENPOWERLINK_STRIP_COMPONENTS = 0

Quoted 13 lines

package/openpowerlink/openpowerlink.mk line 23

Quoted 10 lines
package/openpowerlink/openpowerlink.mk +2 -6
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_LIBPCAP),y)
-#  use the user space stack (libpcap)
-OPENPOWERLINK_CONF_OPTS += -DCFG_KERNEL_STACK=OFF
-OPENPOWERLINK_DEPENDENCIES = libpcap
-else
-# use the kernel stack
+# CFG_DEBUG_LVL is taken into account only in Debug
+ifeq ($(BR2_ENABLE_DEBUG),y)

See comments above, don't use BR2_ENABLE_DEBUG.

Quoted 6 lines

package/openpowerlink/openpowerlink.mk line 29

Quoted 3 lines
package/openpowerlink/openpowerlink.mk +2 -1
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_82573),y)
+OPENPOWERLINK_MN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK_MN),ON,OFF)
+OPENPOWERLINK_CN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK_CN),ON,OFF)

So it seems like OpenPowerLink allows to be MN and CN at the same time, but you don't allow that in your Config.in. Is this intended ?

Yes, it's for the CFG_OPLK_MN boolean option.

- **CFG_OPLK_MN**

If enabled, the POWERLINK stack will be compiled with MN functionality, otherwise it will be compiled only with CN functionality.

Quoted 34 lines
Quoted 34 lines
package/openpowerlink/openpowerlink.mk +33 -0
+#### OPLK LIBRARY ####
+
+# Always build a oplk stack
+OPENPOWERLINK_CONF_OPTS += -DCFG_OPLK_LIB=ON
+
+# All option are ON by default
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += libpcap
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=$(OPENPOWERLINK_MN_ONOFF) \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=$(OPENPOWERLINK_CN_ONOFF) \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += libpcap
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=$(OPENPOWERLINK_MN_ONOFF) \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=$(OPENPOWERLINK_MN_ONOFF) \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=$(OPENPOWERLINK_CN_ONOFF) \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=$(OPENPOWERLINK_CN_ONOFF)
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=$(OPENPOWERLINK_MN_ONOFF) \
Quoted 8 lines

package/openpowerlink/openpowerlink.mk line 68

Quoted 5 lines
package/openpowerlink/openpowerlink.mk +5 -0
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=$(OPENPOWERLINK_CN_ONOFF) \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF

Ah, it took me a little while to understand how the options were working, but OK.

:)

Quoted 6 lines
Quoted 6 lines
package/openpowerlink/openpowerlink.mk +6 -0
+
+# See apps/common/cmake/configure-linux.cmake for available options list.
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Link to Application"
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
Quoted 8 lines

package/openpowerlink/openpowerlink.mk line 120

Quoted 6 lines
package/openpowerlink/openpowerlink.mk +5 -0
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Linux Userspace Daemon"
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Linux Kernel Module"
 endif

What is this string doing ?

It tell to the demo application against which library we need to link.

I'll respin shortly.

Thanks.
Romain

Quoted 3 lines

Thomas