Distributions like Gentoo and Debian have policies which make it necessary to use some kind of environmental variable to control the parallel build.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 3374687..15f099e 100644 --- a/Makefile +++ b/Makefile @@ -33,12 +33,10 @@ REVISION= $(shell if [ -d .git ]; then \ echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \ fi)
-NUM_CPUS = $(shell nproc 2> /dev/null || echo 1) - include $(PWD)/Makefile.kbuild
all: - $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) -j $(NUM_CPUS) modules + $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) modules
clean: $(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean
Makefile and Makefile.kbuild are included by the linux kbuild environment to build the kernel module. Rules by other build systems could lead to hard to debug problems and therefore should be avoided.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile.kbuild | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/Makefile.kbuild b/Makefile.kbuild index bd7e93c..3c51455 100644 --- a/Makefile.kbuild +++ b/Makefile.kbuild @@ -18,13 +18,6 @@ # 02110-1301, USA #
- - -# openwrt integration -ifeq ($(MAKING_MODULES),1) --include $(TOPDIR)/Rules.make -endif - # ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG
ifneq ($(REVISION),)
On Monday, December 05, 2011 03:10:46 Sven Eckelmann wrote:
Makefile and Makefile.kbuild are included by the linux kbuild environment to build the kernel module. Rules by other build systems could lead to hard to debug problems and therefore should be avoided.
Applied in revision fac4043.
Thanks, Marek
The standalone batman-adv module is sent to the linux kernel maintainers to be merged by them. A batman-adv developer has to manually merge the changes since the last submission and apply it on top of the current linux development tree. The standalone sources have to provide an additional layer that increases the compatibility to kernels and to give a better user experience. This layer will not be sent to the kernel maintainers and has to manually removed each time.
To reduce this work, the Makefile.kbuild should be cleaned up to be only the vanilla version of the Makefile in the kernel. The Makefile in the standalone sources is used to provide most of the additional layer.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 8 +++++++- Makefile.kbuild | 9 +-------- 2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile index 15f099e..4f338aa 100644 --- a/Makefile +++ b/Makefile @@ -33,10 +33,16 @@ REVISION= $(shell if [ -d .git ]; then \ echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \ fi)
+CONFIG_BATMAN_ADV=m +batman-adv-y += compat.o +ifneq ($(REVISION),) +ccflags-y += -DSOURCE_VERSION="$(REVISION)" +endif +# ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG include $(PWD)/Makefile.kbuild
all: - $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) modules + $(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) modules
clean: $(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean diff --git a/Makefile.kbuild b/Makefile.kbuild index 3c51455..ce68611 100644 --- a/Makefile.kbuild +++ b/Makefile.kbuild @@ -18,13 +18,7 @@ # 02110-1301, USA #
-# ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG - -ifneq ($(REVISION),) -ccflags-y += -DSOURCE_VERSION="$(REVISION)" -endif - -obj-m += batman-adv.o +obj-$(CONFIG_BATMAN_ADV) += batman-adv.o batman-adv-y += bat_debugfs.o batman-adv-y += bat_iv_ogm.o batman-adv-y += bat_sysfs.o @@ -43,4 +37,3 @@ batman-adv-y += soft-interface.o batman-adv-y += translation-table.o batman-adv-y += unicast.o batman-adv-y += vis.o -batman-adv-y += compat.o
On Monday, December 05, 2011 03:10:47 Sven Eckelmann wrote:
The standalone batman-adv module is sent to the linux kernel maintainers to be merged by them. A batman-adv developer has to manually merge the changes since the last submission and apply it on top of the current linux development tree. The standalone sources have to provide an additional layer that increases the compatibility to kernels and to give a better user experience. This layer will not be sent to the kernel maintainers and has to manually removed each time.
To reduce this work, the Makefile.kbuild should be cleaned up to be only the vanilla version of the Makefile in the kernel. The Makefile in the standalone sources is used to provide most of the additional layer.
Applied in revision b49b17f.
Thanks, Marek
The user should not be encouraged to edit sources to prevent inconsistent changes. Upcoming features will not only use preprocessor variables to enable or disable itself, but also need to compile specific files at the same time. Therefore, it is safer to provide make parameters which can enable everything necessary for a specific option and look similar to the .config options of the kernel.
It is not possible to disable features enabled by the target kernel because the include/generated/autoconf.h of the kernel sources isn't regenerated by a module build. Hence, it is better not to disable features in the makefile by default because the preprocessor will not have the same information. This can be changed later by a more complex configuration system that generates an own compat_autoconf.h that is included by compat.h. This header would have to
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 7 +++++-- README | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index 4f338aa..e78e797 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,10 @@ # 02110-1301, USA #
- +# uncomment the CONFIG_* line to enable the related feature +# features enabled in the target kernel configuration cannot be disabled +# B.A.T.M.A.N. debugging: +# CONFIG_BATMAN_ADV_DEBUG=y
PWD:=$(shell pwd) KERNELPATH ?= /lib/modules/$(shell uname -r)/build @@ -38,7 +41,7 @@ batman-adv-y += compat.o ifneq ($(REVISION),) ccflags-y += -DSOURCE_VERSION="$(REVISION)" endif -# ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG +ccflags-$(CONFIG_BATMAN_ADV_DEBUG) += -DCONFIG_BATMAN_ADV_DEBUG include $(PWD)/Makefile.kbuild
all: diff --git a/README b/README index 7404c0a..ddc9569 100644 --- a/README +++ b/README @@ -207,10 +207,10 @@ times necessary to see more detail debug messages. This must be enabled when compiling the batman-adv module. When building bat- man-adv as part of kernel, use "make menuconfig" and enable the option "B.A.T.M.A.N. debugging". When compiling outside of the -kernel tree it is necessary to edit the file Makefile.kbuild and -uncomment the line +kernel tree it is necessary to enable it using the make option +CONFIG_BATMAN_ADV_DEBUG=y
-#ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG +# make CONFIG_BATMAN_ADV_DEBUG=y
Those additional debug messages can be accessed using a special file in debugfs
On Sunday 04 December 2011 20:10:48 Sven Eckelmann wrote: [...]
generates an own compat_autoconf.h that is included by compat.h. This header would have to
[...]
I should have checked that a line doesn't begin with #... nevertheless: "define/undef all preprocessor variables used to configure batman-adv features".
Kind regards, Sven
On Monday, December 05, 2011 03:16:05 Sven Eckelmann wrote:
On Sunday 04 December 2011 20:10:48 Sven Eckelmann wrote: [...]
generates an own compat_autoconf.h that is included by compat.h. This header would have to
[...]
I should have checked that a line doesn't begin with #... nevertheless: "define/undef all preprocessor variables used to configure batman-adv features".
Applied in revision b3d474c.
Thanks, Marek
On Monday, December 05, 2011 03:10:45 Sven Eckelmann wrote:
Distributions like Gentoo and Debian have policies which make it necessary to use some kind of environmental variable to control the parallel build.
Applied in revision 63b3c66.
Thanks, Marek
b.a.t.m.a.n@lists.open-mesh.org