DPDK patches and discussions
 help / color / mirror / Atom feed
* [kmods PATCH] linux/igb_uio: allow modules install
@ 2022-04-12 13:14 Bruce Richardson
  2022-06-14 10:25 ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2022-04-12 13:14 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

For those still using the "igb_uio" kernel module, there may be
occasions where the module is installed in /lib/modules/$VERSION folder
rather than being insmod'ed from the build directory. To support this, a
number of changes are needed to the makefile:

* Change the "clean" command to a generic wildcard target where that
  target is just passed through to the top-level kernel makefile. This
  should allow all standard kernel module targets, including "clean" and
  "modules_install" to work.
* To install in /lib/modules, root permissions are needed, so it is
  likely that users may try installing the module using "sudo". However,
  under sudo there is often no $PWD environment variable, breaking the
  build. This can be fixed by changing the environment variable $PWD to
  the make built-in variable "CURDIR"[1].
* As a cleanup, the actual kernel module path is got directly by make
  from the shell, rather than relying on the shell substitution later
  when making the recursive make call. This improves things slightly for
  the user as the full recursive command is visible, with the kernel
  version appearing in place of `uname -r` in the output.

[1] While neither PWD nor CURDIR will work correctly in the case where
one is building outside of the sources directory, this is an edge case,
and a simple replacement of PWD by CURDIR keeps things simple while
adding support for "sudo".

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 linux/igb_uio/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/linux/igb_uio/Makefile b/linux/igb_uio/Makefile
index 09ae5d9..bd2e356 100644
--- a/linux/igb_uio/Makefile
+++ b/linux/igb_uio/Makefile
@@ -1,7 +1,7 @@
-KSRC ?= /lib/modules/`uname -r`/build
+KSRC ?= /lib/modules/$(shell uname -r)/build
 
 all:
-	make -C $(KSRC)/ M=$(PWD)
+	make -C $(KSRC)/ M=$(CURDIR)
 
-clean:
-	make -C $(KSRC)/ M=$(PWD) clean
+%:
+	make -C $(KSRC)/ M=$(CURDIR) $@
-- 
2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kmods PATCH] linux/igb_uio: allow modules install
  2022-04-12 13:14 [kmods PATCH] linux/igb_uio: allow modules install Bruce Richardson
@ 2022-06-14 10:25 ` Ferruh Yigit
  2022-06-14 10:27   ` Ferruh Yigit
  2023-02-05 18:03   ` Thomas Monjalon
  0 siblings, 2 replies; 4+ messages in thread
From: Ferruh Yigit @ 2022-06-14 10:25 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On 4/12/2022 2:14 PM, Bruce Richardson wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
> 
> 
> For those still using the "igb_uio" kernel module, there may be
> occasions where the module is installed in /lib/modules/$VERSION folder
> rather than being insmod'ed from the build directory. To support this, a
> number of changes are needed to the makefile:
> 
> * Change the "clean" command to a generic wildcard target where that
>    target is just passed through to the top-level kernel makefile. This
>    should allow all standard kernel module targets, including "clean" and
>    "modules_install" to work.

ack

> * To install in /lib/modules, root permissions are needed, so it is
>    likely that users may try installing the module using "sudo". However,
>    under sudo there is often no $PWD environment variable, breaking the
>    build. This can be fixed by changing the environment variable $PWD to
>    the make built-in variable "CURDIR"[1].

It can be possible to use shell PWD:

"make -C $(KSRC)/ M=$$PWD"

or

"
PWD := $(shell pwd)

all:
	make -C $(KSRC)/ M=$(PWD)
"

But '$(CURDIR)' also seems doing the job, so lgtm.

> * As a cleanup, the actual kernel module path is got directly by make
>    from the shell, rather than relying on the shell substitution later
>    when making the recursive make call. This improves things slightly for
>    the user as the full recursive command is visible, with the kernel
>    version appearing in place of `uname -r` in the output.
> 

ack

> [1] While neither PWD nor CURDIR will work correctly in the case where
> one is building outside of the sources directory, this is an edge case,
> and a simple replacement of PWD by CURDIR keeps things simple while
> adding support for "sudo".
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>

> ---
>   linux/igb_uio/Makefile | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/linux/igb_uio/Makefile b/linux/igb_uio/Makefile
> index 09ae5d9..bd2e356 100644
> --- a/linux/igb_uio/Makefile
> +++ b/linux/igb_uio/Makefile
> @@ -1,7 +1,7 @@
> -KSRC ?= /lib/modules/`uname -r`/build
> +KSRC ?= /lib/modules/$(shell uname -r)/build
> 
>   all:
> -       make -C $(KSRC)/ M=$(PWD)
> +       make -C $(KSRC)/ M=$(CURDIR)
> 
> -clean:
> -       make -C $(KSRC)/ M=$(PWD) clean
> +%:
> +       make -C $(KSRC)/ M=$(CURDIR) $@
> --
> 2.32.0
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kmods PATCH] linux/igb_uio: allow modules install
  2022-06-14 10:25 ` Ferruh Yigit
@ 2022-06-14 10:27   ` Ferruh Yigit
  2023-02-05 18:03   ` Thomas Monjalon
  1 sibling, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2022-06-14 10:27 UTC (permalink / raw)
  To: Thomas Monjalon, David Marchand; +Cc: dev, Bruce Richardson, Stephen Hemminger

