mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
![David Howells](/assets/img/avatar_default.png)
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>
60 lines
1.8 KiB
Perl
60 lines
1.8 KiB
Perl
#!/usr/bin/perl -w
|
|
#
|
|
# headers_install prepare the listed header files for use in
|
|
# user space and copy the files to their destination.
|
|
#
|
|
# Usage: headers_install.pl readdir installdir arch [files...]
|
|
# installdir: dir to install the files to
|
|
# arch: current architecture
|
|
# arch is used to force a reinstallation when the arch
|
|
# changes because kbuild then detect a command line change.
|
|
# files: list of files to check
|
|
#
|
|
# Step in preparation for users space:
|
|
# 1) Drop all use of compiler.h definitions
|
|
# 2) Drop include of compiler.h
|
|
# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
|
|
|
|
use strict;
|
|
|
|
my ($installdir, $arch, @files) = @ARGV;
|
|
|
|
my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
|
|
|
|
foreach my $filename (@files) {
|
|
my $file = $filename;
|
|
$file =~ s!^.*/!!;
|
|
|
|
my $tmpfile = "$installdir/$file.tmp";
|
|
|
|
open(my $in, '<', $filename)
|
|
or die "$filename: $!\n";
|
|
open(my $out, '>', $tmpfile)
|
|
or die "$tmpfile: $!\n";
|
|
while (my $line = <$in>) {
|
|
$line =~ s/([\s(])__user\s/$1/g;
|
|
$line =~ s/([\s(])__force\s/$1/g;
|
|
$line =~ s/([\s(])__iomem\s/$1/g;
|
|
$line =~ s/\s__attribute_const__\s/ /g;
|
|
$line =~ s/\s__attribute_const__$//g;
|
|
$line =~ s/\b__packed\b/__attribute__((packed))/g;
|
|
$line =~ s/^#include <linux\/compiler.h>//;
|
|
$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
|
|
$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
|
|
$line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
|
|
printf {$out} "%s", $line;
|
|
}
|
|
close $out;
|
|
close $in;
|
|
|
|
system $unifdef . " $tmpfile > $installdir/$file";
|
|
# unifdef will exit 0 on success, and will exit 1 when the
|
|
# file was processed successfully but no changes were made,
|
|
# so abort only when it's higher than that.
|
|
my $e = $? >> 8;
|
|
if ($e > 1) {
|
|
die "$tmpfile: $!\n";
|
|
}
|
|
unlink $tmpfile;
|
|
}
|
|
exit 0;
|