Skip to contentSkip to conversation

Adding support for NVME utils

PATCH Superseded Mamatha 2 participants 6 messages Jan 12, 2016 – Jan 14, 2016 1 message not in the archive

lore
Share & tools
lore

Mamatha

author
#0 lore raw

PATCH v3 1/1 Adding support for NVME utils

Add support for building NVME utility - a utility for interacting with standard NVM Express (optimized PCI Express SSD interface) devices.

---
 package/Config.in      |    1 +
 package/nvme/Config.in |    6 ++++++
 package/nvme/nvme.mk   |   23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100755 package/nvme/Config.in
 create mode 100755 package/nvme/nvme.mk
package/Config.in +1 -0
index e0c2e2a..014debd 100644
@@ -1399,6 +1399,7 @@ endif
 	source "package/openvmtools/Config.in"
 	source "package/polkit/Config.in"
 	source "package/powerpc-utils/Config.in"
+	source "package/nvme/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/procps-ng/Config.in"
 	source "package/psmisc/Config.in"
package/nvme/Config.in new file +6 -0
new file mode 100755
index 0000000..a3c8ada
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_NVME
+	bool "nvme"
+	help
+	  System utilities for standard NVME Express devices
+
+	  https://github.com/linux-nvme/nvme-cli
package/nvme/nvme.mk new file +23 -0
new file mode 100755
index 0000000..43bec67
@@ -0,0 +1,23 @@
+################################################################################
+#
+# nvme
+#
+################################################################################
+
+NVME_VERSION = 0.1
+NVME_SITE = https://github.com/linux-nvme/nvme-cli.git
+NVME_SITE_METHOD = git
+NVME_LICENSE = GPLv2
+NVME_LICENSE_FILES = COPYING
+
+define NVME_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		INCLUDEDIR="-I." all
+endef
+
+define NVME_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/nvme $(TARGET_DIR)/sbin/nvme
+endef
+
+$(eval $(generic-package))
+
#1 lore raw

PATCH v3 1/1 Adding support for NVME utils

Dear Mamatha,

Thanks for your contribution!

Quoted 2 lines · Mamatha

Add support for building NVME utility - a utility for interacting with standard NVM Express (optimized PCI Express SSD interface) devices.

For all patches on packages, we prefer to have the title of the commit comply with the following format:

<package>: <description>

So in your case, it should be:

nvme: new package

Quoted 1 line

Sorry if I'm not familiar with naming practices in your part of the world, but we require a full name (i.e first name + last name). Is Mamatha your full name ?

Quoted 13 lines
---
 package/Config.in      |    1 +
 package/nvme/Config.in |    6 ++++++
 package/nvme/nvme.mk   |   23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100755 package/nvme/Config.in
 create mode 100755 package/nvme/nvme.mk
package/Config.in +0 -0
index e0c2e2a..014debd 100644

package/Config.in endif · line 1402

Quoted 4 lines
package/Config.in +1 -0
@@ -1399,6 +1399,7 @@ endif
 	source "package/openvmtools/Config.in"
 	source "package/polkit/Config.in"
 	source "package/powerpc-utils/Config.in"
+	source "package/nvme/Config.in"

You should respect alphabetic ordering here when including nvme/Config.in. Also I believe this package better belongs to the "Hardware handling" menu rather than "System tools".

Quoted 21 lines
package/Config.in +0 -0
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/procps-ng/Config.in"
 	source "package/psmisc/Config.in"
package/nvme/Config.in new file +6 -0
new file mode 100755
index 0000000..a3c8ada
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_NVME
+	bool "nvme"
+	help
+	  System utilities for standard NVME Express devices
+
+	  https://github.com/linux-nvme/nvme-cli
package/nvme/nvme.mk new file +0 -0
new file mode 100755
index 0000000..43bec67

package/nvme/nvme.mk line 9

Quoted 9 lines
package/nvme/nvme.mk new file +9 -0
@@ -0,0 +1,23 @@
+################################################################################
+#
+# nvme
+#
+################################################################################
+
+NVME_VERSION = 0.1
+NVME_SITE = https://github.com/linux-nvme/nvme-cli.git
+NVME_SITE_METHOD = git

You should use the github helper. See also
https://buildroot.org/downloads/manual/manual.html#github-download-url.

package/nvme/nvme.mk line 10

Quoted 1 line
package/nvme/nvme.mk new file +1 -0
+NVME_LICENSE = GPLv2

The license is GPLv2+

package/nvme/nvme.mk line 15

Quoted 5 lines
package/nvme/nvme.mk new file +5 -0
+NVME_LICENSE_FILES = COPYING
+
+define NVME_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		INCLUDEDIR="-I." all

Why do you explicitly specify "all" here ? It is going to build the documentation, while if you leave it out, it will only build the first target, which is named "default" in nvme's Makefile, and it will only build the nvme binary.

Also, when calling $(MAKE), please pass $(TARGET_MAKE_ENV) in the environment:

	$(TARGET_MAKE_ENV) $(MAKE) ...

