FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SmartisanOS_Kernel_Source/scripts/headers_install.pl at master · z1n/SmartisanOS_Kernel_Source · GitHub
z1n
/
SmartisanOS_Kernel_Source
Public
forked from
SmartisanTech/SmartisanOS_Kernel_Source
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SmartisanOS_Kernel_Source
/
scripts
/
headers_install.pl
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (52 loc) · 1.79 KB
Breadcrumbs
SmartisanOS_Kernel_Source
/
scripts
/
headers_install.pl
Copy path
File metadata and controls
58 lines (52 loc) · 1.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
!/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...]
#
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;
my
(
$readdir
,
$installdir
,
$arch
,
@files
) =
@ARGV
;
my
$unifdef
=
"
scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__
"
;
foreach
my
$file
(
@files
) {
my
$tmpfile
=
"
$installdir
/
$file
.tmp
"
;
open
(
my
$in
,
'
<
'
,
"
$readdir
/
$file
"
)
or
die
"
$readdir
/
$file
:
$!
\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;
Back
|
FazBrowse Home
|
New Git URL