[Buildroot] [PATCH V3] Adding support for NVME utils

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Thu Jan 14 09:04:35 UTC 2016


Hello,

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

On Thu, 14 Jan 2016 09:45:59 +0530, Mamatha Inamdar wrote:

> 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.


> 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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


More information about the buildroot mailing list