lineage: build: kernel: Rework kernel header logic
The existing kernel header logic has several issues:
* It does not depend on the actual kernel headers, so it does not
detect actual kernel header changes.
* It does depend on the kernel config, which should not be used to
generate (user space) kernel headers.
The end result is that kernel headers aren't properly regenerated when
needed, and spuriously regenerated when not needed. Additionally, the
kernel header rebuild mucks around with the kernel config, which is
unneccesary and fraught with danger.
Rewrite the kernel header dependency and generation logic as follows:
* Use the dependency file $(KERNEL_OUT)/.headers_install_deps to
manage dependencies on the actual kernel header files which are
exported to user space (and the top level kernel Makefile, which
is used to generate version.h). The dependency file is exactly
the same as what GCC would output for a C/C++ dependency with the
M/MM flags.
* Conditionally include the dependency file to detect when headers
should be (re)generated.
* Introduce the phony target INSTALLED_KERNEL_HEADERS for modules to
declare a dependency on kernel headers.
Additionally:
* Get rid of TARGET_KERNEL_HEADER_ARCH and KERNEL_HEADER_DEFCONFIG.
* Get rid of KERNEL_OUT_STAMP and move commands to the appropriate
places in the rules.
* Fail the build when $(KERNEL_OUT)/usr is mentioned in a dependency.
Note a separate commit to build/core/binary.mk will provide a
migration path and a suitable deprecation warning.
* Declare the kernel*config targets phony.
Change-Id: I8b46f4ea1c622d8e73cca5157be96ec09d42ebb3
1 file changed