Skip to contentSkip to conversation

package/openpowerlink2: new package

PATCH Superseded Romain Naour 2 participants 9 messages May 1, 2015 – May 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 package/openpowerlink2: new package

The openpowerlink2 package archive contains several cmake projects, and each of them must be packaged separately in Buildroot.

"With version 2.0, the source code has been cleanly split into an application-oriented user library and a time-critical stack driver."

This complicates the packaging but it help to refine the dependencies compared to openpowerlink v1 build system.
(openpowerlink v1 require C++ only for the qt demo)

The generic openpowerlink2 package provide all sources files and patches which are then used by other openpowerlink2-* packages (sub-packages).
Doing this avoids patches duplication over all sub-packages.

All patches fixes several issues with the cmake build system.

For each sub-packages, the extract hook create a symlink to the sources and the path to the cmake project is provided by *_SUBDIR value.

There is one project for the EPL stack libraries wich provides:
* an user space EPL stack to be linked into application
* an user space EPL stack pcap daemon
* an kernel space EPL library interface

There is two projects for EPL network driver:
* pcap daemon driver
* kernel module driver.

Note: On x86/x86_64 only few EPL ethernet driver are available for the EPL kernel stack implementation:
* Intel 82573
* Intel 8255x
* Intel I210
* Realtek RTL-8111/8168 (new since V2.1.0)
* Realtek RTL-8139

There are one project for each demo applications:
* demo_cn_embedded
* demo_mn_embedded
* demo_cn_console
* demo_mn_console
* demo_mn_qt

Only demo_mn_console will be packaged in Buildroot for now.

This patch add the package for the stack libraries.

[1] http://sourceforge.net/p/openpowerlink/discussion/newbie/thread/3f13af65/

---
v2: add a patch to install the stack libraries to "lib" subdirectory
remove -DCMAKE_INSTALL_PREFIX="/usr/lib" from OPENPOWERLINK2_STACK_CONF_OPTS

---
 package/Config.in                                  |   1 +
 ...a-better-regex-for-CMAKE_SYSTEM_PROCESSOR.patch | 153 +++++++++++++++++++++
 ...ink-demos-with-Debug-and-Release-librarie.patch | 116 ++++++++++++++++
 ...l-the-stack-libraries-to-lib-subdirectory.patch | 108 +++++++++++++++
 package/openpowerlink2/Config.in                   |  46 +++++++
 .../openpowerlink2/openpowerlink2-stack/Config.in  |  34 +++++
 .../openpowerlink2-stack/openpowerlink2-stack.mk   |  69 ++++++++++
 package/openpowerlink2/openpowerlink2.mk           |  17 +++
 8 files changed, 544 insertions(+)
 create mode 100644 package/openpowerlink2/0001-FIX-use-a-better-regex-for-CMAKE_SYSTEM_PROCESSOR.patch
 create mode 100644 package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch
 create mode 100644 package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch
 create mode 100644 package/openpowerlink2/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-stack/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk
 create mode 100644 package/openpowerlink2/openpowerlink2.mk
package/Config.in +1 -0
index afa145e..17b466f 100644
@@ -384,6 +384,7 @@ endif
 	source "package/open2300/Config.in"
 	source "package/openocd/Config.in"
 	source "package/openpowerlink/Config.in"
+	source "package/openpowerlink2/Config.in"
 	source "package/owl-linux/Config.in"
 	source "package/parted/Config.in"
 	source "package/pciutils/Config.in"
package/openpowerlink2/0001-FIX-use-a-better-regex-for-CMAKE_SYSTEM_PROCESSOR.patch new file +153 -0

153 lines not on this page · raw message

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +116 -0

116 lines not on this page · raw message

package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch new file +108 -0

108 lines not on this page · raw message

package/openpowerlink2/Config.in new file +46 -0

46 lines not on this page · raw message

package/openpowerlink2/openpowerlink2-stack/Config.in new file +34 -0
new file mode 100644
index 0000000..c3ddf47
@@ -0,0 +1,34 @@
+
+choice
+	prompt "Select openPOWERLINK library type"
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB
+	bool "the EPL stack is directly linked into application."
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  Compile a monolithic openPOWERLINK library. The library contains
+	  an Ethernet driver which is using the PCAP library for accessing
+	  the network.
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
+	bool "build EPL stack as linux userspace pcap daemon."
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  Compile openPOWERLINK application library which contains the
+	  interface to a Linux user space driver, and the Linux user space
+	  driver. It is used for implementing a multi-process solution
+	  where the openPOWERLINK kernel layer is running as a separate
+	  Linux user space daemon (e.g. a PCAP based user space daemon).
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB
+	bool "build EPL stack as linux kernelspace module."
+	depends on BR2_LINUX_KERNEL # openpowerlink-kernel-driver
+	help
+	  Compile openPOWERLINK application library which contains the
+	  interface to a Linux kernel space driver. It is used together
+	  with a Linux kernel module openPOWERLINK driver.
+
+comment "openpowerlink kernel stack needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
+
+endchoice
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +69 -0

69 lines not on this page · raw message

package/openpowerlink2/openpowerlink2.mk new file +17 -0
new file mode 100644
index 0000000..82c4277
@@ -0,0 +1,17 @@
+################################################################################
+#
+# openpowerlink2
+#
+################################################################################
+
+OPENPOWERLINK2_VERSION = V2.1.1
+OPENPOWERLINK2_SITE = http://git.code.sf.net/p/openpowerlink/openPOWERLINK2
+OPENPOWERLINK2_SITE_METHOD = git
+OPENPOWERLINK2_LICENSE = BSD-2c, GPLv2
+OPENPOWERLINK2_LICENSE_FILES = license.md
+
+# Just extract the archive
+
+$(eval $(generic-package))
+
+include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk
Signature · 1 line
1.9.3
#1 lore raw

PATCH v2 2/3 package/openpowerlink2: add drivers packages

---
v2: s/BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER/BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS/
The kernel module wasn't build due to a typo in the kconfig variable. rename openpowerlink2-pcap-drivers to openpowerlink2-pcap-daemon.

---
 package/openpowerlink2/Config.in                   |  1 +
 .../openpowerlink2-drivers/Config.in               |  3 ++
 .../openpowerlink2-drivers.mk                      |  2 +
 .../openpowerlink2-kernel-drivers/Config.in        | 33 +++++++++++++++
 .../openpowerlink2-kernel-drivers.mk               | 48 ++++++++++++++++++++++
 .../openpowerlink2-pcap-daemon/Config.in           | 12 ++++++
 .../openpowerlink2-pcap-daemon.mk                  | 34 +++++++++++++++
 .../openpowerlink2/openpowerlink2-stack/Config.in  |  2 +
 package/openpowerlink2/openpowerlink2.mk           |  1 +
 9 files changed, 136 insertions(+)
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk
package/openpowerlink2/Config.in +1 -0
index 8e61a7d..c651031 100644
@@ -35,6 +35,7 @@ choice
 
 endchoice
 
+source "package/openpowerlink2/openpowerlink2-drivers/Config.in"
 source "package/openpowerlink2/openpowerlink2-stack/Config.in"
 
 config BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL
