2014-06-05 20:17:06 +02:00
|
|
|
Bionic comes with a processed set of all of the uapi Linux kernel headers that
|
|
|
|
can safely be included by userland applications and libraries.
|
|
|
|
|
|
|
|
These clean headers are automatically generated by several scripts located
|
|
|
|
in the 'bionic/kernel/tools' directory. The tools process the original
|
|
|
|
unmodified kernel headers in order to get rid of many annoying
|
2009-03-04 04:28:35 +01:00
|
|
|
declarations and constructs that usually result in compilation failure.
|
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
The 'clean headers' only contain type and macro definitions, with the
|
2009-03-04 04:28:35 +01:00
|
|
|
exception of a couple static inline functions used for performance
|
2014-06-05 20:17:06 +02:00
|
|
|
reason (e.g. optimized CPU-specific byte-swapping routines).
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
They can be included from C++, or when compiling code in strict ANSI mode.
|
|
|
|
They can be also included before or after any Bionic C library header.
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
Description of the directories involved in generating the parsed kernel headers:
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2012-03-23 16:07:36 +01:00
|
|
|
* 'external/kernel-headers/original/'
|
2014-06-05 20:17:06 +02:00
|
|
|
Contains the uapi kernel headers found in the android kernel. Note this
|
|
|
|
also includes the header files that are generated by building the kernel
|
|
|
|
sources.
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
* 'bionic/libc/kernel/uapi'
|
|
|
|
Contains the cleaned kernel headers and mirrors the directory structure
|
|
|
|
in 'external/kernel-headers/original/uapi/'.
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
* 'bionic/libc/kernel/tools'
|
|
|
|
Contains various Python and shell scripts used to get and re-generate
|
|
|
|
the headers.
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
The tools to get/parse the headers:
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
* tools/generate_uapi_headers.sh
|
|
|
|
Checks out the android kernel and generates all uapi header files.
|
|
|
|
copies all the changed files into external/kernel-headers.
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
* tools/clean_header.py
|
2014-06-05 20:17:06 +02:00
|
|
|
Prints the clean version of a given kernel header. With the -u option,
|
2009-03-04 04:28:35 +01:00
|
|
|
this will also update the corresponding clean header file if its
|
2014-06-05 20:17:06 +02:00
|
|
|
content has changed. You can also process more than one file with -u.
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
* tools/update_all.py
|
2014-06-05 20:17:06 +02:00
|
|
|
Automatically update all clean headers from the content of
|
|
|
|
'external/kernel-headers/original'.
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
HOW TO UPDATE THE HEADERS WHEN NEEDED:
|
|
|
|
======================================
|
|
|
|
|
|
|
|
IMPORTANT IMPORTANT:
|
|
|
|
|
|
|
|
WHEN UPDATING THE HEADERS, ALWAYS CHECK THAT THE NEW CLEAN HEADERS DO
|
|
|
|
NOT BREAK THE KERNEL <-> USER ABI, FOR EXAMPLE BY CHANGING THE SIZE
|
|
|
|
OF A GIVEN TYPE. THIS TASK CANNOT BE EASILY AUTOMATED AT THE MOMENT
|
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
Grab the latest headers from the android kernel by running this command:
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
bionic/kernel/tools/generate_uapi_headers.sh --download-kernel
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
Next, run this command to copy the parsed files to bionic/libc/kernel/uapi:
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
bionic/kernel/tools/update_all.py
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-06-05 20:17:06 +02:00
|
|
|
After this, you will need to build/test the tree to make sure that these
|
|
|
|
changes do not introduce any errors.
|