From 19331dcf3ff6a6f4eda0721466821b56acaf256d Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Mon, 23 Jun 2025 19:52:58 +0200 Subject: [PATCH 1/5] feat: build p-net from binary library This allow us to build p-net from releases instead of source code which i useful for evaluation. --- .../p-net/p-net-eval_1.0.2.bb | 52 +++++++++++++++++++ .../p-net/p-net-samples_1.0.2.bb | 13 +++++ recipes-connectivity/p-net/p-net.bb | 45 ---------------- 3 files changed, 65 insertions(+), 45 deletions(-) create mode 100644 recipes-connectivity/p-net/p-net-eval_1.0.2.bb create mode 100644 recipes-connectivity/p-net/p-net-samples_1.0.2.bb delete mode 100644 recipes-connectivity/p-net/p-net.bb diff --git a/recipes-connectivity/p-net/p-net-eval_1.0.2.bb b/recipes-connectivity/p-net/p-net-eval_1.0.2.bb new file mode 100644 index 0000000..c6ffefd --- /dev/null +++ b/recipes-connectivity/p-net/p-net-eval_1.0.2.bb @@ -0,0 +1,52 @@ +SUMMARY = "P-Net Profinet communication stack" +HOMEPAGE = "https://github.com/rtlabs-com/p-net" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://include/pnet_api.h;beginline=1;endline=14;md5=9613aac56556c534a901f25038170285" +SECTION = "libs" +PROVIDES = "p-net" + +COMPATIBLE_HOST = "(x86_64|aarch64).*-linux" + +_SRC_CHECKSUM:x86-64 = "58f3e1e0a645bf3ca83232f2ec1d605d3fea7fbe114fe530ab2dc98ae3c950c5" +_SRC_CHECKSUM:aarch64 = "e1f928b5ec66e80c5b2a589fc42d8a1a371c70d5ebc0d53f63a5cec2a6860ad8" +_SRC_SUFFIX:x86-64 = "-Linux-x86_64" +_SRC_SUFFIX:aarch64 = "-Linux-aarch64" + +SRC_URI = "https://github.com/rtlabs-com/p-net/releases/download/public%2Fv${PV}/p-net-${PV}${_SRC_SUFFIX}.zip" +SRC_URI[sha256sum] = "${_SRC_CHECKSUM}" +S = "${WORKDIR}/p-net-${PV}${_SRC_SUFFIX}" + +INSANE_SKIP:${PN} = "ldflags" +INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_SYSROOT_STRIP = "1" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + +FILES:${PN}-dev += " \ + ${prefix}/cmake/*.cmake \ +" + +FILES:${PN} += " \ + ${prefix}/share/profinet \ +" + +SYSROOT_DIRS += "${prefix}/cmake" + +do_install () { + install -d ${D}${libdir} + install -m 0755 ${S}/lib/* ${D}${libdir} + + install -d ${D}${includedir} + install -m 0755 ${S}/include/*.h ${D}${includedir} + + install -d ${D}${includedir}/sys + install -m 0755 ${S}/include/sys/*.h ${D}${includedir}/sys + + install -d ${D}${bindir} + install -m 0755 ${S}/bin/* ${D}${bindir} + + install -d ${D}${prefix}/cmake + install -m 0755 ${S}/cmake/*.cmake ${D}${prefix}/cmake + + install -d ${D}${prefix}/share/profinet + install -m 0755 ${S}/share/profinet/* ${D}${prefix}/share/profinet +} diff --git a/recipes-connectivity/p-net/p-net-samples_1.0.2.bb b/recipes-connectivity/p-net/p-net-samples_1.0.2.bb new file mode 100644 index 0000000..1a03227 --- /dev/null +++ b/recipes-connectivity/p-net/p-net-samples_1.0.2.bb @@ -0,0 +1,13 @@ +SUMMARY = "P-Net Profinet communication stack - Samples" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://CMakeLists.txt;beginline=1;endline=14;md5=aa7e6f963fad674b02c35dc8e9aa5519" +SECTION = "console/network" + +DEPENDS = "p-net-eval" + +SRC_URI = "https://github.com/rtlabs-com/p-net/releases/download/public%2Fv${PV}/p-net-${PV}-samples.zip" +SRC_URI[sha256sum] = "8ce40738fa67bf04deb4f27938e6a70599526765ea6d8cf1a26b73395073d658" + +S = "${WORKDIR}/p-net-${PV}-samples" + +inherit pkgconfig cmake diff --git a/recipes-connectivity/p-net/p-net.bb b/recipes-connectivity/p-net/p-net.bb deleted file mode 100644 index 83f2a81..0000000 --- a/recipes-connectivity/p-net/p-net.bb +++ /dev/null @@ -1,45 +0,0 @@ -SUMMARY = "p-net Profinet communication stack" -HOMEPAGE = "https://github.com/rtlabs-com/p-net" -LICENSE = "GPLv3 | commercial" -LIC_FILES_CHKSUM = "file://LICENSE.md;md5=207cc6189ccb6e2be4f164397fc210ae" -SECTION = "console/network" - -SRC_URI = "git://github.com/rtlabs-com/p-net.git" -SRCREV = "089df76f38df13e4b8b58e12e5d1be6d3b9aa792" - -# Enable these lines if using Yocto older than version 2.7 -#DEPENDS = "cmake-zeus-native" -#DEPENDS_remove = "cmake-native" - -S = "${WORKDIR}/git" - -inherit cmake - -# TODO How to handle -DCMAKE_MAKE_PROGRAM better? -EXTRA_OECMAKE = "-DCMAKE_MAKE_PROGRAM=/usr/bin/make -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DUSE_SCHED_FIFO=ON" -OECMAKE_RPATH = "" -OECMAKE_GENERATOR = "Unix Makefiles" -SOLIBS = ".so" -FILES_SOLIBSDEV = "" -FILES_${PN} = "/usr/lib/libpro*" - -PACKAGE_BEFORE_PN = "${PN}-demo" -RDEPENDS_${PN}-demo = "${PN}" -FILES_${PN}-demo = "${bindir}/pn_dev" -FILES_${PN}-demo += "${bindir}/set_network_parameters" -FILES_${PN}-demo += "${bindir}/set_profinet_leds" -FILES_${PN}-demo += "${bindir}/set_profinet_leds.raspberrypi" - -do_configure_prepend() { - cd ${WORKDIR}/git - git submodule update --init --recursive -} - -do_install_append() { - install -d ${D}${bindir} - cp "${WORKDIR}/build/set_network_parameters" ${D}${bindir} - cp "${WORKDIR}/build/set_profinet_leds" ${D}${bindir} - cp "${WORKDIR}/build/set_profinet_leds.raspberrypi" ${D}${bindir} - - rm -rf ${D}/usr/cmake/ -} From eb7d329b5e34a9681591720882b21fcc22d823e3 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Tue, 24 Jun 2025 13:44:00 +0200 Subject: [PATCH 2/5] feat: add build of p-net from source if available --- recipes-connectivity/p-net/files/.gitignore | 1 + recipes-connectivity/p-net/files/README.md | 4 +++ recipes-connectivity/p-net/p-net-src_1.0.2.bb | 32 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 recipes-connectivity/p-net/files/.gitignore create mode 100644 recipes-connectivity/p-net/files/README.md create mode 100644 recipes-connectivity/p-net/p-net-src_1.0.2.bb diff --git a/recipes-connectivity/p-net/files/.gitignore b/recipes-connectivity/p-net/files/.gitignore new file mode 100644 index 0000000..61d8490 --- /dev/null +++ b/recipes-connectivity/p-net/files/.gitignore @@ -0,0 +1 @@ +p-net-sources-1.0.2.zip diff --git a/recipes-connectivity/p-net/files/README.md b/recipes-connectivity/p-net/files/README.md new file mode 100644 index 0000000..94c1f8e --- /dev/null +++ b/recipes-connectivity/p-net/files/README.md @@ -0,0 +1,4 @@ +# P-Net Yocto Files + +Place source code of p-net in `p-net-sources.zip` here +to build from a source dump. diff --git a/recipes-connectivity/p-net/p-net-src_1.0.2.bb b/recipes-connectivity/p-net/p-net-src_1.0.2.bb new file mode 100644 index 0000000..b620311 --- /dev/null +++ b/recipes-connectivity/p-net/p-net-src_1.0.2.bb @@ -0,0 +1,32 @@ +SUMMARY = "P-Net Profinet communication stack" +LICENSE = "LicenseRef-Proprietary" +LIC_FILES_CHKSUM = "file://CMakeLists.txt;beginline=1;endline=14;md5=aa7e6f963fad674b02c35dc8e9aa5519" +SECTION = "libs" +PROVIDES = "p-net" + +SRC_URI = "file://p-net-sources-1.0.2.zip" + +# Require activation to use the official stack +# since this requires available sources. +DEFAULT_PREFERENCE = "-1" + +S = "${WORKDIR}/p-net" + +FILES:${PN}-dev += " \ + ${prefix}/cmake/*.cmake \ +" + +FILES:${PN} += " \ + ${prefix}/share/profinet \ +" + +# We need network access to get Osal +EXTRA_OECMAKE += "-DFETCHCONTENT_FULLY_DISCONNECTED=OFF" +do_configure[network] = "1" + +# Disable the tests since build fail +# when cross compiling due to test discovery +# using GOOGLE_TEST_INDIVIDUAL +EXTRA_OECMAKE += "-DBUILD_TESTING=OFF" + +inherit pkgconfig cmake From c32814fa8ef1729b7241c1af098a41619d66ea50 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 26 Jun 2025 11:24:45 +0200 Subject: [PATCH 3/5] fix: ensure we prioritize evaluation version --- conf/layer.conf | 2 ++ .../p-net/{p-net-src_1.0.2.bb => p-net-commercial_1.0.2.bb} | 5 ----- .../p-net/{p-net-eval_1.0.2.bb => p-net-evaluation_1.0.2.bb} | 0 3 files changed, 2 insertions(+), 5 deletions(-) rename recipes-connectivity/p-net/{p-net-src_1.0.2.bb => p-net-commercial_1.0.2.bb} (85%) rename recipes-connectivity/p-net/{p-net-eval_1.0.2.bb => p-net-evaluation_1.0.2.bb} (100%) diff --git a/conf/layer.conf b/conf/layer.conf index 4d49e72..bd65cd0 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -8,3 +8,5 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ BBFILE_COLLECTIONS += "rtlabs" BBFILE_PATTERN_rtlabs = "^${LAYERDIR}/" BBFILE_PRIORITY_rtlabs = "6" + +PREFERRED_PROVIDER_p-net = "p-net-evaluation" diff --git a/recipes-connectivity/p-net/p-net-src_1.0.2.bb b/recipes-connectivity/p-net/p-net-commercial_1.0.2.bb similarity index 85% rename from recipes-connectivity/p-net/p-net-src_1.0.2.bb rename to recipes-connectivity/p-net/p-net-commercial_1.0.2.bb index b620311..fd1af4c 100644 --- a/recipes-connectivity/p-net/p-net-src_1.0.2.bb +++ b/recipes-connectivity/p-net/p-net-commercial_1.0.2.bb @@ -5,11 +5,6 @@ SECTION = "libs" PROVIDES = "p-net" SRC_URI = "file://p-net-sources-1.0.2.zip" - -# Require activation to use the official stack -# since this requires available sources. -DEFAULT_PREFERENCE = "-1" - S = "${WORKDIR}/p-net" FILES:${PN}-dev += " \ diff --git a/recipes-connectivity/p-net/p-net-eval_1.0.2.bb b/recipes-connectivity/p-net/p-net-evaluation_1.0.2.bb similarity index 100% rename from recipes-connectivity/p-net/p-net-eval_1.0.2.bb rename to recipes-connectivity/p-net/p-net-evaluation_1.0.2.bb From 419d7f219b27109bb6f9e82fc1f0d4b65832c966 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 26 Jun 2025 11:33:30 +0200 Subject: [PATCH 4/5] docs: update documentation for adjusted layer --- README.md | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 997ee27..acb9dd1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ meta-rtlabs Yocto layer ======================= + This Yocto layer contains a recipe to build p-net. The p-net stack is an open-source Profinet IO-device stack developed by @@ -9,9 +10,9 @@ license, please contact sales@rt-labs.com * p-net: [https://github.com/rtlabs-com/p-net](https://github.com/rtlabs-com/p-net) * rt-labs: [https://rt-labs.com](https://rt-labs.com) - Versions -======== +-------- + This layer is tested with Yocto version 2.4 ("rocko"), but should work with other Yocto versions. @@ -26,9 +27,9 @@ recent enough. Nowever this layer contains a recipe for updated cmake-native so it also can be used with older Yocto releases. In the future when we only support Yocto 2.7 or later, that recipe will be removed. - Dependencies -============ +------------ + This layer depends on: URI: git://git.openembedded.org/bitbake @@ -38,9 +39,9 @@ This layer depends on: layers: meta branch: master - Adding the rtlabs layer to your build -===================================== +------------------------------------- + In order to use this layer, you need to make the build system aware of it. @@ -58,5 +59,20 @@ other layers needed. e.g.: In order to use the recipes, add this to your image: -* *p-net* Adds libprofinet -* *p-net-demo* Adds libprofinet and the sample app +* *p-net* Adds libpnet +* *p-net-samples* Adds libpnet and the sample app + +Variants +-------- + +Two variants of the p-net recipe is added by this layer: + +* `Evaluation` (p-net-evaluation) +* `Production` (p-net-production) + +The `Evaluation` version uses publicly available precompiled binaries for the library +compiled in evaluation mode. + +The `Production` variant depends on a locally provided zip of the p-net sources. The +source package can be placed in the `recipes-connectivity/p-net/files` folder, or +a `bbappend` file can be used to provide the path to the source package. From af5c0bf5d779e0db3ed3f90df0e44b322aca8cb6 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Fri, 27 Jun 2025 08:47:27 +0200 Subject: [PATCH 5/5] fixup! feat: add build of p-net from source if available --- conf/layer.conf | 3 +++ licenses/LicenseRef-RT-Labs-Deployment-1.0 | 14 ++++++++++++++ .../p-net/p-net-commercial_1.0.2.bb | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 licenses/LicenseRef-RT-Labs-Deployment-1.0 diff --git a/conf/layer.conf b/conf/layer.conf index bd65cd0..c37aca9 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -10,3 +10,6 @@ BBFILE_PATTERN_rtlabs = "^${LAYERDIR}/" BBFILE_PRIORITY_rtlabs = "6" PREFERRED_PROVIDER_p-net = "p-net-evaluation" + +LICENSE_PATH += "${LAYERDIR}/licenses" +SPDXLICENSEMAP[LicenseRef-RT-Labs-Deployment-1.0] = "RT-Labs-Deployment-1.0" diff --git a/licenses/LicenseRef-RT-Labs-Deployment-1.0 b/licenses/LicenseRef-RT-Labs-Deployment-1.0 new file mode 100644 index 0000000..003c5e6 --- /dev/null +++ b/licenses/LicenseRef-RT-Labs-Deployment-1.0 @@ -0,0 +1,14 @@ +RT-Labs Deployment License 1.0 +============================== + +Deployment licenses grants you the right to produce up to a certain number of +units per year that includes one network stack from RT-Labs. A deployment +license can only be purchased if you have an ongoing or previously owned an +Essentials, Standard or Enterprise development plan for a communication stack. + +Deployment Licenses are purchased on a yearly basis and grants you the right to +produce up to the purchased license level during that year. If you produce more +units than your license grants, the cost will be added to the following year. + +RT-Labs will each year help you coordinate and balance the deployment license +level for the upcoming year. diff --git a/recipes-connectivity/p-net/p-net-commercial_1.0.2.bb b/recipes-connectivity/p-net/p-net-commercial_1.0.2.bb index fd1af4c..fc31031 100644 --- a/recipes-connectivity/p-net/p-net-commercial_1.0.2.bb +++ b/recipes-connectivity/p-net/p-net-commercial_1.0.2.bb @@ -1,5 +1,6 @@ SUMMARY = "P-Net Profinet communication stack" -LICENSE = "LicenseRef-Proprietary" +LICENSE = "LicenseRef-RT-Labs-Deployment-1.0" +LICENSE_FLAGS = "commercial" LIC_FILES_CHKSUM = "file://CMakeLists.txt;beginline=1;endline=14;md5=aa7e6f963fad674b02c35dc8e9aa5519" SECTION = "libs" PROVIDES = "p-net"