package/openpowerlink2/openpowerlink2-drivers/Config.in new file +3 -0
new file mode 100644
index 0000000..b9239ae
@@ -0,0 +1,3 @@
+
+source "package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in"
+source "package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in"
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk new file +2 -0
new file mode 100644
index 0000000..ab5cd1c
@@ -0,0 +1,2 @@
+
+include $(sort $(wildcard package/openpowerlink2/openpowerlink2-drivers/*/*.mk))
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +33 -0
new file mode 100644
index 0000000..461504c
@@ -0,0 +1,33 @@
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
+	bool "openpowerlink kernel stack"
+	depends on BR2_LINUX_KERNEL
+	depends on BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB
+	help
+	  The openPOWERLINK stack is implemented as Linux kernel module.
+	  This solution provides the best performance, but is limited to
+	  the available openPOWERLINK network drivers.
+
+if BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
+
+choice
+	prompt "select Ethernet Powerlink Driver"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_82573
+	bool "Intel 82573"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_8255x
+	bool "Intel 8255x"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_I210
+	bool "Intel I210"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_RTL8111
+	bool "Realtek RTL-8111/8168"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_RTL8139
+	bool "Realtek RTL-8139"
+
+endchoice
+
+endif # BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +48 -0

48 lines not on this page · raw message

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in new file +12 -0
new file mode 100644
index 0000000..896152e
@@ -0,0 +1,12 @@
+
+config BR2_PACKAGE_OPENPOWERLINK2_PCAP_DAEMON
+	bool "openpowerlink userspace (PCAP) stack"
+	depends on BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  The Linux userspace implementation of the openPOWERLINK stack
+	  provides all functions for a software based POWERLINK solution
+	  running as Linux userspace application. The stack uses the
+	  libpcap library for accessing the network interface and is
+	  therefore totally independant of the used network card and
+	  driver.
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk new file +34 -0
new file mode 100644
index 0000000..cc28d66
@@ -0,0 +1,34 @@
+################################################################################
+#
+# openpowerlink2-pcap-daemon
+#
+################################################################################
+
+OPENPOWERLINK2_PCAP_DAEMON_VERSION = $(OPENPOWERLINK2_VERSION)
+
+OPENPOWERLINK2_PCAP_DAEMON_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_PCAP_DAEMON_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_PCAP_DAEMON_SOURCE =
+OPENPOWERLINK2_PCAP_DAEMON_DEPENDENCIES = libpcap openpowerlink2-stack
+
+define OPENPOWERLINK2_PCAP_DAEMON_SYMLINK_TO_SRC_HOOK
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_PCAP_DAEMON_DIR)/src
+endef
+
+OPENPOWERLINK2_PCAP_DAEMON_POST_EXTRACT_HOOKS += \
+	OPENPOWERLINK2_PCAP_DAEMON_SYMLINK_TO_SRC_HOOK
+
+OPENPOWERLINK2_PCAP_DAEMON_SUBDIR = src/drivers/linux/drv_daemon_pcap
+
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS = \
+	-DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL))
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_MN),y)
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS += -DCFG_OPLK_MN=ON
+else
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS += -DCFG_OPLK_MN=OFF
+endif
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2-stack/Config.in +2 -0
index c3ddf47..f73d8c8 100644
@@ -13,6 +13,7 @@ config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB
 config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
 	bool "build EPL stack as linux userspace pcap daemon."
 	select BR2_PACKAGE_LIBPCAP
+	select BR2_PACKAGE_OPENPOWERLINK2_PCAP_DAEMON
 	help
 	  Compile openPOWERLINK application library which contains the
 	  interface to a Linux user space driver, and the Linux user space
@@ -23,6 +24,7 @@ config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
 config BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB
 	bool "build EPL stack as linux kernelspace module."
 	depends on BR2_LINUX_KERNEL # openpowerlink-kernel-driver
+	select BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
 	help
 	  Compile openPOWERLINK application library which contains the
 	  interface to a Linux kernel space driver. It is used together
package/openpowerlink2/openpowerlink2.mk +1 -0
index 82c4277..144fa98 100644
@@ -14,4 +14,5 @@ OPENPOWERLINK2_LICENSE_FILES = license.md
 
 $(eval $(generic-package))
 
+include package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk
Signature · 1 line
1.9.3
#2 lore raw

PATCH v2 2/3 package/openpowerlink2: add drivers packages

Quoted 5 lines · Romain Naour

---
v2: s/BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER/BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS/
The kernel module wasn't build due to a typo in the kconfig variable. rename openpowerlink2-pcap-drivers to openpowerlink2-pcap-daemon.

Quoted 10 lines
---
 package/openpowerlink2/Config.in                   |  1 +
 .../openpowerlink2-drivers/Config.in               |  3 ++
 .../openpowerlink2-drivers.mk                      |  2 +
 .../openpowerlink2-kernel-drivers/Config.in        | 33 +++++++++++++++
 .../openpowerlink2-kernel-drivers.mk               | 48 ++++++++++++++++++++++
 .../openpowerlink2-pcap-daemon/Config.in           | 12 ++++++
 .../openpowerlink2-pcap-daemon.mk                  | 34 +++++++++++++++
 .../openpowerlink2/openpowerlink2-stack/Config.in  |  2 +
 package/openpowerlink2/openpowerlink2.mk           |  1 +

Again, this should be split into one patch per package, and without subdirectory.

Quoted 13 lines
 9 files changed, 136 insertions(+)
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk
package/openpowerlink2/Config.in +0 -0
index 8e61a7d..c651031 100644

package/openpowerlink2/Config.in choice · line 39

Quoted 5 lines
package/openpowerlink2/Config.in +1 -0
@@ -35,6 +35,7 @@ choice
 
 endchoice
 
+source "package/openpowerlink2/openpowerlink2-drivers/Config.in"
 source "package/openpowerlink2/openpowerlink2-stack/Config.in"

It doesn't make sense to put the drivers before the stack, if you first have to
go to the stack to select the option that makes it possible to select drivers... So IMHO this is a case were we can break alphabetical ordering.

package/openpowerlink2/openpowerlink2-drivers/Config.in line 3

Quoted 11 lines
package/openpowerlink2/Config.in +0 -0
 config BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL
package/openpowerlink2/openpowerlink2-drivers/Config.in new file +3 -0
new file mode 100644
index 0000000..b9239ae
@@ -0,0 +1,3 @@
+
+source "package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in"
+source "package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in"

This extra config file and non-package package isn't needed. So just make one
patch to add -kernel-drivers, and another patch to add -pcap-daemon.

Quoted 14 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk new file +2 -0
new file mode 100644
index 0000000..ab5cd1c
@@ -0,0 +1,2 @@
+
+include $(sort $(wildcard package/openpowerlink2/openpowerlink2-drivers/*/*.mk))
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +0 -0
new file mode 100644
index 0000000..461504c

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in line 5

Quoted 5 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +5 -0
@@ -0,0 +1,33 @@
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
+	bool "openpowerlink kernel stack"
+	depends on BR2_LINUX_KERNEL
+	depends on BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB

That can't be right, you have both a depends here and a select in
BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB. Kconfig should error on that.

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in line 9

Quoted 4 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +4 -0
+	help
+	  The openPOWERLINK stack is implemented as Linux kernel module.
+	  This solution provides the best performance, but is limited to
+	  the available openPOWERLINK network drivers.

This sentence should go to the choice in the stack.

Perhaps the help text should also mention that the user is responsible for
making sure that the 'normal' driver for the ethernet chip isn't enabled or loaded.

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in line 14

Quoted 5 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +5 -0
+
+if BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
+
+choice
+	prompt "select Ethernet Powerlink Driver"

Are they really mutually exclusive?

Quoted 36 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +19 -0
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_82573
+	bool "Intel 82573"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_8255x
+	bool "Intel 8255x"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_I210
+	bool "Intel I210"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_RTL8111
+	bool "Realtek RTL-8111/8168"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_RTL8139
+	bool "Realtek RTL-8139"
+
+endchoice
+
+endif # BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +11 -0
new file mode 100644
index 0000000..a4470d8
@@ -0,0 +1,48 @@
+################################################################################
+#
+# openpowerlink2-kernel-drivers
+#
+################################################################################
+
+OPENPOWERLINK2_KERNEL_DRIVERS_VERSION = $(OPENPOWERLINK2_VERSION)
+
+OPENPOWERLINK2_KERNEL_DRIVERS_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_KERNEL_DRIVERS_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk line 21

Quoted 10 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +10 -0
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_KERNEL_DRIVERS_SOURCE =
+OPENPOWERLINK2_KERNEL_DRIVERS_DEPENDENCIES = linux openpowerlink2-stack
+
+define OPENPOWERLINK2_KERNEL_DRIVERS_SYMLINK_TO_SRC_HOOK
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_KERNEL_DRIVERS_DIR)/src
+endef
+
+OPENPOWERLINK2_KERNEL_DRIVERS_POST_EXTRACT_HOOKS += \
+	OPENPOWERLINK2_KERNEL_DRIVERS_SYMLINK_TO_SRC_HOOK

Same here for extracting instead of symlinking, but I guess here you need just
src/drivers/linux/drv_kernelmod_edrv.

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk line 33

Quoted 12 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +12 -0
+
+OPENPOWERLINK2_KERNEL_DRIVERS_SUBDIR = src/drivers/linux/drv_kernelmod_edrv
+
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS = \
+	-DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL)) \
+	-DCFG_KERNEL_DIR=$(LINUX_DIR) \
+	-DCMAKE_SYSTEM_VERSION=$(LINUX_VERSION)
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_MN),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_OPLK_MN=ON
+else
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_OPLK_MN=OFF

For consistency, it would be better to use the same $(if ...) construct that
you use in -stack.

BTW, is there no corresponding option for CN?

Quoted 22 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +15 -0
+endif
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_82573),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=82573
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_8255x),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=8255x
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_I210),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=I210
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_RTL8139),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=8139
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_RTL8111),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=8111
+endif
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in new file +1 -0
new file mode 100644
index 0000000..896152e
@@ -0,0 +1,12 @@
+

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in line 11

Quoted 10 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in new file +10 -0
+config BR2_PACKAGE_OPENPOWERLINK2_PCAP_DAEMON
+	bool "openpowerlink userspace (PCAP) stack"
+	depends on BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  The Linux userspace implementation of the openPOWERLINK stack
+	  provides all functions for a software based POWERLINK solution
+	  running as Linux userspace application. The stack uses the
+	  libpcap library for accessing the network interface and is
+	  therefore totally independant of the used network card and

independent

Quoted 29 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in new file +1 -0
+	  driver.
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk new file +22 -0
new file mode 100644
index 0000000..cc28d66
@@ -0,0 +1,34 @@
+################################################################################
+#
+# openpowerlink2-pcap-daemon
+#
+################################################################################
+
+OPENPOWERLINK2_PCAP_DAEMON_VERSION = $(OPENPOWERLINK2_VERSION)
+
+OPENPOWERLINK2_PCAP_DAEMON_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_PCAP_DAEMON_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_PCAP_DAEMON_SOURCE =
+OPENPOWERLINK2_PCAP_DAEMON_DEPENDENCIES = libpcap openpowerlink2-stack
+
+define OPENPOWERLINK2_PCAP_DAEMON_SYMLINK_TO_SRC_HOOK
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_PCAP_DAEMON_DIR)/src
+endef
+
+OPENPOWERLINK2_PCAP_DAEMON_POST_EXTRACT_HOOKS += \
+	OPENPOWERLINK2_PCAP_DAEMON_SYMLINK_TO_SRC_HOOK
+

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk line 32

