All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] backports: redefine srctree
@ 2013-04-12  6:41 Luis R. Rodriguez
  2013-04-12  7:41 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Luis R. Rodriguez @ 2013-04-12  6:41 UTC (permalink / raw)
  To: backports; +Cc: Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Drivers may do header sharing in their subsystems by
not using a full include path. There are different ways
folks append the include path, one strategy is to use
srctree as follows:

ccflags-y += -I$(srctree)/drivers/media/dvb-core/

Another example (for b2c2):

ccflags-y += -Idrivers/media/dvb-core/

The above gets fixed by the kernel through addtree which
prefixes -I with $(srctree) if it was not set. To take
advantage of the kernel's srctree but not break the build
we must lead it back in to the scripts/Makefile.build,
we do this by using our own scripts/Makefile.build that
points back to the kernel's.
---

Note: this breaks the kernel's build scripts that rely on
srctree so ideally we'd want to modify instead addtree but
I can't figure out how. Thoughts?

 backport/Makefile.kernel        |    2 ++
 backport/scripts/Makefile.build |    1 +
 2 files changed, 3 insertions(+)
 create mode 100644 backport/scripts/Makefile.build

diff --git a/backport/Makefile.kernel b/backport/Makefile.kernel
index 91e7dd6..12b5112 100644
--- a/backport/Makefile.kernel
+++ b/backport/Makefile.kernel
@@ -15,6 +15,8 @@ NOSTDINC_FLAGS := \
 	$(BACKPORTS_GIT_TRACKER_DEF) \
 	$(CFLAGS)
 
+srctree = $(M)
+
 obj-y += compat/
 
 obj-$(CPTCFG_CFG80211) += net/wireless/
diff --git a/backport/scripts/Makefile.build b/backport/scripts/Makefile.build
new file mode 100644
index 0000000..4c7498d
--- /dev/null
+++ b/backport/scripts/Makefile.build
@@ -0,0 +1 @@
+include $(KLIB_BUILD)/scripts/Makefile.build
-- 
1.7.10.4


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

* Re: [RFC] backports: redefine srctree
  2013-04-12  6:41 [RFC] backports: redefine srctree Luis R. Rodriguez
@ 2013-04-12  7:41 ` Johannes Berg
  2013-04-12  9:15   ` Luis R. Rodriguez
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2013-04-12  7:41 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Thu, 2013-04-11 at 23:41 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> 
> Drivers may do header sharing in their subsystems by
> not using a full include path. There are different ways
> folks append the include path, one strategy is to use
> srctree as follows:
> 
> ccflags-y += -I$(srctree)/drivers/media/dvb-core/

