backports: redefine srctree
RFC 1/1 backports: redefine srctree
From: "Luis R. Rodriguez" <[email protected]>
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
backport/Makefile.kernel +2 -0
@@ -15,6 +15,8 @@ NOSTDINC_FLAGS := \ $(BACKPORTS_GIT_TRACKER_DEF) \ $(CFLAGS) +srctree = $(M) + obj-y += compat/ obj-$(CPTCFG_CFG80211) += net/wireless/
backport/scripts/Makefile.build new file +1 -0
@@ -0,0 +1 @@ +include $(KLIB_BUILD)/scripts/Makefile.build
Signature · 1 line
1.7.10.4
Johannes Berg
maintainerQuoted 8 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
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
net/wireless/Makefile +1 -1
@@ -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
Quoted 11 lines
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 ownscripts/Makefile.buildthat 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
Quoted 32 lines · Johannes Berg
Quoted 8 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
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/Makefilebecause of this (patches/collateral-evolutions/network/35-fix-makefile-includes/net_wireless_Makefile.patchnet/wireless/Makefile +1
-1@@ -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.cQuoted 9 lines
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 ownscripts/Makefile.buildthat points back to the kernel's.
---
Quoted 7 lines
Quoted 3 lines
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.
Quoted 2 lines
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.
Quoted 3 lines
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