If headers_install is executed from a deep/long directory structure, the
shell's maximum argument length can be execeeded, which breaks the operation
with:
| make[2]: execvp: /bin/sh: Argument list too long
| make[2]: ***
Instead of passing each files name with the entire path, I give only the file
name without the source path and give this path as a new argument to
headers_install.pl.
Because there is three possible paths, I have tree input-files list, one per
path.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Remove perl from make headers_install by replacing a perl script (doing a
simple regex search and replace) with a smaller, faster, simpler,
POSIX-2008 shell script implementation. The new shell script is a single
for loop calling sed and piping its output through unifdef to produce the
target file.
Same as last time except for minor tweak to deal with code review from
here: http://lkml.indiana.edu/hypermail/linux/kernel/1302.3/00078.html
(Note that this drops the "arch" argument, which isn't used. Kbuild
already points to the right input files on the command line.)
Signed-off-by: Rob Landley <rob@landley.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: David Howells <dhowell@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Commit 10b63956 ("UAPI: Plumb the UAPI Kbuilds into the user header
installation and checking") introduced a dependency of make 3.81
due to use of $(or ...)
We do not want to lift the requirement to gmake 3.81 just yet...
Included are a straightforward conversion to $(if ...)
Bisected-and-tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: <stable@vger.kernel.org> [v3.7+]
Signed-off-by: Michal Marek <mmarek@suse.cz>
Commit 10b63956fc which plumbed in UAPI
broke the destination-y functionality of scripts/Makefile.headersinst.
The variable destination-y is used in a := assignment and so is expanded at
declaration time, and the include of the Kbuild fragments that set
destination-y to something is after this time, so it now always expands empty.
There are no in-tree users of destination-y, but it allows any
Kbuild-fragment to redirect where headers are installed.
Just move the assignment of the variable that uses it below the include
of the Kbuild fragment.
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Plumb the UAPI Kbuilds into the user header installation and checking system.
As the headers are split the entries will be transferred across from the old
Kbuild files to the UAPI Kbuild files.
The changes made in this commit are:
(1) Exported generated files (of which there are currently four) are moved to
uapi/ directories under the appropriate generated/ directory, thus we
get:
include/generated/uapi/linux/version.h
arch/x86/include/generated/uapi/asm/unistd_32.h
arch/x86/include/generated/uapi/asm/unistd_64.h
arch/x86/include/generated/uapi/asm/unistd_x32.h
These paths were added to the build as -I flags in a previous patch.
(2) scripts/Makefile.headersinst is now given the UAPI path to install from
rather than the old path.
It then determines the old path from that and includes that Kbuild also
if it exists, thus permitting the headers to exist in either directory
during the changeover.
I also renamed the "install" variable to "installdir" as it refers to a
directory not the install program.
(3) scripts/headers_install.pl is altered to take a list of source file paths
instead of just their names so that the makefile can tell it exactly
where to find each file.
For the moment, files can be obtained from one of four places for each
output directory:
.../include/uapi/foo/
.../include/generated/uapi/foo/
.../include/foo/
.../include/generated/foo/
The non-UAPI paths will be dropped later.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
Remove the objhdr-y export list as it is no longer used. genhdr-y should be
used instead.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
Generated asm headers are supposed to live in
arch/*/include/generated/asm, but objhdr-y expect them to live in the
same directory they are generated in. Instead of trying to cut that
particular Gordian knot, introduce genhdr-y that takes this into
account; the sole user of objhdr-y, linux/version.h, should be
migrated over at some later date.
Suggested-by: David Woodhouse <dwmw2@infradead.org>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
There is an increasing amount of header files
shared between individual architectures in asm-generic.
To avoid a lot of dummy wrapper files that just
include the corresponding file in asm-generic provide
some basic support in kbuild for this.
With the following patch an architecture can maintain
a list of files in the file arch/$(ARCH)/include/asm/Kbuild
To use a generic file just add:
generic-y += <name-of-header-file.h>
For each file listed kbuild will generate the necessary
wrapper in arch/$(ARCH)/include/generated/asm.
When installing userspace headers a wrapper is likewise created.
The original inspiration for this came from the unicore32
patchset - although a different method is used.
The patch includes several improvements from Arnd Bergmann.
Michael Marek contributed Makefile.asm-generic.
Remis Baima did an intial implementation along to achive
the same - see https://patchwork.kernel.org/patch/13352/
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>
Tested-by: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Remis Lima Baima <remis.developer@googlemail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
xtensa and arm have asked for a possibility to export headers
and locate them in a specific directory when exported.
Introduce destiantion-y to support this.
This patch in additiona adds some limited
documentation for the variables used for exported headers.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Oskar Schirmer <os@emlix.com>
Cc: Mikael Starvik <mikael.starvik@axis.com>
We see some header files that are selected dependent on
the actual architecture so force a reinstallation
of all header files when the arch changes.
This slows down "make headers_check_all" but then
we better reflect reality.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Move the core functionality of headers_install
and headers_check to two small perl scripts.
The makefile is adapted to use the perl scrip and
changed to operate on all files in a directory.
So if one file is changed then all files in the
directory is processed.
perl were chosen for the helper scripts because this
is pure text processing which perl is good at and
especially the headers_check.pl script are expected to
see changes / new checks implmented.
The speed is ~300% faster on this box.
And the output generated to the screen is now down to
two lines per directory (one for install, one for check)
so it is easier to scroll back after a kernel build.
The perl scripts has been brought to sanity by patient
feedback from: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Move it to the top-level file to decide if we install/check
the generic headers or the arch specific headers.
This revealed a long standing bug where "make headers_check_all"
relied on the files in asm/ for the current architecture.
So make headers_check_all is now broken by this commit.
In addition:
o add a simpler way to detect if an arch support
exporting header files.
o add 'set -e;' so we error out early if
make headers_check_all fails.
o add sparc64 and cris to arch we do not process
in make headers_*_all because:
sparc64 - use sparc to export headers
cris - is know seriously broken
Includes suggestions from: David Woodhouse
<dwmw2@infradead.org>.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: David Woodhouse <dwmw2@infradead.org>
ALTARCH is no longer used by any arch(*) so drop
support for this from Makefile.headerinst
Dropping ALTARCH support simplifies Makefile.headerinst
(*) sparc64 uses it but work is ongoing to drop it
and no furter usage is planned.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: David Miller <davem@davemloft.net>
unifdef utility is fast enough to warrant that we always
run the scripts through unifdef.
This patch runs all headers listed with header-y and unifdef-y
through unifdef.
Next step is to drop unifdef-y in all Kbuild files and
that can now be done in smaller steps.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Adrian Bunk <bunk@kernel.org>
The sed expression used at the moment in scripts/Makefile.headersinst
relies on the (handy) GNU extension where you can escape ERE's in an
otherwise BRE without using the GNU -r option. The following patch
replaces this "\+" usage with a functionally equivalent POSIX BRE compliant
"\{1,\}". Tested with `make headers_install` against blackfin/x86_64/i386
targets.
Stupid whiny OS X users and their crappy sed ;)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
A bug in headers_install for ARCH=x86_64 yields an asm/ directory full of
files all of which are using the same #ifdef guard, "__ASM_STUB_" with no
postfix. So the second and later asm files #included in the same C file
(often through standard headers like ioctl.h) yields no symbols.
Strangeness with the Ubuntu 'tell me if I support something that's not
explcitly mentioned in POSIX, and I'll strip it out' shell, I believe.
We don't need the 'export' but we do need a semicolon at the end of the
FNAME line:
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This should make it stop immediately after printing the _helpful_ error
message, rather than continuing to spit out many pages more of 'CHECK
include/linux/foo.h' before eventually coming to a halt with something
less obvious.
Now I get this...
CHECK include/linux/smb_fs.h
/shiny/git/linux-2.6/usr/include/linux/smb_fs.h requires linux/jiffies.h, which does not exist in exported headers
make[2]: *** [/shiny/git/linux-2.6/usr/include/linux/.check.smb_fs.h] Error 1
make[1]: *** [linux] Error 2
make: *** [headers_check] Error 2
Signed-off-by-if-Sam-says-so: David Woodhouse <dwmw2@infradead.org>
[ Sam had better say so! This made me waste way too much time. - Linus]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The current filename->define translation does not scrub dashes so when
creating stub defines for like asm-x86_64/ptrace-abi.h, we get: #define
__ASM_STUB_PTRACE-ABI_H
gcc just hates that sort of thing :)
trivial attached patch adds - to the tr list to scrub it to _
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Don't require that scripts/hdrcheck.sh be executable - shit happens...
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* git://git.infradead.org/~dwmw2/khdrs-2.6:
New 'make headers_install_all' target.
Use dependencies for 'make headers_install'.
[S390] Unexport <asm/z90crypt.h>, export <asm/zcrypt.h> in its place.
Remove dead netfilter_logging.h from include/linux/Kbuild
Remove offsetof() from user-visible <linux/stddef.h>
Clean up exported headers on CRIS
Fix v850 exported headers
Don't advertise (or allow) headers_{install,check} where inappropriate.
Remove UML header export
Remove ARM26 header export.
Fix H8300 exported headers.
Fix m68knommu exported headers
Fix exported headers for SPARC, SPARC64
Fix 'make headers_check' on m32r
Fix 'make headers_check' on sh64
Fix 'make headers_check' on sh
[HEADERS] Fix ARM 'make headers_check'
Initial pass of manual conflict resolution in top-level Makefile over
conflicting build rule and headers_install changes.
Re-export header files only if either they or their controlling Kbuild
file has actually changed. Also allow for similar dependencies with
'headers_check', once we properly create the dependencies for those.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
We generate an <asm/foo.h> which includes either <asm-$ARCH/foo.h> or
<asm-$ALTARCH/foo.h> as appropriate. But we were doing this dependent on
whether the file in question existed in the _unexported_ tree, not the
exported tree. So if a file was exported to userspace in one asm- directory
but not the other, the generated file in asm/ was incorrect.
This only changed the failure mode if it _was_ included from a nice #error to
a less explicable #include failure -- but it also gave false errors in 'make
headers_check' output. Fix it by looking in the right place instead.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Based on the 'headers_install' target, this performs a basic sanity check
on the exported headers -- so far only checking that they do not include
any other headers which aren't selected for import, but easily extendable.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This adds a make target which exports a subset of headers which contain
definitions which are useful for system libraries and tools. It uses the
BSD 'unifdef' tool to remove instances of #ifdef __KERNEL__, and uses
sed to remove markers like __user.
Based on an original implementation by Arnd Bergmann <arnd@arndb.de>
Hacked about by David Woodhouse <dwmw2@infradead.org>
Reviewed and cleaned up by Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>