The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | # this module contains all the defaults used by the generation of cleaned-up headers |
| 2 | # for the Bionic C library |
| 3 | # |
| 4 | |
| 5 | import time, os, sys |
| 6 | from utils import * |
| 7 | |
| 8 | # the list of supported architectures |
| 9 | # |
Shin-ichiro KAWASAKI | 37429ff | 2009-07-01 15:41:52 +0900 | [diff] [blame] | 10 | kernel_archs = [ 'arm', 'x86', 'sh' ] |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 11 | |
| 12 | # the list of include directories that belong to the kernel |
| 13 | # tree. used when looking for sources... |
| 14 | # |
| 15 | kernel_dirs = [ "linux", "asm", "asm-generic", "mtd" ] |
| 16 | |
| 17 | # path to the directory containing the original kernel headers |
| 18 | # |
| 19 | kernel_original_path = os.path.normpath( find_program_dir() + '/../original' ) |
| 20 | |
| 21 | # a special value that is used to indicate that a given macro is known to be |
| 22 | # undefined during optimization |
| 23 | kCppUndefinedMacro = "<<<undefined>>>" |
| 24 | |
| 25 | # this is the set of known macros we want to totally optimize out from the |
| 26 | # final headers |
| 27 | kernel_known_macros = { |
| 28 | "__KERNEL__": kCppUndefinedMacro, |
| 29 | "__KERNEL_STRICT_NAMES":"1", |
| 30 | "__CHECKER__": kCppUndefinedMacro, |
| 31 | "__CHECK_ENDIAN__": kCppUndefinedMacro, |
| 32 | } |
| 33 | |
| 34 | # define to true if you want to remove all defined(CONFIG_FOO) tests |
| 35 | # from the clean headers. testing shows that this is not strictly necessary |
| 36 | # but just generates cleaner results |
| 37 | kernel_remove_config_macros = True |
| 38 | |
The Android Open Source Project | 4e468ed | 2008-12-17 18:03:48 -0800 | [diff] [blame] | 39 | # maps an architecture to a set of default macros that would be provided by |
| 40 | # toolchain preprocessor |
| 41 | kernel_default_arch_macros = { |
| 42 | "arm": {}, |
| 43 | "x86": {"__i386__": "1"}, |
| 44 | } |
| 45 | |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 46 | # this is the set of known static inline functions that we want to keep |
| 47 | # in the final ARM headers. this is only used to keep optimized byteswapping |
| 48 | # static functions and stuff like that. |
| 49 | kernel_known_arm_statics = set( |
| 50 | [ "___arch__swab32", # asm-arm/byteorder.h |
| 51 | ] |
| 52 | ) |
| 53 | |
| 54 | kernel_known_x86_statics = set( |
| 55 | [ "___arch__swab32", # asm-x86/byteorder.h |
| 56 | "___arch__swab64", # asm-x86/byteorder.h |
| 57 | ] |
| 58 | ) |
| 59 | |
Shin-ichiro KAWASAKI | 37429ff | 2009-07-01 15:41:52 +0900 | [diff] [blame] | 60 | kernel_known_sh_statics = set( |
| 61 | [ "___arch__swab16", # asm-sh/byteorder.h |
| 62 | "___arch__swab32", # asm-sh/byteorder.h |
| 63 | "___arch__swab64", # asm-sh/byteorder.h |
| 64 | "__FD_ZERO", # asm-sh/posix_types_32/64.h |
| 65 | "__FD_SET", # asm-sh/posix_types_32/64.h |
| 66 | ] |
| 67 | ) |
| 68 | |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 69 | kernel_known_generic_statics = set( |
| 70 | [ "__invalid_size_argument_for_IOC", # asm-generic/ioctl.h |
| 71 | "__cmsg_nxthdr", # linux/socket.h |
| 72 | "cmsg_nxthdr", # linux/socket.h |
| 73 | "ipt_get_target", |
Vilmos Nebehaj | c1a534b | 2010-06-28 15:13:23 +0200 | [diff] [blame] | 74 | "ip6t_get_target", |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 75 | ] |
| 76 | ) |
| 77 | |
| 78 | # this maps an architecture to the set of static inline functions that |
| 79 | # we want to keep in the final headers |
| 80 | # |
| 81 | kernel_known_statics = { |
| 82 | "arm" : kernel_known_arm_statics, |
Shin-ichiro KAWASAKI | 37429ff | 2009-07-01 15:41:52 +0900 | [diff] [blame] | 83 | "x86" : kernel_known_x86_statics, |
| 84 | "sh" : kernel_known_sh_statics |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 85 | } |
| 86 | |
The Android Open Source Project | 6d6c82c | 2009-01-09 17:50:54 -0800 | [diff] [blame] | 87 | # this is a list of macros which we want to specifically exclude from |
| 88 | # the generated files. |
| 89 | # |
| 90 | kernel_ignored_macros = set( |
| 91 | [ "MAXHOSTNAMELEN", # for some reason, Linux defines it to 64 |
| 92 | # while most of the BSD code expects this to be 256 |
| 93 | # so ignore the kernel-provided definition and |
| 94 | # define it in the Bionic headers instead |
| 95 | ] |
| 96 | ) |
| 97 | |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 98 | # this is the standard disclaimer |
| 99 | # |
| 100 | kernel_disclaimer = """\ |
| 101 | /**************************************************************************** |
| 102 | **************************************************************************** |
| 103 | *** |
| 104 | *** This header was automatically generated from a Linux kernel header |
| 105 | *** of the same name, to make information necessary for userspace to |
| 106 | *** call into the kernel available to libc. It contains only constants, |
| 107 | *** structures, and macros generated from the original header, and thus, |
| 108 | *** contains no copyrightable information. |
| 109 | *** |
| 110 | **************************************************************************** |
| 111 | ****************************************************************************/ |
| 112 | """ |