mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 16:54:20 +08:00
db1bec4f52
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>
46 lines
1.4 KiB
Perl
46 lines
1.4 KiB
Perl
#!/usr/bin/perl
|
|
#
|
|
# 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...]
|
|
# readdir: dir to open files
|
|
# installdir: dir to install the files
|
|
# 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;
|
|
use warnings;
|
|
|
|
my ($readdir, $installdir, $arch, @files) = @ARGV;
|
|
|
|
my $unifdef = "scripts/unifdef -U__KERNEL__";
|
|
|
|
foreach my $file (@files) {
|
|
my $tmpfile = "$installdir/$file.tmp";
|
|
open(my $infile, '<', "$readdir/$file")
|
|
or die "$readdir/$file: $!\n";
|
|
open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n";
|
|
while (my $line = <$infile>) {
|
|
$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/^#include <linux\/compiler.h>//;
|
|
printf $outfile "%s", $line;
|
|
}
|
|
close $outfile;
|
|
close $infile;
|
|
system $unifdef . " $tmpfile > $installdir/$file";
|
|
unlink $tmpfile;
|
|
}
|
|
exit 0;
|