summaryrefslogtreecommitdiff
path: root/libc/kernel/tools
AgeCommit message (Collapse)Author
2021-04-21Merge "Fix last python3 issues."Christopher Ferris
2021-04-20Fix last python3 issues.Christopher Ferris
Includes pointing to the python3 version of the clang bindings. Also, remove stale .gitignore line. Test: Ran bionic/libc/kernel/tools/update_all.py and verified Test: the files generated the same exact way. Change-Id: I4eb9dd7382bca013f70d921b6ef48c7e7478615a
2021-04-20Fix overly-zealous strip.Dan Albert
The argument to this is the characters to strip, so `line.strip(line)` just returns the empty string. Test: None? Bug: None Change-Id: I4f62bffcd00936e4eef837a28b78023fcad54bb0
2021-04-19Update for python3.Christopher Ferris
This fixes all of the problems with our kernel scripts, but not the clang python script problems. I also removed the updateGitFiles function since that code was just silently failing any way. I replaced all calls with updateFiles. Test: Ran script using python2 to verify it still works. Test: Run script in python3 verifying that it starts to run. Change-Id: I223a31a8324c59e6bc4067f48a6110361b3e26e8
2021-04-15Force everything to use python3 for consistency.Elliott Hughes
Rather than "whatever people have installed as 'python' on their machine". I've removed check-symbols.py because that's been broken for years and we never even noticed, and I'm not sure it's worth fixing. Test: treehugger, manual Change-Id: Ieb996bbdf790a18d4b1fb46a409cc240ba2a2a49
2020-12-03Clean up header files from kernel directory.Christopher Ferris
Add a make distclean for each supported arch before generating headers and at the end so these files are not left hanging around in the kernel directory. Bug: 174795055 Test: Verified all generated files are deleted after running. Test: Verified this generates the exact same files as before this change. Change-Id: I0f66f580af2ea50c190eb532032017e782d7cae6
2020-07-31More cleanup for #inclusivefixit.Elliott Hughes
Found manually with grep, since the script seems to miss stuff. Test: treehugger Change-Id: I5933cbade9792801d4a0bec1ccb077efa6ad8fbc
2020-06-04Update the generate script.Christopher Ferris
The arm kvm.h file has been deprecated, so nobody should be including it. Therefore, remove the hack to copy the file out of the tools directory. Also, update to remove the arm kvm.h file. Test: Ran generate and update script and verified only the arm kvm.h Test: was deleted. Test: Builds and boots on a walleye. Change-Id: I95dcc8877bdb2da2858b0b9d0aa95d1d2072cf9a
2020-06-02Update to v5.7 kernel headers.Christopher Ferris
Kernel headers coming from: Git: https://android.googlesource.com/kernel/common/ Branch: android-mainline Tag: android-mainline-5.7 Update the generate_uapi_headers.sh where the types.h file is now in the right place, but kvm.h is not. Test: Booted cuttlefish/bonito. Test: Ran bionic-unit-tests on cuttlefish/bonito. Change-Id: Ice9ce370a658e320b80f564b34a4431927fcf100
2020-04-10Update to v5.6 kernel headers.Christopher Ferris
Kernel headers coming from: Git: https://android.googlesource.com/kernel/common/ Branch: android-mainline Tag: android-mainline-5.6 Add a new method for removing structures. This is to deal with the kernel headers changing some definitions of timeval to __kernel_old_timeval and itimerval to __kernel_old_itimerval. Remove the __kernel_old_XX strutures and change the other structures to the previous definitions. This only works so long as these structures stay the same, if they diverge, then a different strategy will need to be implemented. Test: Booted cuttlefish/walleye. Test: Ran bionic-unit-tests on cuttlefish/walleye. Change-Id: I0a61f4fa6e4155c602e0414d9b38c2e1637829af
2020-02-07Update to v5.5 kernel headers.Christopher Ferris
Kernel headers coming from: Git: https://android.googlesource.com/kernel/common/ Branch: android-mainline Tag: android-mainline-5.5 Test: Boots on walleye. Test: Ran bionic-unit-tests on walleye. Test: Boots on cuttlefish. Test: Ran bionic-unit-tests on cuttlefish. Change-Id: I57387d3c31e0ba5ad125ffe291cecf365c7b374e Merged-In: I57387d3c31e0ba5ad125ffe291cecf365c7b374e
2020-02-03Stop generating unused headers.Elliott Hughes
These just cause confusion because they often have different values/layouts, but they're never actually used. Test: treehugger Change-Id: I424034088e017c919f62fcefa7d6d3f903f31cfb
2020-01-29_FILE_OFFSET_BITS=64 support for fcntl.Elliott Hughes
On Android, fcntl is always implemented by fcntl64(2). This means that an LP32 binary can `fcntl(F_SETLK, struct flock)` (because fcntl64(2) passes through to the 32-bit fcntl(2) to handle F_SETLK), and it can also `fcntl(F_SETLK64, struct flock64)`. What it can't do before this patch is set _FILE_OFFSET_BITS=64 and then `fcntl(F_SETLK, struct flock)` where that `struct flock` is actually implicitly `struct flock64`. Move the kernel uapi structs out of the way, define them ourselves based on __LP64__ and _FILE_OFFSET_BITS, and fix up the relevant F_ constants. (Also add a .clang-format to turn off clang-format in libc/include/.) Bug: N/A Test: treehugger (and strace!) Change-Id: Iccd6c83d9133e1efcf93a7b49a6ae0f1bbd3d58b
2019-12-13Clone with --depth 1 in generate_uapi_headers.sh --download-kernel.Josh Gao
Test: manual Change-Id: Id60b354fb1914470315976dd103d2665a6fefab8
2019-12-12Update to android-mainline kernel headers v5.4.Christopher Ferris
Update generate_uapi_headers.sh to checkout the android mainline kernel. Also, add a small modification to look for the kernel directory in common not linux-stable. Remove deprecated android headers from android/uapi/linux. Also, remove f_accessory.h since it's in the android mainline kernel. Test: Builds and runs on walleye. Change-Id: Ia371305e19f56e6bcc2db6d5b4d299819f07ffc6
2019-08-05Update to kernel headers v5.2.6.Christopher Ferris
Also, fix a bug in update_all.py when the syscalls file does not change. Test: Builds and boots on a taimen. Change-Id: If85b00daef2c176f804a0861894f5bbca9c6d5df
2019-04-15clean_header: Run outside of $ANDROID_BUILD_TOPDaniel Mentz
Enable the use case where we run clean_header.py from outside of $ANDROID_BUILD_TOP. Previously, this script required the current working directory to be under $ANDROID_BUILD_TOP. Running it from a different directory resulted in the following error message: clean_header.py: error: Not in android tree pointed at by ANDROID_BUILD_TOP (....) Change-Id: I48210ea1a0033228a9aaa4124d28247b07cee6d4
2019-04-15clean_header: Fix error handling for no-such-file caseDaniel Mentz
The function cleanupFile should always return a single value (as opposed to a tuple or list). In addition, if it encounters an error, it is expected to return a value that evaluates to False. As it stands, however, it returns (None, None) in certain error cases. Change this function to return None, in those cases. We previously saw the following error message, when we tried to run clean_header.py on a non-existent file. Traceback (most recent call last): File "clean_header.py", line 208, in <module> b.updateGitFiles() File "utils.py", line 164, in updateGitFiles self._writeFile(dst) File "utils.py", line 136, in _writeFile f.write(self.new_data[dst]) TypeError: expected a string or other character buffer object Change-Id: I5f717dd1a4388f598f0fd4bfd5e6129017de9095
2019-04-11<bits/glibc-syscalls.h>: only regenerate when we have new uapi headers.Elliott Hughes
Test: update_all.py Change-Id: Iaa92dce263197f5a0e7d2dce5e00a31372dcb3e9
2019-03-29clean_header: Don't print extraneous newline charDaniel Mentz
Don't print an extraneous newline character at the end of the include file if clean_header.py is used in the non-update mode. This is necessary to achieve consistent results in the update and non-update modes. Running clean_header in the non-update mode and redirecting the output to a file should have the same result as using the update mode and have the script write to the file directly. Change-Id: I6b176c5365840d66e4499bacd205f1fa77302a2b
2019-03-29clean_header: Write to correct dst_fileDaniel Mentz
Write to correct dst_file when in update mode. This enables use cases like the following: ../../../bionic/libc/kernel/tools/clean_header.py -k original-kernel-headers/ -d kernel-headers/ -u linux/ion.h Previously, we had to cd into kernel-headers/ and then run ../../../../bionic/libc/kernel/tools/clean_header.py -k ../original-kernel-headers/ -d . -u linux/ion.h because the tool didn't allow the relative path to be different from the destination path. Change-Id: I8c5e284ce7a6737d77a2f5ead3e7e5db01317425
2019-01-10Rewrite removeVarsAndFuncs.Christopher Ferris
The current version has these bugs: - Adding a semicolon after a function results in the removal of structures following the function. - Function like macros get removed on accident rather than on purpose. - It removes extern "C" { completely, which might not be a bug, but doesn't seem right. I couldn't easily fix any of these problems because the code depends heavily on the header being correct. New unit tests added for the function to cover all of these cases. A follow-on CL will include the updated headers. Bug: 112290385 Test: Passes all new unit tests. Test: When run on the current kernel headers, the generated headers are Test: nearly the same, missing data is being added. Change-Id: Ib22a5f2e78873544e8a9d54e385af1156b2a72bb
2018-10-26Fix handling of #elif.Christopher Ferris
When a construct like: if defined(something) blocks1 elif 1 blocks2 else blocks3 endif The parser would put the first clause but then simply omit the elif and put all of blocks2 without a terminating #endif. The code also did something similar when the #else was an #endif. Also convert all of the unit tests to real unit tests and only run them if you run cpp.py by itself. Added new unit tests to cover the new cases. Test: Ran cpp.py unit tests. Test: Reran update_all.py and verified nothing changed, and that running Test: it on the new kernel headers that exposed this problem. Change-Id: Ie168511303c4e15afdb60c37baef75a966ca29a8
2018-05-24Modify the script to use the linux source tree.Christopher Ferris
The current code checks out the android kernel tree. Long ago, we moved to using the linux kernel source code. Modify the script to actually do this. Bug: 6653610 Test: Ran the script using the --download_kernel option and without. Change-Id: I769e769edea272f4f8c9c8d2e76bd336059c66e3
2018-04-24Remove ion.h from bionic uapi headers.Christopher Ferris
Bug: 77976082 Test: Ran the generate script and verified ion.h is deleted. Change-Id: I33b3aeef66f08f35dd496a073931b2fe2c80a1d6
2017-12-14Use in_addr in ip_mreq_source and ip_msfilter.Elliott Hughes
This adds a new mechanism to say "replace struct S with #include <bits/S.h>". Also switch epoll_event over to the new mechanism. Also use the kernel's struct sockaddr_storage directly rather than behind an unnecessary #define. This patch also removes some dead code in the header scrubber. This code still needs rewriting completely. I learned that a "block" isn't necessarily a single struct definition, say; it might be a run of them. It seems like a block is a run of preprocessor directives or a run of regular code. Bug: https://issuetracker.google.com/36987220 Test: new test Change-Id: Ic6a5c09559766a4babe3cd4c3ea538b885e07308
2017-11-16Merge "Change ARG_MAX/_SC_ARG_MAX back to a constant."Elliott Hughes
2017-11-15Change ARG_MAX/_SC_ARG_MAX back to a constant.Elliott Hughes
As per the lkml thread https://lkml.org/lkml/2017/11/1/946. Bug: http://b/65818597 Test: ran tests Change-Id: I7a0610e6903e6761f2b31416e2f5017bd7a60659
2017-11-15Update to kernel headers v4.14.Christopher Ferris
Remove the hiding of the kernel structure binder_fd_array_object. This structure now matches the structure used in the binder code. Load the libclang_android.so shared library directly for parsing. This file changed name in a recent update to the prebuilts. Test: Compiles arm/arm64/x86/x86_64. Test: Boots on hikey and boots on a sailfish. Test: Ran bionic unit tests on hikey and sailfish. Change-Id: I141a4b93ac3511cd58f4d12bb3c0d4efaa4c2742
2017-08-31Use env to invoke pythonStephen Crane
/usr/bin/python may be python3. We should respect PATH to find the python executable so it can be locally overridden to be python2. Test: Build libc, repo upload Change-Id: Iaddd7cd4a1c2177c32786e4fa0fc664ab0ad36de
2017-07-27Update to kernel headers v4.12.3.Christopher Ferris
Test: Built angler. Change-Id: Icbcf4fac2334de8409b049ed7a3b4c24b4e98ce9
2017-05-25Enable exporting the non-uapi scsi headers.Elliott Hughes
Callers are supposed to #include <scsi/sg.h> but if we tell soong to add bionic/libc/kernel/android/ to the include path, the uapi headers in there would be (unintentionally) accessible as either <linux/name.h> or <uapi/linux/name.h>. Bug: N/A (hit while upgrading strace to 4.17) Test: builds Change-Id: I8d47dd51da688c38f747a255d401dfb2c209c805
2017-05-25Remove the repetitive warnings from the uapi headers.Elliott Hughes
Having WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS every four lines made the headers harder to read, made the diffs much worse each time we upgraded, and wasn't really providing any benefit. Before the next uapi update, let's just stop doing this. Bug: N/A Test: builds, manually inspected files look right Change-Id: Id7088cf750894c9d24950f3d53587fe3156c4f7d
2017-05-18Make `union semun` usable.Elliott Hughes
This is a bit bogus because it's been removed from glibc (though not thoroughly) and is never useful on Android (because the system calls in question are compiled out of Android kernels, and SELinux would disallow them even if you weren't running an Android kernel). This also means that on glibc you need to include <linux/sem.h> for this and on bionic you need <sys/sem.h> (and for either if you #include the other file, you won't get this union). Bug: https://github.com/android-ndk/ndk/issues/400 Test: added new test Change-Id: I47f721da77515531f616d6ad8479bfbc9b60ee47
2017-04-21Update static functions/macro definitions.Christopher Ferris
Fix the list of static functions coming from swab.h to match the ones exported by glibc. Force the definition of __HAVE_BUILTIN_BSWAP{16,32,64}__ so the headers use the builtin. Add a unit test to guarantee that kernel header updates do not break this. Test: Built and booted angler. Test: Built the bionic unit tests for arm, arm64, mips, x86, x86_64. Test: Ran the new test on angler and glibc. Change-Id: I4ce229e3f198c204186d72bf22dd97b5cdf239e4
2017-03-03Merge "Refactor the kernel update scripts."Christopher Ferris
2017-03-02Refactor the kernel update scripts.Christopher Ferris
The previous versions of the scripts did a lot of redundant changes and were hard to follow. I rewrote most of update_all.py so that it's clear about what's going on. I updated clean_header.py to change the cleanupFile function so that there is no magic about where the destination file is going to wind up. Now the caller specifies the final location. I updated utils.py so that if you are trying to do an update in one location, but your lunch target is from another location, it causes an error. Bug: 35726570 Change-Id: Ic5a44d90c2774a627eecde34c0c403bc925a497c Test: Ran the updater and verified it works properly. Test: Verified that doing an update in one tree to another tree Test: fails.
2017-02-23Use <linux/eventpoll.h> to implement <sys/epoll.h>.Elliott Hughes
Bug: https://github.com/android-ndk/ndk/issues/302 Test: builds Change-Id: Ia3074326a128c38f2488e342c028cc030801cfd9
2016-08-29Update to kernel headers v4.7.2.Christopher Ferris
Modify the kernel header update script to rename C++ keyword struct members to something else. This fixes problems when including these kernel files in C++ code. Also, make a manual change to linux/fib_rules.h and comment out the value FRA_PAD since it conflicts with a special android kernel value FRA_UID_START that has not been upstreamed yet. Test: Built aosp_angler, aosp_x86_64, aosp_mips (bionic only) Test: Booted on angler and ran bionic unit tests Test: Built these changes in internal master Change-Id: Ia22b7e3ca409404696dba76311f49157f4a9ceed
2016-08-18Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>.Elliott Hughes
Also fix <sys/ipc.h>. Not useful except to systems/bringup folks for testing. Trivial tests added, and double-checked under strace to see that things look right. x86 -- which works differently to everything else -- tested on the host. Bug: http://b/27952303 Change-Id: I328534e994ae9e90755f545478fba03038c0bb94
2016-08-10Fix sysconf(_SC_ARG_MAX).Elliott Hughes
ARG_MAX hasn't been a constant since Linux 2.6.23. Bug: http://lists.landley.net/pipermail/toybox-landley.net/2016-August/008592.html Change-Id: I1eddb562751604c75b89fa610d79be0655c53693 Test: ran the bionic tests on device and against glibc
2016-07-22More kernel header cleanup.Christopher Ferris
Modify the generate script to add a new option and copy the types.h arm header file since it's not currently being created properly. Also manually generate the arm types.h uapi header since it's not being properly generated right now. Modify both generate scripts to delete the target directories before adding the files to handle moved/deleted header files. Move the common/scsi headers into android and delete the common directory. Change the scripts to reflect this change. Update the scsi headers since they've been modified in upstream kernels. Bug: 30072483 Change-Id: Ia43d4b238b6a041350d60cc30184ecbd4829d7d5
2015-09-22<netinet/udp.h> should include <linux/udp.h>.Elliott Hughes
The comment about "other stuff" referred to pre-uapi headers. Everything in the current <linux/udp.h> should be exposed to userspace. The only problem is that BSD and Linux use different names for the members of struct udphdr. We can move the Linux udphdr out of the way and use an anonymous union to get the best of both worlds. (Though unfortunately this means that code that includes <linux/udp.h> directly instead of using <netinet/udp.h> now won't have any definition of struct udphdr. We've taken the stance in the past that you shouldn't include a linux/ header if there's a standard equivalent --- you should rely on us transitively including it for you.) Change-Id: Ie625892441b0edd8df3b76d3fcf2cbe299077bc4
2015-09-17Add support for manually modified kernel headers.Christopher Ferris
This changes the scripts so that if some kernel files exists in external/kernel-headers/modified, that they will be preferred over the same files found in original. This is to support the case where the kernel headers cannot be taken without some small modifications. Included with this change, is a general cleanup of the python scripts. This also modifies the generate uapi headers script to indicate if the source of the modified headers has changed. Change-Id: Id13523b244ced52a2ecd9f1399c43996dd8296fa
2015-04-22Update the search path for libclang.soTao Bao
Prebuilt shared libraries (libclang.so, libLLVM.so and etc) have been moved to prebuilts/sdk/tools/linux/lib64. Update the search path in cpp.py to match the change. Bug: 20485471 Change-Id: Ib7784db4d5529d16a1e2bfc07cb0237929bc5a64
2015-02-09Define MAXHOSTNAMELEN explicitly in source files.Yabin Cui
Bug: 19093777 Bug: 19092844 Change-Id: I0778507ca2d5c008abb9a6d6315d0909263a8817
2015-02-06Switch kernel header parsing to python libclangTao Bao
Replace the tokenizer in cpp.py with libclang. Bug: 18937958 Change-Id: I27630904c6d2849418cd5ca3d3c612ec3078686d
2014-12-10fix runtime issues for scriptsKyunam Jo
now, some script to update kernel-headers is not working. because of wrong variable value and test codes. so this issue is fixed. Change-Id: Iffae9607858cc3c1c58fa24244be217b5a1ab06e
2014-08-20Clean up some of our python scripts.Elliott Hughes
Change-Id: Ifa75345db43434298cfb6113fbe2f7a33b88c79d
2014-07-10Update kernel headers to v3.14.Christopher Ferris
Other changes: - Modify update_all.py to skip ion header files when importing into aosp. - Fix generate_uapi_headers.sh to handle imports from a linux-stable kernel. Change-Id: I1ad81b9ccb063c21740f9875f2cc1238052cd4b3