[dpdk-dev,06/10] mk: install kernel modules

Message ID 1449028676-19232-7-git-send-email-thomas.monjalon@6wind.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Thomas Monjalon Dec. 2, 2015, 3:57 a.m. UTC
  Add kernel modules to "make install".
Nothing is done if there is no kernel module compiled.

On native Linux, this path is suggested:
	kerneldir=/lib/modules/$(uname -r)/extra/dpdk

Suggested-by: Mario Carrillo <mario.alfredo.c.arevalo@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 mk/rte.sdkinstall.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Panu Matilainen Dec. 2, 2015, 9:53 a.m. UTC | #1
On 12/02/2015 05:57 AM, Thomas Monjalon wrote:
> Add kernel modules to "make install".
> Nothing is done if there is no kernel module compiled.
>
> On native Linux, this path is suggested:
> 	kerneldir=/lib/modules/$(uname -r)/extra/dpdk
>
> Suggested-by: Mario Carrillo <mario.alfredo.c.arevalo@intel.com>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
>   mk/rte.sdkinstall.mk | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
> index 5585974..46253ff 100644
> --- a/mk/rte.sdkinstall.mk
> +++ b/mk/rte.sdkinstall.mk
> @@ -36,6 +36,7 @@ BUILD_DIR := $O
>
>   prefix      ?=     /usr/local
>   exec_prefix ?=      $(prefix)
> +kerneldir   ?= $(exec_prefix)/kmod
>   bindir      ?= $(exec_prefix)/bin
>   libdir      ?= $(exec_prefix)/lib
>   includedir  ?=      $(prefix)/include/dpdk
> @@ -89,6 +90,7 @@ ifeq '$(DESTDIR)$(if $T,,+)' ''
>   else
>   	@echo ================== Installing $(DESTDIR)$(prefix)/
>   	$(Q)$(MAKE) O=$(BUILD_DIR) install-runtime
> +	$(Q)$(MAKE) O=$(BUILD_DIR) install-kmod
>   	$(Q)$(MAKE) O=$(BUILD_DIR) install-sdk
>   	@echo Installation in $(DESTDIR)$(prefix)/ complete
>   endif
> @@ -105,6 +107,12 @@ install-runtime:
>   	$(Q)$(call rte_mkdir,      $(DESTDIR)$(datadir))
>   	$(Q)cp -a $(RTE_SDK)/tools $(DESTDIR)$(datadir)
>
> +install-kmod:
> +ifneq '$(wildcard $O/kmod/*)' ''
> +	$(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir))
> +	$(Q)cp -a   $O/kmod/* $(DESTDIR)$(kerneldir)
> +endif
> +
>   install-sdk:
>   	$(Q)$(call rte_mkdir, $(DESTDIR)$(includedir))
>   	$(Q)tar -chf -     -C $O include | \
>

This by default installs the modules to /usr/local/kmod/ with no kernel 
version etc. That's so broken that it'd be better not to install them at 
all.

So either get the kerneldir right (the correct path is known on Linux 
and surely BSD too) or dont install them at all unless kerneldir is 
manually specified. For Linux, it should default to 
/lib/modules/<kernelver>/extra/dpdk on Linux, where <kernelver> is the 
version those modules were built against (which might or might not have 
anything to do with uname -r output).

	- Panu -
  
Thomas Monjalon Dec. 2, 2015, 10:09 a.m. UTC | #2
2015-12-02 11:53, Panu Matilainen:
> On 12/02/2015 05:57 AM, Thomas Monjalon wrote:
> > Add kernel modules to "make install".
> > Nothing is done if there is no kernel module compiled.
> >
> > On native Linux, this path is suggested:
> > 	kerneldir=/lib/modules/$(uname -r)/extra/dpdk
[...]
> > +kerneldir   ?= $(exec_prefix)/kmod
> 
> This by default installs the modules to /usr/local/kmod/ with no kernel 
> version etc. That's so broken that it'd be better not to install them at 
> all.
> 
> So either get the kerneldir right (the correct path is known on Linux 
> and surely BSD too) or dont install them at all unless kerneldir is 
> manually specified. For Linux, it should default to 
> /lib/modules/<kernelver>/extra/dpdk on Linux, where <kernelver> is the 
> version those modules were built against (which might or might not have 
> anything to do with uname -r output).

Yes. That's what Mario did.
I wanted to keep the same default as with the old T= command.
But both are do-able by using "ifdef T".
  

Patch

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 5585974..46253ff 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -36,6 +36,7 @@  BUILD_DIR := $O
 
 prefix      ?=     /usr/local
 exec_prefix ?=      $(prefix)
+kerneldir   ?= $(exec_prefix)/kmod
 bindir      ?= $(exec_prefix)/bin
 libdir      ?= $(exec_prefix)/lib
 includedir  ?=      $(prefix)/include/dpdk
@@ -89,6 +90,7 @@  ifeq '$(DESTDIR)$(if $T,,+)' ''
 else
 	@echo ================== Installing $(DESTDIR)$(prefix)/
 	$(Q)$(MAKE) O=$(BUILD_DIR) install-runtime
+	$(Q)$(MAKE) O=$(BUILD_DIR) install-kmod
 	$(Q)$(MAKE) O=$(BUILD_DIR) install-sdk
 	@echo Installation in $(DESTDIR)$(prefix)/ complete
 endif
@@ -105,6 +107,12 @@  install-runtime:
 	$(Q)$(call rte_mkdir,      $(DESTDIR)$(datadir))
 	$(Q)cp -a $(RTE_SDK)/tools $(DESTDIR)$(datadir)
 
+install-kmod:
+ifneq '$(wildcard $O/kmod/*)' ''
+	$(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir))
+	$(Q)cp -a   $O/kmod/* $(DESTDIR)$(kerneldir)
+endif
+
 install-sdk:
 	$(Q)$(call rte_mkdir, $(DESTDIR)$(includedir))
 	$(Q)tar -chf -     -C $O include | \