package/nvme/nvme.mk line 19

Quoted 4 lines
package/nvme/nvme.mk new file +4 -0
+endef
+
+define NVME_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/nvme $(TARGET_DIR)/sbin/nvme

Why you don't you use the install-bin target ? Like this:

	$(TARGET_MAKE_ENV) $(MAKE) -C (@D) DESTDIR=$(TARGET_DIR) install-bin

Also, could you add a hash file, as explained in
https://buildroot.org/downloads/manual/manual.html#adding-packages-hash ?

Could you rework your patch to take into account those comments and send an updated version ?

Thanks!

Thomas

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

PATCH v3 1/1 Adding support for NVME utils

Hi Thomas,

Thanks for reviewing the patch.

I have worked on all your comments,facing some issue while building nvme. Will check and send new version of patch soon.

Quoted 110 lines · Thomas Petazzoni

Dear Mamatha,

Thanks for your contribution!

Quoted 2 lines · Mamatha

Add support for building NVME utility - a utility for interacting with standard NVM Express (optimized PCI Express SSD interface) devices.

For all patches on packages, we prefer to have the title of the commit comply with the following format:

<package>: <description>

So in your case, it should be:

nvme: new package

Quoted 1 line

Sorry if I'm not familiar with naming practices in your part of the world, but we require a full name (i.e first name + last name). Is Mamatha your full name ?

Quoted 13 lines
---
  package/Config.in      |    1 +
  package/nvme/Config.in |    6 ++++++
  package/nvme/nvme.mk   |   23 +++++++++++++++++++++++
  3 files changed, 30 insertions(+)

create mode 100755 package/nvme/Config.in
create mode 100755 package/nvme/nvme.mk

package/Config.in +0 -0
index e0c2e2a..014debd 100644

package/Config.in endif · line 1402

Quoted 4 lines
package/Config.in +1 -0
@@ -1399,6 +1399,7 @@ endif
  	source "package/openvmtools/Config.in"
  	source "package/polkit/Config.in"
  	source "package/powerpc-utils/Config.in"
+	source "package/nvme/Config.in"

You should respect alphabetic ordering here when including nvme/Config.in. Also I believe this package better belongs to the "Hardware handling" menu rather than "System tools".

Quoted 21 lines
package/Config.in +0 -0
  if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
  	source "package/procps-ng/Config.in"
  	source "package/psmisc/Config.in"
package/nvme/Config.in new file +6 -0
new file mode 100755
index 0000000..a3c8ada
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_NVME
+	bool "nvme"
+	help
+	  System utilities for standard NVME Express devices
+
+	  https://github.com/linux-nvme/nvme-cli
package/nvme/nvme.mk new file +0 -0
new file mode 100755
index 0000000..43bec67

package/nvme/nvme.mk line 9

Quoted 9 lines
package/nvme/nvme.mk new file +9 -0
@@ -0,0 +1,23 @@
+################################################################################
+#
+# nvme
+#
+################################################################################
+
+NVME_VERSION = 0.1
+NVME_SITE = https://github.com/linux-nvme/nvme-cli.git
+NVME_SITE_METHOD = git

You should use the github helper. See also
https://buildroot.org/downloads/manual/manual.html#github-download-url.

package/nvme/nvme.mk line 10

Quoted 1 line
package/nvme/nvme.mk new file +1 -0
+NVME_LICENSE = GPLv2

The license is GPLv2+

package/nvme/nvme.mk line 15

Quoted 5 lines
package/nvme/nvme.mk new file +5 -0
+NVME_LICENSE_FILES = COPYING
+
+define NVME_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		INCLUDEDIR="-I." all

Why do you explicitly specify "all" here ? It is going to build the documentation, while if you leave it out, it will only build the first target, which is named "default" in nvme's Makefile, and it will only build the nvme binary.

Also, when calling $(MAKE), please pass $(TARGET_MAKE_ENV) in the environment:

	$(TARGET_MAKE_ENV) $(MAKE) ...

package/nvme/nvme.mk line 19

Quoted 4 lines
package/nvme/nvme.mk new file +4 -0
+endef
+
+define NVME_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/nvme $(TARGET_DIR)/sbin/nvme

Why you don't you use the install-bin target ? Like this:

	$(TARGET_MAKE_ENV) $(MAKE) -C (@D) DESTDIR=$(TARGET_DIR) install-bin

Also, could you add a hash file, as explained in
https://buildroot.org/downloads/manual/manual.html#adding-packages-hash ?

Could you rework your patch to take into account those comments and send an updated version ?

Thanks!

Thomas

#3 lore raw

PATCH v3 1/1 Adding support for NVME utils

Mamatha,

Quoted 1 line · Mamatha Inamdar

Thanks for reviewing the patch.

You're welcome, thanks for your contribution in the first place.

Quoted 1 line

I have worked on all your comments,facing some issue while building nvme.

Which issues?

Quoted 1 line

Will check and send new version of patch soon.

Thanks!

Thomas

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

PATCH v3 1/1 Adding support for NVME utils

