package/ndctl: new package
cover package/ndctl: new package
From: Chen Pei <[email protected]>
ndctl is a userspace utility for managing persistent memory (PMEM) and NVDIMM devices on Linux, enabling configuration and monitoring of namespaces, regions, and health status.
Adding ndctl to Buildroot allows embedded or server systems with PMEM hardware to manage persistent memory directly on the target device in a lightweight, self-contained manner.
Chen Pei (2):
package/ndctl: new package
DEVELOPERS: Add Chen Pei to ndctl
DEVELOPERS | 1 + package/Config.in | 1 + package/ndctl/Config.in | 21 +++++++++++++++++++++ package/ndctl/ndctl.hash | 3 +++ package/ndctl/ndctl.mk | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 package/ndctl/Config.in create mode 100644 package/ndctl/ndctl.hash create mode 100644 package/ndctl/ndctl.mk
Signature · 6 lines
2.50.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 package/ndctl: new package
From: Chen Pei <[email protected]>
A "device memory" enabling project encompassing tools and libraries for CXL, NVDIMMs, DAX, memory tiering and other platform memory device topics.
--- package/Config.in | 1 + package/ndctl/Config.in | 21 +++++++++++++++++++++ package/ndctl/ndctl.hash | 3 +++ package/ndctl/ndctl.mk | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 package/ndctl/Config.in create mode 100644 package/ndctl/ndctl.hash create mode 100644 package/ndctl/ndctl.mk
package/Config.in +1 -0
@@ -2867,6 +2867,7 @@ menu "System tools" source "package/monit/Config.in" source "package/multipath-tools/Config.in" source "package/ncdu/Config.in" + source "package/ndctl/Config.in" source "package/nerdctl/Config.in" source "package/netifrc/Config.in" source "package/numactl/Config.in"
package/ndctl/Config.in new file +21 -0
@@ -0,0 +1,21 @@ +config BR2_PACKAGE_NDCTL + bool "ndctl" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU + depends on BR2_LINUX_KERNEL + depends on BR2_PACKAGE_HAS_UDEV + select BR2_PACKAGE_KMOD + select BR2_PACKAGE_JSON_C + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_LIBS + select BR2_PACKAGE_UTIL_LINUX_LIBUUID + select BR2_PACKAGE_LIBTRACEEVENT + select BR2_PACKAGE_LIBTRACEFS + select BR2_PACKAGE_KEYUTILS + select BR2_PACKAGE_INIPARSER + help + A "device memory" enabling project encompassing tools and + libraries for CXL, NVDIMMs, DAX, memory tiering and other + platform memory device topics. + + https://github.com/pmem/ndctl
package/ndctl/ndctl.hash new file +3 -0
@@ -0,0 +1,3 @@ +# locally computed +sha256 dd4b9b9a9dc0a15e980670b6f889e910a80ad60f2309e03bfd9cc6071d14dd30 ndctl-83.tar.gz +sha256 1334f22048052d69647860fe9fb24997dc3b33737cb494297d68949f589fa1cf COPYING
package/ndctl/ndctl.mk new file +34 -0
@@ -0,0 +1,34 @@ +################################################################################ +# +# ndctl +# +################################################################################ + +NDCTL_VERSION = 83 +NDCTL_SITE = $(call github,pmem,ndctl,v$(NDCTL_VERSION)) +NDCTL_LICENSE = LGPL-2.1+, GPL-2.0+ +NDCTL_LICENSE_FILES = COPYING + +NDCTL_DEPENDENCIES = \ + host-meson \ + host-ninja \ + util-linux-libs \ + kmod \ + json-c \ + libtraceevent \ + libtracefs \ + keyutils \ + iniparser + +NDCTL_CONF_OPTS = \ + -Ddocs=disabled \ + -Diniparserdir=$(TARGET_DIR)/usr/include/iniparser + +ifeq ($(BR2_PACKAGE_SYSTEMD),y) +NDCTL_CONF_OPTS += -Dsystemd=enabled +NDCTL_DEPENDENCIES += systemd +else +NDCTL_CONF_OPTS += -Dsystemd=disabled +endif + +$(eval $(meson-package))
Signature · 6 lines
2.50.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Pei,
Thanks for the patch. I have few comments, see below.
Quoted 8 lines · On 06/03/2026 04:44, [email protected] wrote:
From: Chen Pei <[email protected]>
A "device memory" enabling project encompassing tools and libraries for CXL, NVDIMMs, DAX, memory tiering and other platform memory device topics.
Signed-off-by Chen Pei <[email protected]>---
[...]
package/ndctl/Config.in line 5
Quoted 11 lines
package/ndctl/Config.in new file +5
-0@@ -0,0 +1,21 @@ +config BR2_PACKAGE_NDCTL + bool "ndctl" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU + depends on BR2_LINUX_KERNEL
This "depends on BR2_LINUX_KERNEL" is not needed. It can be removed. ndctl can compile without the kernel being selected. The kernel-headers are in the toolchain.
package/ndctl/Config.in line 6
Quoted 1 line
package/ndctl/Config.in new file +1
-0+ depends on BR2_PACKAGE_HAS_UDEV
There is possibly a missing "depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_..." here.
ndctl cxl/fwctl is using __struct_group(). See:
https://github.com/pmem/ndctl/blob/v83/cxl/fwctl/features.h#L108
This macro was introduced in Kernel 5.16 in:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?&id=50d7bd38c3aafc4749e05e8d7fcb616979143602
So this cannot compile with toolchains with older kernel headers. When using the Arm external toolchain, compilation fails with error:
In file included from ../test/fwctl.c:17:../cxl/fwctl/features.h:108:9: error: expected specifier-qualifier-list before ‘__struct_group’
The fwctl support is a ndctl meson option, but disabling it breaks at configuration time. You could probably propose a fix upstream for that (fixing ndctl when configured with -Dtest=enabled and -Dfwctl=disabled).
Or you can always pass -Dfwctl=enabled in Buildroot, and add this kernel header requirement. See the kmemd package for example:
https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/kmemd/Config.in
package/ndctl/Config.in line 13
Quoted 7 lines
package/ndctl/Config.in new file +7
-0+ select BR2_PACKAGE_KMOD + select BR2_PACKAGE_JSON_C + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_LIBS + select BR2_PACKAGE_UTIL_LINUX_LIBUUID + select BR2_PACKAGE_LIBTRACEEVENT + select BR2_PACKAGE_LIBTRACEFS
libtracefs seems to be an optional dependency. See:
https://github.com/pmem/ndctl/blob/v83/meson_options.txt#L5
In Buildroot, we try to keep package dependencies minimal. So, unless there is a good reason to always enable it in Buildroot (e.g. upstream support incomplete or broken), this should be kept optional. So those "select BR2_PACKAGE_..." should be removed, and the optional dependency should go in ndctl.mk (like you did for systemd). For example:
ifeq ($(BR2_PACKAGE_TRACEFS)$(BR2_PACKAGE_TRACEEVENT),yy) NDCTL_CONF_OPTS += -Dlibtracefs=enabled NDCTL_DEPENDENCIES += libtraceevent libtracefs elseNDCTL_CONF_OPTS += -Dlibtracefs=disabled
endif
package/ndctl/Config.in line 14
Quoted 1 line
package/ndctl/Config.in new file +1
-0+ select BR2_PACKAGE_KEYUTILS
The keyutils is optional:
https://github.com/pmem/ndctl/blob/v83/meson_options.txt#L7
Again, trying to build with -Dkeyutils=disabled fails with error:
../ndctl/dimm.c:1030:16: error: too many arguments to function ‘ndctl_dimm_remove_key’; expected 1, have 2
Ideally, this should be fixed upstream to keep it optional in Buildroot.
If you decide to not fix it upstream, you can add a comment that building with keyutils support disabled is currently broken upstream. You can also add -Dkeyutils=enabled in ndctl.mk to show it is always enabled.
package/ndctl/Config.in line 15
Quoted 1 line
package/ndctl/Config.in new file +1
-0+ select BR2_PACKAGE_INIPARSER
After those changes, could you sort all the remaining "select BR2_PACKAGE_" line alphabetically?
package/ndctl/Config.in line 21
Quoted 6 lines
package/ndctl/Config.in new file +6
-0+ help + A "device memory" enabling project encompassing tools and + libraries for CXL, NVDIMMs, DAX, memory tiering and other + platform memory device topics. + + https://github.com/pmem/ndctl
Since the package has specific "depends on" requirements, you should add here a Kconfig comment when they are not met. See for example:
https://gitlab.com/buildroot.org/buildroot/-/blob/2026.02/package/collectd/Config.in?ref_type=tags#L617
[...]
Quoted 6 lines
package/ndctl/ndctl.mk new file +0
-0
package/ndctl/ndctl.mk line 9
Quoted 9 lines
package/ndctl/ndctl.mk new file +9
-0@@ -0,0 +1,34 @@ +################################################################################ +# +# ndctl +# +################################################################################ + +NDCTL_VERSION = 83 +NDCTL_SITE = $(call github,pmem,ndctl,v$(NDCTL_VERSION)) +NDCTL_LICENSE = LGPL-2.1+, GPL-2.0+
Reading the file:
https://github.com/pmem/ndctl/blob/v83/COPYING
there is more details of components and extra licenses.
You could add those info in _LICENSE, for ex:
NDCTL_LICENSE = \ CC0-1.0 (helper routines), \ GPL-2.0+ (tools), \ LGPL-2.1+ (libraries), \ MIT (helper routines)
package/ndctl/ndctl.mk line 10
Quoted 1 line
package/ndctl/ndctl.mk new file +1
-0+NDCTL_LICENSE_FILES = COPYING
It would also be preferable to include the actual license files too:
NDCTL_LICENSE_FILES = \ COPYING \ LICENSES/other/CC0-1.0 \ LICENSES/other/MIT \ LICENSES/preferred/GPL-2.0 \ LICENSES/preferred/LGPL-2.1
and update the ndctl.hash accordingly.
package/ndctl/ndctl.mk line 14
Quoted 4 lines
package/ndctl/ndctl.mk new file +4
-0+ +NDCTL_DEPENDENCIES = \ + host-meson \ + host-ninja \
The host-meson and host-ninja can be removed. They are automatically added by the package infra in the last line "$(eval $(meson-package))"
package/ndctl/ndctl.mk line 19
Quoted 5 lines
package/ndctl/ndctl.mk new file +5
-0+ util-linux-libs \ + kmod \ + json-c \ + libtraceevent \ + libtracefs \
libtraceevent and libtracefs can be removed from here, and added in a conditional block to handle those as optional dependencies.
package/ndctl/ndctl.mk line 20
Quoted 1 line
package/ndctl/ndctl.mk new file +1
-0+ keyutils \
Same comment for keyutils (if you decide to fix it upstream).
package/ndctl/ndctl.mk line 21
Quoted 1 line
package/ndctl/ndctl.mk new file +1
-0+ iniparser
You miss a dependency to "udev" in this list. Without it, the configuration can fail depending the order.
Could you also sort the _DEPENDENCY list alphabetically please?
package/ndctl/ndctl.mk line 25
Quoted 4 lines
package/ndctl/ndctl.mk new file +4
-0+ +NDCTL_CONF_OPTS = \ + -Ddocs=disabled \ + -Diniparserdir=$(TARGET_DIR)/usr/include/iniparser
The compilation should not point to $(TARGET_DIR). You should use $(STAGING_DIR) instead.
Quoted 11 lines
package/ndctl/ndctl.mk new file +9
-1+ +ifeq ($(BR2_PACKAGE_SYSTEMD),y) +NDCTL_CONF_OPTS += -Dsystemd=enabled +NDCTL_DEPENDENCIES += systemd +else +NDCTL_CONF_OPTS += -Dsystemd=disabled +endif + +$(eval $(meson-package)) --2.50.1
After those changes, could you also check it passes the compilation tests with the command:
utils/test-pkg -a -p ndctl
and it also passes checks with the command:
utils/docker-run make check-package
Could you send an updated patch with those changes, please?
Best regards,
Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 208 lines · On Sat, 07 Mar 2026 13:46:56 +0100, [email protected] wrote:
Quoted 8 lines
From: Chen Pei <[email protected]>
A "device memory" enabling project encompassing tools and libraries for CXL, NVDIMMs, DAX, memory tiering and other platform memory device topics.
Signed-off-by Chen Pei <[email protected]>---
[...]
package/ndctl/Config.in line 5
Quoted 11 lines
package/ndctl/Config.in new file +5
-0@@ -0,0 +1,21 @@ +config BR2_PACKAGE_NDCTL + bool "ndctl" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU + depends on BR2_LINUX_KERNELThis "depends on
BR2_LINUX_KERNEL" is not needed. It can be removed. ndctl can compile without the kernel being selected. The kernel-headers are in the toolchain.package/ndctl/Config.in line 6
Quoted 1 line
package/ndctl/Config.in new file +1
-0+ depends on BR2_PACKAGE_HAS_UDEVThere is possibly a missing "depends on
BR2_TOOLCHAIN_HEADERS_AT_LEAST_..." here.ndctl cxl/fwctl is using
__struct_group(). See:
https://github.com/pmem/ndctl/blob/v83/cxl/fwctl/features.h#L108This macro was introduced in Kernel 5.16 in:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?&id=50d7bd38c3aafc4749e05e8d7fcb616979143602So this cannot compile with toolchains with older kernel headers. When using the Arm external toolchain, compilation fails with error:
In file included from
../test/fwctl.c:17:../cxl/fwctl/features.h:108:9: error: expected specifier-qualifier-list before ‘__struct_group’The fwctl support is a ndctl meson option, but disabling it breaks at configuration time. You could probably propose a fix upstream for that (fixing ndctl when configured with -Dtest=enabled and -Dfwctl=disabled).
Or you can always pass -Dfwctl=enabled in Buildroot, and add this kernel header requirement. See the kmemd package for example:
https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/kmemd/Config.inpackage/ndctl/Config.in line 13
Quoted 7 lines
package/ndctl/Config.in new file +7
-0+ select BR2_PACKAGE_KMOD + select BR2_PACKAGE_JSON_C + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_LIBS + select BR2_PACKAGE_UTIL_LINUX_LIBUUID + select BR2_PACKAGE_LIBTRACEEVENT + select BR2_PACKAGE_LIBTRACEFSlibtracefs seems to be an optional dependency. See:
https://github.com/pmem/ndctl/blob/v83/meson_options.txt#L5In Buildroot, we try to keep package dependencies minimal. So, unless there is a good reason to always enable it in Buildroot (e.g. upstream support incomplete or broken), this should be kept optional. So those "select
BR2_PACKAGE_..." should be removed, and the optional dependency should go in ndctl.mk (like you did for systemd). For example:ifeq ($(BR2_PACKAGE_TRACEFS)$(BR2_PACKAGE_TRACEEVENT),yy)
NDCTL_CONF_OPTS+= -Dlibtracefs=enabledNDCTL_DEPENDENCIES+= libtraceevent libtracefs elseNDCTL_CONF_OPTS+= -Dlibtracefs=disabled
endifpackage/ndctl/Config.in line 14
Quoted 1 line
package/ndctl/Config.in new file +1
-0+ select BR2_PACKAGE_KEYUTILSThe keyutils is optional:
https://github.com/pmem/ndctl/blob/v83/meson_options.txt#L7Again, trying to build with -Dkeyutils=disabled fails with error:
../ndctl/dimm.c:1030:16: error: too many arguments to function ‘ndctl_dimm_remove_key’; expected 1, have 2Ideally, this should be fixed upstream to keep it optional in Buildroot.
If you decide to not fix it upstream, you can add a comment that building with keyutils support disabled is currently broken upstream. You can also add -Dkeyutils=enabled in ndctl.mk to show it is always enabled.
package/ndctl/Config.in line 15
Quoted 1 line
package/ndctl/Config.in new file +1
-0+ select BR2_PACKAGE_INIPARSERAfter those changes, could you sort all the remaining "select
BR2_PACKAGE_" line alphabetically?package/ndctl/Config.in line 21
Quoted 6 lines
package/ndctl/Config.in new file +6
-0+ help + A "device memory" enabling project encompassing tools and + libraries for CXL, NVDIMMs, DAX, memory tiering and other + platform memory device topics. + + https://github.com/pmem/ndctlSince the package has specific "depends on" requirements, you should add here a
Kconfigcomment when they are not met. See for example:
https://gitlab.com/buildroot.org/buildroot/-/blob/2026.02/package/collectd/Config.in?ref_type=tags#L617[...]
Quoted 6 lines
package/ndctl/ndctl.mk new file +0
-0package/ndctl/ndctl.mk line 9
Quoted 9 lines
package/ndctl/ndctl.mk new file +9
-0@@ -0,0 +1,34 @@ +################################################################################ +# +# ndctl +# +################################################################################ + +NDCTL_VERSION = 83 +NDCTL_SITE = $(call github,pmem,ndctl,v$(NDCTL_VERSION)) +NDCTL_LICENSE = LGPL-2.1+, GPL-2.0+Reading the file:
https://github.com/pmem/ndctl/blob/v83/COPYING
there is more details of components and extra licenses.You could add those info in
_LICENSE, for ex:
NDCTL_LICENSE= \
CC0-1.0 (helper routines), \
GPL-2.0+ (tools), \
LGPL-2.1+ (libraries), \
MIT (helper routines)package/ndctl/ndctl.mk line 10
Quoted 1 line
package/ndctl/ndctl.mk new file +1
-0+NDCTL_LICENSE_FILES = COPYINGIt would also be preferable to include the actual license files too:
NDCTL_LICENSE_FILES= \
COPYING \LICENSES/other/CC0-1.0\LICENSES/other/MIT\LICENSES/preferred/GPL-2.0\LICENSES/preferred/LGPL-2.1and update the ndctl.hash accordingly.
package/ndctl/ndctl.mk line 14
Quoted 4 lines
package/ndctl/ndctl.mk new file +4
-0+ +NDCTL_DEPENDENCIES = \ + host-meson \ + host-ninja \The host-meson and host-ninja can be removed. They are automatically added by the package infra in the last line "$(eval $(meson-package))"
package/ndctl/ndctl.mk line 19
Quoted 5 lines
package/ndctl/ndctl.mk new file +5
-0+ util-linux-libs \ + kmod \ + json-c \ + libtraceevent \ + libtracefs \libtraceevent and libtracefs can be removed from here, and added in a conditional block to handle those as optional dependencies.
package/ndctl/ndctl.mk line 20
Quoted 1 line
package/ndctl/ndctl.mk new file +1
-0+ keyutils \Same comment for keyutils (if you decide to fix it upstream).
package/ndctl/ndctl.mk line 21
Quoted 1 line
package/ndctl/ndctl.mk new file +1
-0+ iniparserYou miss a dependency to "udev" in this list. Without it, the configuration can fail depending the order.
Could you also sort the
_DEPENDENCYlist alphabetically please?package/ndctl/ndctl.mk line 25
Quoted 4 lines
package/ndctl/ndctl.mk new file +4
-0+ +NDCTL_CONF_OPTS = \ + -Ddocs=disabled \ + -Diniparserdir=$(TARGET_DIR)/usr/include/iniparserThe compilation should not point to $(TARGET_DIR). You should use $(STAGING_DIR) instead.
Quoted 11 lines
package/ndctl/ndctl.mk new file +9
-1+ +ifeq ($(BR2_PACKAGE_SYSTEMD),y) +NDCTL_CONF_OPTS += -Dsystemd=enabled +NDCTL_DEPENDENCIES += systemd +else +NDCTL_CONF_OPTS += -Dsystemd=disabled +endif + +$(eval $(meson-package)) --2.50.1
After those changes, could you also check it passes the compilation tests with the command:
utils/test-pkg -a -p ndctl
Quoted 2 lines
and it also passes checks with the command:
utils/docker-run make check-package
Hi, Julien,
Thank you for your very detailed review. I will revise according to your feedback.
Thanks,
Pei
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 DEVELOPERS: Add Chen Pei to ndctl
In reply to [email protected]From: Chen Pei <[email protected]>
--- DEVELOPERS | 1 + 1 file changed, 1 insertion(+)
DEVELOPERS +1 -0
@@ -604,6 +604,7 @@ F: package/qoriq-cadence-dp-firmware/ N: Chen Pei <[email protected]> F: package/iniparser/ +F: package/ndctl/ N: Chris Packham <[email protected]> F: package/coremark/
Signature · 6 lines
2.50.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot