The module alias support in the kernel have a consistency
check where it is checked that the size of a structure
in the kernel and on the build host are the same.
For cross builds this check does not make sense so detect
when we do cross builds and silently skip the check in these
situations.
This fixes a build bug for a wireless driver when cross building
for arm.
Acked-by: Michael Buesch <mb@bu3sch.de>
Tested-by: Gordon Farquharson <gordonfarquharson@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: stable@kernel.org
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
kbuild: explain why DEBUG_SECTION_MISMATCH is UNDEFINED
kbuild: fix building vmlinux.o
kbuild: allow -fstack-protector to take effect
kconfig: fix select in combination with default
Ingo Molnar wrote:
>
> i've got a build log from a weird build error below:
>
> LD init/built-in.o
> distcc[12023] ERROR: compile (null) on localhost failed
> make: *** [vmlinux.o] Error 1
> make: *** Waiting for unfinished jobs....
> LD .tmp_vmlinux1
>
Building vmlinux.o were moved up in the dependency chain so we started
to build it before the kallsym stuff. This was done to let modpost
report section mismatch bugs even when the final link failed.
Originally I had expected the dependency of $(kallsyms.o) to
cover this but it turns out that we need to be even more explicit.
Fix this by adding a conditional dependency on firat target
used in the kallsyms serie of builds.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>
Arjan van de Ven <arjan@infradead.org> wrote:
===
I just read the excellent LWN writeup of the vmsplice
security thing, and that got me wondering why this attack
wasn't stopped by the CONFIG_CC_STACKPROTECTOR option...
because it plain should have been...
Some analysis later.. it turns out that the following line
in the top level Makefile, added by you in October 2007,
entirely disables CONFIG_CC_STACKPROTECTOR ;(
With this line removed the exploit will be nicely stopped.
CFLAGS += $(call cc-option, -fno-stack-protector)
Now I realize that certain distros have patched gcc to
compensate for their lack of distro wide CFLAGS, and it's
great to work around that... but would there be a way to NOT
disable this for CONFIG_CC_STACKPROTECTOR please?
It would have made this exploit not possible for those kernels
that enable this feature (and that includes distros like Fedora)
===
Move the assignment to KBUILD_CFLAGS up before including
the arch specific Makefile so arch makefiles may override
the setting.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: stable@kernel.org
.. and I really need to call it something else. Maybe it is time to
bring back the weasel series, since weasels always make me feel good
about a kernel.
link vmlinux.o so we may report section mismatch bugs before
we start with the real link - that may error out.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Setting the option DEBUG_SECTION_MISMATCH will
report additional section mismatch'es but this
should in the end makes it possible to get rid of
all of them.
See help text in lib/Kconfig.debug for details.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
The output of 'make help' covers a lot of options, but doesn't include
a listing for 'make prepare'. Here's a one-liner to fix that...
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
With this patch I'm able to find the definition of _xmit_lock defined in
include/linux/netdevice.h as follows:
struct net_device {
...
spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
}
Otherwise this counts as definition of ____cacheline_aligned_in_smp.
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
When multiple built-in modules (especially drivers) provide the same
capability, they're prioritized by link order specified by the order
listed in Makefile. This implicit ordering is lost for loadable
modules.
When driver modules are loaded by udev, what comes first in
modules.alias file is selected. However, the order in this file is
indeterministic (depends on filesystem listing order of installed
modules). This causes confusion.
The solution is two-parted. This patch updates kbuild such that it
generates and installs modules.order which contains the name of
modules ordered according to Makefile. The second part is update to
depmod such that it generates output files according to this file.
Note that both obj-y and obj-m subdirs can contain modules and
ordering information between those two are lost from beginning.
Currently obj-y subdirs are put before obj-m subdirs.
Sam Ravnborg cleaned up Makefile modifications and suggested using awk
to remove duplicate lines from modules.order instead of using separate
C program.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Bill Nottingham <notting@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Jon Masters <jonathan@jonmasters.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Add missing $(srctree)/ prefix for scripts used by the includecheck and
versioncheck make targets
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Add 'includecheck' to the Static analyzers help list.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Change two occurances of "behavour" to "behaviour".
Signed-off-by: Linus Nilsson <lajnold@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The check introduced in commit:
4f1127e204 "kbuild: fix
infinite make recursion"
caused certain external modules not to build and
also caused 'make targz-pkg' to fail.
This is a minimal fix so we revert to previous
behaviour - but we do not overwrite the Makefile
in the top-level directory.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Jay Cliburn <jacliburn@bellsouth.net>
Cc: Jay Cliburn <jacliburn@bellsouth.net>
Jan Altenberg <jan.altenberg@linutronix.de> reported that
building with redirected input like this failed:
make O=dir oldconfig bzImage < /dev/null
The problem were caused by a make silentoldconfig being
run before oldconfig and with a non-recent .config the build
failed because silentoldconfig requires non-redirected stdin.
Silentoldconfig was run as a side-effect of having the
top-level Makefile re-made by make.
Introducing an empty rule for the top-level Makefile
(and Kbuild.include) fixed the issue.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Simplify "make ARCH=x86" and fix kconfig so we again
can set 64BIT in all.config.
For a fix the diffstat is nice:
6 files changed, 3 insertions(+), 36 deletions(-)
The patch reverts these commits:
0f855aa64b
-> kconfig: add helper to set config symbol from environment variable
2a113281f5
-> kconfig: use $K64BIT to set 64BIT with all*config targets
Roman Zippel pointed out that kconfig supported string
compares so the additional complexity introduced by the
above two patches were not needed.
With this patch we have following behaviour:
# make {allno,allyes,allmod,rand}config [ARCH=...]
option \ host arch | 32bit | 64bit
=====================================================
./. | 32bit | 64bit
ARCH=x86 | 32bit | 32bit
ARCH=i386 | 32bit | 32bit
ARCH=x86_64 | 64bit | 64bit
The general rule are that ARCH= and native architecture
takes precedence over the configuration.
So make ARCH=i386 [whatever] will always build a 32-bit
kernel no matter what the configuration says.
The configuration will be updated to 32-bit if it was
configured to 64-bit and the other way around.
This behaviour is consistent with previous behaviour so
no suprises here.
make ARCH=x86 will per default result in a 32-bit kernel
but as the only ARCH= value x86 allow the user to select
between 32-bit and 64-bit using menuconfig.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Andreas Herrmann <aherrman@arcor.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
The x86 merge modified the tags target to handle the two separate
source directories. Remove it now that i386/x86_64 are gone completely.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
After unification of the Kconfig files and
introducing K64BIT support in kconfig
it required only trivial changes to enable
"make ARCH=x86".
With this patch you can build for x86_64 in several ways:
1) make ARCH=x86_64
2) make ARCH=x86 K64BIT=y
3) make ARCH=x86 menuconfig
=> select 64-bit
Likewise for i386 with the addition that
i386 is default is you say ARCH=x86.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
For x86 ARCH may say i386 or x86_64 and soon x86.
Rely on CONFIG_X64_32 to select between 32/64 or just
hardcode the value as appropriate.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Too many people have CFLAGS set to support building userspace.
And now Kbuild picks up CFLAGS this caused troubles.
Although people should realise that setting CFLAGS has
a 'global' effect the impact on the kernel build is a suprise.
So change kbuild to pick up value from KCFLAGS that is
much less used.
When kbuild pick up a value it will warn like this:
Makefile:544: "WARNING: Appending $KCFLAGS (-O3) from environment to kernel $CFLAGS"
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Bächler <thomas@archlinux.org>
Cc: David Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@redhat.com>
When configuring the kernel natively the uname matching is off,
so fix up the uname mangling to get the proper SUBARCH. Needs
an explicit range so that SH-5 doesn't break.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Moving the ARCH specific Makefiles for i386 and x86_64
required a litle bit tweaking in the top-lvel Makefile.
SRCARCH is now set in the top-level Makefile
because we need this info to include the correct
arch Makefile.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
The patch is big. Really big. You just won't believe how vastly hugely
mindbogglingly big it is. I mean you may think it's a long way down the
road to the chemist, but that's just peanuts to how big the patch from
2.6.23 is.
But it's all good.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
depmod from module-init-tools 3.3-pre2 are reported
to work fine in cross build.
depmod from module-init-tools 3.1-pre5 are known to SEGV
Do not workaround older module-init-tools bugs here.
The right fix is for users to upgrade module-init-tools.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
make vmlinux would delete the content of $(MODVERDIR)
equals .tmp_versions. This caused a subsequent
make modules_install to fail.
Fix it so we clean the directory only for the
modules build - but we still unconditionally create it so
we can do:
make dir/file.ko
without a preceeding make modules.
Reported by David Miller <davem@davemloft.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: David Miller <davem@davemloft.net>
This removes a syntax error (seen building on Ubuntu Feisty).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
kbuild: fix first module build
kconfig: update kconfig-language text
kbuild: introduce cc-cross-prefix
kbuild: disable depmod in cross-compile kernel build
kbuild: make deb-pkg - add 'Provides:' line
kconfig: comment typo in scripts/kconfig/Makefile.
kbuild: stop docproc segfaulting when SRCTREE isn't set.
kbuild: modpost problem when symbols move from one module to another
kbuild: cscope - filter out .tmp_* in find_sources
kbuild: mailing list has moved
kbuild: check asm symlink when building a kernel
When building a specific module before doing a total kernel
build it failed because $(MORVERDIR) were missing.
Creating the MODVERDIR explicit (independent of KBUILD_MODULES)
fixed this. As a side-effect the MODVERDIR will be created
also for a non-module build - but no harm done by that.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Begin infrastructure for kernel code samples in the samples/ directory.
Add its Kconfig and Kbuild files.
Source its Kconfig file in all arch/ Kconfigs.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
When building embedded systems in a cross-compile environment and
populating a target's file system image, we don't want to run the
depmod on the host as we may be building for a completely different
architecture. Since there's no such thing as a cross-depmod, we
just disable running depmod in the cross-compile case and we just
run depmod on the target at bootup.
Inspired by patches from Christian, Armin and Deepak.
This solves: http://bugzilla.kernel.org/show_bug.cgi?id=3881
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Christian Bjølevik <nafallo@magicalforest.se>
Cc: Deepak Saxena <dsaxena@mvista.com> and
Cc: Armin Kuster <akuster@mvista.com>,