diff mbox

[09/11,v2] package/owl-linux: use kernel-module helper

Message ID e63af963671131bf2d33fd2ab2eaa351bcc51150.1433964001.git.yann.morin.1998@free.fr
State Changes Requested
Headers show

Commit Message

Yann E. MORIN June 10, 2015, 7:22 p.m. UTC
Git rid of first patch, no longer needed; rename remaining patch.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
Changes v1 -> v2:
  - override $(PWD)
---
 .../0001-fix-CROSS_COMPILE-usage-in-Makefile.patch       | 16 ----------------
 ...-linux-3.3.x.patch => 0001-fix-for-linux-3.3.x.patch} |  0
 package/owl-linux/owl-linux.mk                           | 15 ++++++---------
 3 files changed, 6 insertions(+), 25 deletions(-)
 delete mode 100644 package/owl-linux/0001-fix-CROSS_COMPILE-usage-in-Makefile.patch
 rename package/owl-linux/{0002-fix-for-linux-3.3.x.patch => 0001-fix-for-linux-3.3.x.patch} (100%)

Comments

Arnout Vandecappelle June 11, 2015, 11:13 p.m. UTC | #1
On 06/10/15 21:22, Yann E. MORIN wrote:
> Git rid of first patch, no longer needed; rename remaining patch.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
[snip]
> diff --git a/package/owl-linux/owl-linux.mk b/package/owl-linux/owl-linux.mk
> index 371cc02..844b11e 100644
> --- a/package/owl-linux/owl-linux.mk
> +++ b/package/owl-linux/owl-linux.mk
> @@ -10,14 +10,11 @@ OWL_LINUX_LICENSE = PROPRIETARY
>  OWL_LINUX_LICENSE_FILES = LICENSE
>  OWL_LINUX_REDISTRIBUTE = NO
>  
> -OWL_LINUX_DEPENDENCIES = linux
> -
> -define OWL_LINUX_BUILD_CMDS
> -	$(MAKE) -C $(@D) $(LINUX_MAKE_FLAGS) KERNELDIR=$(LINUX_DIR)
> -endef
> -
> -define OWL_LINUX_INSTALL_TARGET_CMDS
> -	$(MAKE) -C $(LINUX_DIR) $(LINUX_MAKE_FLAGS) M="$(@D)" modules_install
> -endef
> +# owl-linux wants to use $(PWD) to find its includes, however $(PWD) is not
> +# the top of the package's source tree, but the top of Buildroot source tree

 Unless I'm very much mistaken, PWD will be $(LINUX_DIR) when the Makefile is
included.

 With that small thing fixed:

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

> +# $(TOPDIR)  (i.e. the place where make is run from).
> +# So, override PWD to the proper value.
> +OWL_LINUX_MODULE_MAKE_OPTS = PWD=$(@D)
>  
> +$(eval $(kernel-module))
>  $(eval $(generic-package))
>
Yann E. MORIN June 12, 2015, 5:55 p.m. UTC | #2
Arnout, All,

On 2015-06-12 01:13 +0200, Arnout Vandecappelle spake thusly:
> On 06/10/15 21:22, Yann E. MORIN wrote:
> > Git rid of first patch, no longer needed; rename remaining patch.

s/Git/Get/  Damn... :-]

> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > 
> [snip]
> > diff --git a/package/owl-linux/owl-linux.mk b/package/owl-linux/owl-linux.mk
> > index 371cc02..844b11e 100644
> > --- a/package/owl-linux/owl-linux.mk
> > +++ b/package/owl-linux/owl-linux.mk
> > @@ -10,14 +10,11 @@ OWL_LINUX_LICENSE = PROPRIETARY
> >  OWL_LINUX_LICENSE_FILES = LICENSE
> >  OWL_LINUX_REDISTRIBUTE = NO
> >  
> > -OWL_LINUX_DEPENDENCIES = linux
> > -
> > -define OWL_LINUX_BUILD_CMDS
> > -	$(MAKE) -C $(@D) $(LINUX_MAKE_FLAGS) KERNELDIR=$(LINUX_DIR)
> > -endef
> > -
> > -define OWL_LINUX_INSTALL_TARGET_CMDS
> > -	$(MAKE) -C $(LINUX_DIR) $(LINUX_MAKE_FLAGS) M="$(@D)" modules_install
> > -endef
> > +# owl-linux wants to use $(PWD) to find its includes, however $(PWD) is not
> > +# the top of the package's source tree, but the top of Buildroot source tree
> 
>  Unless I'm very much mistaken, PWD will be $(LINUX_DIR) when the Makefile is
> included.

I think you are very much mistaken, indeed! ;-)

What happens is that all commands we run are run from Buildroot's
$(TOPDIR). So $(PWD) is set to that location.

So, this command, which we run from our Makefile:

    make -C $(LINUX_DIR) M=$(@D) foo-bar

would get its $(PWD) make-variable set from whatever value it had in the
shell that called make, which happens to itself be called by Buildroot's
Makefile, which runs from $(TOPDIR), always (even for out-of-tree builds).

Then, the Linux buildsystem does *not* chdir() when it builds modules,
it just includes $(M)/Kbuild (or if it does not exist, $(M)/Makefile ),
so $(PWD) as used in those will still be Buildroot's $(TOPDIR).

>  With that small thing fixed:
> 
> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Still valid with that small thing *not* fixed? ;-)

