Skip to content

Commit e89fa2d

Browse files
Rashed97RakeshBatra
authored andcommitted
build: Automatically replace old-style kernel header includes with new header lib
This is a combination of 3 commits. This is the 1st commit message: build: add kernel header dependency if module uses kernel headers Many of the QCOM components use kernel headers, but don't declare the dependency on them. This is fine in CAF because of the way they build the boot.img before anything else. In CM, we don't build the boot.img the same, so we run into a race between the kernel build & these modules... and the modules lose. Warn about modules that have this missing dependency, and add it for them so we don't have to modify each Android.mk. Change-Id: I95f1e47b5ef440f6f5d8f64a0c3f38d9572e839e ============================================================================ This is the commit message #2: build: Switch kernel header inclusion The build is switching to the target INSTALLED_KERNEL_HEADERS to declare dependencies on kernel headers. Change-Id: I913e74681b02dfcf1eaed3d1e47ff4ab2300b12d ============================================================================ This is the commit message #3: build: Automatically replace old-style kernel header includes with new header lib Since we do this via soong and the result is a header library, just replace all legacy include paths that point to the old header location with calls to the new header library. Since we no longer have the legacy include, we can also remove the additional dependency. This reverts commit fa79821. Change-Id: I716955534e50831e6568ca01e480aa8b90075d92 Signed-off-by: RakeshBatra <[email protected]>
1 parent 5130ad0 commit e89fa2d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

core/binary.mk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,26 @@ endif
4040

4141
my_soong_problems :=
4242

43+
# Automatically replace the old-style kernel header include with a dependency
44+
# on the generated_kernel_headers header library
45+
ifneq (,$(findstring $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,$(LOCAL_C_INCLUDES)))
46+
LOCAL_C_INCLUDES := $(patsubst $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,,$(LOCAL_C_INCLUDES))
47+
LOCAL_HEADER_LIBRARIES += generated_kernel_headers
48+
endif
49+
50+
# Some qcom binaries use this weird -isystem include...
51+
ifneq (,$(findstring $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,$(LOCAL_CFLAGS)))
52+
LOCAL_CFLAGS := $(patsubst -isystem $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,,$(LOCAL_CFLAGS))
53+
LOCAL_HEADER_LIBRARIES += generated_kernel_headers
54+
endif
55+
56+
# Remove KERNEL_OBJ/usr from any LOCAL_ADDITIONAL_DEPENDENCIES, we will
57+
# just include generated_kernel_headers which already has the proper
58+
# dependency
59+
ifneq (,$(findstring $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr,$(LOCAL_ADDITIONAL_DEPENDENCIES)))
60+
LOCAL_ADDITIONAL_DEPENDENCIES := $(patsubst $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr,,$(LOCAL_ADDITIONAL_DEPENDENCIES))
61+
endif
62+
4363
# The following LOCAL_ variables will be modified in this file.
4464
# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
4565
# we can't modify them in place.

0 commit comments

Comments
 (0)