[dpdk-dev,7/7] mk: Add hierarchy-file support (linux mod)

Message ID 1442608390-12537-8-git-send-email-mario.alfredo.c.arevalo@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Mario Carrillo Sept. 18, 2015, 8:33 p.m. UTC
  Add hierarchy-file support to the DPDK modules for linux,
when invoking "make install H=1" (hierarchy-file)

This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

headers will be installed in: $(DESTDIR)/lib/modules

Signed-off-by: Mario Carrillo <mario.alfredo.c.arevalo@intel.com>
---
 mk/rte.module.mk     | 8 ++++++++
 mk/rte.sdkinstall.mk | 4 ++++
 2 files changed, 12 insertions(+)
  

Comments

Panu Matilainen Sept. 22, 2015, 6:56 a.m. UTC | #1
On 09/18/2015 11:33 PM, Mario Carrillo wrote:
> Add hierarchy-file support to the DPDK modules for linux,
> when invoking "make install H=1" (hierarchy-file)
>
> This hierarchy is based on:
> http://www.freedesktop.org/software/systemd/man/file-hierarchy.html
>
> headers will be installed in: $(DESTDIR)/lib/modules
>
> Signed-off-by: Mario Carrillo <mario.alfredo.c.arevalo@intel.com>
> ---
>   mk/rte.module.mk     | 8 ++++++++
>   mk/rte.sdkinstall.mk | 4 ++++
>   2 files changed, 12 insertions(+)
>
> diff --git a/mk/rte.module.mk b/mk/rte.module.mk
> index 7bf77c1..4fc43ba 100644
> --- a/mk/rte.module.mk
> +++ b/mk/rte.module.mk
> @@ -59,6 +59,14 @@ compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1)))
>
>   .PHONY: all
>   all: install
> +#
> +# if H (hierarchy-file) varible is equal "1"
> +# install modules in /lib/modules/$(KERNEL_DIR).
> +#
> +ifeq ($(H),1)
> +	@[ -d $(MOD_DIR)/$(KERNEL_DIR) ] || mkdir -p $(MOD_DIR)/$(KERNEL_DIR)
> +	$(Q)cp -f $(MODULE).ko $(MOD_DIR)/$(KERNEL_DIR)
> +endif
>
>   .PHONY: install
>   install: build _postinstall
> diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
> index b506959..5ddc3f7 100644
> --- a/mk/rte.sdkinstall.mk
> +++ b/mk/rte.sdkinstall.mk
> @@ -59,6 +59,8 @@ DATA_DIR := $(DESTDIR)/usr/share
>   INCLUDE_DIR := $(DESTDIR)/usr/include
>   SBIN_DIR := $(DESTDIR)/usr/sbin
>   BIN_DIR := $(DESTDIR)/usr/bin
> +MOD_DIR := $(DESTDIR)/lib/modules
> +KERNEL_DIR := $(shell uname -r)/extra

Please don't assume one is always building for the running kernel. 
Defaulting around uname -r is perfectly reasonable, but there needs to 
be a way to override it from the cli. For example rte.vars.mk has this:

# can be overriden by make command line or exported environment variable
RTE_KERNELDIR ?= /lib/modules/$(shell uname -r)/build

	- Panu -
  
Thomas Monjalon Nov. 27, 2015, 3:40 p.m. UTC | #2
2015-09-22 09:56, Panu Matilainen:
> On 09/18/2015 11:33 PM, Mario Carrillo wrote:
> > +MOD_DIR := $(DESTDIR)/lib/modules
> > +KERNEL_DIR := $(shell uname -r)/extra
> 
> Please don't assume one is always building for the running kernel. 
> Defaulting around uname -r is perfectly reasonable, but there needs to 
> be a way to override it from the cli. For example rte.vars.mk has this:
> 
> # can be overriden by make command line or exported environment variable
> RTE_KERNELDIR ?= /lib/modules/$(shell uname -r)/build

For info, the ?= operator is a way to give a default value after having
included other makefiles which may set a different value.
Both ?= and := (or simply =) are overriden by the command line.
Only "override VAR =" will not be overriden by the command line.
  
David Marchand Nov. 27, 2015, 4:20 p.m. UTC | #3
On Fri, Nov 27, 2015 at 5:01 PM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> As far as I know only "?=" assignment overridden by command line.
>
> Basic experiment:
>
> # cat Makefile
> A ?= a
> B := b
> C = c
>
> all:
>         @echo $(A) $(B) $(C)
>
> -----
>
> # make
> a b c
>
> # A=x B=x C=x make
> x b c
>

Those variables are passed through env, but if you give them to make.

$ make A=x B=x C=x
x x x
  
Bruce Richardson Nov. 27, 2015, 4:23 p.m. UTC | #4
On Fri, Nov 27, 2015 at 05:20:43PM +0100, David Marchand wrote:
> On Fri, Nov 27, 2015 at 5:01 PM, Ferruh Yigit <ferruh.yigit@intel.com>
> wrote:
> 
> > As far as I know only "?=" assignment overridden by command line.
> >
> > Basic experiment:
> >
> > # cat Makefile
> > A ?= a
> > B := b
> > C = c
> >
> > all:
> >         @echo $(A) $(B) $(C)
> >
> > -----
> >
> > # make
> > a b c
> >
> > # A=x B=x C=x make
> > x b c
> >
> 
> Those variables are passed through env, but if you give them to make.
> 
> $ make A=x B=x C=x
> x x x
> 
>
You just beat me to it! ?= can be overridden by either environment or cmdline, others
are overridden just by cmdline, which means they are passed to make, not to the
shell.

/Bruce
  
Mario Carrillo Nov. 27, 2015, 9:05 p.m. UTC | #5
Hi ferruh,

thank you for your comments in this serie of patches :) , I have been
working on different new patches version in order to improve them according
to feedback from different developers, at this moment I have sent the version 6
I would like to know your point of view and the point of view from more developers about it :)
this is the link where you can see the 6 version:

http://dpdk.org/ml/archives/dev/2015-November/027988.html

Thank you.
Mario.
  

Patch

diff --git a/mk/rte.module.mk b/mk/rte.module.mk
index 7bf77c1..4fc43ba 100644
--- a/mk/rte.module.mk
+++ b/mk/rte.module.mk
@@ -59,6 +59,14 @@  compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1)))
 
 .PHONY: all
 all: install
+#
+# if H (hierarchy-file) varible is equal "1"
+# install modules in /lib/modules/$(KERNEL_DIR).
+#
+ifeq ($(H),1)
+	@[ -d $(MOD_DIR)/$(KERNEL_DIR) ] || mkdir -p $(MOD_DIR)/$(KERNEL_DIR)
+	$(Q)cp -f $(MODULE).ko $(MOD_DIR)/$(KERNEL_DIR)
+endif
 
 .PHONY: install
 install: build _postinstall
diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index b506959..5ddc3f7 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -59,6 +59,8 @@  DATA_DIR := $(DESTDIR)/usr/share
 INCLUDE_DIR := $(DESTDIR)/usr/include
 SBIN_DIR := $(DESTDIR)/usr/sbin
 BIN_DIR := $(DESTDIR)/usr/bin
+MOD_DIR := $(DESTDIR)/lib/modules
+KERNEL_DIR := $(shell uname -r)/extra
 ifeq ($(RTE_ARCH),x86_64)
 LIB_DIR := $(DESTDIR)/usr/lib64
 else
@@ -68,6 +70,8 @@  export INCLUDE_DIR
 export SBIN_DIR
 export BIN_DIR
 export LIB_DIR
+export MOD_DIR
+export KERNEL_DIR
 endif
 
 #