On 6/14/2022 11:25 AM, Ferruh Yigit wrote:
> On 4/12/2022 2:14 PM, Bruce Richardson wrote:
>> CAUTION: This message has originated from an External Source. Please 
>> use proper judgment and caution when opening attachments, clicking 
>> links, or responding to this email.
>>
>>
>> For those still using the "igb_uio" kernel module, there may be
>> occasions where the module is installed in /lib/modules/$VERSION folder
>> rather than being insmod'ed from the build directory. To support this, a
>> number of changes are needed to the makefile:
>>
>> * Change the "clean" command to a generic wildcard target where that
>>    target is just passed through to the top-level kernel makefile. This
>>    should allow all standard kernel module targets, including "clean" and
>>    "modules_install" to work.
> 
> ack
> 
>> * To install in /lib/modules, root permissions are needed, so it is
>>    likely that users may try installing the module using "sudo". However,
>>    under sudo there is often no $PWD environment variable, breaking the
>>    build. This can be fixed by changing the environment variable $PWD to
>>    the make built-in variable "CURDIR"[1].
> 
> It can be possible to use shell PWD:
> 
> "make -C $(KSRC)/ M=$$PWD"
> 
> or
> 
> "
> PWD := $(shell pwd)
> 
> all:
>      make -C $(KSRC)/ M=$(PWD)
> "
> 
> But '$(CURDIR)' also seems doing the job, so lgtm.
> 
>> * As a cleanup, the actual kernel module path is got directly by make
>>    from the shell, rather than relying on the shell substitution later
>>    when making the recursive make call. This improves things slightly for
>>    the user as the full recursive command is visible, with the kernel
>>    version appearing in place of `uname -r` in the output.
>>
> 
> ack
> 
>> [1] While neither PWD nor CURDIR will work correctly in the case where
>> one is building outside of the sources directory, this is an edge case,
>> and a simple replacement of PWD by CURDIR keeps things simple while
>> adding support for "sudo".
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> 
>> ---
>>   linux/igb_uio/Makefile | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/linux/igb_uio/Makefile b/linux/igb_uio/Makefile
>> index 09ae5d9..bd2e356 100644
>> --- a/linux/igb_uio/Makefile
>> +++ b/linux/igb_uio/Makefile
>> @@ -1,7 +1,7 @@
>> -KSRC ?= /lib/modules/`uname -r`/build
>> +KSRC ?= /lib/modules/$(shell uname -r)/build
>>
>>   all:
>> -       make -C $(KSRC)/ M=$(PWD)
>> +       make -C $(KSRC)/ M=$(CURDIR)
>>
>> -clean:
>> -       make -C $(KSRC)/ M=$(PWD) clean
>> +%:
>> +       make -C $(KSRC)/ M=$(CURDIR) $@
>> -- 
>> 2.32.0
>>
> 

Btw, igb_uio doesn't compile with '5.19.0-rc2',
'pci_set_dma_mask()' & 'pci_set_consistent_dma_mask()' APIs are no more 
exist. 'igb_uio' needs to be updated.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kmods PATCH] linux/igb_uio: allow modules install
  2022-06-14 10:25 ` Ferruh Yigit
  2022-06-14 10:27   ` Ferruh Yigit
@ 2023-02-05 18:03   ` Thomas Monjalon
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2023-02-05 18:03 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Ferruh Yigit

14/06/2022 12:25, Ferruh Yigit:
> On 4/12/2022 2:14 PM, Bruce Richardson wrote:
> > CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
> > 
> > 
> > For those still using the "igb_uio" kernel module, there may be
> > occasions where the module is installed in /lib/modules/$VERSION folder
> > rather than being insmod'ed from the build directory. To support this, a
> > number of changes are needed to the makefile:
> > 
> > * Change the "clean" command to a generic wildcard target where that
> >    target is just passed through to the top-level kernel makefile. This
> >    should allow all standard kernel module targets, including "clean" and
> >    "modules_install" to work.
> 
> ack
> 
> > * To install in /lib/modules, root permissions are needed, so it is
> >    likely that users may try installing the module using "sudo". However,
> >    under sudo there is often no $PWD environment variable, breaking the
> >    build. This can be fixed by changing the environment variable $PWD to
> >    the make built-in variable "CURDIR"[1].
> 
> It can be possible to use shell PWD:
> 
> "make -C $(KSRC)/ M=$$PWD"
> 
> or
> 
> "
> PWD := $(shell pwd)
> 
> all:
> 	make -C $(KSRC)/ M=$(PWD)
> "
> 
> But '$(CURDIR)' also seems doing the job, so lgtm.
> 
> > * As a cleanup, the actual kernel module path is got directly by make
> >    from the shell, rather than relying on the shell substitution later
> >    when making the recursive make call. This improves things slightly for
> >    the user as the full recursive command is visible, with the kernel
> >    version appearing in place of `uname -r` in the output.
> > 
> 
> ack
> 
> > [1] While neither PWD nor CURDIR will work correctly in the case where
> > one is building outside of the sources directory, this is an edge case,
> > and a simple replacement of PWD by CURDIR keeps things simple while
> > adding support for "sudo".
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>

Applied, thanks.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-05 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 13:14 [kmods PATCH] linux/igb_uio: allow modules install Bruce Richardson
2022-06-14 10:25 ` Ferruh Yigit
2022-06-14 10:27   ` Ferruh Yigit
2023-02-05 18:03   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).