Home | History | Annotate | only in /bionic/libc/kernel
Up to higher level directory
NameDateSize
android/05-Oct-2017
README.TXT05-Oct-20173.2K
tools/05-Oct-2017
uapi/05-Oct-2017

README.TXT

      1 Bionic Kernel Header Files
      2 ==========================
      3 
      4 Bionic comes with a processed set of all of the uapi Linux kernel headers that
      5 can safely be included by userland applications and libraries.
      6 
      7 These clean headers are automatically generated by several scripts located
      8 in the 'bionic/kernel/tools' directory. The tools process the original
      9 unmodified kernel headers in order to get rid of many annoying
     10 declarations and constructs that usually result in compilation failure.
     11 
     12 The 'clean headers' only contain type and macro definitions, with the
     13 exception of a couple static inline functions used for performance
     14 reason (e.g. optimized CPU-specific byte-swapping routines).
     15 
     16 They can be included from C++, or when compiling code in strict ANSI mode.
     17 They can be also included before or after any Bionic C library header.
     18 
     19 Description of the directories involved in generating the parsed kernel headers:
     20 
     21   * 'external/kernel-headers/original/'
     22     Contains the uapi kernel headers found in the android kernel. Note this
     23     also includes the header files that are generated by building the kernel
     24     sources.
     25 
     26   * 'bionic/libc/kernel/uapi'
     27     Contains the cleaned kernel headers and mirrors the directory structure
     28     in 'external/kernel-headers/original/uapi/'.
     29 
     30   * 'bionic/libc/kernel/tools'
     31     Contains various Python and shell scripts used to get and re-generate
     32     the headers.
     33 
     34 The tools to get/parse the headers:
     35 
     36   * tools/generate_uapi_headers.sh
     37     Checks out the android kernel and generates all uapi header files.
     38     copies all the changed files into external/kernel-headers.
     39 
     40   * tools/clean_header.py
     41     Prints the clean version of a given kernel header. With the -u option,
     42     this will also update the corresponding clean header file if its
     43     content has changed. You can also process more than one file with -u.
     44 
     45   * tools/update_all.py
     46     Automatically update all clean headers from the content of
     47     'external/kernel-headers/original'.
     48 
     49 How To Update The Headers
     50 =========================
     51 
     52 IMPORTANT IMPORTANT:
     53 
     54 WHEN UPDATING THE HEADERS, ALWAYS CHECK THAT THE NEW CLEAN HEADERS DO
     55 NOT BREAK THE KERNEL <-> USER ABI, FOR EXAMPLE BY CHANGING THE SIZE
     56 OF A GIVEN TYPE. THIS TASK CANNOT BE EASILY AUTOMATED AT THE MOMENT.
     57 
     58 Download the Linux kernel source code:
     59 
     60   > mkdir kernel_src
     61   > cd kernel_src
     62   kernel_src> git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
     63 
     64 Then checkout the stable tag for the new kernel headers to import:
     65 
     66   kernel_src> cd linux-stable
     67   kernel_src/linux-stable> git checkout tags/vXXX
     68 
     69 Before running the command to import the headers, make sure that you have
     70 done a lunch TARGET. The script uses a variable set by the lunch command
     71 to determine which directory to use as the destination directory.
     72 
     73 After running lunch, run this command to import the headers into the android
     74 source tree:
     75 
     76   bionic/libc/kernel/tools/generate_uapi_headers.sh --use-kernel-dir kernel_src
     77 
     78 Next, run this command to copy the parsed files to bionic/libc/kernel/uapi:
     79 
     80   bionic/libc/kernel/tools/update_all.py
     81 
     82 Finally, run this command to regenerate the syscalls list:
     83 
     84   bionic/libc/tools/gensyscalls.py
     85 
     86 After this, you will need to build/test the tree to make sure that these
     87 changes do not introduce any errors.
     88