Quoted 10 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk new file +10 -0
+OPENPOWERLINK2_PCAP_DAEMON_SUBDIR = src/drivers/linux/drv_daemon_pcap
+
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS = \
+	-DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL))
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_MN),y)
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS += -DCFG_OPLK_MN=ON
+else
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS += -DCFG_OPLK_MN=OFF
+endif

Same here about the $(if).

Since it's used so often, perhaps it's better to define a global

OPENPOWERLINK2_MN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) OPENPOWERLINK2_CN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF)

package/openpowerlink2/openpowerlink2-stack/Config.in config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB · line 15

Quoted 10 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk new file +2 -0
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2-stack/Config.in +0 -0
index c3ddf47..f73d8c8 100644
@@ -13,6 +13,7 @@ config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB
 config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
 	bool "build EPL stack as linux userspace pcap daemon."
 	select BR2_PACKAGE_LIBPCAP

Does the -stack use LIBPCAP directly in this case? If not, this select
shouldn't be there.

Regards,
Arnout

Quoted 23 lines
package/openpowerlink2/openpowerlink2-stack/Config.in +2 -0
+	select BR2_PACKAGE_OPENPOWERLINK2_PCAP_DAEMON
 	help
 	  Compile openPOWERLINK application library which contains the
 	  interface to a Linux user space driver, and the Linux user space
@@ -23,6 +24,7 @@ config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
 config BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB
 	bool "build EPL stack as linux kernelspace module."
 	depends on BR2_LINUX_KERNEL # openpowerlink-kernel-driver
+	select BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
 	help
 	  Compile openPOWERLINK application library which contains the
 	  interface to a Linux kernel space driver. It is used together
package/openpowerlink2/openpowerlink2.mk +1 -0
index 82c4277..144fa98 100644
@@ -14,4 +14,5 @@ OPENPOWERLINK2_LICENSE_FILES = license.md
 
 $(eval $(generic-package))
 
+include package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH v2 2/3 package/openpowerlink2: add drivers packages

Hi Arnout,

Le 02/05/2015 17:12, Arnout Vandecappelle a ?crit :

Quoted 33 lines · Romain Naour
Quoted 5 lines

---
v2: s/BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER/BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS/
The kernel module wasn't build due to a typo in the kconfig variable. rename openpowerlink2-pcap-drivers to openpowerlink2-pcap-daemon.

Quoted 10 lines
---
 package/openpowerlink2/Config.in                   |  1 +
 .../openpowerlink2-drivers/Config.in               |  3 ++
 .../openpowerlink2-drivers.mk                      |  2 +
 .../openpowerlink2-kernel-drivers/Config.in        | 33 +++++++++++++++
 .../openpowerlink2-kernel-drivers.mk               | 48 ++++++++++++++++++++++
 .../openpowerlink2-pcap-daemon/Config.in           | 12 ++++++
 .../openpowerlink2-pcap-daemon.mk                  | 34 +++++++++++++++
 .../openpowerlink2/openpowerlink2-stack/Config.in  |  2 +
 package/openpowerlink2/openpowerlink2.mk           |  1 +

Again, this should be split into one patch per package, and without subdirectory.

Quoted 14 lines
 9 files changed, 136 insertions(+)
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk
package/openpowerlink2/Config.in +0 -0
index 8e61a7d..c651031 100644
@@ -35,6 +35,7 @@ choice
 
Quoted 8 lines

package/openpowerlink2/Config.in choice · line 39

Quoted 4 lines
package/openpowerlink2/Config.in +1 -0
 endchoice
 
+source "package/openpowerlink2/openpowerlink2-drivers/Config.in"
 source "package/openpowerlink2/openpowerlink2-stack/Config.in"

It doesn't make sense to put the drivers before the stack, if you first have to
go to the stack to select the option that makes it possible to select drivers... So IMHO this is a case were we can break alphabetical ordering.

ok

Quoted 15 lines

package/openpowerlink2/openpowerlink2-drivers/Config.in line 3

Quoted 12 lines
package/openpowerlink2/Config.in +0 -0
 config BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL
package/openpowerlink2/openpowerlink2-drivers/Config.in new file +3 -0
new file mode 100644
index 0000000..b9239ae
@@ -0,0 +1,3 @@
+
+source "package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in"
+source "package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in"

This extra config file and non-package package isn't needed. So just make one
patch to add -kernel-drivers, and another patch to add -pcap-daemon.

ok