We also have a patch for net/wireless/Makefile because of this
(patches/collateral-evolutions/network/35-fix-makefile-includes/net_wireless_Makefile.patch

--- a/net/wireless/Makefile
+++ b/net/wireless/Makefile
@@ -20,6 +20,6 @@ CFLAGS_trace.o := -I$(src)
 ccflags-y += -D__CHECK_ENDIAN__
 
 $(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk
-	@$(AWK) -f $(srctree)/$(src)/genregdb.awk < $< > $@
+	@$(AWK) -f $(src)/genregdb.awk < $< > $@
 
 clean-files := regdb.c

> The above gets fixed by the kernel through addtree which
> prefixes -I with $(srctree) if it was not set. To take
> advantage of the kernel's srctree but not break the build
> we must lead it back in to the scripts/Makefile.build,
> we do this by using our own scripts/Makefile.build that
> points back to the kernel's.
> ---
> 
> Note: this breaks the kernel's build scripts that rely on
> srctree so ideally we'd want to modify instead addtree but
> I can't figure out how. Thoughts?

Yeah I was going to say ... does this actually work? It also relies on
the kernel's Makefile.build existing in all versions of the kernel, is
that actually true? Just curious.

I don't see a good way to solve these things other than patching them,
unfortunately.

An alternative might be to have the gentree script replace "$(srctree)"
with "$(backport-sourcetree)" in the copied Makefiles, and then just set
that variable?

johannes


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

* Re: [RFC] backports: redefine srctree
  2013-04-12  7:41 ` Johannes Berg
@ 2013-04-12  9:15   ` Luis R. Rodriguez
  0 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2013-04-12  9:15 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On Fri, Apr 12, 2013 at 12:41 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2013-04-11 at 23:41 -0700, Luis R. Rodriguez wrote:
>> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
>>
>> Drivers may do header sharing in their subsystems by
>> not using a full include path. There are different ways
>> folks append the include path, one strategy is to use
>> srctree as follows:
>>
>> ccflags-y += -I$(srctree)/drivers/media/dvb-core/
>
> We also have a patch for net/wireless/Makefile because of this
> (patches/collateral-evolutions/network/35-fix-makefile-includes/net_wireless_Makefile.patch
>
> --- a/net/wireless/Makefile
> +++ b/net/wireless/Makefile
> @@ -20,6 +20,6 @@ CFLAGS_trace.o := -I$(src)
>  ccflags-y += -D__CHECK_ENDIAN__
>
>  $(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk
> -       @$(AWK) -f $(srctree)/$(src)/genregdb.awk < $< > $@
> +       @$(AWK) -f $(src)/genregdb.awk < $< > $@
>
>  clean-files := regdb.c
>
>> The above gets fixed by the kernel through addtree which
>> prefixes -I with $(srctree) if it was not set. To take
>> advantage of the kernel's srctree but not break the build
>> we must lead it back in to the scripts/Makefile.build,
>> we do this by using our own scripts/Makefile.build that
>> points back to the kernel's.
>> ---
>>
>> Note: this breaks the kernel's build scripts that rely on
>> srctree so ideally we'd want to modify instead addtree but
>> I can't figure out how. Thoughts?
>
> Yeah I was going to say ... does this actually work? It also relies on
> the kernel's Makefile.build existing in all versions of the kernel, is
> that actually true? Just curious.

I tried ckmake --allyesconfig and its looked actually fine for the
older kernels, for the newer ones it started messing up due to some
perl script that was being looked up via srctree.

> I don't see a good way to solve these things other than patching them,
> unfortunately.

So what if we had instead of obj-m backport-m ? We might have to
reinvent a lot of the while but all I think we'd need is to add a
backport_addtree for the header hack.

> An alternative might be to have the gentree script replace "$(srctree)"
> with "$(backport-sourcetree)" in the copied Makefiles, and then just set
> that variable?

Sexy. Thanks Python.

  Luis

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

* [RFC] backports: redefine srctree
@ 2013-04-12  6:41 Luis R. Rodriguez
  0 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2013-04-12  6:41 UTC (permalink / raw)
  To: backports; +Cc: Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Drivers may do header sharing in their subsystems by
not using a full include path. There are different ways
folks append the include path, one strategy is to use
srctree as follows:

ccflags-y += -I$(srctree)/drivers/media/dvb-core/

Another example (for b2c2):

ccflags-y += -Idrivers/media/dvb-core/

The above gets fixed by the kernel through addtree which
prefixes -I with $(srctree) if it was not set. To take
advantage of the kernel's srctree but not break the build
we must lead it back in to the scripts/Makefile.build,
we do this by using our own scripts/Makefile.build that
points back to the kernel's.
---

Note: this breaks the kernel's build scripts that rely on
srctree so ideally we'd want to modify instead addtree but
I can't figure out how. Thoughts?

 backport/Makefile.kernel        |    2 ++
 backport/scripts/Makefile.build |    1 +
 2 files changed, 3 insertions(+)
 create mode 100644 backport/scripts/Makefile.build

diff --git a/backport/Makefile.kernel b/backport/Makefile.kernel
index 91e7dd6..12b5112 100644
--- a/backport/Makefile.kernel
+++ b/backport/Makefile.kernel
@@ -15,6 +15,8 @@ NOSTDINC_FLAGS := \
 	$(BACKPORTS_GIT_TRACKER_DEF) \
 	$(CFLAGS)
 
+srctree = $(M)
+
 obj-y += compat/
 
 obj-$(CPTCFG_CFG80211) += net/wireless/
diff --git a/backport/scripts/Makefile.build b/backport/scripts/Makefile.build
new file mode 100644
index 0000000..4c7498d
--- /dev/null
+++ b/backport/scripts/Makefile.build
@@ -0,0 +1 @@
+include $(KLIB_BUILD)/scripts/Makefile.build
-- 
1.7.10.4


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

end of thread, other threads:[~2013-04-12  9:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-12  6:41 [RFC] backports: redefine srctree Luis R. Rodriguez
2013-04-12  7:41 ` Johannes Berg
2013-04-12  9:15   ` Luis R. Rodriguez
  -- strict thread matches above, loose matches on Subject: below --
2013-04-12  6:41 Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.