Regards,
Yann E. MORIN.
Arnout Vandecappelle June 12, 2015, 11:19 p.m. UTC | #3
On 06/12/15 19:55, Yann E. MORIN wrote:
> Arnout, All,
> 
> On 2015-06-12 01:13 +0200, Arnout Vandecappelle spake thusly:
>> On 06/10/15 21:22, Yann E. MORIN wrote:
>>> Git rid of first patch, no longer needed; rename remaining patch.
> 
> s/Git/Get/  Damn... :-]
> 
>>> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>>>
>> [snip]
>>> diff --git a/package/owl-linux/owl-linux.mk b/package/owl-linux/owl-linux.mk
>>> index 371cc02..844b11e 100644
>>> --- a/package/owl-linux/owl-linux.mk
>>> +++ b/package/owl-linux/owl-linux.mk
>>> @@ -10,14 +10,11 @@ OWL_LINUX_LICENSE = PROPRIETARY
>>>  OWL_LINUX_LICENSE_FILES = LICENSE
>>>  OWL_LINUX_REDISTRIBUTE = NO
>>>  
>>> -OWL_LINUX_DEPENDENCIES = linux
>>> -
>>> -define OWL_LINUX_BUILD_CMDS
>>> -	$(MAKE) -C $(@D) $(LINUX_MAKE_FLAGS) KERNELDIR=$(LINUX_DIR)
>>> -endef
>>> -
>>> -define OWL_LINUX_INSTALL_TARGET_CMDS
>>> -	$(MAKE) -C $(LINUX_DIR) $(LINUX_MAKE_FLAGS) M="$(@D)" modules_install
>>> -endef
>>> +# owl-linux wants to use $(PWD) to find its includes, however $(PWD) is not
>>> +# the top of the package's source tree, but the top of Buildroot source tree
>>
>>  Unless I'm very much mistaken, PWD will be $(LINUX_DIR) when the Makefile is
>> included.
> 
> I think you are very much mistaken, indeed! ;-)
> 
> What happens is that all commands we run are run from Buildroot's
> $(TOPDIR). So $(PWD) is set to that location.
> 
> So, this command, which we run from our Makefile:
> 
>     make -C $(LINUX_DIR) M=$(@D) foo-bar
> 
> would get its $(PWD) make-variable set from whatever value it had in the
> shell that called make, which happens to itself be called by Buildroot's
> Makefile, which runs from $(TOPDIR), always (even for out-of-tree builds).

 Oh yes indeed, I missed the fact that the PWD := $(shell pwd) is only included
when it's *not* the kbuild call...

 Crazy Makefile...

> 
> Then, the Linux buildsystem does *not* chdir() when it builds modules,
> it just includes $(M)/Kbuild (or if it does not exist, $(M)/Makefile ),
> so $(PWD) as used in those will still be Buildroot's $(TOPDIR).
> 
>>  With that small thing fixed:
>>
>> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> 
> Still valid with that small thing *not* fixed? ;-)

 Yep!


 Regards,
 Arnout

> 
> Regards,
> Yann E. MORIN.
>
diff mbox

Patch

diff --git a/package/owl-linux/0001-fix-CROSS_COMPILE-usage-in-Makefile.patch b/package/owl-linux/0001-fix-CROSS_COMPILE-usage-in-Makefile.patch
deleted file mode 100644
index 14b4631..0000000
--- a/package/owl-linux/0001-fix-CROSS_COMPILE-usage-in-Makefile.patch
+++ /dev/null
@@ -1,16 +0,0 @@ 
-Fix the owl-linux Makefile so that it protects spaces in the CROSS_COMPILE
-variable. For example, this variable will contain spaces if ccache is used.
-
-Signed-off-by: Simon Dawson <spdawson@gmail.com>
-diff -Nurp a/Makefile b/Makefile
---- a/Makefile	2012-06-14 10:51:45.000000000 +0100
-+++ b/Makefile	2012-07-20 10:46:41.636752148 +0100
-@@ -35,7 +35,7 @@ else
- 	PWD := $(shell pwd)
- 
- default:
--	$(MAKE) -C $(KERNELDIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) MODE=$(MODE) modules
-+	$(MAKE) -C $(KERNELDIR) ARCH=$(ARCH) CROSS_COMPILE="$(CROSS_COMPILE)" M=$(PWD) MODE=$(MODE) modules
- 
- clean: 
- 	-rm -f *.o *.mod.c *.ko modules.order Module.symvers
diff --git a/package/owl-linux/0002-fix-for-linux-3.3.x.patch b/package/owl-linux/0001-fix-for-linux-3.3.x.patch
similarity index 100%
rename from package/owl-linux/0002-fix-for-linux-3.3.x.patch
rename to package/owl-linux/0001-fix-for-linux-3.3.x.patch
diff --git a/package/owl-linux/owl-linux.mk b/package/owl-linux/owl-linux.mk
index 371cc02..844b11e 100644
--- a/package/owl-linux/owl-linux.mk
+++ b/package/owl-linux/owl-linux.mk
@@ -10,14 +10,11 @@  OWL_LINUX_LICENSE = PROPRIETARY
 OWL_LINUX_LICENSE_FILES = LICENSE
 OWL_LINUX_REDISTRIBUTE = NO
 
-OWL_LINUX_DEPENDENCIES = linux
-
-define OWL_LINUX_BUILD_CMDS
-	$(MAKE) -C $(@D) $(LINUX_MAKE_FLAGS) KERNELDIR=$(LINUX_DIR)
-endef
-
-define OWL_LINUX_INSTALL_TARGET_CMDS
-	$(MAKE) -C $(LINUX_DIR) $(LINUX_MAKE_FLAGS) M="$(@D)" modules_install
-endef
+# owl-linux wants to use $(PWD) to find its includes, however $(PWD) is not
+# the top of the package's source tree, but the top of Buildroot source tree
+# $(TOPDIR)  (i.e. the place where make is run from).
+# So, override PWD to the proper value.
+OWL_LINUX_MODULE_MAKE_OPTS = PWD=$(@D)
 
+$(eval $(kernel-module))
 $(eval $(generic-package))