Quoted 15 lines
Quoted 15 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk new file +2 -0
new file mode 100644
index 0000000..ab5cd1c
@@ -0,0 +1,2 @@
+
+include $(sort $(wildcard package/openpowerlink2/openpowerlink2-drivers/*/*.mk))
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +0 -0
new file mode 100644
index 0000000..461504c
@@ -0,0 +1,33 @@
Quoted 8 lines

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in line 5

Quoted 5 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +5 -0
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
+	bool "openpowerlink kernel stack"
+	depends on BR2_LINUX_KERNEL
+	depends on BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB

That can't be right, you have both a depends here and a select in
BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB. Kconfig should error on that.

BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB already depends on BR2_LINUX_KERNEL. In fact, I anticipated the fact that it will select BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS and added BR2_LINUX_KERNEL as a reverse dependency.

Quoted 7 lines

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in line 9

Quoted 5 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +4 -0
+	help
+	  The openPOWERLINK stack is implemented as Linux kernel module.
+	  This solution provides the best performance, but is limited to
+	  the available openPOWERLINK network drivers.

This sentence should go to the choice in the stack.

ok

Quoted 3 lines

Perhaps the help text should also mention that the user is responsible for
making sure that the 'normal' driver for the ethernet chip isn't enabled or loaded.

The openpowerlink's kernel modules should be loaded by using a little script plkload which unbind the 'normal' kernel's modules.

Quoted 8 lines

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in line 14

Quoted 6 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +5 -0
+
+if BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
+
+choice
+	prompt "select Ethernet Powerlink Driver"

Are they really mutually exclusive?

Yes, cmake set a string to select one by one the module to be build.

SET(CFG_POWERLINK_EDRV "82573" CACHE STRING

        "Valid drivers are 8139, 82573, 8255x, i210, 8111, emacps")

SET_PROPERTY(CACHE CFG_POWERLINK_EDRV PROPERTY STRINGS 8139 82573 8255x i210 8111 emacps)

So, I can't build several openpowerlink driver without modify the config... Actually, you can't run several instance of the openpowerlink stack on the same machine.

Quoted 42 lines
Quoted 42 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/Config.in new file +19 -0
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_82573
+	bool "Intel 82573"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_8255x
+	bool "Intel 8255x"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_I210
+	bool "Intel I210"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_RTL8111
+	bool "Realtek RTL-8111/8168"
+
+config BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVER_RTL8139
+	bool "Realtek RTL-8139"
+
+endchoice
+
+endif # BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +16 -0
new file mode 100644
index 0000000..a4470d8
@@ -0,0 +1,48 @@
+################################################################################
+#
+# openpowerlink2-kernel-drivers
+#
+################################################################################
+
+OPENPOWERLINK2_KERNEL_DRIVERS_VERSION = $(OPENPOWERLINK2_VERSION)
+
+OPENPOWERLINK2_KERNEL_DRIVERS_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_KERNEL_DRIVERS_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_KERNEL_DRIVERS_SOURCE =
+OPENPOWERLINK2_KERNEL_DRIVERS_DEPENDENCIES = linux openpowerlink2-stack
+
+define OPENPOWERLINK2_KERNEL_DRIVERS_SYMLINK_TO_SRC_HOOK
Quoted 8 lines

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk line 21

Quoted 5 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +5 -0
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_KERNEL_DRIVERS_DIR)/src
+endef
+
+OPENPOWERLINK2_KERNEL_DRIVERS_POST_EXTRACT_HOOKS += \
+	OPENPOWERLINK2_KERNEL_DRIVERS_SYMLINK_TO_SRC_HOOK

Same here for extracting instead of symlinking, but I guess here you need just
src/drivers/linux/drv_kernelmod_edrv.

Exactly.

Quoted 16 lines

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk line 33

Quoted 13 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +12 -0
+
+OPENPOWERLINK2_KERNEL_DRIVERS_SUBDIR = src/drivers/linux/drv_kernelmod_edrv
+
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS = \
+	-DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL)) \
+	-DCFG_KERNEL_DIR=$(LINUX_DIR) \
+	-DCMAKE_SYSTEM_VERSION=$(LINUX_VERSION)
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_MN),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_OPLK_MN=ON
+else
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_OPLK_MN=OFF

For consistency, it would be better to use the same $(if ...) construct that
you use in -stack.

Ha yes, thanks I forgot to made the change here.

Quoted 2 lines

BTW, is there no corresponding option for CN?

No, because the MN capacities is a superset of CN capacities, so if MN is disabled it mean that the CN mode is enabled.

Quoted 77 lines
Quoted 23 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-kernel-drivers/openpowerlink2-kernel-drivers.mk new file +15 -0
+endif
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_82573),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=82573
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_8255x),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=8255x
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_I210),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=I210
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_RTL8139),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=8139
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS_RTL8111),y)
+OPENPOWERLINK2_KERNEL_DRIVERS_CONF_OPTS += -DCFG_POWERLINK_EDRV=8111
+endif
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in new file +1 -0
new file mode 100644
index 0000000..896152e
@@ -0,0 +1,12 @@
+

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in line 11

Quoted 10 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in new file +10 -0
+config BR2_PACKAGE_OPENPOWERLINK2_PCAP_DAEMON
+	bool "openpowerlink userspace (PCAP) stack"
+	depends on BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  The Linux userspace implementation of the openPOWERLINK stack
+	  provides all functions for a software based POWERLINK solution
+	  running as Linux userspace application. The stack uses the
+	  libpcap library for accessing the network interface and is
+	  therefore totally independant of the used network card and

independent

Quoted 29 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/Config.in new file +1 -0
+	  driver.
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk new file +22 -0
new file mode 100644
index 0000000..cc28d66
@@ -0,0 +1,34 @@
+################################################################################
+#
+# openpowerlink2-pcap-daemon
+#
+################################################################################
+
+OPENPOWERLINK2_PCAP_DAEMON_VERSION = $(OPENPOWERLINK2_VERSION)
+
+OPENPOWERLINK2_PCAP_DAEMON_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_PCAP_DAEMON_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_PCAP_DAEMON_SOURCE =
+OPENPOWERLINK2_PCAP_DAEMON_DEPENDENCIES = libpcap openpowerlink2-stack
+
+define OPENPOWERLINK2_PCAP_DAEMON_SYMLINK_TO_SRC_HOOK
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_PCAP_DAEMON_DIR)/src
+endef
+
+OPENPOWERLINK2_PCAP_DAEMON_POST_EXTRACT_HOOKS += \
+	OPENPOWERLINK2_PCAP_DAEMON_SYMLINK_TO_SRC_HOOK
+

package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk line 32

Quoted 10 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk new file +10 -0
+OPENPOWERLINK2_PCAP_DAEMON_SUBDIR = src/drivers/linux/drv_daemon_pcap
+
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS = \
+	-DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL))
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_MN),y)
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS += -DCFG_OPLK_MN=ON
+else
+OPENPOWERLINK2_PCAP_DAEMON_CONF_OPTS += -DCFG_OPLK_MN=OFF
+endif

Same here about the $(if).

Quoted 4 lines

Since it's used so often, perhaps it's better to define a global

OPENPOWERLINK2_MN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) OPENPOWERLINK2_CN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF)

Ok, I'll try that.

Quoted 14 lines

package/openpowerlink2/openpowerlink2-stack/Config.in config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB · line 15

Quoted 11 lines
package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-pcap-daemon/openpowerlink2-pcap-daemon.mk new file +2 -0
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2-stack/Config.in +0 -0
index c3ddf47..f73d8c8 100644
@@ -13,6 +13,7 @@ config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB
 config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
 	bool "build EPL stack as linux userspace pcap daemon."
 	select BR2_PACKAGE_LIBPCAP

Does the -stack use LIBPCAP directly in this case? If not, this select
shouldn't be there.

libpcap is needed here since src/kernel/edrv/edrv-pcap_linux.c which is used to build the library is included.

Thanks you for your review.

Best regards,
Romain

Quoted 29 lines

Regards,
Arnout

Quoted 23 lines
package/openpowerlink2/openpowerlink2-stack/Config.in +2 -0
+	select BR2_PACKAGE_OPENPOWERLINK2_PCAP_DAEMON
 	help
 	  Compile openPOWERLINK application library which contains the
 	  interface to a Linux user space driver, and the Linux user space
@@ -23,6 +24,7 @@ config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
 config BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB
 	bool "build EPL stack as linux kernelspace module."
 	depends on BR2_LINUX_KERNEL # openpowerlink-kernel-driver
+	select BR2_PACKAGE_OPENPOWERLINK2_KERNEL_DRIVERS
 	help
 	  Compile openPOWERLINK application library which contains the
 	  interface to a Linux kernel space driver. It is used together
package/openpowerlink2/openpowerlink2.mk +1 -0
index 82c4277..144fa98 100644
@@ -14,4 +14,5 @@ OPENPOWERLINK2_LICENSE_FILES = license.md
 
 $(eval $(generic-package))
 
+include package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk
#4 lore raw

PATCH v2 3/3 package/openpowerlink2: add demo mn console application

In reply to Romain Naour

---
v2: add missing -DCFG_DEBUG_LVL in CONF_OPTS

---
 package/openpowerlink2/Config.in                   |  1 +
 .../openpowerlink2/openpowerlink2-apps/Config.in   |  2 +
 .../openpowerlink2-apps-demo-mn-console/Config.in  |  5 +++
 .../openpowerlink2-apps-demo-mn-console.mk         | 45 ++++++++++++++++++++++
 .../openpowerlink2-apps/openpowerlink2-apps.mk     |  2 +
 package/openpowerlink2/openpowerlink2.mk           |  1 +
 6 files changed, 56 insertions(+)
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps.mk
package/openpowerlink2/Config.in +1 -0
index c651031..e82e738 100644
@@ -35,6 +35,7 @@ choice
 
 endchoice
 
+source "package/openpowerlink2/openpowerlink2-apps/Config.in"
 source "package/openpowerlink2/openpowerlink2-drivers/Config.in"
 source "package/openpowerlink2/openpowerlink2-stack/Config.in"
 
package/openpowerlink2/openpowerlink2-apps/Config.in new file +2 -0
new file mode 100644
index 0000000..6f10a6a
@@ -0,0 +1,2 @@
+
+source "package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in"
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in new file +5 -0
new file mode 100644
index 0000000..dcf2605
@@ -0,0 +1,5 @@
+
+config BR2_PACKAGE_OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE
+	bool "demo_mn_console"
+	help
+	  Managing Node console demo application
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk new file +45 -0

45 lines not on this page · raw message

package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps.mk new file +2 -0
new file mode 100644
index 0000000..802dcbf
@@ -0,0 +1,2 @@
+
+include $(sort $(wildcard package/openpowerlink2/openpowerlink2-apps/*/*.mk))
package/openpowerlink2/openpowerlink2.mk +1 -0
index 144fa98..ba0d418 100644
@@ -14,5 +14,6 @@ OPENPOWERLINK2_LICENSE_FILES = license.md
 
 $(eval $(generic-package))
 
+include package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps.mk
 include package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk
Signature · 1 line
1.9.3
#5 lore raw

PATCH v2 3/3 package/openpowerlink2: add demo mn console application

Quoted 21 lines · Romain Naour

---
v2: add missing -DCFG_DEBUG_LVL in CONF_OPTS

---
 package/openpowerlink2/Config.in                   |  1 +
 .../openpowerlink2/openpowerlink2-apps/Config.in   |  2 +
 .../openpowerlink2-apps-demo-mn-console/Config.in  |  5 +++
 .../openpowerlink2-apps-demo-mn-console.mk         | 45 ++++++++++++++++++++++
 .../openpowerlink2-apps/openpowerlink2-apps.mk     |  2 +
 package/openpowerlink2/openpowerlink2.mk           |  1 +
 6 files changed, 56 insertions(+)
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk
 create mode 100644 package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps.mk
package/openpowerlink2/Config.in +0 -0
index c651031..e82e738 100644

package/openpowerlink2/Config.in choice · line 40

Quoted 6 lines
package/openpowerlink2/Config.in +1 -0
@@ -35,6 +35,7 @@ choice
 
 endchoice
 
+source "package/openpowerlink2/openpowerlink2-apps/Config.in"
 source "package/openpowerlink2/openpowerlink2-drivers/Config.in"
 source "package/openpowerlink2/openpowerlink2-stack/Config.in"

Actually, shouldn't the _DEBUG_LEVEL option come before the sourcing of the
other packages?

Quoted 15 lines
package/openpowerlink2/openpowerlink2-apps/Config.in new file +2 -0
new file mode 100644
index 0000000..6f10a6a
@@ -0,0 +1,2 @@
+
+source "package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in"
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in new file +0 -0
new file mode 100644
index 0000000..dcf2605

package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in line 3

Quoted 3 lines
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in new file +3 -0
@@ -0,0 +1,5 @@
+
+config BR2_PACKAGE_OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE
+	bool "demo_mn_console"

Shouldn't this depend on BR2_PACKAGE_OPENPOWERLINK2_MN and either select or
depend on the stack?

Quoted 28 lines
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/Config.in new file +2 -0
+	help
+	  Managing Node console demo application
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk new file +20 -0
new file mode 100644
index 0000000..23c17b5
@@ -0,0 +1,45 @@
+################################################################################
+#
+# openpowerlink2-apps-demo-mn-console
+#
+################################################################################
+
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_VERSION = $(OPENPOWERLINK2_VERSION)
+
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_SOURCE =
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_DEPENDENCIES = openpowerlink2-stack
+
+define OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_SYMLINK_TO_SRC_HOOK
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_DIR)/src
+endef
+
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_POST_EXTRACT_HOOKS += \

package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk line 30

Quoted 10 lines
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk new file +10 -0
+	OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_SYMLINK_TO_SRC_HOOK
+
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_SUBDIR = src/apps/demo_mn_console/
+
+# See apps/common/cmake/configure-linux.cmake for available options list.
+
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_CONF_OPTS = \
+	-DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL))
+	
+# PCAP is used for directlink or userspace daemon

Why is this here?

package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk line 39

Quoted 9 lines
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk new file +9 -0
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Link to Application"
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Linux Userspace Daemon" \
+	-DCFG_DEMO_MN_CONSOLE_USE_SYNCTHREAD=ON
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB),y)
+# kernel stack

Well, yes, obviously...

Regards,
Arnout

