As noted in the previous commit a Linux kernel module's
Makefile will be read twice, during initial GNU make run,
and later for when the kernel will build the external module.
Variables that require path consideration must address in
which context it needs to be defined and do so by detecting
at which run time case it wants to instantiate variables. In
our case we want to ensure that both COMPAT_CONFIG and
COMPAT_AUTOCONF are defined within the context of the
directory of the external module we are building as otherwise
GNU Make will try to treat it as part of the kernel's build
directory's files.
We already have COMPAT_CONFIG and COMPAT_AUTOCONF defined
under a ifeq ($(KERNELRELEASE),) check, we now just need
to add the directory context and then remove the other
now superfluous uses of the $(PWD).
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
compat: move definition of COMPAT_CONFIG and COMPAT_AUTOCONF
The Makefile for external modules are read twice, once during
the initial make command, and then later to build the modules
target *by the kernel*. This ensures that we define the variables
COMPAT_CONFIG and COMPAT_AUTOCONF are only defined once.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
We broke parallel builds by breaking GNU Make's heuristics.
GNU Make does not whether or not target commands are sub-make
commands or not, these must be explicitly annotated. To tell
GNU Make that target command is going to be a sub-process
we can use the $(MAKE) variable for a command. Another option
is to tell GNU Make that a target command is *not* a sub-make
command instead explicitly by prepending a command with a plus,
"+" prior to the command. This will force GNU Make to avoid
supporting certain flags for those targets but more importantly,
it will also ensure that during execution of commands that are
*not* sub-make commands it will yield the jobserver to ensure
file descriptor / job sanity.
Annotate to GNU Make two commands that we issue are *not* sub-make
commands. This avoids stop the job server for these commands but
also allows GNU Make to figure out the heuristics to run the job
server for further sub-make commands -- in this case the recursive
call to make.
Reported-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
modpost, the second part of module building, does not
use NOSTDINC_FLAGS and friends so all the hackery we did
to use it to prefer our header files and include compat-2.6.h
will not work during modpost for older kernels. We don't really
need all that stuff during modpost even for newer kernels so
just avoid it all together.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
compat: fix compilation warning for compat_firmware_class on 2.6.26
This fixes this compilation issue:
CC [M] /home/mcgrof/compat/compat/compat_firmware_class.o
/home/mcgrof/compat/compat/compat_firmware_class.c:24:0: warning: "to_dev" redefined
include/linux/input.h:1218:0: note: this is the location of the previous definition
/home/mcgrof/compat/compat/compat_firmware_class.c:24:0: warning: "to_dev" redefined
include/linux/input.h:1218:0: note: this is the location of the previous definition
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
The variables wasn't being set in shell. By defining
the variables in shell and outputing them once onto
a .config we avoid having to do release kernel checks
every single time.
This adds a series of CONFIG_COMPAT_${RHEL_MAJOR}_${i} tags
for each known RHEL version that we supercede. I cannot
verify if this is correct but this is my translation of
this to script:
compat: fix few compilations by adding compat_autoconf.h support
The Makefile was generating the appropriate CONFIG_COMPAT_KERNEL_*
variables for our Makefiles but this was being ignored by C files
as compat had no compat_autoconf.h being generated. This patch
addresses this but also puhes out the CONFIG_COMPAT_KERNEL_* variable
generation to scripts. We have now two scripts:
scripts/gen-compat-config.sh - generates .config for Makefile propagation
scripts/gen-compat-autoconf.sh - generates compat_autoconf.h for code propagation
This fixes running ckmake on older kernels. This issue was present
only on compat and not compat_wireless as compat_wireless was generating
its own compat_autoconf.h. This fixes compilation against some older
kernels of just the compat module alone. Some work is still required
for some newer and really ancient kernels:
This commit moved atomic_t and atomic64_t to a generic
place, but some archs already had it defined. Just include
that header for the archs that had it.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
The CONFIG_PHYS_ADDR_T_64BIT was added as of v2.6.28-rc1~271^2^4~6,
this is either u32 or u64 dependent on 64BIT || ARCH_PHYS_ADDR_T_64BIT.
The ARCH_PHYS_ADDR_T_64BIT allows architectures to override the
value even if the platform does not have CONFIG_64BIT. We simplify
this check by just checking for all known architecture variables and
also the CONFIG_64BIT -- but we skip adding this if the arch is
x86 or PPC which already had phys_addr_t.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
This adds get-compat-kernels, a utility that is intended
to be Linux distribution agnostic that downloads and installs
all kernel headers for all supported kernel releases of compat.
You also have the option of specifying you want to also install
the actual kernel image (get-compat-kernels -i).
We start off by adding support for Ubuntu on x86_64 as that
is what a few of us maintaining compat and compat-wireless run.
Just for kernel headers (default run of get-compat-kernels),
you'll need currently 205 M of hard drive space.
Once done with running get-compat-kernels, you can then
start running ckmake to verify your compat kernel changes
won't bust compilation against any known supported kernel.
I'd like to start requiring runs against this script for
patch submissions. Eventually we can try to add the same
runs against compat-wireless so we can verify integrity
against compilation for different kernel versions.
Support for different Linux distributios is welcomed.
John W. Linville [Thu, 26 Jan 2012 18:00:56 +0000 (13:00 -0500)]
compat: use kconfig.h in compat-2.6.h for 3.1 and later kernels
This file was introduced in commit 2a11c8ea20bf850b3a2c60db8c2e7497d28aba99
and included in 3.1 and later kernels. It includes <generated/autoconf.h>
itself, as well as some other definitions that are used elsewhere.
Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Hauke Mehrtens [Thu, 26 Jan 2012 22:51:45 +0000 (23:51 +0100)]
compat: move br_port_exists() to compat-2.6.36.h
br_port_exists() was moved to a new compat-*.h file for every new
kernel release, as it is not in mainline. This patch moves it to compat-
2.6.36.h so it has not to be moved any more for a new kernel version.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Hauke Mehrtens [Sat, 3 Dec 2011 14:49:25 +0000 (15:49 +0100)]
compat: add config var for CORDIC and CRC8
Sometimes the kernel version compat-wireless is build against has
support for cordic and crc8 in its source, but these modules were not
build when the kernel was build, because no one selected them. The modules are
needed for the bcmsmac driver and they should be build every time when
they were not already build while the kernel was build.
linux/security.h needs to be included before the dummy function overrides it,
otherwise the macro that redirects it to the compat version will apply to
the kernel function as well, causing multiple conflicting definitions
John W. Linville [Fri, 18 Nov 2011 20:52:44 +0000 (15:52 -0500)]
compat: implement dummy security_sk_clone
This has been defined in include/linux/security.h for some time, but was
only given an EXPORT_SYMBOL for 3.1. Add a compat_* definition to avoid
breaking the module load with an undefined symbol.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Hauke Mehrtens [Thu, 17 Nov 2011 23:05:45 +0000 (00:05 +0100)]
compat: backport kfree_rcu()
This adds a nested function everywhere kfree_rcu() was called. This
function frees the memory and is given as a function to call_rcu().
The kfree_rcu define was made by Johannes Berg.
The rcu callback could happen every time also after the module was
unloaded and this will cause problems.
A rcu_barrier() was added into every module_exit so that this will not
be called after the module was unloaded.
The define overwriting module_exit is based on the original module_exit
which looks like this:
/* This is only required if you want to be unloadable. */
/#define module_exit(exitfn) \
static inline exitcall_t __exittest(void) \
{ return exitfn; } \
void cleanup_module(void) __attribute__((alias(#exitfn)));
We replaced the call to the actual function exitfn() with a call to our
function which calls the original exitfn() and then rcu_barrier()
As a module will not be unloaded that ofter it should not have a big
performance impact when rcu_barrier() is called on every module exit,
also when no kfree_rcu() backport is used in that module.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> CC: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
John W. Linville [Thu, 17 Nov 2011 22:20:42 +0000 (17:20 -0500)]
compat: support RHEL6 as a build target
This patch enables compatibility with RHEL6 as a build target, mostly
with simple tricks similar to what was added for compatibility with
Debian Squeeze.
Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
John W. Linville [Thu, 17 Nov 2011 22:20:41 +0000 (17:20 -0500)]
compat: check CONFIG_COMPAT_FIRMWARE_CLASS in compat-2.6.33.h
If a pre-2.6.33 kernel has backported suitable firmware loader
functionality, then it doesn't need the compat_firmware_class. In that
case, compat-2.6.33 should not redefine the *_firmware function names.
Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Some kernels have versions of (struct bin_attribute)->{read,write}
that require a struct file * as their first argument. This change
accommodates them in the firmware loader class.
Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Hauke Mehrtens [Tue, 8 Nov 2011 20:46:31 +0000 (21:46 +0100)]
compat: add some workarounds for Debian squeeze
Debian squeeze also backports some stuff and this conflicts with compat
wireless stuff. This is a nice way of making compat work with debian
squeeze without breaking normal kernels.
Hauke Mehrtens [Sun, 6 Nov 2011 21:25:03 +0000 (22:25 +0100)]
compat: backport system_nrt_wq
The workqueue system_nrt_wq is not available in kernel version < 2.6.36.
This backport code creates such a queue but this old kernel does not
have WQ_NON_REENTRANT, so we use a single threaded queue instead as it
should meat the same restrictions.
Hauke Mehrtens [Tue, 4 Oct 2011 11:11:47 +0000 (13:11 +0200)]
compat: add linux/of.h just when CONFIG_OF is set.
In kernel < 2.6.34 linux/of.h unconditionally includes asm/prom.h which
is not available on all architectures. In newer kernel versions this is
just included if CONFIG_OF is set. For these old kernel just include
linux/of.h when CONFIG_OF is set. This fixes a compile problem with
ath6kl as it uses linux/of.h only when CONFIG_OF is set.
Hauke Mehrtens [Tue, 23 Aug 2011 11:38:28 +0000 (13:38 +0200)]
compat: pm_qos_params.h was renamed to pm_qos.h
pm_qos.h was renamed to pm_qos_params.h in:
commit 1eee4691c3f058d1cf9757947ad9d9e03145a12c
Author: Jean Pihet <j-pihet@ti.com>
Date: Thu Aug 18 10:31:55 2011 +0200
PM QoS: Move and rename the implementation files
For older kernel versions the old header file should be used instead of the new one.
Pavel Roskin [Wed, 29 Jun 2011 22:01:10 +0000 (18:01 -0400)]
Signed-off-by: Pavel Roskin <proski@gnu.org>
set_irq_probe() and set_irq_probe() are missing on Linux 2.6.24, so the
code won't compile. compat-wireless doesn't need those functions. Keep
the functions for Linux 2.6.25 and newer for other compat packages.
Pavel Roskin [Wed, 29 Jun 2011 20:47:15 +0000 (16:47 -0400)]
Signed-off-by: Pavel Roskin <proski@gnu.org>
Debian backports netdev_name as a function. As we cannot test if a
function is present, use an equivalent macro.
Reported by Sivaraman V <krusna@gmail.com> and Alex <alex9434@gmail.com>
Hauke Mehrtens [Thu, 9 Jun 2011 22:04:44 +0000 (00:04 +0200)]
compat: add device name in register_netdevice(dev)
dev_alloc_name() is not called explicitly in the driver code any more,
but it is done in register_netdevice(). This causes devices getting
wrong names like "wlan%d". With this patch they get names like wlan0
again.
Hauke Mehrtens [Sun, 22 May 2011 10:47:34 +0000 (12:47 +0200)]
compat: remove wrong backport of kfree_rcu
Backporting kfree_rcu() in compat does not work as
struct rcu_head->func is always interpreted as a pointer in older
kernel versions, but when using kfree_rcu() it is set to an offset.
rcu_head->func is used in some functions in the kernel not backported
by compat-wireless.
In older kernel versions in __rcu_reclaim just the else path is available.