Skip to contentSkip to conversation

nvme: Allow libudev support

PATCH New Samuel Mendoza-Jonas 2 participants 2 messages Apr 19, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvme: Allow libudev support

Commands like 'nvme list' require libudev but support for libudev is decided at compile time, and in buildroot this is hard disabled. Add a check for udev and if it is available build nvme with udev support.

---
v2: Use BR2_PACKAGE_HAS_UDEV and NVME_MAKE_OPTS instead of a new option as suggested by Thomas Petazzoni

 package/nvme/nvme.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/nvme/nvme.mk +7 -1
index 7c4bd8e..3571494 100755
@@ -8,11 +8,17 @@ NVME_VERSION = v0.3
 NVME_SITE = $(call github,linux-nvme,nvme-cli,$(NVME_VERSION))
 NVME_LICENSE = GPLv2+
 NVME_LICENSE_FILES = LICENSE
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+NVME_DEPENDENCIES += udev
+NVME_MAKE_OPTS = LIBUDEV=0
+else
+NVME_MAKE_OPTS = LIBUDEV=1
+endif
 
 # LIBUDEV=1 means that libudev is _disabled_
 define NVME_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
-		LIBUDEV=1 -C $(@D)
+		$(NVME_MAKE_OPTS) -C $(@D)
 endef
 
 define NVME_INSTALL_TARGET_CMDS
Signature · 1 line
2.8.0
#1 lore raw

PATCH v2 1/1 nvme: Allow libudev support

Hello,

Quoted 6 lines · Samuel Mendoza-Jonas

Commands like 'nvme list' require libudev but support for libudev is decided at compile time, and in buildroot this is hard disabled. Add a check for udev and if it is available build nvme with udev support.

I've applied, after doing a few changes (since below).

package/nvme/nvme.mk NVME_VERSION = v0.3 · line 10

Quoted 8 lines
package/nvme/nvme.mk +0 -0
index 7c4bd8e..3571494 100755
@@ -8,11 +8,17 @@ NVME_VERSION = v0.3
 NVME_SITE = $(call github,linux-nvme,nvme-cli,$(NVME_VERSION))
 NVME_LICENSE = GPLv2+
 NVME_LICENSE_FILES = LICENSE

I've added a comment here that insists on the fact that yes, LIBUDEV=0 enables udev support, while LIBUDEV=1 disables udev support, which is a bit counter-intuitive.

package/nvme/nvme.mk NVME_VERSION = v0.3 · line 13

Quoted 3 lines
package/nvme/nvme.mk +3 -0
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+NVME_DEPENDENCIES += udev
+NVME_MAKE_OPTS = LIBUDEV=0

I've changed to use += here

package/nvme/nvme.mk NVME_VERSION = v0.3 · line 15

Quoted 2 lines
package/nvme/nvme.mk +2 -0
+else
+NVME_MAKE_OPTS = LIBUDEV=1

and here, since it's a bit more future proof. It will avoid mistakes if someone adds NVME_MAKE_OPTS = <something> outside of the conditional block.

Thanks!

Thomas

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