In reply to a message not in the archive

Hello,

Please don't reply to me directly, always keep the list in Cc.

Quoted 5 lines · Mamatha Inamdar

I am facing two issues here.

1) NVME_VERSION = 0.1
If I update version as 0.1 and compile the build, It's unable to
build and following errors occur

You need to do:

NVME_VERSION = v0.2
NVME_SITE = $(call github,linux-nvme,nvme-cli,$(NVME_VERSION))

(and not define the NVME_SOURCE variable)

Note that I've changed the version from 0.1 to 0.2, since 0.2 is available, so you should use this one.

Quoted 6 lines

2) Second issue is...If I use the install-bin target Like this:

$(TARGET_MAKE_ENV) $(MAKE) -C (@D) DESTDIR=$(TARGET_DIR) install-bin

I don't see nvme tool installed in sbin/bin, but it works for the following install command

Because you also need to set PREFIX=/usr otherwise it gets installed in /usr/local.

A few other things:

*) You need to patch the Makefile to remove -m64 and -Werror otherwise
it won't build

*) You need to pass $(TARGET_CONFIGURE_OPTS) on the left hand side of
$(MAKE) rather than the right hand side so that the CFLAGS from $(TARGET_CONFIGURE_OPTS) don't override the ones defined in the Makefile. Without this, -std=gnu99 is no longer passed in the CFLAGS, and the package fails to build.

*) INCLUDEDIR="-I." becomes useless.

*) You need to pass LIBUDEV=1 to disable using the udev library. If
you don't do this, the Makefile looks on the host machine if libudev is installed to determine whether it should enable udev support or not, which is completely wrong since we're cross-compiling. Alternatively, you could optionally add libudev support if you want, but that's not mandatory.

*) Since the upstream project is named nvme-cli, I think the Buildroot
package should also be named nvme-cli.

All in all, I had a .mk file that looks like this:

NVME_VERSION = v0.2
NVME_SITE = $(call github,linux-nvme,nvme-cli,$(NVME_VERSION)) NVME_LICENSE = GPLv2
NVME_LICENSE_FILES = COPYING

# LIBUDEV=1 indicates that we don't want udev support define NVME_BUILD_CMDS

	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
		LIBUDEV=1 -C $(@D)

endef

define NVME_INSTALL_TARGET_CMDS

	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) \
		PREFIX=/usr install-bin

endef

$(eval $(generic-package))

Hope this helps,

Thomas

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

PATCH v3 1/1 Adding support for NVME utils

Thanks for the detailed explanation,
updated your comments and sent new version of Patch.

Thanks
Mamatha

Quoted 77 lines · Thomas Petazzoni

Hello,

Please don't reply to me directly, always keep the list in Cc.

Quoted 5 lines · Mamatha Inamdar

I am facing two issues here.

1) NVME_VERSION = 0.1
If I update version as 0.1 and compile the build, It's unable to
build and following errors occur

You need to do:

NVME_VERSION = v0.2
NVME_SITE = $(call github,linux-nvme,nvme-cli,$(NVME_VERSION))

(and not define the NVME_SOURCE variable)

Note that I've changed the version from 0.1 to 0.2, since 0.2 is available, so you should use this one.

Quoted 6 lines

2) Second issue is...If I use the install-bin target Like this:

$(TARGET_MAKE_ENV) $(MAKE) -C (@D) DESTDIR=$(TARGET_DIR) install-bin

I don't see nvme tool installed in sbin/bin, but it works for the following install command

Because you also need to set PREFIX=/usr otherwise it gets installed in /usr/local.

A few other things:

*) You need to patch the Makefile to remove -m64 and -Werror otherwise
it won't build

  *) You need to pass $(TARGET_CONFIGURE_OPTS) on the left hand side of
     $(MAKE) rather than the right hand side so that the CFLAGS from
     $(TARGET_CONFIGURE_OPTS) don't override the ones defined in the
     Makefile. Without this, -std=gnu99 is no longer passed in the CFLAGS,
     and the package fails to build.

*) INCLUDEDIR="-I." becomes useless.

*) You need to pass LIBUDEV=1 to disable using the udev library. If
you don't do this, the Makefile looks on the host machine if libudev is installed to determine whether it should enable udev support or not, which is completely wrong since we're cross-compiling. Alternatively, you could optionally add libudev support if you want, but that's not mandatory.

*) Since the upstream project is named nvme-cli, I think the Buildroot
package should also be named nvme-cli.

All in all, I had a .mk file that looks like this:

NVME_VERSION = v0.2
NVME_SITE = $(call github,linux-nvme,nvme-cli,$(NVME_VERSION)) NVME_LICENSE = GPLv2
NVME_LICENSE_FILES = COPYING

# LIBUDEV=1 indicates that we don't want udev support define NVME_BUILD_CMDS

	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
		LIBUDEV=1 -C $(@D)

endef

define NVME_INSTALL_TARGET_CMDS

	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) \
		PREFIX=/usr install-bin

endef

$(eval $(generic-package))

Hope this helps,

Thomas