Quoted 26 lines
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps-demo-mn-console/openpowerlink2-apps-demo-mn-console.mk new file +6 -0
+OPENPOWERLINK2_APPS_DEMO_MN_CONSOLE_CONF_OPTS += \
+	-DCFG_BUILD_KERNEL_STACK="Linux Kernel Module" \
+	-DCFG_DEMO_MN_CONSOLE_USE_SYNCTHREAD=ON
+endif
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps.mk new file +2 -0
new file mode 100644
index 0000000..802dcbf
@@ -0,0 +1,2 @@
+
+include $(sort $(wildcard package/openpowerlink2/openpowerlink2-apps/*/*.mk))
package/openpowerlink2/openpowerlink2.mk +1 -0
index 144fa98..ba0d418 100644
@@ -14,5 +14,6 @@ OPENPOWERLINK2_LICENSE_FILES = license.md
 
 $(eval $(generic-package))
 
+include package/openpowerlink2/openpowerlink2-apps/openpowerlink2-apps.mk
 include package/openpowerlink2/openpowerlink2-drivers/openpowerlink2-drivers.mk
 include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#6 lore raw

PATCH v2 1/3 package/openpowerlink2: new package

In reply to Romain Naour
Quoted 5 lines · Romain Naour

The openpowerlink2 package archive contains several cmake projects, and each of them must be packaged separately in Buildroot.

"With version 2.0, the source code has been cleanly split into an application-oriented user library and a time-critical stack driver."

Is the library's API also sufficiently different to warrant making it
powerlink2? It's difficult to evaluate for us since we don't have anything that makes use of it in buildroot...

Quoted 2 lines

This complicates the packaging but it help to refine the dependencies

helps

Quoted 2 lines

compared to openpowerlink v1 build system. (openpowerlink v1 require C++ only for the qt demo)

requires

Quoted 7 lines

The generic openpowerlink2 package provide all sources files and patches which are then used by other openpowerlink2-* packages (sub-packages).
Doing this avoids patches duplication over all sub-packages.

All patches fixes several issues with the cmake build system.

fix

What's the upstream status of these patches?

Quoted 2 lines

For each sub-packages, the extract hook create a symlink to the

creates

Quoted 2 lines

sources and the path to the cmake project is provided by *_SUBDIR value.

Ouch, I really really don't like that. I'd much prefer to re-extract it from
the same source for each individual package - a bit like what we do with gcc. The patches can be symlinked or applied with a hook (like is done for gcc).

Quoted 2 lines

There is one project for the EPL stack libraries wich provides:

Perhaps explain what EPL is.

Quoted 5 lines

* an user space EPL stack to be linked into application
* an user space EPL stack pcap daemon
* an kernel space EPL library interface

There is two projects for EPL network driver:

are the

Quoted 4 lines

* pcap daemon driver
* kernel module driver.

Note: On x86/x86_64 only few EPL ethernet driver are available for

a drivers

Quoted 8 lines

the EPL kernel stack implementation:
* Intel 82573
* Intel 8255x
* Intel I210
* Realtek RTL-8111/8168 (new since V2.1.0)
* Realtek RTL-8139

There are one project for each demo applications:

is application

Quoted 9 lines

* demo_cn_embedded
* demo_mn_embedded
* demo_cn_console
* demo_mn_console
* demo_mn_qt

Only demo_mn_console will be packaged in Buildroot for now.

This patch add the package for the stack libraries.

adds

This patch actually does two things: it adds the overall openpowerlink
infrastructure, and it adds the stack libraries. So it should be split into two
patches: one which adds the openpowerlink2 package, and one which adds the openpowerlink2-stack package.

Also, the policy is not to create more subdirectories. So openpowerlink2-stack
should appear directly under packages/.

Quoted 3 lines

[1] http://sourceforge.net/p/openpowerlink/discussion/newbie/thread/3f13af65/

[snip]

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 6

Quoted 12 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +6 -0
new file mode 100644
index 0000000..16602ac
@@ -0,0 +1,116 @@
+From 545fc1d84a224093f7f79b5193aa3f7308f86b3a Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Wed, 17 Sep 2014 13:45:19 +0200
+Subject: [PATCH] [FIX] Don't link demos with Debug and Release libraries
+
+This is acutualy used by Visual Studio:

actually

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 13

Quoted 7 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +7 -0
+
+"When you create a Visual Studio Solution on Windows by CMake,
+the solution contains both Release and Debug build configurations.
+You can switch between them in Visual Studio.
+Therefore, you need both release and debug libraries."
+
+This patch break the build for Windows.

I don't by that.

Yes, you'll need to build both Release and Debug libraries. But you need to
link with only one of them.

But in fact, that's exactly what TARGET_LINK_LIBRARIES does [1] - the libraries
after 'optimized' will be used in all configurations except Debug, and the target after 'debug' will be used in the Debug configuration. So this patch is doing what CMake should already do according to the documentation... However, it turns out that CMake checks if ${OPLKLIB_DEBUG} exists even if we don't need it because we're not in a Debug configuration.

So, I think this patch should be acceptable upstream with an adapted commit
message:

[FIX] Don't link demos with Debug and Release libraries

TARGET_LINK_LIBRARIES() will link only with the 'debug' libraries in debug mode and only with the 'optimized' libraries in any other mode, but CMake still checks if the libraries that you don't link with exist. That makes it impossible to release just an optimized library without debug library [1].

Therefore, this patch provides an alternative way to distinguish between debug and optimized, with an explicit condition.

[1] http://sourceforge.net/p/openpowerlink/discussion/newbie/thread/3f13af65/

Quoted 10 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +10 -0
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ apps/demo_cn_console/CMakeLists.txt  |    6 +++++-
+ apps/demo_cn_embedded/CMakeLists.txt |    6 +++++-
+ apps/demo_mn_console/CMakeLists.txt  |    6 +++++-
+ apps/demo_mn_embedded/CMakeLists.txt |    6 +++++-
+ apps/demo_mn_qt/CMakeLists.txt       |    6 +++++-
+ 5 files changed, 25 insertions(+), 5 deletions(-)
+

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 33

Quoted 10 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +10 -0
+diff --git a/apps/demo_cn_console/CMakeLists.txt b/apps/demo_cn_console/CMakeLists.txt
+index 2ba2bbd..4051bc8 100644
+--- a/apps/demo_cn_console/CMakeLists.txt
++++ b/apps/demo_cn_console/CMakeLists.txt
+@@ -105,8 +105,12 @@ SET_PROPERTY(TARGET demo_cn_console
+ 
+ ################################################################################
+ # Libraries to link
++IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
++    TARGET_LINK_LIBRARIES(demo_cn_console debug ${OPLKLIB_DEBUG})

The 'debug' part is now redundant.

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 34

Quoted 1 line
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +1 -0
++ELSE ()

The coding style seems to be not to insert a space here.

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 35

Quoted 1 line
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +1 -0
++    TARGET_LINK_LIBRARIES(demo_cn_console optimized ${OPLKLIB})

And here the optimized part.

Quoted 2 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +2 -0
++ENDIF()
+ 

[snip]

package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch line 7

Quoted 13 lines
package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch new file +7 -0
new file mode 100644
index 0000000..9d68288
@@ -0,0 +1,108 @@
+From e322ca01613f6a51f1465711c2f890a372053a30 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Fri, 1 May 2015 12:19:34 +0200
+Subject: [PATCH] [FIX] install the stack libraries to "lib" subdirectory
+
+Using '.' to install the stack libraries is not correct since
+it will install them to /usr/ when CMAKE_INSTALL_PREFIX is set

CMAKE_INSTALL_PREFIX isn't needed here, CMake will add that automatically.

package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch line 12

Quoted 5 lines
package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch new file +5 -0
+to "/usr/".
+
+ls /usr/liboplkmnapp-kernelintf.so
+
+Fix this by using ${CMAKE_INSTALL_PREFIX}/lib instead of '.'

I guess there must be a reason why upstream does this crazy sh*t, so probably
this patch will be harder for them to accept...

[snip]

package/openpowerlink2/Config.in line 3

Quoted 9 lines
package/openpowerlink2/Config.in new file +3 -0
new file mode 100644
index 0000000..8e61a7d
@@ -0,0 +1,46 @@
+comment "openpowerlink2 needs a toolchain w/ threads"
+	depends on BR2_i386 || BR2_x86_64
+	depends on !BR2_TOOLCHAIN_HAS_THREADS

Did you test with uClibc and/or musl?

Quoted 6 lines
package/openpowerlink2/Config.in new file +6 -0
+
+menuconfig BR2_PACKAGE_OPENPOWERLINK2
+	bool "openpowerlink2"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_i386 || BR2_x86_64
+	help

package/openpowerlink2/Config.in line 19

Quoted 10 lines
package/openpowerlink2/Config.in new file +10 -0
+	  openPOWERLINK2 is an Open Source Industrial Ethernet
+	  stack implementing the POWERLINK protocol for Managing Node
+	  (MN, POWERLINK Master) and Controlled Node (CN, POWERLINK Slave).
+
+	  It is provided by
+	  SYSTEC electronic (http://www.systec-electronic.com),
+	  B&R (http://www.br-automation.com) and
+	  Kalycito (http://www.kalycito.com).
+
+	  https://sourceforge.net/projects/openpowerlink/

This refers to http://openpowerlink.sourceforge.net/web/ as the website.

package/openpowerlink2/Config.in line 29

Quoted 10 lines
package/openpowerlink2/Config.in new file +10 -0
+
+if BR2_PACKAGE_OPENPOWERLINK2
+
+choice
+	prompt "Select MN/CN mode"
+
+	config BR2_PACKAGE_OPENPOWERLINK2_MN
+	bool "MN"
+	help
+	  Enable Managing Node mode

Perhaps add (Master) here.

Quoted 5 lines
package/openpowerlink2/Config.in new file +5 -0
+
+	config BR2_PACKAGE_OPENPOWERLINK2_CN
+	bool "CN"
+	help
+	  Enable Controlled Node mode

package/openpowerlink2/Config.in line 44

Quoted 10 lines
package/openpowerlink2/Config.in new file +10 -0
+
+endchoice
+
+source "package/openpowerlink2/openpowerlink2-stack/Config.in"
+
+config BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL
+	string "debug level for openpowerlink stack"
+	default "0xEC000000L"
+	help
+	  Debug level to be used for openPOWERLINK debugging functions.

Maybe slightly more explanation what the bits mean? At least you should explain
that it has to be a hex number starting with 0x and ending with L.

Why do you have this default?

Quoted 9 lines
package/openpowerlink2/Config.in new file +2 -0
+
+endif # BR2_PACKAGE_OPENPOWERLINK2
package/openpowerlink2/openpowerlink2-stack/Config.in new file +1 -0
new file mode 100644
index 0000000..c3ddf47
@@ -0,0 +1,34 @@
+

package/openpowerlink2/openpowerlink2-stack/Config.in line 11

Quoted 10 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +10 -0
+choice
+	prompt "Select openPOWERLINK library type"
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB
+	bool "the EPL stack is directly linked into application."
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  Compile a monolithic openPOWERLINK library. The library contains
+	  an Ethernet driver which is using the PCAP library for accessing
+	  the network.

Add "No kernel-side driver is needed."

Or actually, replace driver with stack everywhere.

package/openpowerlink2/openpowerlink2-stack/Config.in line 18

Quoted 7 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +7 -0
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
+	bool "build EPL stack as linux userspace pcap daemon."
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  Compile openPOWERLINK application library which contains the
+	  interface to a Linux user space driver, and the Linux user space

I wouldn't call it driver, and there's no need to mention Linux so often.

package/openpowerlink2/openpowerlink2-stack/Config.in line 20

Quoted 2 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +2 -0
+	  driver. It is used for implementing a multi-process solution
+	  where the openPOWERLINK kernel layer is running as a separate

This 'kernel' is confusing, so just remove it.

package/openpowerlink2/openpowerlink2-stack/Config.in line 21

Quoted 1 line
package/openpowerlink2/openpowerlink2-stack/Config.in new file +1 -0
+	  Linux user space daemon (e.g. a PCAP based user space daemon).

e.g. -> i.e.

And add "No kernel-side stack is needed."

package/openpowerlink2/openpowerlink2-stack/Config.in line 29

Quoted 8 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +8 -0
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB
+	bool "build EPL stack as linux kernelspace module."
+	depends on BR2_LINUX_KERNEL # openpowerlink-kernel-driver
+	help
+	  Compile openPOWERLINK application library which contains the
+	  interface to a Linux kernel space driver. It is used together
+	  with a Linux kernel module openPOWERLINK driver.

It is used together with -> This will also build and install

Also mention the name of that module.

Quoted 19 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +5 -0
+
+comment "openpowerlink kernel stack needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
+
+endchoice
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +8 -0
new file mode 100644
index 0000000..9fa2d63
@@ -0,0 +1,69 @@
+################################################################################
+#
+# openpowerlink2-stack
+#
+################################################################################
+
+OPENPOWERLINK2_STACK_VERSION = $(OPENPOWERLINK2_VERSION)
+

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 18

Quoted 10 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +10 -0
+OPENPOWERLINK2_STACK_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_STACK_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_STACK_SOURCE =
+OPENPOWERLINK2_STACK_DEPENDENCIES = openpowerlink2
+
+define OPENPOWERLINK2_STACK_SYMLINK_TO_SRC_HOOK
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_STACK_DIR)/src
+endef

So here you can use the global _SOURCE and _SITE, and change this into

in the global .mk file:

define OPENPOWERLINK2_EXTRACT_CMDS

	$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
		$(TAR) -C $($(PKG)_DIR) $(TAR_OPTIONS) - $($(PKG)_TAR_OPTIONS)

endef

and in openpowerlink2-stack.mk:

OPENPOWERLINK2_STACK_EXTRACT_TAR_OPTIONS = src OPENPOWERLINK2_STACK_EXTRACT_CMDS = $(OPENPOWERLINK2_EXTRACT_CMDS)

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 26

Quoted 8 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +8 -0
+
+OPENPOWERLINK2_STACK_POST_EXTRACT_HOOKS += OPENPOWERLINK2_STACK_SYMLINK_TO_SRC_HOOK
+
+OPENPOWERLINK2_STACK_SUBDIR = src/stack
+
+OPENPOWERLINK2_STACK_INSTALL_STAGING = YES
+
+OPENPOWERLINK2_STACK_CONF_OPTS = -DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL))

Add "" around this. And split the long line.

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 28

Quoted 2 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +2 -0
+
+# All option are ON by default

So by default it would build the monolithic stack, the daemon, and the kernel
interface?

Quoted 22 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +22 -0
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK2_STACK_DEPENDENCIES += libpcap
+OPENPOWERLINK2_STACK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK2_STACK_DEPENDENCIES += libpcap
+OPENPOWERLINK2_STACK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF)

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 60

Quoted 10 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +10 -0
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK2_STACK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF

There is nothing here that refers to $(LINUX_DIR), so how is the module built?

Quoted 15 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +9 -0
+endif
+
+ifeq ($(BR2_STATIC_LIBS),y)
+OPENPOWERLINK2_STACK_CONF_OPTS += -DCFG_COMPILE_SHARED_LIBRARY=NO
+else
+OPENPOWERLINK2_STACK_CONF_OPTS += -DCFG_COMPILE_SHARED_LIBRARY=YES
+endif
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2.mk new file +0 -0
new file mode 100644
index 0000000..82c4277

package/openpowerlink2/openpowerlink2.mk line 9

Quoted 9 lines
package/openpowerlink2/openpowerlink2.mk new file +9 -0
@@ -0,0 +1,17 @@
+################################################################################
+#
+# openpowerlink2
+#
+################################################################################
+
+OPENPOWERLINK2_VERSION = V2.1.1
+OPENPOWERLINK2_SITE = http://git.code.sf.net/p/openpowerlink/openPOWERLINK2
+OPENPOWERLINK2_SITE_METHOD = git

What's wrong with the tarball [2] ? It has the same contents. It is missing a
leading directory component but that's easily solved with custom extract commands.

In that case, of course, add a hash file.

Regards,
Arnout

package/openpowerlink2/openpowerlink2.mk line 17

Quoted 9 lines
package/openpowerlink2/openpowerlink2.mk new file +8 -0
+OPENPOWERLINK2_LICENSE = BSD-2c, GPLv2
+OPENPOWERLINK2_LICENSE_FILES = license.md
+
+# Just extract the archive
+
+$(eval $(generic-package))
+
+include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk

[1] http://www.cmake.org/cmake/help/v3.2/command/target_link_libraries.html
[2]
http://downloads.sourceforge.net/project/openpowerlink/openPOWERLINK/V2.1.1/openPOWERLINK-V2.1.1.tar.gz

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#7 lore raw

PATCH v2 1/3 package/openpowerlink2: new package

Hi Arnout,

Le 02/05/2015 16:53, Arnout Vandecappelle a ?crit :

Quoted 10 lines · Romain Naour
Quoted 5 lines

The openpowerlink2 package archive contains several cmake projects, and each of them must be packaged separately in Buildroot.

"With version 2.0, the source code has been cleanly split into an application-oriented user library and a time-critical stack driver."

Is the library's API also sufficiently different to warrant making it
powerlink2? It's difficult to evaluate for us since we don't have anything that makes use of it in buildroot...

No, it's a complete rewrite of the powerlink stack, so the API has changed.
Example: EPLApiInitialize() became oplk_init().
And some openpowerlink variable type has changed...

Quoted 22 lines
Quoted 3 lines

This complicates the packaging but it help to refine the dependencies

helps

Quoted 2 lines

compared to openpowerlink v1 build system. (openpowerlink v1 require C++ only for the qt demo)

requires

Quoted 7 lines

The generic openpowerlink2 package provide all sources files and patches which are then used by other openpowerlink2-* packages (sub-packages).
Doing this avoids patches duplication over all sub-packages.

All patches fixes several issues with the cmake build system.

fix

What's the upstream status of these patches?

Quoted 2 lines

For each sub-packages, the extract hook create a symlink to the

Quoted 8 lines

creates

Quoted 2 lines

sources and the path to the cmake project is provided by *_SUBDIR value.

Ouch, I really really don't like that. I'd much prefer to re-extract it from
the same source for each individual package - a bit like what we do with gcc. The patches can be symlinked or applied with a hook (like is done for gcc).

Ok, I'll try with a hook then. But it seems that the build system is not really sysroot aware, I'm expecting some build issue with the demo apps.

Quoted 5 lines
Quoted 3 lines

There is one project for the EPL stack libraries wich provides:

Perhaps explain what EPL is.

EPL means Ethernet PowerLink but it seems that upstream use opkl now.

Quoted 32 lines
Quoted 6 lines

* an user space EPL stack to be linked into application
* an user space EPL stack pcap daemon
* an kernel space EPL library interface

There is two projects for EPL network driver:

are the

Quoted 4 lines

* pcap daemon driver
* kernel module driver.

Note: On x86/x86_64 only few EPL ethernet driver are available for

a drivers

Quoted 8 lines

the EPL kernel stack implementation:
* Intel 82573
* Intel 8255x
* Intel I210
* Realtek RTL-8111/8168 (new since V2.1.0)
* Realtek RTL-8139

There are one project for each demo applications:

is application

Quoted 8 lines

* demo_cn_embedded
* demo_mn_embedded
* demo_cn_console
* demo_mn_console
* demo_mn_qt

Only demo_mn_console will be packaged in Buildroot for now.

Quoted 7 lines
Quoted 1 line

This patch add the package for the stack libraries.

adds

This patch actually does two things: it adds the overall openpowerlink
infrastructure, and it adds the stack libraries. So it should be split into two
patches: one which adds the openpowerlink2 package, and one which adds the openpowerlink2-stack package.

I'll try to merge openpowerlink2 and openpowerlink2-stack into the same Buildroot's package to simplify thanks to the apply-patch hook.

Quoted 3 lines

Also, the policy is not to create more subdirectories. So openpowerlink2-stack
should appear directly under packages/.

OK.

Quoted 32 lines
Quoted 4 lines

[1] http://sourceforge.net/p/openpowerlink/discussion/newbie/thread/3f13af65/

[snip]

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 6

Quoted 12 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +6 -0
new file mode 100644
index 0000000..16602ac
@@ -0,0 +1,116 @@
+From 545fc1d84a224093f7f79b5193aa3f7308f86b3a Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Wed, 17 Sep 2014 13:45:19 +0200
+Subject: [PATCH] [FIX] Don't link demos with Debug and Release libraries
+
+This is acutualy used by Visual Studio:

actually

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 13

Quoted 7 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +7 -0
+
+"When you create a Visual Studio Solution on Windows by CMake,
+the solution contains both Release and Debug build configurations.
+You can switch between them in Visual Studio.
+Therefore, you need both release and debug libraries."
+
+This patch break the build for Windows.

I don't by that.

Yes, you'll need to build both Release and Debug libraries. But you need to
link with only one of them.

Quoted 6 lines

But in fact, that's exactly what TARGET_LINK_LIBRARIES does [1] - the libraries
after 'optimized' will be used in all configurations except Debug, and the target after 'debug' will be used in the Debug configuration. So this patch is doing what CMake should already do according to the documentation... However, it turns out that CMake checks if ${OPLKLIB_DEBUG} exists even if we don't need it because we're not in a Debug configuration.

Since I reported this issue, a note has been added to the documentation:
doc/build-stack.md but the issue hasn't be fixed...

Quoted 11 lines

So, I think this patch should be acceptable upstream with an adapted commit
message:

[FIX] Don't link demos with Debug and Release libraries

TARGET_LINK_LIBRARIES() will link only with the 'debug' libraries in debug mode and only with the 'optimized' libraries in any other mode, but CMake still checks if the libraries that you don't link with exist. That makes it impossible to release just an optimized library without debug library [1].

Quoted 4 lines

Therefore, this patch provides an alternative way to distinguish between debug and optimized, with an explicit condition.

[1] http://sourceforge.net/p/openpowerlink/discussion/newbie/thread/3f13af65/

Thanks, commit log updated :)

Quoted 23 lines
Quoted 10 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +10 -0
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ apps/demo_cn_console/CMakeLists.txt  |    6 +++++-
+ apps/demo_cn_embedded/CMakeLists.txt |    6 +++++-
+ apps/demo_mn_console/CMakeLists.txt  |    6 +++++-
+ apps/demo_mn_embedded/CMakeLists.txt |    6 +++++-
+ apps/demo_mn_qt/CMakeLists.txt       |    6 +++++-
+ 5 files changed, 25 insertions(+), 5 deletions(-)
+

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 33

Quoted 10 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +10 -0
+diff --git a/apps/demo_cn_console/CMakeLists.txt b/apps/demo_cn_console/CMakeLists.txt
+index 2ba2bbd..4051bc8 100644
+--- a/apps/demo_cn_console/CMakeLists.txt
++++ b/apps/demo_cn_console/CMakeLists.txt
+@@ -105,8 +105,12 @@ SET_PROPERTY(TARGET demo_cn_console
+ 
+ ################################################################################
+ # Libraries to link
++IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
++    TARGET_LINK_LIBRARIES(demo_cn_console debug ${OPLKLIB_DEBUG})

The 'debug' part is now redundant.

Quoted 7 lines

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 34

Quoted 1 line
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +1 -0
++ELSE ()

The coding style seems to be not to insert a space here.

package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch line 35

Quoted 1 line
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +1 -0
++    TARGET_LINK_LIBRARIES(demo_cn_console optimized ${OPLKLIB})

And here the optimized part.

Yes indeed.

Quoted 31 lines
Quoted 3 lines
package/openpowerlink2/0002-FIX-Don-t-link-demos-with-Debug-and-Release-librarie.patch new file +2 -0
++ENDIF()
+ 

[snip]

package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch line 7

Quoted 13 lines
package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch new file +7 -0
new file mode 100644
index 0000000..9d68288
@@ -0,0 +1,108 @@
+From e322ca01613f6a51f1465711c2f890a372053a30 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Fri, 1 May 2015 12:19:34 +0200
+Subject: [PATCH] [FIX] install the stack libraries to "lib" subdirectory
+
+Using '.' to install the stack libraries is not correct since
+it will install them to /usr/ when CMAKE_INSTALL_PREFIX is set

CMAKE_INSTALL_PREFIX isn't needed here, CMake will add that automatically.

package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch line 12

Quoted 5 lines
package/openpowerlink2/0003-FIX-install-the-stack-libraries-to-lib-subdirectory.patch new file +5 -0
+to "/usr/".
+
+ls /usr/liboplkmnapp-kernelintf.so
+
+Fix this by using ${CMAKE_INSTALL_PREFIX}/lib instead of '.'

I guess there must be a reason why upstream does this crazy sh*t, so probably
this patch will be harder for them to accept...

[snip]

Quoted 11 lines

package/openpowerlink2/Config.in line 3

Quoted 9 lines
package/openpowerlink2/Config.in new file +3 -0
new file mode 100644
index 0000000..8e61a7d
@@ -0,0 +1,46 @@
+comment "openpowerlink2 needs a toolchain w/ threads"
+	depends on BR2_i386 || BR2_x86_64
+	depends on !BR2_TOOLCHAIN_HAS_THREADS

Did you test with uClibc and/or musl?

No, only with a glibc toolchain, you know my cs ia32 toolchain 2014.11 sgxx-glibc ;-)
Ok, I'll try just with a test build.

Quoted 11 lines
Quoted 11 lines
package/openpowerlink2/Config.in new file +10 -0
+
+menuconfig BR2_PACKAGE_OPENPOWERLINK2
+	bool "openpowerlink2"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_i386 || BR2_x86_64
+	help
+	  openPOWERLINK2 is an Open Source Industrial Ethernet
+	  stack implementing the POWERLINK protocol for Managing Node
+	  (MN, POWERLINK Master) and Controlled Node (CN, POWERLINK Slave).
+
Quoted 8 lines

package/openpowerlink2/Config.in line 19

Quoted 6 lines
package/openpowerlink2/Config.in new file +6 -0
+	  It is provided by
+	  SYSTEC electronic (http://www.systec-electronic.com),
+	  B&R (http://www.br-automation.com) and
+	  Kalycito (http://www.kalycito.com).
+
+	  https://sourceforge.net/projects/openpowerlink/

This refers to http://openpowerlink.sourceforge.net/web/ as the website.

Ok

Quoted 13 lines

package/openpowerlink2/Config.in line 29

Quoted 11 lines
package/openpowerlink2/Config.in new file +10 -0
+
+if BR2_PACKAGE_OPENPOWERLINK2
+
+choice
+	prompt "Select MN/CN mode"
+
+	config BR2_PACKAGE_OPENPOWERLINK2_MN
+	bool "MN"
+	help
+	  Enable Managing Node mode

Perhaps add (Master) here.

ok

Quoted 6 lines

package/openpowerlink2/Config.in line 34

Quoted 6 lines
package/openpowerlink2/Config.in new file +5 -0
+
+	config BR2_PACKAGE_OPENPOWERLINK2_CN
+	bool "CN"
+	help
+	  Enable Controlled Node mode

I also added (slave) here.

Quoted 14 lines

package/openpowerlink2/Config.in line 44

Quoted 10 lines
package/openpowerlink2/Config.in new file +10 -0
+
+endchoice
+
+source "package/openpowerlink2/openpowerlink2-stack/Config.in"
+
+config BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL
+	string "debug level for openpowerlink stack"
+	default "0xEC000000L"
+	help
+	  Debug level to be used for openPOWERLINK debugging functions.

Maybe slightly more explanation what the bits mean? At least you should explain
that it has to be a hex number starting with 0x and ending with L.

Quoted 1 line

Why do you have this default?

Well, it's the default value I found in stack/CMakeLists.txt.
I added a link to the header file where the bit field is defined (oplk/debug.h). I'm not sure that L is really necessary.

Quoted 23 lines
Quoted 10 lines
package/openpowerlink2/Config.in new file +2 -0
+
+endif # BR2_PACKAGE_OPENPOWERLINK2
package/openpowerlink2/openpowerlink2-stack/Config.in new file +1 -0
new file mode 100644
index 0000000..c3ddf47
@@ -0,0 +1,34 @@
+

package/openpowerlink2/openpowerlink2-stack/Config.in line 11

Quoted 10 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +10 -0
+choice
+	prompt "Select openPOWERLINK library type"
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB
+	bool "the EPL stack is directly linked into application."
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  Compile a monolithic openPOWERLINK library. The library contains
+	  an Ethernet driver which is using the PCAP library for accessing
+	  the network.

Add "No kernel-side driver is needed."

Quoted 1 line

Or actually, replace driver with stack everywhere.

They use "Linux user space driver" for PCAP Ethernet driver. I'm trying to follow to documentation found in build-stack.md. So, I want to avoid another terminology here.

Quoted 10 lines

package/openpowerlink2/openpowerlink2-stack/Config.in line 18

Quoted 8 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +7 -0
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB
+	bool "build EPL stack as linux userspace pcap daemon."
+	select BR2_PACKAGE_LIBPCAP
+	help
+	  Compile openPOWERLINK application library which contains the
+	  interface to a Linux user space driver, and the Linux user space

I wouldn't call it driver, and there's no need to mention Linux so often.

So, I may reword entirely the help text without borrowing the text from build-stack.md.

Quoted 80 lines

package/openpowerlink2/openpowerlink2-stack/Config.in line 20

Quoted 3 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +2 -0
+	  driver. It is used for implementing a multi-process solution
+	  where the openPOWERLINK kernel layer is running as a separate

This 'kernel' is confusing, so just remove it.

package/openpowerlink2/openpowerlink2-stack/Config.in line 21

Quoted 1 line
package/openpowerlink2/openpowerlink2-stack/Config.in new file +1 -0
+	  Linux user space daemon (e.g. a PCAP based user space daemon).

e.g. -> i.e.

And add "No kernel-side stack is needed."

package/openpowerlink2/openpowerlink2-stack/Config.in line 29

Quoted 8 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +8 -0
+
+config BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB
+	bool "build EPL stack as linux kernelspace module."
+	depends on BR2_LINUX_KERNEL # openpowerlink-kernel-driver
+	help
+	  Compile openPOWERLINK application library which contains the
+	  interface to a Linux kernel space driver. It is used together
+	  with a Linux kernel module openPOWERLINK driver.

It is used together with -> This will also build and install

Also mention the name of that module.

Quoted 19 lines
package/openpowerlink2/openpowerlink2-stack/Config.in new file +5 -0
+
+comment "openpowerlink kernel stack needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
+
+endchoice
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +8 -0
new file mode 100644
index 0000000..9fa2d63
@@ -0,0 +1,69 @@
+################################################################################
+#
+# openpowerlink2-stack
+#
+################################################################################
+
+OPENPOWERLINK2_STACK_VERSION = $(OPENPOWERLINK2_VERSION)
+

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 18

Quoted 10 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +10 -0
+OPENPOWERLINK2_STACK_LICENSE = $(OPENPOWERLINK2_LICENSE)
+OPENPOWERLINK2_STACK_LICENSE_FILES = $(OPENPOWERLINK2_LICENSE_FILES)
+
+# We want to use the same archive for all sub-packages.
+OPENPOWERLINK2_STACK_SOURCE =
+OPENPOWERLINK2_STACK_DEPENDENCIES = openpowerlink2
+
+define OPENPOWERLINK2_STACK_SYMLINK_TO_SRC_HOOK
+	ln -s $(OPENPOWERLINK2_DIR) $(OPENPOWERLINK2_STACK_DIR)/src
+endef

So here you can use the global _SOURCE and _SITE, and change this into

in the global .mk file:

define OPENPOWERLINK2_EXTRACT_CMDS

	$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
		$(TAR) -C $($(PKG)_DIR) $(TAR_OPTIONS) - $($(PKG)_TAR_OPTIONS)

endef

and in openpowerlink2-stack.mk:

OPENPOWERLINK2_STACK_EXTRACT_TAR_OPTIONS = src OPENPOWERLINK2_STACK_EXTRACT_CMDS = $(OPENPOWERLINK2_EXTRACT_CMDS)

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 26

Quoted 8 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +8 -0
+
+OPENPOWERLINK2_STACK_POST_EXTRACT_HOOKS += OPENPOWERLINK2_STACK_SYMLINK_TO_SRC_HOOK
+
+OPENPOWERLINK2_STACK_SUBDIR = src/stack
+
+OPENPOWERLINK2_STACK_INSTALL_STAGING = YES
+
+OPENPOWERLINK2_STACK_CONF_OPTS = -DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK2_DEBUG_LEVEL))

Add "" around this. And split the long line.

Quoted 5 lines

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 28

Quoted 2 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +2 -0
+
+# All option are ON by default

So by default it would build the monolithic stack, the daemon, and the kernel
interface?

Yes, all libraries are build since all options are ON in stack/cmake/options-linux.cmake.
But you can use only one of them at run time.
Also disabling monolithic stack and daemon remove the pcap dependency and disabling the kernel interface remove the linux dependency. Actually, I only use the kernel interface.

Quoted 27 lines
Quoted 27 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +26 -0
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK2_STACK_DEPENDENCIES += libpcap
+OPENPOWERLINK2_STACK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK2_STACK_DEPENDENCIES += libpcap
+OPENPOWERLINK2_STACK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF)
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK2_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK2_STACK_CONF_OPTS += \
+	-DCFG_COMPILE_LIB_MN=OFF \
+	-DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
Quoted 8 lines

package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk line 60

Quoted 6 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +6 -0
+	-DCFG_COMPILE_LIB_MNAPP_KERNELINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_MN),ON,OFF) \
+	-DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+	-DCFG_COMPILE_LIB_CN=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+	-DCFG_COMPILE_LIB_CNAPP_KERNELINTF=$(if $(BR2_PACKAGE_OPENPOWERLINK2_CN),ON,OFF) \
+	-DCFG_COMPILE_LIB_CNDRV_PCAP=OFF

There is nothing here that refers to $(LINUX_DIR), so how is the module built?

There is a separate cmake project to build the module. Here we only build a library interface to the kernel module. So there is no need to add $(LINUX_DIR) here.

Quoted 20 lines
Quoted 20 lines
package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk new file +9 -0
+endif
+
+ifeq ($(BR2_STATIC_LIBS),y)
+OPENPOWERLINK2_STACK_CONF_OPTS += -DCFG_COMPILE_SHARED_LIBRARY=NO
+else
+OPENPOWERLINK2_STACK_CONF_OPTS += -DCFG_COMPILE_SHARED_LIBRARY=YES
+endif
+
+$(eval $(cmake-package))
package/openpowerlink2/openpowerlink2.mk new file +4 -0
new file mode 100644
index 0000000..82c4277
@@ -0,0 +1,17 @@
+################################################################################
+#
+# openpowerlink2
+#
Quoted 8 lines

package/openpowerlink2/openpowerlink2.mk line 9

Quoted 5 lines
package/openpowerlink2/openpowerlink2.mk new file +5 -0
+################################################################################
+
+OPENPOWERLINK2_VERSION = V2.1.1
+OPENPOWERLINK2_SITE = http://git.code.sf.net/p/openpowerlink/openPOWERLINK2
+OPENPOWERLINK2_SITE_METHOD = git

What's wrong with the tarball [2] ? It has the same contents. It is missing a
leading directory component but that's easily solved with custom extract commands.

In the past, I had an issue with the zip archive:
http://git.buildroot.net/buildroot/commit/?id=8dda4eb3bd65fdf9eff0422e0e974e0a1d012015
This is why the git repository was used...
Ok I'll try to use the tar.gz archive.

Quoted 2 lines

In that case, of course, add a hash file.

Sure.

Thanks for your review.

Best regards,
Romain

Quoted 19 lines

Regards,
Arnout

package/openpowerlink2/openpowerlink2.mk line 17

Quoted 9 lines
package/openpowerlink2/openpowerlink2.mk new file +8 -0
+OPENPOWERLINK2_LICENSE = BSD-2c, GPLv2
+OPENPOWERLINK2_LICENSE_FILES = license.md
+
+# Just extract the archive
+
+$(eval $(generic-package))
+
+include package/openpowerlink2/openpowerlink2-stack/openpowerlink2-stack.mk

[1] http://www.cmake.org/cmake/help/v3.2/command/target_link_libraries.html
[2]
http://downloads.sourceforge.net/project/openpowerlink/openPOWERLINK/V2.1.1/openPOWERLINK-V2.1.1.tar.gz

#8 lore raw

PATCH v2 1/3 package/openpowerlink2: new package

In reply to Arnout Vandecappelle

Hi Arnout,

I'm working on the v2 but I have an issue when all sub-package are in package/.

When I use $(OPENPOWERLINK2_VERSION) to share the same version, it is empty:
OPENPOWERLINK2_KERNEL_DRIVERS_VERSION = $(OPENPOWERLINK2_VERSION)

I think it's due to "include $(sort $(wildcard package/*/*.mk))" in the Buildroot's main Makefile.

So I moved again to openpowerlink2/ package directory and add this line at the end of openpowerlink2.mk:

include $(wildcard package/openpowerlink2/*/*.mk)

So, when we want to share the same variable to several packages, all *.mk of these packages needs to be included in a specific order.

Actually, I'm using the efl packaging as a reference.

I uploaded my working branch on github:
https://github.com/RomainNaour/buildroot/tree/eplv2

What do you think ?

Best regards,
Romain