blob: 2bee4ec43eb69e1419000d7b77b573d90fb4c8cf [file] [log] [blame]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -07001# this module contains all the defaults used by the generation of cleaned-up headers
2# for the Bionic C library
3#
4
5import time, os, sys
6from utils import *
7
8# the list of supported architectures
9#
Shin-ichiro KAWASAKI37429ff2009-07-01 15:41:52 +090010kernel_archs = [ 'arm', 'x86', 'sh' ]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070011
12# the list of include directories that belong to the kernel
13# tree. used when looking for sources...
14#
15kernel_dirs = [ "linux", "asm", "asm-generic", "mtd" ]
16
17# path to the directory containing the original kernel headers
18#
David 'Digit' Turnerfc269312010-10-11 22:11:06 +020019kernel_original_path = os.path.normpath( find_program_dir() + '/../../../../external/kernel-headers/original' )
20
21# path to the default location of the cleaned-up headers
22#
23kernel_cleaned_path = os.path.normpath( find_program_dir() + '/..' )
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070024
25# a special value that is used to indicate that a given macro is known to be
26# undefined during optimization
27kCppUndefinedMacro = "<<<undefined>>>"
28
29# this is the set of known macros we want to totally optimize out from the
30# final headers
31kernel_known_macros = {
32 "__KERNEL__": kCppUndefinedMacro,
33 "__KERNEL_STRICT_NAMES":"1",
34 "__CHECKER__": kCppUndefinedMacro,
35 "__CHECK_ENDIAN__": kCppUndefinedMacro,
36 }
37
38# define to true if you want to remove all defined(CONFIG_FOO) tests
39# from the clean headers. testing shows that this is not strictly necessary
40# but just generates cleaner results
41kernel_remove_config_macros = True
42
The Android Open Source Project4e468ed2008-12-17 18:03:48 -080043# maps an architecture to a set of default macros that would be provided by
44# toolchain preprocessor
45kernel_default_arch_macros = {
46 "arm": {},
47 "x86": {"__i386__": "1"},
48 }
49
Martin Storsjoc9205db2010-12-08 11:39:05 +010050# Replace tokens in the output according to this mapping
51kernel_token_replacements = {
David 'Digit' Turnerb969b5a2011-01-11 17:23:10 +010052 "asm": "__asm__",
Martin Storsjoc9205db2010-12-08 11:39:05 +010053 }
54
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070055# this is the set of known static inline functions that we want to keep
56# in the final ARM headers. this is only used to keep optimized byteswapping
57# static functions and stuff like that.
58kernel_known_arm_statics = set(
59 [ "___arch__swab32", # asm-arm/byteorder.h
60 ]
61 )
62
63kernel_known_x86_statics = set(
64 [ "___arch__swab32", # asm-x86/byteorder.h
65 "___arch__swab64", # asm-x86/byteorder.h
66 ]
67 )
68
Shin-ichiro KAWASAKI37429ff2009-07-01 15:41:52 +090069kernel_known_sh_statics = set(
70 [ "___arch__swab16", # asm-sh/byteorder.h
71 "___arch__swab32", # asm-sh/byteorder.h
72 "___arch__swab64", # asm-sh/byteorder.h
73 "__FD_ZERO", # asm-sh/posix_types_32/64.h
74 "__FD_SET", # asm-sh/posix_types_32/64.h
75 ]
76 )
77
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070078kernel_known_generic_statics = set(
79 [ "__invalid_size_argument_for_IOC", # asm-generic/ioctl.h
80 "__cmsg_nxthdr", # linux/socket.h
81 "cmsg_nxthdr", # linux/socket.h
82 "ipt_get_target",
Vilmos Nebehajc1a534b2010-06-28 15:13:23 +020083 "ip6t_get_target",
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070084 ]
85 )
86
87# this maps an architecture to the set of static inline functions that
88# we want to keep in the final headers
89#
90kernel_known_statics = {
91 "arm" : kernel_known_arm_statics,
Shin-ichiro KAWASAKI37429ff2009-07-01 15:41:52 +090092 "x86" : kernel_known_x86_statics,
93 "sh" : kernel_known_sh_statics
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070094 }
95
The Android Open Source Project6d6c82c2009-01-09 17:50:54 -080096# this is a list of macros which we want to specifically exclude from
97# the generated files.
98#
99kernel_ignored_macros = set(
100 [ "MAXHOSTNAMELEN", # for some reason, Linux defines it to 64
101 # while most of the BSD code expects this to be 256
102 # so ignore the kernel-provided definition and
103 # define it in the Bionic headers instead
104 ]
105 )
106
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700107# this is the standard disclaimer
108#
109kernel_disclaimer = """\
110/****************************************************************************
111 ****************************************************************************
112 ***
113 *** This header was automatically generated from a Linux kernel header
114 *** of the same name, to make information necessary for userspace to
115 *** call into the kernel available to libc. It contains only constants,
116 *** structures, and macros generated from the original header, and thus,
117 *** contains no copyrightable information.
118 ***
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200119 *** To edit the content of this header, modify the corresponding
120 *** source file (e.g. under external/kernel-headers/original/) then
121 *** run bionic/libc/kernel/tools/update_all.py
122 ***
123 *** Any manual change here will be lost the next time this script will
124 *** be run. You've been warned!
125 ***
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700126 ****************************************************************************
127 ****************************************************************************/
128"""
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200129
130# This is the warning line that will be inserted every N-th line in the output
131kernel_warning = """\
132/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
133"""