Merge "kbuild: skip install/check of headers right under uapi directories"
diff --git a/Android.bp b/Android.bp
index 4341e3a..1fd921a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -3,25 +3,43 @@
     srcs: ["scripts/unifdef.c"],
     sanitize: {
         never: true,
-    }
+    },
 }
 
-gensrcs {
-    name: "qseecom-kernel-includes",
-
-    // move to out/ as root for header generation because of scripts/unifdef
-    // storage - at the expense of extra ../ references
-    cmd: "pushd out && mkdir -p scripts && rm -f scripts/unifdef && ln -s ../../$(location unifdef) scripts/unifdef && ../$(location scripts/headers_install.sh) `dirname ../$(out)` ../ $(in) && popd",
-
+genrule {
+    name: "gen-headers_install.sh",
+    srcs: ["scripts/headers_install.sh"],
     tools: ["unifdef"],
-    tool_files: ["scripts/headers_install.sh"],
-    export_include_dirs: ["include/uapi"],
-    srcs: ["include/uapi/linux/qseecom.h"],
-    output_extension: "h",
+    out: ["headers_install.sh"],
+    cmd: "sed 's+scripts/unifdef+$(location unifdef)+g' $(in) > $(out)",
 }
 
+cc_prebuilt_binary {
+    name: "headers_install.sh",
+    device_supported: false,
+    host_supported: true,
+    srcs: [":gen-headers_install.sh"],
+}
+
+// Use the following for verbose output from kernel_headers.py.
+// kernel_headers_verbose = "--verbose "
+// Use the following for minimal output from kernel_headers.py.
+kernel_headers_verbose = ""
+
+build = ["gen_headers_arm.bp", "gen_headers_arm64.bp"]
+
 cc_library_headers {
-    name: "qseecom-kernel-headers",
-    generated_headers: ["qseecom-kernel-includes"],
-    export_generated_headers: ["qseecom-kernel-includes"],
+    name: "qti_kernel_headers",
+    arch: {
+        arm: {
+            generated_headers: ["qti_generate_kernel_headers_arm"],
+            export_generated_headers: ["qti_generate_kernel_headers_arm"],
+        },
+        arm64: {
+            generated_headers: ["qti_generate_kernel_headers_arm64"],
+            export_generated_headers: ["qti_generate_kernel_headers_arm64"],
+        },
+    },
+    vendor: true,
+    recovery_available: true,
 }
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 9b9c479..e988247 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -44,11 +44,10 @@
 	   --- 6.11 Post-link pass
 
 	=== 7 Kbuild syntax for exported headers
-		--- 7.1 header-y
-		--- 7.2 genhdr-y
-		--- 7.3 destination-y
-		--- 7.4 generic-y
-		--- 7.5 generated-y
+		--- 7.1 no-export-headers-y
+		--- 7.2 generic-y
+		--- 7.3 generated-y
+		--- 7.4 mandatory-y
 
 	=== 8 Kbuild Variables
 	=== 9 Makefile language
@@ -1236,7 +1235,7 @@
 	that may be shared between individual architectures.
 	The recommended approach how to use a generic header file is
 	to list the file in the Kbuild file.
-	See "7.4 generic-y" for further info on syntax etc.
+	See "7.2 generic-y" for further info on syntax etc.
 
 --- 6.11 Post-link pass
 
@@ -1263,53 +1262,21 @@
 - drop include of compiler.h
 - drop all sections that are kernel internal (guarded by ifdef __KERNEL__)
 
-Each relevant directory contains a file name "Kbuild" which specifies the
-headers to be exported.
+All headers under include/uapi/, include/generated/uapi/,
+arch/<arch>/include/uapi/ and arch/<arch>/include/generated/uapi/
+are exported.
+
+A Kbuild file may be defined under arch/<arch>/include/uapi/asm/ and
+arch/<arch>/include/asm/ to list asm files coming from asm-generic.
 See subsequent chapter for the syntax of the Kbuild file.
 
-	--- 7.1 header-y
+	--- 7.1 no-export-headers
 
-	header-y specifies header files to be exported.
+	no-export-headers is essentially used by include/uapi/linux/Kbuild to
+	avoid exporting specific headers (e.g. kvm.h) on architectures that do
+	not support it. It should be avoided as much as possible.
 
-		Example:
-			#include/linux/Kbuild
-			header-y += usb/
-			header-y += aio_abi.h
-
-	The convention is to list one file per line and
-	preferably in alphabetic order.
-
-	header-y also specifies which subdirectories to visit.
-	A subdirectory is identified by a trailing '/' which
-	can be seen in the example above for the usb subdirectory.
-
-	Subdirectories are visited before their parent directories.
-
-	--- 7.2 genhdr-y
-
-	genhdr-y specifies generated files to be exported.
-	Generated files are special as they need to be looked
-	up in another directory when doing 'make O=...' builds.
-
-		Example:
-			#include/linux/Kbuild
-			genhdr-y += version.h
-
-	--- 7.3 destination-y
-
-	When an architecture has a set of exported headers that needs to be
-	exported to a different directory destination-y is used.
-	destination-y specifies the destination directory for all exported
-	headers in the file where it is present.
-
-		Example:
-			#arch/xtensa/platforms/s6105/include/platform/Kbuild
-			destination-y := include/linux
-
-	In the example above all exported headers in the Kbuild file
-	will be located in the directory "include/linux" when exported.
-
-	--- 7.4 generic-y
+	--- 7.2 generic-y
 
 	If an architecture uses a verbatim copy of a header from
 	include/asm-generic then this is listed in the file
@@ -1336,11 +1303,10 @@
 		Example: termios.h
 			#include <asm-generic/termios.h>
 
-	--- 7.5 generated-y
+	--- 7.3 generated-y
 
 	If an architecture generates other header files alongside generic-y
-	wrappers, and not included in genhdr-y, then generated-y specifies
-	them.
+	wrappers, generated-y specifies them.
 
 	This prevents them being treated as stale asm-generic wrappers and
 	removed.
@@ -1349,6 +1315,15 @@
 			#arch/x86/include/asm/Kbuild
 			generated-y += syscalls_32.h
 
+	--- 7.4 mandatory-y
+
+	mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm
+	to define the minimun set of headers that must be exported in
+	include/asm.
+
+	The convention is to list one subdir per line and
+	preferably in alphabetic order.
+
 === 8 Kbuild Variables
 
 The top Makefile exports the following variables:
diff --git a/Makefile b/Makefile
index 23c3897..874a3a7 100644
--- a/Makefile
+++ b/Makefile
@@ -1300,7 +1300,7 @@
 export INSTALL_HDR_PATH = $(objtree)/usr
 
 # If we do an all arch process set dst to asm-$(hdr-arch)
-hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
 
 PHONY += archheaders
 archheaders:
@@ -1321,7 +1321,7 @@
 	$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
 	  $(error Headers not exportable for the $(SRCARCH) architecture))
 	$(Q)$(MAKE) $(hdr-inst)=include/uapi
-	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst)
+	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
 	$(Q)$(MAKE) $(hdr-inst)=techpack
 
 PHONY += headers_check_all
@@ -1331,7 +1331,7 @@
 PHONY += headers_check
 headers_check: headers_install
 	$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
-	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1
+	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) HDRCHECK=1
 	$(Q)$(MAKE) $(hdr-inst)=techpack HDRCHECK=1
 
 # ---------------------------------------------------------------------------
diff --git a/arch/alpha/include/uapi/asm/Kbuild b/arch/alpha/include/uapi/asm/Kbuild
index d96f2ef..b15bf6b 100644
--- a/arch/alpha/include/uapi/asm/Kbuild
+++ b/arch/alpha/include/uapi/asm/Kbuild
@@ -1,43 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += a.out.h
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += compiler.h
-header-y += console.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += fpu.h
-header-y += gentrap.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += pal.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += reg.h
-header-y += regdef.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += sysinfo.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/arc/include/uapi/asm/Kbuild b/arch/arc/include/uapi/asm/Kbuild
index f50d02d..b15bf6b 100644
--- a/arch/arc/include/uapi/asm/Kbuild
+++ b/arch/arc/include/uapi/asm/Kbuild
@@ -1,5 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-header-y += elf.h
-header-y += page.h
-header-y += cachectl.h
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild
index 46a76cd6..424935e 100644
--- a/arch/arm/include/uapi/asm/Kbuild
+++ b/arch/arm/include/uapi/asm/Kbuild
@@ -1,23 +1,6 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += auxvec.h
-header-y += byteorder.h
-header-y += fcntl.h
-header-y += hwcap.h
-header-y += ioctls.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += perf_regs.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += setup.h
-header-y += sigcontext.h
-header-y += signal.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += unistd.h
-genhdr-y += unistd-common.h
-genhdr-y += unistd-oabi.h
-genhdr-y += unistd-eabi.h
+generated-y += unistd-common.h
+generated-y += unistd-oabi.h
+generated-y += unistd-eabi.h
diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/uapi/asm/types.h
similarity index 93%
rename from arch/arm/include/asm/types.h
rename to arch/arm/include/uapi/asm/types.h
index a53cdb8..9435a42 100644
--- a/arch/arm/include/asm/types.h
+++ b/arch/arm/include/uapi/asm/types.h
@@ -1,5 +1,5 @@
-#ifndef _ASM_TYPES_H
-#define _ASM_TYPES_H
+#ifndef _UAPI_ASM_TYPES_H
+#define _UAPI_ASM_TYPES_H
 
 #include <asm-generic/int-ll64.h>
 
@@ -37,4 +37,4 @@
 #define __UINTPTR_TYPE__	unsigned long
 #endif
 
-#endif /* _ASM_TYPES_H */
+#endif /* _UAPI_ASM_TYPES_H */
diff --git a/arch/arm64/include/uapi/asm/Kbuild b/arch/arm64/include/uapi/asm/Kbuild
index 825b0fe..13a97aa 100644
--- a/arch/arm64/include/uapi/asm/Kbuild
+++ b/arch/arm64/include/uapi/asm/Kbuild
@@ -2,21 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += kvm_para.h
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += fcntl.h
-header-y += hwcap.h
-header-y += kvm_para.h
-header-y += perf_regs.h
-header-y += param.h
-header-y += ptrace.h
-header-y += setup.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += stat.h
-header-y += statfs.h
-header-y += ucontext.h
-header-y += unistd.h
diff --git a/arch/blackfin/include/uapi/asm/Kbuild b/arch/blackfin/include/uapi/asm/Kbuild
index 0bd28f7..b15bf6b 100644
--- a/arch/blackfin/include/uapi/asm/Kbuild
+++ b/arch/blackfin/include/uapi/asm/Kbuild
@@ -1,19 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += bfin_sport.h
-header-y += byteorder.h
-header-y += cachectl.h
-header-y += fcntl.h
-header-y += fixed_code.h
-header-y += ioctls.h
-header-y += kvm_para.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += stat.h
-header-y += swab.h
-header-y += unistd.h
diff --git a/arch/c6x/include/uapi/asm/Kbuild b/arch/c6x/include/uapi/asm/Kbuild
index e9bc2b2..13a97aa 100644
--- a/arch/c6x/include/uapi/asm/Kbuild
+++ b/arch/c6x/include/uapi/asm/Kbuild
@@ -2,11 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += kvm_para.h
-
-header-y += byteorder.h
-header-y += kvm_para.h
-header-y += ptrace.h
-header-y += setup.h
-header-y += sigcontext.h
-header-y += swab.h
-header-y += unistd.h
diff --git a/arch/cris/include/uapi/arch-v10/arch/Kbuild b/arch/cris/include/uapi/arch-v10/arch/Kbuild
deleted file mode 100644
index 9048c87..0000000
--- a/arch/cris/include/uapi/arch-v10/arch/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-# UAPI Header export list
-header-y += sv_addr.agh
-header-y += sv_addr_ag.h
-header-y += svinto.h
-header-y += user.h
diff --git a/arch/cris/include/uapi/arch-v32/arch/Kbuild b/arch/cris/include/uapi/arch-v32/arch/Kbuild
deleted file mode 100644
index 59efffd..0000000
--- a/arch/cris/include/uapi/arch-v32/arch/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
-# UAPI Header export list
-header-y += cryptocop.h
-header-y += user.h
diff --git a/arch/cris/include/uapi/asm/Kbuild b/arch/cris/include/uapi/asm/Kbuild
index d5564a0..b15bf6b 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -1,44 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += ../arch-v10/arch/
-header-y += ../arch-v32/arch/
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += elf.h
-header-y += elf_v10.h
-header-y += elf_v32.h
-header-y += errno.h
-header-y += ethernet.h
-header-y += etraxgpio.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += ptrace_v10.h
-header-y += ptrace_v32.h
-header-y += resource.h
-header-y += rs485.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += sync_serial.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/frv/include/uapi/asm/Kbuild b/arch/frv/include/uapi/asm/Kbuild
index 42a2b33..b15bf6b 100644
--- a/arch/frv/include/uapi/asm/Kbuild
+++ b/arch/frv/include/uapi/asm/Kbuild
@@ -1,35 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += registers.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/h8300/include/uapi/asm/Kbuild b/arch/h8300/include/uapi/asm/Kbuild
index fb6101a..b15bf6b 100644
--- a/arch/h8300/include/uapi/asm/Kbuild
+++ b/arch/h8300/include/uapi/asm/Kbuild
@@ -1,30 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += siginfo.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index db8ddab..f3b1ceb 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -1,6 +1,3 @@
-
-header-y += ucontext.h
-
 generic-y += auxvec.h
 generic-y += barrier.h
 generic-y += bug.h
diff --git a/arch/hexagon/include/uapi/asm/Kbuild b/arch/hexagon/include/uapi/asm/Kbuild
index c31706c..b15bf6b 100644
--- a/arch/hexagon/include/uapi/asm/Kbuild
+++ b/arch/hexagon/include/uapi/asm/Kbuild
@@ -1,15 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += kvm_para.h
-header-y += param.h
-header-y += ptrace.h
-header-y += registers.h
-header-y += setup.h
-header-y += sigcontext.h
-header-y += signal.h
-header-y += swab.h
-header-y += unistd.h
-header-y += user.h
diff --git a/arch/ia64/include/uapi/asm/Kbuild b/arch/ia64/include/uapi/asm/Kbuild
index 891002b..13a97aa 100644
--- a/arch/ia64/include/uapi/asm/Kbuild
+++ b/arch/ia64/include/uapi/asm/Kbuild
@@ -2,48 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += kvm_para.h
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += break.h
-header-y += byteorder.h
-header-y += cmpxchg.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += fpu.h
-header-y += gcc_intrin.h
-header-y += ia64regs.h
-header-y += intel_intrin.h
-header-y += intrinsics.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += perfmon.h
-header-y += perfmon_default_smpl.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += ptrace_offsets.h
-header-y += resource.h
-header-y += rse.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += ucontext.h
-header-y += unistd.h
-header-y += ustack.h
diff --git a/arch/m32r/include/uapi/asm/Kbuild b/arch/m32r/include/uapi/asm/Kbuild
index 43937a6..b15bf6b 100644
--- a/arch/m32r/include/uapi/asm/Kbuild
+++ b/arch/m32r/include/uapi/asm/Kbuild
@@ -1,33 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/m68k/include/uapi/asm/Kbuild b/arch/m68k/include/uapi/asm/Kbuild
index 6a2d257..6436807 100644
--- a/arch/m68k/include/uapi/asm/Kbuild
+++ b/arch/m68k/include/uapi/asm/Kbuild
@@ -9,27 +9,3 @@
 generic-y += sockios.h
 generic-y += termbits.h
 generic-y += termios.h
-
-header-y += a.out.h
-header-y += bootinfo.h
-header-y += bootinfo-amiga.h
-header-y += bootinfo-apollo.h
-header-y += bootinfo-atari.h
-header-y += bootinfo-hp300.h
-header-y += bootinfo-mac.h
-header-y += bootinfo-q40.h
-header-y += bootinfo-vme.h
-header-y += byteorder.h
-header-y += cachectl.h
-header-y += fcntl.h
-header-y += ioctls.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += setup.h
-header-y += sigcontext.h
-header-y += signal.h
-header-y += stat.h
-header-y += swab.h
-header-y += unistd.h
diff --git a/arch/metag/include/uapi/asm/Kbuild b/arch/metag/include/uapi/asm/Kbuild
index ab78be2..b29731e 100644
--- a/arch/metag/include/uapi/asm/Kbuild
+++ b/arch/metag/include/uapi/asm/Kbuild
@@ -1,14 +1,6 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += byteorder.h
-header-y += ech.h
-header-y += ptrace.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += swab.h
-header-y += unistd.h
-
 generic-y += mman.h
 generic-y += resource.h
 generic-y += setup.h
diff --git a/arch/microblaze/include/uapi/asm/Kbuild b/arch/microblaze/include/uapi/asm/Kbuild
index 1aac99f..2178c78 100644
--- a/arch/microblaze/include/uapi/asm/Kbuild
+++ b/arch/microblaze/include/uapi/asm/Kbuild
@@ -2,35 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += types.h
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += elf.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += unistd.h
diff --git a/arch/mips/include/uapi/asm/Kbuild b/arch/mips/include/uapi/asm/Kbuild
index f2cf414..a0266fe 100644
--- a/arch/mips/include/uapi/asm/Kbuild
+++ b/arch/mips/include/uapi/asm/Kbuild
@@ -2,40 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += ipcbuf.h
-
-header-y += auxvec.h
-header-y += bitfield.h
-header-y += bitsperlong.h
-header-y += break.h
-header-y += byteorder.h
-header-y += cachectl.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += inst.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += sgidefs.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += sysmips.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/mn10300/include/uapi/asm/Kbuild b/arch/mn10300/include/uapi/asm/Kbuild
index 040178c..b15bf6b 100644
--- a/arch/mn10300/include/uapi/asm/Kbuild
+++ b/arch/mn10300/include/uapi/asm/Kbuild
@@ -1,34 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild
index e0bb972..0c74c3c 100644
--- a/arch/nios2/include/uapi/asm/Kbuild
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -1,5 +1,4 @@
+# UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += elf.h
-
 generic-y += ucontext.h
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 2832f03..5619157 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -1,6 +1,3 @@
-
-header-y += ucontext.h
-
 generic-y += atomic.h
 generic-y += auxvec.h
 generic-y += barrier.h
diff --git a/arch/openrisc/include/uapi/asm/Kbuild b/arch/openrisc/include/uapi/asm/Kbuild
index 80761eb..b15bf6b 100644
--- a/arch/openrisc/include/uapi/asm/Kbuild
+++ b/arch/openrisc/include/uapi/asm/Kbuild
@@ -1,10 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += byteorder.h
-header-y += elf.h
-header-y += kvm_para.h
-header-y += param.h
-header-y += ptrace.h
-header-y += sigcontext.h
-header-y += unistd.h
diff --git a/arch/parisc/include/uapi/asm/Kbuild b/arch/parisc/include/uapi/asm/Kbuild
index 348356c..3971c60 100644
--- a/arch/parisc/include/uapi/asm/Kbuild
+++ b/arch/parisc/include/uapi/asm/Kbuild
@@ -2,31 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += resource.h
-
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += pdc.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild
index dab3717..b15bf6b 100644
--- a/arch/powerpc/include/uapi/asm/Kbuild
+++ b/arch/powerpc/include/uapi/asm/Kbuild
@@ -1,47 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += bootx.h
-header-y += byteorder.h
-header-y += cputable.h
-header-y += eeh.h
-header-y += elf.h
-header-y += epapr_hcalls.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += nvram.h
-header-y += opal-prd.h
-header-y += param.h
-header-y += perf_event.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ps3fb.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += spu_info.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += tm.h
-header-y += types.h
-header-y += ucontext.h
-header-y += unistd.h
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index cc44b09..baebb3d 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -1,53 +1,3 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += chpid.h
-header-y += chsc.h
-header-y += clp.h
-header-y += cmb.h
-header-y += dasd.h
-header-y += debug.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm.h
-header-y += kvm_para.h
-header-y += kvm_perf.h
-header-y += kvm_virtio.h
-header-y += mman.h
-header-y += monwriter.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += qeth.h
-header-y += resource.h
-header-y += schid.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += sclp_ctl.h
-header-y += sie.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += tape390.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += ucontext.h
-header-y += unistd.h
-header-y += virtio-ccw.h
-header-y += vtoc.h
-header-y += zcrypt.h
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index a05218f..c70aceb 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -1,7 +1,4 @@
 
-header-y +=
-
-
 generic-y += barrier.h
 generic-y += clkdev.h
 generic-y += cputime.h
diff --git a/arch/score/include/uapi/asm/Kbuild b/arch/score/include/uapi/asm/Kbuild
index 040178c..b15bf6b 100644
--- a/arch/score/include/uapi/asm/Kbuild
+++ b/arch/score/include/uapi/asm/Kbuild
@@ -1,34 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
diff --git a/arch/sh/include/uapi/asm/Kbuild b/arch/sh/include/uapi/asm/Kbuild
index 60613ae..b15bf6b 100644
--- a/arch/sh/include/uapi/asm/Kbuild
+++ b/arch/sh/include/uapi/asm/Kbuild
@@ -1,25 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += byteorder.h
-header-y += cachectl.h
-header-y += cpu-features.h
-header-y += hw_breakpoint.h
-header-y += ioctls.h
-header-y += posix_types.h
-header-y += posix_types_32.h
-header-y += posix_types_64.h
-header-y += ptrace.h
-header-y += ptrace_32.h
-header-y += ptrace_64.h
-header-y += setup.h
-header-y += sigcontext.h
-header-y += signal.h
-header-y += sockios.h
-header-y += stat.h
-header-y += swab.h
-header-y += types.h
-header-y += unistd.h
-header-y += unistd_32.h
-header-y += unistd_64.h
diff --git a/arch/sparc/include/uapi/asm/Kbuild b/arch/sparc/include/uapi/asm/Kbuild
index b5843ee..b15bf6b 100644
--- a/arch/sparc/include/uapi/asm/Kbuild
+++ b/arch/sparc/include/uapi/asm/Kbuild
@@ -1,50 +1,2 @@
 # UAPI Header export list
-# User exported sparc header files
-
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += apc.h
-header-y += asi.h
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += display7seg.h
-header-y += envctrl.h
-header-y += errno.h
-header-y += fbio.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += jsflash.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += openpromio.h
-header-y += param.h
-header-y += perfctr.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += psr.h
-header-y += psrcompat.h
-header-y += pstate.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += traps.h
-header-y += uctx.h
-header-y += unistd.h
-header-y += utrap.h
-header-y += watchdog.h
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index ba35c41..bf3e654 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -1,6 +1,3 @@
-
-header-y += ../arch/
-
 generic-y += bug.h
 generic-y += bugs.h
 generic-y += clkdev.h
diff --git a/arch/tile/include/uapi/arch/Kbuild b/arch/tile/include/uapi/arch/Kbuild
deleted file mode 100644
index 97dfbec..0000000
--- a/arch/tile/include/uapi/arch/Kbuild
+++ /dev/null
@@ -1,17 +0,0 @@
-# UAPI Header export list
-header-y += abi.h
-header-y += chip.h
-header-y += chip_tilegx.h
-header-y += chip_tilepro.h
-header-y += icache.h
-header-y += interrupts.h
-header-y += interrupts_32.h
-header-y += interrupts_64.h
-header-y += opcode.h
-header-y += opcode_tilegx.h
-header-y += opcode_tilepro.h
-header-y += sim.h
-header-y += sim_def.h
-header-y += spr_def.h
-header-y += spr_def_32.h
-header-y += spr_def_64.h
diff --git a/arch/tile/include/uapi/asm/Kbuild b/arch/tile/include/uapi/asm/Kbuild
index c20db8e..0c74c3c 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -1,21 +1,4 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += cachectl.h
-header-y += hardwall.h
-header-y += kvm_para.h
-header-y += mman.h
-header-y += ptrace.h
-header-y += setup.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += stat.h
-header-y += swab.h
-header-y += ucontext.h
-header-y += unistd.h
-
 generic-y += ucontext.h
diff --git a/arch/unicore32/include/uapi/asm/Kbuild b/arch/unicore32/include/uapi/asm/Kbuild
index 0514d7a..13a97aa 100644
--- a/arch/unicore32/include/uapi/asm/Kbuild
+++ b/arch/unicore32/include/uapi/asm/Kbuild
@@ -1,10 +1,4 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += byteorder.h
-header-y += kvm_para.h
-header-y += ptrace.h
-header-y += sigcontext.h
-header-y += unistd.h
-
 generic-y += kvm_para.h
diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index 1c532b3..da1489c 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -1,64 +1,6 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-genhdr-y += unistd_32.h
-genhdr-y += unistd_64.h
-genhdr-y += unistd_x32.h
-header-y += a.out.h
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += boot.h
-header-y += bootparam.h
-header-y += byteorder.h
-header-y += debugreg.h
-header-y += e820.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += hw_breakpoint.h
-header-y += hyperv.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += ist.h
-header-y += kvm.h
-header-y += kvm_para.h
-header-y += kvm_perf.h
-header-y += ldt.h
-header-y += mce.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += msr.h
-header-y += mtrr.h
-header-y += param.h
-header-y += perf_regs.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += posix_types_32.h
-header-y += posix_types_64.h
-header-y += posix_types_x32.h
-header-y += prctl.h
-header-y += processor-flags.h
-header-y += ptrace-abi.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += sigcontext32.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += svm.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += ucontext.h
-header-y += unistd.h
-header-y += vm86.h
-header-y += vmx.h
-header-y += vsyscall.h
+generated-y += unistd_32.h
+generated-y += unistd_64.h
+generated-y += unistd_x32.h
diff --git a/arch/xtensa/include/uapi/asm/Kbuild b/arch/xtensa/include/uapi/asm/Kbuild
index 56aad54..b15bf6b 100644
--- a/arch/xtensa/include/uapi/asm/Kbuild
+++ b/arch/xtensa/include/uapi/asm/Kbuild
@@ -1,25 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-header-y += auxvec.h
-header-y += byteorder.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += swab.h
-header-y += termbits.h
-header-y += types.h
-header-y += unistd.h
diff --git a/gen_headers_arm.bp b/gen_headers_arm.bp
new file mode 100644
index 0000000..e8d2f2f
--- /dev/null
+++ b/gen_headers_arm.bp
@@ -0,0 +1,976 @@
+// ***** DO NOT EDIT *****
+// This file is generated by kernel_headers.py
+
+gen_headers_srcs_arm = [
+    "arch/arm/include/uapi/asm/Kbuild",
+    "include/uapi/asm-generic/Kbuild.asm",
+    "Makefile",
+    "arch/arm/tools/syscall.tbl",
+    "include/uapi/**/*.h",
+    "arch/arm/include/uapi/**/*.h",
+]
+
+gen_headers_exclude_srcs_arm = [
+    "include/uapi/linux/a.out.h",
+    "include/uapi/drm/armada_drm.h",
+    "include/uapi/drm/etnaviv_drm.h",
+    "include/uapi/drm/omap_drm.h",
+    "include/uapi/drm/vgem_drm.h",
+    "include/uapi/linux/auto_dev-ioctl.h",
+    "include/uapi/linux/batman_adv.h",
+    "include/uapi/linux/bcache.h",
+    "include/uapi/linux/btrfs_tree.h",
+    "include/uapi/linux/cryptouser.h",
+    "include/uapi/linux/dma-buf.h",
+    "include/uapi/linux/hash_info.h",
+    "include/uapi/linux/kcm.h",
+    "include/uapi/linux/kcov.h",
+    "include/uapi/linux/kfd_ioctl.h",
+    "include/uapi/linux/lightnvm.h",
+    "include/uapi/linux/module.h",
+    "include/uapi/linux/nilfs2_api.h",
+    "include/uapi/linux/nilfs2_ondisk.h",
+    "include/uapi/linux/nsfs.h",
+    "include/uapi/linux/pr.h",
+    "include/uapi/linux/qrtr.h",
+    "include/uapi/linux/stm.h",
+    "include/uapi/linux/tee.h",
+    "include/uapi/linux/userio.h",
+    "include/uapi/linux/wil6210_uapi.h",
+    "include/uapi/rdma/qedr-abi.h",
+    "include/uapi/video/adf.h",
+    "include/uapi/linux/cifs/cifs_mount.h",
+    "include/uapi/linux/genwqe/genwqe_card.h",
+    "include/uapi/linux/netfilter/xt_HARDIDLETIMER.h",
+    "include/uapi/linux/usb/f_accessory.h",
+    "include/uapi/linux/usb/f_mtp.h",
+]
+
+gen_headers_out_arm = [
+
+    // Matching generated-y:
+
+    "asm/unistd-common.h",
+    "asm/unistd-oabi.h",
+    "asm/unistd-eabi.h",
+
+    // Matching mandatory-y:
+
+    "asm/bitsperlong.h",
+    "asm/errno.h",
+    "asm/ioctl.h",
+    "asm/ipcbuf.h",
+    "asm/msgbuf.h",
+    "asm/param.h",
+    "asm/poll.h",
+    "asm/resource.h",
+    "asm/sembuf.h",
+    "asm/shmbuf.h",
+    "asm/siginfo.h",
+    "asm/socket.h",
+    "asm/sockios.h",
+    "asm/termbits.h",
+    "asm/termios.h",
+
+    // From include/uapi/**/*.h
+
+    "asm-generic/auxvec.h",
+    "asm-generic/bitsperlong.h",
+    "asm-generic/errno-base.h",
+    "asm-generic/errno.h",
+    "asm-generic/fcntl.h",
+    "asm-generic/int-l64.h",
+    "asm-generic/int-ll64.h",
+    "asm-generic/ioctl.h",
+    "asm-generic/ioctls.h",
+    "asm-generic/ipcbuf.h",
+    "asm-generic/kvm_para.h",
+    "asm-generic/mman-common.h",
+    "asm-generic/mman.h",
+    "asm-generic/msgbuf.h",
+    "asm-generic/param.h",
+    "asm-generic/poll.h",
+    "asm-generic/posix_types.h",
+    "asm-generic/resource.h",
+    "asm-generic/sembuf.h",
+    "asm-generic/setup.h",
+    "asm-generic/shmbuf.h",
+    "asm-generic/shmparam.h",
+    "asm-generic/siginfo.h",
+    "asm-generic/signal-defs.h",
+    "asm-generic/signal.h",
+    "asm-generic/socket.h",
+    "asm-generic/sockios.h",
+    "asm-generic/stat.h",
+    "asm-generic/statfs.h",
+    "asm-generic/swab.h",
+    "asm-generic/termbits.h",
+    "asm-generic/termios.h",
+    "asm-generic/types.h",
+    "asm-generic/ucontext.h",
+    "asm-generic/unistd.h",
+    "drm/amdgpu_drm.h",
+    "drm/drm.h",
+    "drm/drm_fourcc.h",
+    "drm/drm_mode.h",
+    "drm/drm_sarea.h",
+    "drm/exynos_drm.h",
+    "drm/i810_drm.h",
+    "drm/i915_drm.h",
+    "drm/mga_drm.h",
+    "drm/msm_drm.h",
+    "drm/msm_drm_pp.h",
+    "drm/nouveau_drm.h",
+    "drm/qxl_drm.h",
+    "drm/r128_drm.h",
+    "drm/radeon_drm.h",
+    "drm/savage_drm.h",
+    "drm/sde_drm.h",
+    "drm/sis_drm.h",
+    "drm/tegra_drm.h",
+    "drm/vc4_drm.h",
+    "drm/via_drm.h",
+    "drm/virtgpu_drm.h",
+    "drm/vmwgfx_drm.h",
+    "linux/acct.h",
+    "linux/adb.h",
+    "linux/adfs_fs.h",
+    "linux/affs_hardblocks.h",
+    "linux/agpgart.h",
+    "linux/aio_abi.h",
+    "linux/am437x-vpfe.h",
+    "linux/apm_bios.h",
+    "linux/arcfb.h",
+    "linux/atalk.h",
+    "linux/atm.h",
+    "linux/atm_eni.h",
+    "linux/atm_he.h",
+    "linux/atm_idt77105.h",
+    "linux/atm_nicstar.h",
+    "linux/atm_tcp.h",
+    "linux/atm_zatm.h",
+    "linux/atmapi.h",
+    "linux/atmarp.h",
+    "linux/atmbr2684.h",
+    "linux/atmclip.h",
+    "linux/atmdev.h",
+    "linux/atmioc.h",
+    "linux/atmlec.h",
+    "linux/atmmpc.h",
+    "linux/atmppp.h",
+    "linux/atmsap.h",
+    "linux/atmsvc.h",
+    "linux/audit.h",
+    "linux/auto_fs.h",
+    "linux/auto_fs4.h",
+    "linux/auxvec.h",
+    "linux/ax25.h",
+    "linux/b1lli.h",
+    "linux/batterydata-interface.h",
+    "linux/baycom.h",
+    "linux/bcm933xx_hcs.h",
+    "linux/bfs_fs.h",
+    "linux/bgcom_interface.h",
+    "linux/binfmts.h",
+    "linux/blkpg.h",
+    "linux/blktrace_api.h",
+    "linux/bpf.h",
+    "linux/bpf_common.h",
+    "linux/bpf_perf_event.h",
+    "linux/bpqether.h",
+    "linux/bsg.h",
+    "linux/bt-bmc.h",
+    "linux/btrfs.h",
+    "linux/can.h",
+    "linux/capability.h",
+    "linux/capi.h",
+    "linux/cciss_defs.h",
+    "linux/cciss_ioctl.h",
+    "linux/cdrom.h",
+    "linux/cgroupstats.h",
+    "linux/chio.h",
+    "linux/cm4000_cs.h",
+    "linux/cn_proc.h",
+    "linux/coda.h",
+    "linux/coda_psdev.h",
+    "linux/coff.h",
+    "linux/connector.h",
+    "linux/const.h",
+    "linux/coresight-stm.h",
+    "linux/cramfs_fs.h",
+    "linux/cuda.h",
+    "linux/cyclades.h",
+    "linux/cycx_cfm.h",
+    "linux/dcbnl.h",
+    "linux/dccp.h",
+    "linux/devlink.h",
+    "linux/dlm.h",
+    "linux/dlm_device.h",
+    "linux/dlm_netlink.h",
+    "linux/dlm_plock.h",
+    "linux/dlmconstants.h",
+    "linux/dm-ioctl.h",
+    "linux/dm-log-userspace.h",
+    "linux/dn.h",
+    "linux/dqblk_xfs.h",
+    "linux/edd.h",
+    "linux/efs_fs_sb.h",
+    "linux/elf-em.h",
+    "linux/elf-fdpic.h",
+    "linux/elf.h",
+    "linux/elfcore.h",
+    "linux/errno.h",
+    "linux/errqueue.h",
+    "linux/esoc_ctrl.h",
+    "linux/ethtool.h",
+    "linux/eventpoll.h",
+    "linux/fadvise.h",
+    "linux/falloc.h",
+    "linux/fanotify.h",
+    "linux/fb.h",
+    "linux/fcntl.h",
+    "linux/fd.h",
+    "linux/fdreg.h",
+    "linux/fib_rules.h",
+    "linux/fiemap.h",
+    "linux/filter.h",
+    "linux/fips_status.h",
+    "linux/firewire-cdev.h",
+    "linux/firewire-constants.h",
+    "linux/flat.h",
+    "linux/fou.h",
+    "linux/fs.h",
+    "linux/fsl_hypervisor.h",
+    "linux/fuse.h",
+    "linux/futex.h",
+    "linux/gameport.h",
+    "linux/gen_stats.h",
+    "linux/genetlink.h",
+    "linux/gfs2_ondisk.h",
+    "linux/gigaset_dev.h",
+    "linux/gpio.h",
+    "linux/gsmmux.h",
+    "linux/gtp.h",
+    "linux/hbtp_input.h",
+    "linux/hdlc.h",
+    "linux/hdlcdrv.h",
+    "linux/hdreg.h",
+    "linux/hid.h",
+    "linux/hiddev.h",
+    "linux/hidraw.h",
+    "linux/hpet.h",
+    "linux/hsr_netlink.h",
+    "linux/hw_breakpoint.h",
+    "linux/hyperv.h",
+    "linux/hysdn_if.h",
+    "linux/i2c-dev.h",
+    "linux/i2c.h",
+    "linux/i2o-dev.h",
+    "linux/i8k.h",
+    "linux/icmp.h",
+    "linux/icmpv6.h",
+    "linux/if.h",
+    "linux/if_addr.h",
+    "linux/if_addrlabel.h",
+    "linux/if_alg.h",
+    "linux/if_arcnet.h",
+    "linux/if_arp.h",
+    "linux/if_bonding.h",
+    "linux/if_bridge.h",
+    "linux/if_cablemodem.h",
+    "linux/if_eql.h",
+    "linux/if_ether.h",
+    "linux/if_fc.h",
+    "linux/if_fddi.h",
+    "linux/if_frad.h",
+    "linux/if_hippi.h",
+    "linux/if_infiniband.h",
+    "linux/if_link.h",
+    "linux/if_ltalk.h",
+    "linux/if_macsec.h",
+    "linux/if_packet.h",
+    "linux/if_phonet.h",
+    "linux/if_plip.h",
+    "linux/if_ppp.h",
+    "linux/if_pppol2tp.h",
+    "linux/if_pppolac.h",
+    "linux/if_pppopns.h",
+    "linux/if_pppox.h",
+    "linux/if_slip.h",
+    "linux/if_team.h",
+    "linux/if_tun.h",
+    "linux/if_tunnel.h",
+    "linux/if_vlan.h",
+    "linux/if_x25.h",
+    "linux/igmp.h",
+    "linux/ila.h",
+    "linux/in.h",
+    "linux/in6.h",
+    "linux/in_route.h",
+    "linux/inet_diag.h",
+    "linux/inotify.h",
+    "linux/input-event-codes.h",
+    "linux/input.h",
+    "linux/ioctl.h",
+    "linux/ion.h",
+    "linux/ip.h",
+    "linux/ip6_tunnel.h",
+    "linux/ip_vs.h",
+    "linux/ipa_qmi_service_v01.h",
+    "linux/ipc.h",
+    "linux/ipmi.h",
+    "linux/ipmi_msgdefs.h",
+    "linux/ipsec.h",
+    "linux/ipv6.h",
+    "linux/ipv6_route.h",
+    "linux/ipx.h",
+    "linux/irda.h",
+    "linux/irqnr.h",
+    "linux/isdn.h",
+    "linux/isdn_divertif.h",
+    "linux/isdn_ppp.h",
+    "linux/isdnif.h",
+    "linux/iso_fs.h",
+    "linux/ivtv.h",
+    "linux/ivtvfb.h",
+    "linux/ixjuser.h",
+    "linux/jffs2.h",
+    "linux/joystick.h",
+    "linux/kcmp.h",
+    "linux/kd.h",
+    "linux/kdev_t.h",
+    "linux/kernel-page-flags.h",
+    "linux/kernel.h",
+    "linux/kernelcapi.h",
+    "linux/kexec.h",
+    "linux/keyboard.h",
+    "linux/keyctl.h",
+    "linux/kvm.h",
+    "linux/kvm_para.h",
+    "linux/l2tp.h",
+    "linux/libc-compat.h",
+    "linux/limits.h",
+    "linux/lirc.h",
+    "linux/llc.h",
+    "linux/loop.h",
+    "linux/lp.h",
+    "linux/lwtunnel.h",
+    "linux/magic.h",
+    "linux/major.h",
+    "linux/map_to_7segment.h",
+    "linux/matroxfb.h",
+    "linux/mdio.h",
+    "linux/mdss_rotator.h",
+    "linux/media-bus-format.h",
+    "linux/media.h",
+    "linux/mei.h",
+    "linux/membarrier.h",
+    "linux/memfd.h",
+    "linux/mempolicy.h",
+    "linux/meye.h",
+    "linux/mhi.h",
+    "linux/mic_common.h",
+    "linux/mic_ioctl.h",
+    "linux/mii.h",
+    "linux/minix_fs.h",
+    "linux/mman.h",
+    "linux/mmtimer.h",
+    "linux/mpls.h",
+    "linux/mpls_iptunnel.h",
+    "linux/mqueue.h",
+    "linux/mroute.h",
+    "linux/mroute6.h",
+    "linux/msdos_fs.h",
+    "linux/msg.h",
+    "linux/msm-core-interface.h",
+    "linux/msm_dsps.h",
+    "linux/msm_ion.h",
+    "linux/msm_ipa.h",
+    "linux/msm_ipc.h",
+    "linux/msm_kgsl.h",
+    "linux/msm_mdp.h",
+    "linux/msm_mdp_ext.h",
+    "linux/msm_rmnet.h",
+    "linux/msm_rotator.h",
+    "linux/msm_vidc_dec.h",
+    "linux/msm_vidc_enc.h",
+    "linux/mtio.h",
+    "linux/n_r3964.h",
+    "linux/nbd.h",
+    "linux/ncp.h",
+    "linux/ncp_fs.h",
+    "linux/ncp_mount.h",
+    "linux/ncp_no.h",
+    "linux/ndctl.h",
+    "linux/neighbour.h",
+    "linux/net.h",
+    "linux/net_dropmon.h",
+    "linux/net_map.h",
+    "linux/net_namespace.h",
+    "linux/net_tstamp.h",
+    "linux/netconf.h",
+    "linux/netdevice.h",
+    "linux/netfilter.h",
+    "linux/netfilter_arp.h",
+    "linux/netfilter_bridge.h",
+    "linux/netfilter_decnet.h",
+    "linux/netfilter_ipv4.h",
+    "linux/netfilter_ipv6.h",
+    "linux/netlink.h",
+    "linux/netlink_diag.h",
+    "linux/netrom.h",
+    "linux/nfc.h",
+    "linux/nfs.h",
+    "linux/nfs2.h",
+    "linux/nfs3.h",
+    "linux/nfs4.h",
+    "linux/nfs4_mount.h",
+    "linux/nfs_fs.h",
+    "linux/nfs_idmap.h",
+    "linux/nfs_mount.h",
+    "linux/nfsacl.h",
+    "linux/nl80211.h",
+    "linux/nubus.h",
+    "linux/nvme_ioctl.h",
+    "linux/nvram.h",
+    "linux/okl4-link-shbuf.h",
+    "linux/omap3isp.h",
+    "linux/omapfb.h",
+    "linux/oom.h",
+    "linux/openvswitch.h",
+    "linux/packet_diag.h",
+    "linux/param.h",
+    "linux/parport.h",
+    "linux/patchkey.h",
+    "linux/pci.h",
+    "linux/pci_regs.h",
+    "linux/perf_event.h",
+    "linux/personality.h",
+    "linux/pfkeyv2.h",
+    "linux/pg.h",
+    "linux/phantom.h",
+    "linux/phonet.h",
+    "linux/pkt_cls.h",
+    "linux/pkt_sched.h",
+    "linux/pktcdvd.h",
+    "linux/pmu.h",
+    "linux/poll.h",
+    "linux/posix_acl.h",
+    "linux/posix_acl_xattr.h",
+    "linux/posix_types.h",
+    "linux/ppdev.h",
+    "linux/ppp-comp.h",
+    "linux/ppp-ioctl.h",
+    "linux/ppp_defs.h",
+    "linux/pps.h",
+    "linux/prctl.h",
+    "linux/psci.h",
+    "linux/ptp_clock.h",
+    "linux/ptrace.h",
+    "linux/qbt1000.h",
+    "linux/qcedev.h",
+    "linux/qcota.h",
+    "linux/qg-profile.h",
+    "linux/qg.h",
+    "linux/qnx4_fs.h",
+    "linux/qnxtypes.h",
+    "linux/qrng.h",
+    "linux/qseecom.h",
+    "linux/quota.h",
+    "linux/radeonfb.h",
+    "linux/random.h",
+    "linux/raw.h",
+    "linux/rds.h",
+    "linux/reboot.h",
+    "linux/reiserfs_fs.h",
+    "linux/reiserfs_xattr.h",
+    "linux/resource.h",
+    "linux/rfkill.h",
+    "linux/rio_cm_cdev.h",
+    "linux/rio_mport_cdev.h",
+    "linux/rmnet_data.h",
+    "linux/rmnet_ipa_fd_ioctl.h",
+    "linux/romfs_fs.h",
+    "linux/rose.h",
+    "linux/route.h",
+    "linux/rtc.h",
+    "linux/rtnetlink.h",
+    "linux/scc.h",
+    "linux/sched.h",
+    "linux/scif_ioctl.h",
+    "linux/screen_info.h",
+    "linux/sctp.h",
+    "linux/sdla.h",
+    "linux/seccomp.h",
+    "linux/securebits.h",
+    "linux/seemp_api.h",
+    "linux/seemp_param_id.h",
+    "linux/selinux_netlink.h",
+    "linux/sem.h",
+    "linux/serial.h",
+    "linux/serial_core.h",
+    "linux/serial_reg.h",
+    "linux/serio.h",
+    "linux/shm.h",
+    "linux/signal.h",
+    "linux/signalfd.h",
+    "linux/smcinvoke.h",
+    "linux/smiapp.h",
+    "linux/snmp.h",
+    "linux/sock_diag.h",
+    "linux/socket.h",
+    "linux/sockev.h",
+    "linux/sockios.h",
+    "linux/sonet.h",
+    "linux/sonypi.h",
+    "linux/sound.h",
+    "linux/soundcard.h",
+    "linux/spcom.h",
+    "linux/stat.h",
+    "linux/stddef.h",
+    "linux/string.h",
+    "linux/suspend_ioctls.h",
+    "linux/swab.h",
+    "linux/sync_file.h",
+    "linux/synclink.h",
+    "linux/sysctl.h",
+    "linux/sysinfo.h",
+    "linux/target_core_user.h",
+    "linux/taskstats.h",
+    "linux/tcp.h",
+    "linux/tcp_metrics.h",
+    "linux/telephony.h",
+    "linux/termios.h",
+    "linux/thermal.h",
+    "linux/time.h",
+    "linux/times.h",
+    "linux/timex.h",
+    "linux/tiocl.h",
+    "linux/tipc.h",
+    "linux/tipc_config.h",
+    "linux/tipc_netlink.h",
+    "linux/toshiba.h",
+    "linux/tty.h",
+    "linux/tty_flags.h",
+    "linux/types.h",
+    "linux/udf_fs_i.h",
+    "linux/udp.h",
+    "linux/uhid.h",
+    "linux/uinput.h",
+    "linux/uio.h",
+    "linux/ultrasound.h",
+    "linux/un.h",
+    "linux/unistd.h",
+    "linux/unix_diag.h",
+    "linux/usbdevice_fs.h",
+    "linux/usbip.h",
+    "linux/userfaultfd.h",
+    "linux/utime.h",
+    "linux/utsname.h",
+    "linux/uuid.h",
+    "linux/uvcvideo.h",
+    "linux/v4l2-common.h",
+    "linux/v4l2-controls.h",
+    "linux/v4l2-dv-timings.h",
+    "linux/v4l2-mediabus.h",
+    "linux/v4l2-subdev.h",
+    "linux/veth.h",
+    "linux/vfio.h",
+    "linux/vhost.h",
+    "linux/videodev2.h",
+    "linux/virtio_9p.h",
+    "linux/virtio_balloon.h",
+    "linux/virtio_blk.h",
+    "linux/virtio_config.h",
+    "linux/virtio_console.h",
+    "linux/virtio_gpu.h",
+    "linux/virtio_ids.h",
+    "linux/virtio_input.h",
+    "linux/virtio_net.h",
+    "linux/virtio_pci.h",
+    "linux/virtio_ring.h",
+    "linux/virtio_rng.h",
+    "linux/virtio_scsi.h",
+    "linux/virtio_types.h",
+    "linux/virtio_vsock.h",
+    "linux/vm_bms.h",
+    "linux/vm_sockets.h",
+    "linux/vt.h",
+    "linux/vtpm_proxy.h",
+    "linux/wait.h",
+    "linux/wanrouter.h",
+    "linux/watchdog.h",
+    "linux/wimax.h",
+    "linux/wireless.h",
+    "linux/x25.h",
+    "linux/xattr.h",
+    "linux/xfrm.h",
+    "linux/xilinx-v4l2-controls.h",
+    "linux/zorro.h",
+    "linux/zorro_ids.h",
+    "media/cam_cpas.h",
+    "media/cam_defs.h",
+    "media/cam_fd.h",
+    "media/cam_icp.h",
+    "media/cam_isp.h",
+    "media/cam_isp_ife.h",
+    "media/cam_isp_vfe.h",
+    "media/cam_jpeg.h",
+    "media/cam_lrme.h",
+    "media/cam_req_mgr.h",
+    "media/cam_sensor.h",
+    "media/cam_sync.h",
+    "media/msm_cam_sensor.h",
+    "media/msm_camera.h",
+    "media/msm_camsensor_sdk.h",
+    "media/msm_fd.h",
+    "media/msm_isp.h",
+    "media/msm_jpeg.h",
+    "media/msm_jpeg_dma.h",
+    "media/msm_media_info.h",
+    "media/msm_sde_rotator.h",
+    "media/msm_vidc.h",
+    "media/msm_vidc_private.h",
+    "media/msmb_camera.h",
+    "media/msmb_generic_buf_mgr.h",
+    "media/msmb_isp.h",
+    "media/msmb_ispif.h",
+    "media/msmb_pproc.h",
+    "media/msmb_qca.h",
+    "media/radio-iris-commands.h",
+    "media/radio-iris.h",
+    "miniISP/miniISP_ioctl.h",
+    "misc/cxl.h",
+    "mtd/inftl-user.h",
+    "mtd/mtd-abi.h",
+    "mtd/mtd-user.h",
+    "mtd/nftl-user.h",
+    "mtd/ubi-user.h",
+    "rdma/cxgb3-abi.h",
+    "rdma/cxgb4-abi.h",
+    "rdma/ib_user_cm.h",
+    "rdma/ib_user_mad.h",
+    "rdma/ib_user_sa.h",
+    "rdma/ib_user_verbs.h",
+    "rdma/mlx4-abi.h",
+    "rdma/mlx5-abi.h",
+    "rdma/mthca-abi.h",
+    "rdma/nes-abi.h",
+    "rdma/ocrdma-abi.h",
+    "rdma/rdma_netlink.h",
+    "rdma/rdma_user_cm.h",
+    "rdma/rdma_user_rxe.h",
+    "scsi/cxlflash_ioctl.h",
+    "scsi/scsi_bsg_fc.h",
+    "scsi/scsi_ioctl.h",
+    "scsi/scsi_netlink.h",
+    "scsi/scsi_netlink_fc.h",
+    "scsi/sg.h",
+    "sound/asequencer.h",
+    "sound/asoc.h",
+    "sound/asound.h",
+    "sound/asound_fm.h",
+    "sound/compress_offload.h",
+    "sound/compress_params.h",
+    "sound/emu10k1.h",
+    "sound/firewire.h",
+    "sound/hdsp.h",
+    "sound/hdspm.h",
+    "sound/sb16_csp.h",
+    "sound/sfnt_info.h",
+    "sound/snd_sst_tokens.h",
+    "sound/tlv.h",
+    "sound/usb_stream.h",
+    "video/edid.h",
+    "video/msm_hdmi_hdcp_mgr.h",
+    "video/msm_hdmi_modes.h",
+    "video/sisfb.h",
+    "video/uvesafb.h",
+    "xen/evtchn.h",
+    "xen/gntalloc.h",
+    "xen/gntdev.h",
+    "xen/privcmd.h",
+    "linux/android/binder.h",
+    "linux/byteorder/big_endian.h",
+    "linux/byteorder/little_endian.h",
+    "linux/caif/caif_socket.h",
+    "linux/caif/if_caif.h",
+    "linux/can/bcm.h",
+    "linux/can/error.h",
+    "linux/can/gw.h",
+    "linux/can/netlink.h",
+    "linux/can/raw.h",
+    "linux/dvb/audio.h",
+    "linux/dvb/ca.h",
+    "linux/dvb/dmx.h",
+    "linux/dvb/frontend.h",
+    "linux/dvb/net.h",
+    "linux/dvb/osd.h",
+    "linux/dvb/version.h",
+    "linux/dvb/video.h",
+    "linux/hdlc/ioctl.h",
+    "linux/hsi/cs-protocol.h",
+    "linux/hsi/hsi_char.h",
+    "linux/iio/events.h",
+    "linux/iio/types.h",
+    "linux/isdn/capicmd.h",
+    "linux/mfd/msm-adie-codec.h",
+    "linux/mmc/core.h",
+    "linux/mmc/ioctl.h",
+    "linux/mmc/mmc.h",
+    "linux/netfilter/nf_conntrack_common.h",
+    "linux/netfilter/nf_conntrack_ftp.h",
+    "linux/netfilter/nf_conntrack_sctp.h",
+    "linux/netfilter/nf_conntrack_tcp.h",
+    "linux/netfilter/nf_conntrack_tuple_common.h",
+    "linux/netfilter/nf_log.h",
+    "linux/netfilter/nf_nat.h",
+    "linux/netfilter/nf_tables.h",
+    "linux/netfilter/nf_tables_compat.h",
+    "linux/netfilter/nfnetlink.h",
+    "linux/netfilter/nfnetlink_acct.h",
+    "linux/netfilter/nfnetlink_compat.h",
+    "linux/netfilter/nfnetlink_conntrack.h",
+    "linux/netfilter/nfnetlink_cthelper.h",
+    "linux/netfilter/nfnetlink_cttimeout.h",
+    "linux/netfilter/nfnetlink_log.h",
+    "linux/netfilter/nfnetlink_queue.h",
+    "linux/netfilter/x_tables.h",
+    "linux/netfilter/xt_AUDIT.h",
+    "linux/netfilter/xt_CHECKSUM.h",
+    "linux/netfilter/xt_CLASSIFY.h",
+    "linux/netfilter/xt_CONNMARK.h",
+    "linux/netfilter/xt_CONNSECMARK.h",
+    "linux/netfilter/xt_CT.h",
+    "linux/netfilter/xt_DSCP.h",
+    "linux/netfilter/xt_HMARK.h",
+    "linux/netfilter/xt_IDLETIMER.h",
+    "linux/netfilter/xt_LED.h",
+    "linux/netfilter/xt_LOG.h",
+    "linux/netfilter/xt_MARK.h",
+    "linux/netfilter/xt_NFLOG.h",
+    "linux/netfilter/xt_NFQUEUE.h",
+    "linux/netfilter/xt_RATEEST.h",
+    "linux/netfilter/xt_SECMARK.h",
+    "linux/netfilter/xt_SYNPROXY.h",
+    "linux/netfilter/xt_TCPMSS.h",
+    "linux/netfilter/xt_TCPOPTSTRIP.h",
+    "linux/netfilter/xt_TEE.h",
+    "linux/netfilter/xt_TPROXY.h",
+    "linux/netfilter/xt_addrtype.h",
+    "linux/netfilter/xt_bpf.h",
+    "linux/netfilter/xt_cgroup.h",
+    "linux/netfilter/xt_cluster.h",
+    "linux/netfilter/xt_comment.h",
+    "linux/netfilter/xt_connbytes.h",
+    "linux/netfilter/xt_connlabel.h",
+    "linux/netfilter/xt_connlimit.h",
+    "linux/netfilter/xt_connmark.h",
+    "linux/netfilter/xt_conntrack.h",
+    "linux/netfilter/xt_cpu.h",
+    "linux/netfilter/xt_dccp.h",
+    "linux/netfilter/xt_devgroup.h",
+    "linux/netfilter/xt_dscp.h",
+    "linux/netfilter/xt_ecn.h",
+    "linux/netfilter/xt_esp.h",
+    "linux/netfilter/xt_hashlimit.h",
+    "linux/netfilter/xt_helper.h",
+    "linux/netfilter/xt_ipcomp.h",
+    "linux/netfilter/xt_iprange.h",
+    "linux/netfilter/xt_ipvs.h",
+    "linux/netfilter/xt_l2tp.h",
+    "linux/netfilter/xt_length.h",
+    "linux/netfilter/xt_limit.h",
+    "linux/netfilter/xt_mac.h",
+    "linux/netfilter/xt_mark.h",
+    "linux/netfilter/xt_multiport.h",
+    "linux/netfilter/xt_nfacct.h",
+    "linux/netfilter/xt_osf.h",
+    "linux/netfilter/xt_owner.h",
+    "linux/netfilter/xt_physdev.h",
+    "linux/netfilter/xt_pkttype.h",
+    "linux/netfilter/xt_policy.h",
+    "linux/netfilter/xt_quota.h",
+    "linux/netfilter/xt_rateest.h",
+    "linux/netfilter/xt_realm.h",
+    "linux/netfilter/xt_recent.h",
+    "linux/netfilter/xt_rpfilter.h",
+    "linux/netfilter/xt_sctp.h",
+    "linux/netfilter/xt_set.h",
+    "linux/netfilter/xt_socket.h",
+    "linux/netfilter/xt_state.h",
+    "linux/netfilter/xt_statistic.h",
+    "linux/netfilter/xt_string.h",
+    "linux/netfilter/xt_tcpmss.h",
+    "linux/netfilter/xt_tcpudp.h",
+    "linux/netfilter/xt_time.h",
+    "linux/netfilter/xt_u32.h",
+    "linux/netfilter_arp/arp_tables.h",
+    "linux/netfilter_arp/arpt_mangle.h",
+    "linux/netfilter_bridge/ebt_802_3.h",
+    "linux/netfilter_bridge/ebt_among.h",
+    "linux/netfilter_bridge/ebt_arp.h",
+    "linux/netfilter_bridge/ebt_arpreply.h",
+    "linux/netfilter_bridge/ebt_ip.h",
+    "linux/netfilter_bridge/ebt_ip6.h",
+    "linux/netfilter_bridge/ebt_limit.h",
+    "linux/netfilter_bridge/ebt_log.h",
+    "linux/netfilter_bridge/ebt_mark_m.h",
+    "linux/netfilter_bridge/ebt_mark_t.h",
+    "linux/netfilter_bridge/ebt_nat.h",
+    "linux/netfilter_bridge/ebt_nflog.h",
+    "linux/netfilter_bridge/ebt_pkttype.h",
+    "linux/netfilter_bridge/ebt_redirect.h",
+    "linux/netfilter_bridge/ebt_stp.h",
+    "linux/netfilter_bridge/ebt_vlan.h",
+    "linux/netfilter_bridge/ebtables.h",
+    "linux/netfilter_ipv4/ip_tables.h",
+    "linux/netfilter_ipv4/ipt_CLUSTERIP.h",
+    "linux/netfilter_ipv4/ipt_ECN.h",
+    "linux/netfilter_ipv4/ipt_LOG.h",
+    "linux/netfilter_ipv4/ipt_NATTYPE.h",
+    "linux/netfilter_ipv4/ipt_REJECT.h",
+    "linux/netfilter_ipv4/ipt_TTL.h",
+    "linux/netfilter_ipv4/ipt_ah.h",
+    "linux/netfilter_ipv4/ipt_ecn.h",
+    "linux/netfilter_ipv4/ipt_ttl.h",
+    "linux/netfilter_ipv6/ip6_tables.h",
+    "linux/netfilter_ipv6/ip6t_HL.h",
+    "linux/netfilter_ipv6/ip6t_LOG.h",
+    "linux/netfilter_ipv6/ip6t_NPT.h",
+    "linux/netfilter_ipv6/ip6t_REJECT.h",
+    "linux/netfilter_ipv6/ip6t_ah.h",
+    "linux/netfilter_ipv6/ip6t_frag.h",
+    "linux/netfilter_ipv6/ip6t_hl.h",
+    "linux/netfilter_ipv6/ip6t_ipv6header.h",
+    "linux/netfilter_ipv6/ip6t_mh.h",
+    "linux/netfilter_ipv6/ip6t_opts.h",
+    "linux/netfilter_ipv6/ip6t_rt.h",
+    "linux/nfc/nfcinfo.h",
+    "linux/nfsd/cld.h",
+    "linux/nfsd/debug.h",
+    "linux/nfsd/export.h",
+    "linux/nfsd/nfsfh.h",
+    "linux/nfsd/stats.h",
+    "linux/raid/md_p.h",
+    "linux/raid/md_u.h",
+    "linux/spi/spidev.h",
+    "linux/sunrpc/debug.h",
+    "linux/tc_act/tc_bpf.h",
+    "linux/tc_act/tc_connmark.h",
+    "linux/tc_act/tc_csum.h",
+    "linux/tc_act/tc_defact.h",
+    "linux/tc_act/tc_gact.h",
+    "linux/tc_act/tc_ife.h",
+    "linux/tc_act/tc_ipt.h",
+    "linux/tc_act/tc_mirred.h",
+    "linux/tc_act/tc_nat.h",
+    "linux/tc_act/tc_pedit.h",
+    "linux/tc_act/tc_skbedit.h",
+    "linux/tc_act/tc_skbmod.h",
+    "linux/tc_act/tc_tunnel_key.h",
+    "linux/tc_act/tc_vlan.h",
+    "linux/tc_ematch/tc_em_cmp.h",
+    "linux/tc_ematch/tc_em_meta.h",
+    "linux/tc_ematch/tc_em_nbyte.h",
+    "linux/tc_ematch/tc_em_text.h",
+    "linux/usb/audio.h",
+    "linux/usb/cdc-wdm.h",
+    "linux/usb/cdc.h",
+    "linux/usb/ch11.h",
+    "linux/usb/ch9.h",
+    "linux/usb/functionfs.h",
+    "linux/usb/g_printer.h",
+    "linux/usb/gadgetfs.h",
+    "linux/usb/midi.h",
+    "linux/usb/tmc.h",
+    "linux/usb/usb_ctrl_qti.h",
+    "linux/usb/video.h",
+    "linux/wimax/i2400m.h",
+    "rdma/hfi/hfi1_user.h",
+    "scsi/fc/fc_els.h",
+    "scsi/fc/fc_fs.h",
+    "scsi/fc/fc_gs.h",
+    "scsi/fc/fc_ns.h",
+    "scsi/ufs/ioctl.h",
+    "scsi/ufs/ufs.h",
+    "linux/mfd/wcd9xxx/wcd9320_registers.h",
+    "linux/mfd/wcd9xxx/wcd9xxx_registers.h",
+    "linux/netfilter/ipset/ip_set.h",
+    "linux/netfilter/ipset/ip_set_bitmap.h",
+    "linux/netfilter/ipset/ip_set_hash.h",
+    "linux/netfilter/ipset/ip_set_list.h",
+
+    // From arch/arm/include/uapi/**/*.h
+
+    "asm/auxvec.h",
+    "asm/byteorder.h",
+    "asm/fcntl.h",
+    "asm/hwcap.h",
+    "asm/ioctls.h",
+    "asm/kvm.h",
+    "asm/kvm_para.h",
+    "asm/mman.h",
+    "asm/perf_regs.h",
+    "asm/posix_types.h",
+    "asm/ptrace.h",
+    "asm/setup.h",
+    "asm/sigcontext.h",
+    "asm/signal.h",
+    "asm/stat.h",
+    "asm/statfs.h",
+    "asm/swab.h",
+    "asm/types.h",
+    "asm/unistd.h",
+]
+
+genrule {
+    // This module generates the gen_headers_<arch>.bp file
+    // (i.e., a new version of this file) so that it can be
+    // checked later to ensure that it matches the checked-
+    // in version (this file).
+    name: "qti_generate_gen_headers_arm",
+    srcs: gen_headers_srcs_arm,
+    exclude_srcs: gen_headers_exclude_srcs_arm,
+    tool_files: ["kernel_headers.py"],
+    cmd: "python3 $(location kernel_headers.py) " +
+        kernel_headers_verbose +
+        "--header_arch arm " +
+        "--gen_dir $(genDir) " +
+        "--arch_asm_kbuild $(location arch/arm/include/uapi/asm/Kbuild) " +
+        "--arch_include_uapi $(locations arch/arm/include/uapi/**/*.h) " +
+        "--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild.asm) " +
+        "blueprints " +
+        "# $(in)",
+    out: ["gen_headers_arm.bp"],
+}
+
+genrule {
+    name: "qti_generate_kernel_headers_arm",
+    tools: ["headers_install.sh"],
+    tool_files: [
+        "kernel_headers.py",
+        "arch/arm/tools/syscallhdr.sh",
+    ],
+    srcs: gen_headers_srcs_arm +[
+        "gen_headers_arm.bp",
+        ":qti_generate_gen_headers_arm",
+    ],
+    exclude_srcs: gen_headers_exclude_srcs_arm,
+    cmd: "python3 $(location kernel_headers.py) " +
+        kernel_headers_verbose +
+        "--header_arch arm " +
+        "--gen_dir $(genDir) " +
+        "--arch_asm_kbuild $(location arch/arm/include/uapi/asm/Kbuild) " +
+        "--arch_include_uapi $(locations arch/arm/include/uapi/**/*.h) " +
+        "--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild.asm) " +
+        "headers " +
+        "--old_gen_headers_bp $(location gen_headers_arm.bp) " +
+        "--new_gen_headers_bp $(location :qti_generate_gen_headers_arm) " +
+        "--version_makefile $(location Makefile) " +
+        "--arch_syscall_tool $(location arch/arm/tools/syscallhdr.sh) " +
+        "--arch_syscall_tbl $(location arch/arm/tools/syscall.tbl) " +
+        "--headers_install $(location headers_install.sh) " +
+        "--include_uapi $(locations include/uapi/**/*.h)",
+    out: ["linux/version.h"] + gen_headers_out_arm,
+}
diff --git a/gen_headers_arm64.bp b/gen_headers_arm64.bp
new file mode 100644
index 0000000..5060c14
--- /dev/null
+++ b/gen_headers_arm64.bp
@@ -0,0 +1,970 @@
+// ***** DO NOT EDIT *****
+// This file is generated by kernel_headers.py
+
+gen_headers_srcs_arm64 = [
+    "arch/arm64/include/uapi/asm/Kbuild",
+    "include/uapi/asm-generic/Kbuild.asm",
+    "Makefile",
+    "include/uapi/**/*.h",
+    "arch/arm64/include/uapi/**/*.h",
+]
+
+gen_headers_exclude_srcs_arm64 = [
+    "include/uapi/linux/a.out.h",
+    "include/uapi/linux/kvm_para.h",
+    "include/uapi/drm/armada_drm.h",
+    "include/uapi/drm/etnaviv_drm.h",
+    "include/uapi/drm/omap_drm.h",
+    "include/uapi/drm/vgem_drm.h",
+    "include/uapi/linux/auto_dev-ioctl.h",
+    "include/uapi/linux/batman_adv.h",
+    "include/uapi/linux/bcache.h",
+    "include/uapi/linux/btrfs_tree.h",
+    "include/uapi/linux/cryptouser.h",
+    "include/uapi/linux/dma-buf.h",
+    "include/uapi/linux/hash_info.h",
+    "include/uapi/linux/kcm.h",
+    "include/uapi/linux/kcov.h",
+    "include/uapi/linux/kfd_ioctl.h",
+    "include/uapi/linux/lightnvm.h",
+    "include/uapi/linux/module.h",
+    "include/uapi/linux/nilfs2_api.h",
+    "include/uapi/linux/nilfs2_ondisk.h",
+    "include/uapi/linux/nsfs.h",
+    "include/uapi/linux/pr.h",
+    "include/uapi/linux/qrtr.h",
+    "include/uapi/linux/stm.h",
+    "include/uapi/linux/tee.h",
+    "include/uapi/linux/userio.h",
+    "include/uapi/linux/wil6210_uapi.h",
+    "include/uapi/rdma/qedr-abi.h",
+    "include/uapi/video/adf.h",
+    "include/uapi/linux/cifs/cifs_mount.h",
+    "include/uapi/linux/genwqe/genwqe_card.h",
+    "include/uapi/linux/netfilter/xt_HARDIDLETIMER.h",
+    "include/uapi/linux/usb/f_accessory.h",
+    "include/uapi/linux/usb/f_mtp.h",
+]
+
+gen_headers_out_arm64 = [
+
+    // Matching generic-y:
+
+    "asm/kvm_para.h",
+
+    // Matching mandatory-y:
+
+    "asm/errno.h",
+    "asm/ioctl.h",
+    "asm/ioctls.h",
+    "asm/ipcbuf.h",
+    "asm/mman.h",
+    "asm/msgbuf.h",
+    "asm/poll.h",
+    "asm/resource.h",
+    "asm/sembuf.h",
+    "asm/shmbuf.h",
+    "asm/socket.h",
+    "asm/sockios.h",
+    "asm/swab.h",
+    "asm/termbits.h",
+    "asm/termios.h",
+    "asm/types.h",
+
+    // From include/uapi/**/*.h
+
+    "asm-generic/auxvec.h",
+    "asm-generic/bitsperlong.h",
+    "asm-generic/errno-base.h",
+    "asm-generic/errno.h",
+    "asm-generic/fcntl.h",
+    "asm-generic/int-l64.h",
+    "asm-generic/int-ll64.h",
+    "asm-generic/ioctl.h",
+    "asm-generic/ioctls.h",
+    "asm-generic/ipcbuf.h",
+    "asm-generic/kvm_para.h",
+    "asm-generic/mman-common.h",
+    "asm-generic/mman.h",
+    "asm-generic/msgbuf.h",
+    "asm-generic/param.h",
+    "asm-generic/poll.h",
+    "asm-generic/posix_types.h",
+    "asm-generic/resource.h",
+    "asm-generic/sembuf.h",
+    "asm-generic/setup.h",
+    "asm-generic/shmbuf.h",
+    "asm-generic/shmparam.h",
+    "asm-generic/siginfo.h",
+    "asm-generic/signal-defs.h",
+    "asm-generic/signal.h",
+    "asm-generic/socket.h",
+    "asm-generic/sockios.h",
+    "asm-generic/stat.h",
+    "asm-generic/statfs.h",
+    "asm-generic/swab.h",
+    "asm-generic/termbits.h",
+    "asm-generic/termios.h",
+    "asm-generic/types.h",
+    "asm-generic/ucontext.h",
+    "asm-generic/unistd.h",
+    "drm/amdgpu_drm.h",
+    "drm/drm.h",
+    "drm/drm_fourcc.h",
+    "drm/drm_mode.h",
+    "drm/drm_sarea.h",
+    "drm/exynos_drm.h",
+    "drm/i810_drm.h",
+    "drm/i915_drm.h",
+    "drm/mga_drm.h",
+    "drm/msm_drm.h",
+    "drm/msm_drm_pp.h",
+    "drm/nouveau_drm.h",
+    "drm/qxl_drm.h",
+    "drm/r128_drm.h",
+    "drm/radeon_drm.h",
+    "drm/savage_drm.h",
+    "drm/sde_drm.h",
+    "drm/sis_drm.h",
+    "drm/tegra_drm.h",
+    "drm/vc4_drm.h",
+    "drm/via_drm.h",
+    "drm/virtgpu_drm.h",
+    "drm/vmwgfx_drm.h",
+    "linux/acct.h",
+    "linux/adb.h",
+    "linux/adfs_fs.h",
+    "linux/affs_hardblocks.h",
+    "linux/agpgart.h",
+    "linux/aio_abi.h",
+    "linux/am437x-vpfe.h",
+    "linux/apm_bios.h",
+    "linux/arcfb.h",
+    "linux/atalk.h",
+    "linux/atm.h",
+    "linux/atm_eni.h",
+    "linux/atm_he.h",
+    "linux/atm_idt77105.h",
+    "linux/atm_nicstar.h",
+    "linux/atm_tcp.h",
+    "linux/atm_zatm.h",
+    "linux/atmapi.h",
+    "linux/atmarp.h",
+    "linux/atmbr2684.h",
+    "linux/atmclip.h",
+    "linux/atmdev.h",
+    "linux/atmioc.h",
+    "linux/atmlec.h",
+    "linux/atmmpc.h",
+    "linux/atmppp.h",
+    "linux/atmsap.h",
+    "linux/atmsvc.h",
+    "linux/audit.h",
+    "linux/auto_fs.h",
+    "linux/auto_fs4.h",
+    "linux/auxvec.h",
+    "linux/ax25.h",
+    "linux/b1lli.h",
+    "linux/batterydata-interface.h",
+    "linux/baycom.h",
+    "linux/bcm933xx_hcs.h",
+    "linux/bfs_fs.h",
+    "linux/bgcom_interface.h",
+    "linux/binfmts.h",
+    "linux/blkpg.h",
+    "linux/blktrace_api.h",
+    "linux/bpf.h",
+    "linux/bpf_common.h",
+    "linux/bpf_perf_event.h",
+    "linux/bpqether.h",
+    "linux/bsg.h",
+    "linux/bt-bmc.h",
+    "linux/btrfs.h",
+    "linux/can.h",
+    "linux/capability.h",
+    "linux/capi.h",
+    "linux/cciss_defs.h",
+    "linux/cciss_ioctl.h",
+    "linux/cdrom.h",
+    "linux/cgroupstats.h",
+    "linux/chio.h",
+    "linux/cm4000_cs.h",
+    "linux/cn_proc.h",
+    "linux/coda.h",
+    "linux/coda_psdev.h",
+    "linux/coff.h",
+    "linux/connector.h",
+    "linux/const.h",
+    "linux/coresight-stm.h",
+    "linux/cramfs_fs.h",
+    "linux/cuda.h",
+    "linux/cyclades.h",
+    "linux/cycx_cfm.h",
+    "linux/dcbnl.h",
+    "linux/dccp.h",
+    "linux/devlink.h",
+    "linux/dlm.h",
+    "linux/dlm_device.h",
+    "linux/dlm_netlink.h",
+    "linux/dlm_plock.h",
+    "linux/dlmconstants.h",
+    "linux/dm-ioctl.h",
+    "linux/dm-log-userspace.h",
+    "linux/dn.h",
+    "linux/dqblk_xfs.h",
+    "linux/edd.h",
+    "linux/efs_fs_sb.h",
+    "linux/elf-em.h",
+    "linux/elf-fdpic.h",
+    "linux/elf.h",
+    "linux/elfcore.h",
+    "linux/errno.h",
+    "linux/errqueue.h",
+    "linux/esoc_ctrl.h",
+    "linux/ethtool.h",
+    "linux/eventpoll.h",
+    "linux/fadvise.h",
+    "linux/falloc.h",
+    "linux/fanotify.h",
+    "linux/fb.h",
+    "linux/fcntl.h",
+    "linux/fd.h",
+    "linux/fdreg.h",
+    "linux/fib_rules.h",
+    "linux/fiemap.h",
+    "linux/filter.h",
+    "linux/fips_status.h",
+    "linux/firewire-cdev.h",
+    "linux/firewire-constants.h",
+    "linux/flat.h",
+    "linux/fou.h",
+    "linux/fs.h",
+    "linux/fsl_hypervisor.h",
+    "linux/fuse.h",
+    "linux/futex.h",
+    "linux/gameport.h",
+    "linux/gen_stats.h",
+    "linux/genetlink.h",
+    "linux/gfs2_ondisk.h",
+    "linux/gigaset_dev.h",
+    "linux/gpio.h",
+    "linux/gsmmux.h",
+    "linux/gtp.h",
+    "linux/hbtp_input.h",
+    "linux/hdlc.h",
+    "linux/hdlcdrv.h",
+    "linux/hdreg.h",
+    "linux/hid.h",
+    "linux/hiddev.h",
+    "linux/hidraw.h",
+    "linux/hpet.h",
+    "linux/hsr_netlink.h",
+    "linux/hw_breakpoint.h",
+    "linux/hyperv.h",
+    "linux/hysdn_if.h",
+    "linux/i2c-dev.h",
+    "linux/i2c.h",
+    "linux/i2o-dev.h",
+    "linux/i8k.h",
+    "linux/icmp.h",
+    "linux/icmpv6.h",
+    "linux/if.h",
+    "linux/if_addr.h",
+    "linux/if_addrlabel.h",
+    "linux/if_alg.h",
+    "linux/if_arcnet.h",
+    "linux/if_arp.h",
+    "linux/if_bonding.h",
+    "linux/if_bridge.h",
+    "linux/if_cablemodem.h",
+    "linux/if_eql.h",
+    "linux/if_ether.h",
+    "linux/if_fc.h",
+    "linux/if_fddi.h",
+    "linux/if_frad.h",
+    "linux/if_hippi.h",
+    "linux/if_infiniband.h",
+    "linux/if_link.h",
+    "linux/if_ltalk.h",
+    "linux/if_macsec.h",
+    "linux/if_packet.h",
+    "linux/if_phonet.h",
+    "linux/if_plip.h",
+    "linux/if_ppp.h",
+    "linux/if_pppol2tp.h",
+    "linux/if_pppolac.h",
+    "linux/if_pppopns.h",
+    "linux/if_pppox.h",
+    "linux/if_slip.h",
+    "linux/if_team.h",
+    "linux/if_tun.h",
+    "linux/if_tunnel.h",
+    "linux/if_vlan.h",
+    "linux/if_x25.h",
+    "linux/igmp.h",
+    "linux/ila.h",
+    "linux/in.h",
+    "linux/in6.h",
+    "linux/in_route.h",
+    "linux/inet_diag.h",
+    "linux/inotify.h",
+    "linux/input-event-codes.h",
+    "linux/input.h",
+    "linux/ioctl.h",
+    "linux/ion.h",
+    "linux/ip.h",
+    "linux/ip6_tunnel.h",
+    "linux/ip_vs.h",
+    "linux/ipa_qmi_service_v01.h",
+    "linux/ipc.h",
+    "linux/ipmi.h",
+    "linux/ipmi_msgdefs.h",
+    "linux/ipsec.h",
+    "linux/ipv6.h",
+    "linux/ipv6_route.h",
+    "linux/ipx.h",
+    "linux/irda.h",
+    "linux/irqnr.h",
+    "linux/isdn.h",
+    "linux/isdn_divertif.h",
+    "linux/isdn_ppp.h",
+    "linux/isdnif.h",
+    "linux/iso_fs.h",
+    "linux/ivtv.h",
+    "linux/ivtvfb.h",
+    "linux/ixjuser.h",
+    "linux/jffs2.h",
+    "linux/joystick.h",
+    "linux/kcmp.h",
+    "linux/kd.h",
+    "linux/kdev_t.h",
+    "linux/kernel-page-flags.h",
+    "linux/kernel.h",
+    "linux/kernelcapi.h",
+    "linux/kexec.h",
+    "linux/keyboard.h",
+    "linux/keyctl.h",
+    "linux/kvm.h",
+    "linux/l2tp.h",
+    "linux/libc-compat.h",
+    "linux/limits.h",
+    "linux/lirc.h",
+    "linux/llc.h",
+    "linux/loop.h",
+    "linux/lp.h",
+    "linux/lwtunnel.h",
+    "linux/magic.h",
+    "linux/major.h",
+    "linux/map_to_7segment.h",
+    "linux/matroxfb.h",
+    "linux/mdio.h",
+    "linux/mdss_rotator.h",
+    "linux/media-bus-format.h",
+    "linux/media.h",
+    "linux/mei.h",
+    "linux/membarrier.h",
+    "linux/memfd.h",
+    "linux/mempolicy.h",
+    "linux/meye.h",
+    "linux/mhi.h",
+    "linux/mic_common.h",
+    "linux/mic_ioctl.h",
+    "linux/mii.h",
+    "linux/minix_fs.h",
+    "linux/mman.h",
+    "linux/mmtimer.h",
+    "linux/mpls.h",
+    "linux/mpls_iptunnel.h",
+    "linux/mqueue.h",
+    "linux/mroute.h",
+    "linux/mroute6.h",
+    "linux/msdos_fs.h",
+    "linux/msg.h",
+    "linux/msm-core-interface.h",
+    "linux/msm_dsps.h",
+    "linux/msm_ion.h",
+    "linux/msm_ipa.h",
+    "linux/msm_ipc.h",
+    "linux/msm_kgsl.h",
+    "linux/msm_mdp.h",
+    "linux/msm_mdp_ext.h",
+    "linux/msm_rmnet.h",
+    "linux/msm_rotator.h",
+    "linux/msm_vidc_dec.h",
+    "linux/msm_vidc_enc.h",
+    "linux/mtio.h",
+    "linux/n_r3964.h",
+    "linux/nbd.h",
+    "linux/ncp.h",
+    "linux/ncp_fs.h",
+    "linux/ncp_mount.h",
+    "linux/ncp_no.h",
+    "linux/ndctl.h",
+    "linux/neighbour.h",
+    "linux/net.h",
+    "linux/net_dropmon.h",
+    "linux/net_map.h",
+    "linux/net_namespace.h",
+    "linux/net_tstamp.h",
+    "linux/netconf.h",
+    "linux/netdevice.h",
+    "linux/netfilter.h",
+    "linux/netfilter_arp.h",
+    "linux/netfilter_bridge.h",
+    "linux/netfilter_decnet.h",
+    "linux/netfilter_ipv4.h",
+    "linux/netfilter_ipv6.h",
+    "linux/netlink.h",
+    "linux/netlink_diag.h",
+    "linux/netrom.h",
+    "linux/nfc.h",
+    "linux/nfs.h",
+    "linux/nfs2.h",
+    "linux/nfs3.h",
+    "linux/nfs4.h",
+    "linux/nfs4_mount.h",
+    "linux/nfs_fs.h",
+    "linux/nfs_idmap.h",
+    "linux/nfs_mount.h",
+    "linux/nfsacl.h",
+    "linux/nl80211.h",
+    "linux/nubus.h",
+    "linux/nvme_ioctl.h",
+    "linux/nvram.h",
+    "linux/okl4-link-shbuf.h",
+    "linux/omap3isp.h",
+    "linux/omapfb.h",
+    "linux/oom.h",
+    "linux/openvswitch.h",
+    "linux/packet_diag.h",
+    "linux/param.h",
+    "linux/parport.h",
+    "linux/patchkey.h",
+    "linux/pci.h",
+    "linux/pci_regs.h",
+    "linux/perf_event.h",
+    "linux/personality.h",
+    "linux/pfkeyv2.h",
+    "linux/pg.h",
+    "linux/phantom.h",
+    "linux/phonet.h",
+    "linux/pkt_cls.h",
+    "linux/pkt_sched.h",
+    "linux/pktcdvd.h",
+    "linux/pmu.h",
+    "linux/poll.h",
+    "linux/posix_acl.h",
+    "linux/posix_acl_xattr.h",
+    "linux/posix_types.h",
+    "linux/ppdev.h",
+    "linux/ppp-comp.h",
+    "linux/ppp-ioctl.h",
+    "linux/ppp_defs.h",
+    "linux/pps.h",
+    "linux/prctl.h",
+    "linux/psci.h",
+    "linux/ptp_clock.h",
+    "linux/ptrace.h",
+    "linux/qbt1000.h",
+    "linux/qcedev.h",
+    "linux/qcota.h",
+    "linux/qg-profile.h",
+    "linux/qg.h",
+    "linux/qnx4_fs.h",
+    "linux/qnxtypes.h",
+    "linux/qrng.h",
+    "linux/qseecom.h",
+    "linux/quota.h",
+    "linux/radeonfb.h",
+    "linux/random.h",
+    "linux/raw.h",
+    "linux/rds.h",
+    "linux/reboot.h",
+    "linux/reiserfs_fs.h",
+    "linux/reiserfs_xattr.h",
+    "linux/resource.h",
+    "linux/rfkill.h",
+    "linux/rio_cm_cdev.h",
+    "linux/rio_mport_cdev.h",
+    "linux/rmnet_data.h",
+    "linux/rmnet_ipa_fd_ioctl.h",
+    "linux/romfs_fs.h",
+    "linux/rose.h",
+    "linux/route.h",
+    "linux/rtc.h",
+    "linux/rtnetlink.h",
+    "linux/scc.h",
+    "linux/sched.h",
+    "linux/scif_ioctl.h",
+    "linux/screen_info.h",
+    "linux/sctp.h",
+    "linux/sdla.h",
+    "linux/seccomp.h",
+    "linux/securebits.h",
+    "linux/seemp_api.h",
+    "linux/seemp_param_id.h",
+    "linux/selinux_netlink.h",
+    "linux/sem.h",
+    "linux/serial.h",
+    "linux/serial_core.h",
+    "linux/serial_reg.h",
+    "linux/serio.h",
+    "linux/shm.h",
+    "linux/signal.h",
+    "linux/signalfd.h",
+    "linux/smcinvoke.h",
+    "linux/smiapp.h",
+    "linux/snmp.h",
+    "linux/sock_diag.h",
+    "linux/socket.h",
+    "linux/sockev.h",
+    "linux/sockios.h",
+    "linux/sonet.h",
+    "linux/sonypi.h",
+    "linux/sound.h",
+    "linux/soundcard.h",
+    "linux/spcom.h",
+    "linux/stat.h",
+    "linux/stddef.h",
+    "linux/string.h",
+    "linux/suspend_ioctls.h",
+    "linux/swab.h",
+    "linux/sync_file.h",
+    "linux/synclink.h",
+    "linux/sysctl.h",
+    "linux/sysinfo.h",
+    "linux/target_core_user.h",
+    "linux/taskstats.h",
+    "linux/tcp.h",
+    "linux/tcp_metrics.h",
+    "linux/telephony.h",
+    "linux/termios.h",
+    "linux/thermal.h",
+    "linux/time.h",
+    "linux/times.h",
+    "linux/timex.h",
+    "linux/tiocl.h",
+    "linux/tipc.h",
+    "linux/tipc_config.h",
+    "linux/tipc_netlink.h",
+    "linux/toshiba.h",
+    "linux/tty.h",
+    "linux/tty_flags.h",
+    "linux/types.h",
+    "linux/udf_fs_i.h",
+    "linux/udp.h",
+    "linux/uhid.h",
+    "linux/uinput.h",
+    "linux/uio.h",
+    "linux/ultrasound.h",
+    "linux/un.h",
+    "linux/unistd.h",
+    "linux/unix_diag.h",
+    "linux/usbdevice_fs.h",
+    "linux/usbip.h",
+    "linux/userfaultfd.h",
+    "linux/utime.h",
+    "linux/utsname.h",
+    "linux/uuid.h",
+    "linux/uvcvideo.h",
+    "linux/v4l2-common.h",
+    "linux/v4l2-controls.h",
+    "linux/v4l2-dv-timings.h",
+    "linux/v4l2-mediabus.h",
+    "linux/v4l2-subdev.h",
+    "linux/veth.h",
+    "linux/vfio.h",
+    "linux/vhost.h",
+    "linux/videodev2.h",
+    "linux/virtio_9p.h",
+    "linux/virtio_balloon.h",
+    "linux/virtio_blk.h",
+    "linux/virtio_config.h",
+    "linux/virtio_console.h",
+    "linux/virtio_gpu.h",
+    "linux/virtio_ids.h",
+    "linux/virtio_input.h",
+    "linux/virtio_net.h",
+    "linux/virtio_pci.h",
+    "linux/virtio_ring.h",
+    "linux/virtio_rng.h",
+    "linux/virtio_scsi.h",
+    "linux/virtio_types.h",
+    "linux/virtio_vsock.h",
+    "linux/vm_bms.h",
+    "linux/vm_sockets.h",
+    "linux/vt.h",
+    "linux/vtpm_proxy.h",
+    "linux/wait.h",
+    "linux/wanrouter.h",
+    "linux/watchdog.h",
+    "linux/wimax.h",
+    "linux/wireless.h",
+    "linux/x25.h",
+    "linux/xattr.h",
+    "linux/xfrm.h",
+    "linux/xilinx-v4l2-controls.h",
+    "linux/zorro.h",
+    "linux/zorro_ids.h",
+    "media/cam_cpas.h",
+    "media/cam_defs.h",
+    "media/cam_fd.h",
+    "media/cam_icp.h",
+    "media/cam_isp.h",
+    "media/cam_isp_ife.h",
+    "media/cam_isp_vfe.h",
+    "media/cam_jpeg.h",
+    "media/cam_lrme.h",
+    "media/cam_req_mgr.h",
+    "media/cam_sensor.h",
+    "media/cam_sync.h",
+    "media/msm_cam_sensor.h",
+    "media/msm_camera.h",
+    "media/msm_camsensor_sdk.h",
+    "media/msm_fd.h",
+    "media/msm_isp.h",
+    "media/msm_jpeg.h",
+    "media/msm_jpeg_dma.h",
+    "media/msm_media_info.h",
+    "media/msm_sde_rotator.h",
+    "media/msm_vidc.h",
+    "media/msm_vidc_private.h",
+    "media/msmb_camera.h",
+    "media/msmb_generic_buf_mgr.h",
+    "media/msmb_isp.h",
+    "media/msmb_ispif.h",
+    "media/msmb_pproc.h",
+    "media/msmb_qca.h",
+    "media/radio-iris-commands.h",
+    "media/radio-iris.h",
+    "miniISP/miniISP_ioctl.h",
+    "misc/cxl.h",
+    "mtd/inftl-user.h",
+    "mtd/mtd-abi.h",
+    "mtd/mtd-user.h",
+    "mtd/nftl-user.h",
+    "mtd/ubi-user.h",
+    "rdma/cxgb3-abi.h",
+    "rdma/cxgb4-abi.h",
+    "rdma/ib_user_cm.h",
+    "rdma/ib_user_mad.h",
+    "rdma/ib_user_sa.h",
+    "rdma/ib_user_verbs.h",
+    "rdma/mlx4-abi.h",
+    "rdma/mlx5-abi.h",
+    "rdma/mthca-abi.h",
+    "rdma/nes-abi.h",
+    "rdma/ocrdma-abi.h",
+    "rdma/rdma_netlink.h",
+    "rdma/rdma_user_cm.h",
+    "rdma/rdma_user_rxe.h",
+    "scsi/cxlflash_ioctl.h",
+    "scsi/scsi_bsg_fc.h",
+    "scsi/scsi_ioctl.h",
+    "scsi/scsi_netlink.h",
+    "scsi/scsi_netlink_fc.h",
+    "scsi/sg.h",
+    "sound/asequencer.h",
+    "sound/asoc.h",
+    "sound/asound.h",
+    "sound/asound_fm.h",
+    "sound/compress_offload.h",
+    "sound/compress_params.h",
+    "sound/emu10k1.h",
+    "sound/firewire.h",
+    "sound/hdsp.h",
+    "sound/hdspm.h",
+    "sound/sb16_csp.h",
+    "sound/sfnt_info.h",
+    "sound/snd_sst_tokens.h",
+    "sound/tlv.h",
+    "sound/usb_stream.h",
+    "video/edid.h",
+    "video/msm_hdmi_hdcp_mgr.h",
+    "video/msm_hdmi_modes.h",
+    "video/sisfb.h",
+    "video/uvesafb.h",
+    "xen/evtchn.h",
+    "xen/gntalloc.h",
+    "xen/gntdev.h",
+    "xen/privcmd.h",
+    "linux/android/binder.h",
+    "linux/byteorder/big_endian.h",
+    "linux/byteorder/little_endian.h",
+    "linux/caif/caif_socket.h",
+    "linux/caif/if_caif.h",
+    "linux/can/bcm.h",
+    "linux/can/error.h",
+    "linux/can/gw.h",
+    "linux/can/netlink.h",
+    "linux/can/raw.h",
+    "linux/dvb/audio.h",
+    "linux/dvb/ca.h",
+    "linux/dvb/dmx.h",
+    "linux/dvb/frontend.h",
+    "linux/dvb/net.h",
+    "linux/dvb/osd.h",
+    "linux/dvb/version.h",
+    "linux/dvb/video.h",
+    "linux/hdlc/ioctl.h",
+    "linux/hsi/cs-protocol.h",
+    "linux/hsi/hsi_char.h",
+    "linux/iio/events.h",
+    "linux/iio/types.h",
+    "linux/isdn/capicmd.h",
+    "linux/mfd/msm-adie-codec.h",
+    "linux/mmc/core.h",
+    "linux/mmc/ioctl.h",
+    "linux/mmc/mmc.h",
+    "linux/netfilter/nf_conntrack_common.h",
+    "linux/netfilter/nf_conntrack_ftp.h",
+    "linux/netfilter/nf_conntrack_sctp.h",
+    "linux/netfilter/nf_conntrack_tcp.h",
+    "linux/netfilter/nf_conntrack_tuple_common.h",
+    "linux/netfilter/nf_log.h",
+    "linux/netfilter/nf_nat.h",
+    "linux/netfilter/nf_tables.h",
+    "linux/netfilter/nf_tables_compat.h",
+    "linux/netfilter/nfnetlink.h",
+    "linux/netfilter/nfnetlink_acct.h",
+    "linux/netfilter/nfnetlink_compat.h",
+    "linux/netfilter/nfnetlink_conntrack.h",
+    "linux/netfilter/nfnetlink_cthelper.h",
+    "linux/netfilter/nfnetlink_cttimeout.h",
+    "linux/netfilter/nfnetlink_log.h",
+    "linux/netfilter/nfnetlink_queue.h",
+    "linux/netfilter/x_tables.h",
+    "linux/netfilter/xt_AUDIT.h",
+    "linux/netfilter/xt_CHECKSUM.h",
+    "linux/netfilter/xt_CLASSIFY.h",
+    "linux/netfilter/xt_CONNMARK.h",
+    "linux/netfilter/xt_CONNSECMARK.h",
+    "linux/netfilter/xt_CT.h",
+    "linux/netfilter/xt_DSCP.h",
+    "linux/netfilter/xt_HMARK.h",
+    "linux/netfilter/xt_IDLETIMER.h",
+    "linux/netfilter/xt_LED.h",
+    "linux/netfilter/xt_LOG.h",
+    "linux/netfilter/xt_MARK.h",
+    "linux/netfilter/xt_NFLOG.h",
+    "linux/netfilter/xt_NFQUEUE.h",
+    "linux/netfilter/xt_RATEEST.h",
+    "linux/netfilter/xt_SECMARK.h",
+    "linux/netfilter/xt_SYNPROXY.h",
+    "linux/netfilter/xt_TCPMSS.h",
+    "linux/netfilter/xt_TCPOPTSTRIP.h",
+    "linux/netfilter/xt_TEE.h",
+    "linux/netfilter/xt_TPROXY.h",
+    "linux/netfilter/xt_addrtype.h",
+    "linux/netfilter/xt_bpf.h",
+    "linux/netfilter/xt_cgroup.h",
+    "linux/netfilter/xt_cluster.h",
+    "linux/netfilter/xt_comment.h",
+    "linux/netfilter/xt_connbytes.h",
+    "linux/netfilter/xt_connlabel.h",
+    "linux/netfilter/xt_connlimit.h",
+    "linux/netfilter/xt_connmark.h",
+    "linux/netfilter/xt_conntrack.h",
+    "linux/netfilter/xt_cpu.h",
+    "linux/netfilter/xt_dccp.h",
+    "linux/netfilter/xt_devgroup.h",
+    "linux/netfilter/xt_dscp.h",
+    "linux/netfilter/xt_ecn.h",
+    "linux/netfilter/xt_esp.h",
+    "linux/netfilter/xt_hashlimit.h",
+    "linux/netfilter/xt_helper.h",
+    "linux/netfilter/xt_ipcomp.h",
+    "linux/netfilter/xt_iprange.h",
+    "linux/netfilter/xt_ipvs.h",
+    "linux/netfilter/xt_l2tp.h",
+    "linux/netfilter/xt_length.h",
+    "linux/netfilter/xt_limit.h",
+    "linux/netfilter/xt_mac.h",
+    "linux/netfilter/xt_mark.h",
+    "linux/netfilter/xt_multiport.h",
+    "linux/netfilter/xt_nfacct.h",
+    "linux/netfilter/xt_osf.h",
+    "linux/netfilter/xt_owner.h",
+    "linux/netfilter/xt_physdev.h",
+    "linux/netfilter/xt_pkttype.h",
+    "linux/netfilter/xt_policy.h",
+    "linux/netfilter/xt_quota.h",
+    "linux/netfilter/xt_rateest.h",
+    "linux/netfilter/xt_realm.h",
+    "linux/netfilter/xt_recent.h",
+    "linux/netfilter/xt_rpfilter.h",
+    "linux/netfilter/xt_sctp.h",
+    "linux/netfilter/xt_set.h",
+    "linux/netfilter/xt_socket.h",
+    "linux/netfilter/xt_state.h",
+    "linux/netfilter/xt_statistic.h",
+    "linux/netfilter/xt_string.h",
+    "linux/netfilter/xt_tcpmss.h",
+    "linux/netfilter/xt_tcpudp.h",
+    "linux/netfilter/xt_time.h",
+    "linux/netfilter/xt_u32.h",
+    "linux/netfilter_arp/arp_tables.h",
+    "linux/netfilter_arp/arpt_mangle.h",
+    "linux/netfilter_bridge/ebt_802_3.h",
+    "linux/netfilter_bridge/ebt_among.h",
+    "linux/netfilter_bridge/ebt_arp.h",
+    "linux/netfilter_bridge/ebt_arpreply.h",
+    "linux/netfilter_bridge/ebt_ip.h",
+    "linux/netfilter_bridge/ebt_ip6.h",
+    "linux/netfilter_bridge/ebt_limit.h",
+    "linux/netfilter_bridge/ebt_log.h",
+    "linux/netfilter_bridge/ebt_mark_m.h",
+    "linux/netfilter_bridge/ebt_mark_t.h",
+    "linux/netfilter_bridge/ebt_nat.h",
+    "linux/netfilter_bridge/ebt_nflog.h",
+    "linux/netfilter_bridge/ebt_pkttype.h",
+    "linux/netfilter_bridge/ebt_redirect.h",
+    "linux/netfilter_bridge/ebt_stp.h",
+    "linux/netfilter_bridge/ebt_vlan.h",
+    "linux/netfilter_bridge/ebtables.h",
+    "linux/netfilter_ipv4/ip_tables.h",
+    "linux/netfilter_ipv4/ipt_CLUSTERIP.h",
+    "linux/netfilter_ipv4/ipt_ECN.h",
+    "linux/netfilter_ipv4/ipt_LOG.h",
+    "linux/netfilter_ipv4/ipt_NATTYPE.h",
+    "linux/netfilter_ipv4/ipt_REJECT.h",
+    "linux/netfilter_ipv4/ipt_TTL.h",
+    "linux/netfilter_ipv4/ipt_ah.h",
+    "linux/netfilter_ipv4/ipt_ecn.h",
+    "linux/netfilter_ipv4/ipt_ttl.h",
+    "linux/netfilter_ipv6/ip6_tables.h",
+    "linux/netfilter_ipv6/ip6t_HL.h",
+    "linux/netfilter_ipv6/ip6t_LOG.h",
+    "linux/netfilter_ipv6/ip6t_NPT.h",
+    "linux/netfilter_ipv6/ip6t_REJECT.h",
+    "linux/netfilter_ipv6/ip6t_ah.h",
+    "linux/netfilter_ipv6/ip6t_frag.h",
+    "linux/netfilter_ipv6/ip6t_hl.h",
+    "linux/netfilter_ipv6/ip6t_ipv6header.h",
+    "linux/netfilter_ipv6/ip6t_mh.h",
+    "linux/netfilter_ipv6/ip6t_opts.h",
+    "linux/netfilter_ipv6/ip6t_rt.h",
+    "linux/nfc/nfcinfo.h",
+    "linux/nfsd/cld.h",
+    "linux/nfsd/debug.h",
+    "linux/nfsd/export.h",
+    "linux/nfsd/nfsfh.h",
+    "linux/nfsd/stats.h",
+    "linux/raid/md_p.h",
+    "linux/raid/md_u.h",
+    "linux/spi/spidev.h",
+    "linux/sunrpc/debug.h",
+    "linux/tc_act/tc_bpf.h",
+    "linux/tc_act/tc_connmark.h",
+    "linux/tc_act/tc_csum.h",
+    "linux/tc_act/tc_defact.h",
+    "linux/tc_act/tc_gact.h",
+    "linux/tc_act/tc_ife.h",
+    "linux/tc_act/tc_ipt.h",
+    "linux/tc_act/tc_mirred.h",
+    "linux/tc_act/tc_nat.h",
+    "linux/tc_act/tc_pedit.h",
+    "linux/tc_act/tc_skbedit.h",
+    "linux/tc_act/tc_skbmod.h",
+    "linux/tc_act/tc_tunnel_key.h",
+    "linux/tc_act/tc_vlan.h",
+    "linux/tc_ematch/tc_em_cmp.h",
+    "linux/tc_ematch/tc_em_meta.h",
+    "linux/tc_ematch/tc_em_nbyte.h",
+    "linux/tc_ematch/tc_em_text.h",
+    "linux/usb/audio.h",
+    "linux/usb/cdc-wdm.h",
+    "linux/usb/cdc.h",
+    "linux/usb/ch11.h",
+    "linux/usb/ch9.h",
+    "linux/usb/functionfs.h",
+    "linux/usb/g_printer.h",
+    "linux/usb/gadgetfs.h",
+    "linux/usb/midi.h",
+    "linux/usb/tmc.h",
+    "linux/usb/usb_ctrl_qti.h",
+    "linux/usb/video.h",
+    "linux/wimax/i2400m.h",
+    "rdma/hfi/hfi1_user.h",
+    "scsi/fc/fc_els.h",
+    "scsi/fc/fc_fs.h",
+    "scsi/fc/fc_gs.h",
+    "scsi/fc/fc_ns.h",
+    "scsi/ufs/ioctl.h",
+    "scsi/ufs/ufs.h",
+    "linux/mfd/wcd9xxx/wcd9320_registers.h",
+    "linux/mfd/wcd9xxx/wcd9xxx_registers.h",
+    "linux/netfilter/ipset/ip_set.h",
+    "linux/netfilter/ipset/ip_set_bitmap.h",
+    "linux/netfilter/ipset/ip_set_hash.h",
+    "linux/netfilter/ipset/ip_set_list.h",
+
+    // From arch/arm64/include/uapi/**/*.h
+
+    "asm/auxvec.h",
+    "asm/bitsperlong.h",
+    "asm/byteorder.h",
+    "asm/fcntl.h",
+    "asm/hwcap.h",
+    "asm/kvm.h",
+    "asm/param.h",
+    "asm/perf_regs.h",
+    "asm/posix_types.h",
+    "asm/ptrace.h",
+    "asm/setup.h",
+    "asm/sigcontext.h",
+    "asm/siginfo.h",
+    "asm/signal.h",
+    "asm/stat.h",
+    "asm/statfs.h",
+    "asm/ucontext.h",
+    "asm/unistd.h",
+]
+
+genrule {
+    // This module generates the gen_headers_<arch>.bp file
+    // (i.e., a new version of this file) so that it can be
+    // checked later to ensure that it matches the checked-
+    // in version (this file).
+    name: "qti_generate_gen_headers_arm64",
+    srcs: gen_headers_srcs_arm64,
+    exclude_srcs: gen_headers_exclude_srcs_arm64,
+    tool_files: ["kernel_headers.py"],
+    cmd: "python3 $(location kernel_headers.py) " +
+        kernel_headers_verbose +
+        "--header_arch arm64 " +
+        "--gen_dir $(genDir) " +
+        "--arch_asm_kbuild $(location arch/arm64/include/uapi/asm/Kbuild) " +
+        "--arch_include_uapi $(locations arch/arm64/include/uapi/**/*.h) " +
+        "--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild.asm) " +
+        "blueprints " +
+        "# $(in)",
+    out: ["gen_headers_arm64.bp"],
+}
+
+genrule {
+    name: "qti_generate_kernel_headers_arm64",
+    tools: ["headers_install.sh"],
+    tool_files: [
+        "kernel_headers.py",
+    ],
+    srcs: gen_headers_srcs_arm64 +[
+        "gen_headers_arm64.bp",
+        ":qti_generate_gen_headers_arm64",
+    ],
+    exclude_srcs: gen_headers_exclude_srcs_arm64,
+    cmd: "python3 $(location kernel_headers.py) " +
+        kernel_headers_verbose +
+        "--header_arch arm64 " +
+        "--gen_dir $(genDir) " +
+        "--arch_asm_kbuild $(location arch/arm64/include/uapi/asm/Kbuild) " +
+        "--arch_include_uapi $(locations arch/arm64/include/uapi/**/*.h) " +
+        "--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild.asm) " +
+        "headers " +
+        "--old_gen_headers_bp $(location gen_headers_arm64.bp) " +
+        "--new_gen_headers_bp $(location :qti_generate_gen_headers_arm64) " +
+        "--version_makefile $(location Makefile) " +
+        "--headers_install $(location headers_install.sh) " +
+        "--include_uapi $(locations include/uapi/**/*.h)",
+    out: ["linux/version.h"] + gen_headers_out_arm64,
+}
diff --git a/include/Kbuild b/include/Kbuild
deleted file mode 100644
index 9205b04..0000000
--- a/include/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-# Top-level Makefile calls into asm-$(ARCH)
-# List only non-arch directories below
-
-ifneq ($(VSERVICES_SUPPORT), "")
-header-y += vservices/
-endif
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
deleted file mode 100644
index d2ee86b..0000000
--- a/include/asm-generic/Kbuild.asm
+++ /dev/null
@@ -1 +0,0 @@
-include include/uapi/asm-generic/Kbuild.asm
diff --git a/include/scsi/fc/Kbuild b/include/scsi/fc/Kbuild
deleted file mode 100644
index e69de29..0000000
--- a/include/scsi/fc/Kbuild
+++ /dev/null
diff --git a/include/uapi/Kbuild b/include/uapi/Kbuild
deleted file mode 100644
index 96815bd..0000000
--- a/include/uapi/Kbuild
+++ /dev/null
@@ -1,17 +0,0 @@
-# UAPI Header export list
-# Top-level Makefile calls into asm-$(ARCH)
-# List only non-arch directories below
-
-
-header-y += asm-generic/
-header-y += linux/
-header-y += sound/
-header-y += mtd/
-header-y += rdma/
-header-y += video/
-header-y += drm/
-header-y += xen/
-header-y += scsi/
-header-y += misc/
-header-y += media/
-header-y += miniISP/
diff --git a/include/uapi/asm-generic/Kbuild b/include/uapi/asm-generic/Kbuild
deleted file mode 100644
index b73de7b..0000000
--- a/include/uapi/asm-generic/Kbuild
+++ /dev/null
@@ -1,36 +0,0 @@
-# UAPI Header export list
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += errno-base.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += int-l64.h
-header-y += int-ll64.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += kvm_para.h
-header-y += mman-common.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += shmparam.h
-header-y += siginfo.h
-header-y += signal-defs.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += ucontext.h
-header-y += unistd.h
diff --git a/include/uapi/asm-generic/Kbuild.asm b/include/uapi/asm-generic/Kbuild.asm
index fcd50b75..2138144 100644
--- a/include/uapi/asm-generic/Kbuild.asm
+++ b/include/uapi/asm-generic/Kbuild.asm
@@ -1,49 +1,33 @@
 #
-# Headers that are optional in usr/include/asm/
-#
-opt-header += kvm.h
-opt-header += kvm_para.h
-opt-header += a.out.h
-
-#
 # Headers that are mandatory in usr/include/asm/
 #
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
-
-header-y += $(foreach hdr,$(opt-header), \
-	      $(if \
-		$(wildcard \
-			$(srctree)/arch/$(SRCARCH)/include/uapi/asm/$(hdr) \
-			$(srctree)/arch/$(SRCARCH)/include/asm/$(hdr) \
-		), \
-		$(hdr) \
-		))
+mandatory-y += auxvec.h
+mandatory-y += bitsperlong.h
+mandatory-y += byteorder.h
+mandatory-y += errno.h
+mandatory-y += fcntl.h
+mandatory-y += ioctl.h
+mandatory-y += ioctls.h
+mandatory-y += ipcbuf.h
+mandatory-y += mman.h
+mandatory-y += msgbuf.h
+mandatory-y += param.h
+mandatory-y += poll.h
+mandatory-y += posix_types.h
+mandatory-y += ptrace.h
+mandatory-y += resource.h
+mandatory-y += sembuf.h
+mandatory-y += setup.h
+mandatory-y += shmbuf.h
+mandatory-y += sigcontext.h
+mandatory-y += siginfo.h
+mandatory-y += signal.h
+mandatory-y += socket.h
+mandatory-y += sockios.h
+mandatory-y += stat.h
+mandatory-y += statfs.h
+mandatory-y += swab.h
+mandatory-y += termbits.h
+mandatory-y += termios.h
+mandatory-y += types.h
+mandatory-y += unistd.h
diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild
index 999c120..74758ea 100644
--- a/include/uapi/drm/Kbuild
+++ b/include/uapi/drm/Kbuild
@@ -1,24 +1,5 @@
 # UAPI Header export list
-header-y += drm.h
-header-y += drm_fourcc.h
-header-y += drm_mode.h
-header-y += drm_sarea.h
-header-y += amdgpu_drm.h
-header-y += exynos_drm.h
-header-y += i810_drm.h
-header-y += i915_drm.h
-header-y += mga_drm.h
-header-y += nouveau_drm.h
-header-y += qxl_drm.h
-header-y += r128_drm.h
-header-y += radeon_drm.h
-header-y += savage_drm.h
-header-y += sis_drm.h
-header-y += tegra_drm.h
-header-y += via_drm.h
-header-y += vmwgfx_drm.h
-header-y += msm_drm.h
-header-y += vc4_drm.h
-header-y += virtgpu_drm.h
-header-y += sde_drm.h
-header-y += msm_drm_pp.h
+no-export-headers += armada_drm.h
+no-export-headers += etnaviv_drm.h
+no-export-headers += omap_drm.h
+no-export-headers += vgem_drm.h
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index c2882c2..8878609 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -1,520 +1,47 @@
 # UAPI Header export list
-header-y += android/
-header-y += byteorder/
-header-y += can/
-header-y += caif/
-header-y += dvb/
-header-y += hdlc/
-header-y += hsi/
-header-y += iio/
-header-y += isdn/
-header-y += mmc/
-header-y += nfsd/
-header-y += raid/
-header-y += spi/
-header-y += sunrpc/
-header-y += tc_act/
-header-y += tc_ematch/
-header-y += netfilter/
-header-y += netfilter_arp/
-header-y += netfilter_bridge/
-header-y += netfilter_ipv4/
-header-y += netfilter_ipv6/
-header-y += usb/
-header-y += wimax/
-header-y += mfd/
-header-y += msm_ipa.h
-genhdr-y += version.h
 
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h \
-		  $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h),)
-header-y += a.out.h
+ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h),)
+no-export-headers += a.out.h
 endif
 
-header-y += acct.h
-header-y += adb.h
-header-y += adfs_fs.h
-header-y += affs_hardblocks.h
-header-y += agpgart.h
-header-y += aio_abi.h
-header-y += am437x-vpfe.h
-header-y += apm_bios.h
-header-y += arcfb.h
-header-y += atalk.h
-header-y += atmapi.h
-header-y += atmarp.h
-header-y += atmbr2684.h
-header-y += atmclip.h
-header-y += atmdev.h
-header-y += atm_eni.h
-header-y += atm.h
-header-y += atm_he.h
-header-y += atm_idt77105.h
-header-y += atmioc.h
-header-y += atmlec.h
-header-y += atmmpc.h
-header-y += atm_nicstar.h
-header-y += atmppp.h
-header-y += atmsap.h
-header-y += atmsvc.h
-header-y += atm_tcp.h
-header-y += atm_zatm.h
-header-y += audit.h
-header-y += auto_fs4.h
-header-y += auto_fs.h
-header-y += auxvec.h
-header-y += ax25.h
-header-y += b1lli.h
-header-y += batterydata-interface.h
-header-y += baycom.h
-header-y += bcm933xx_hcs.h
-header-y += bfs_fs.h
-header-y += binfmts.h
-header-y += blkpg.h
-header-y += blktrace_api.h
-header-y += bpf_common.h
-header-y += bpf_perf_event.h
-header-y += bpf.h
-header-y += bpqether.h
-header-y += bsg.h
-header-y += bt-bmc.h
-header-y += btrfs.h
-header-y += can.h
-header-y += capability.h
-header-y += capi.h
-header-y += cciss_defs.h
-header-y += cciss_ioctl.h
-header-y += cdrom.h
-header-y += cgroupstats.h
-header-y += chio.h
-header-y += cm4000_cs.h
-header-y += cn_proc.h
-header-y += coda.h
-header-y += coda_psdev.h
-header-y += coff.h
-header-y += connector.h
-header-y += const.h
-header-y += coresight-stm.h
-header-y += cramfs_fs.h
-header-y += cuda.h
-header-y += cyclades.h
-header-y += cycx_cfm.h
-header-y += dcbnl.h
-header-y += dccp.h
-header-y += devlink.h
-header-y += dlmconstants.h
-header-y += dlm_device.h
-header-y += dlm.h
-header-y += dlm_netlink.h
-header-y += dlm_plock.h
-header-y += dm-ioctl.h
-header-y += dm-log-userspace.h
-header-y += dn.h
-header-y += dqblk_xfs.h
-header-y += edd.h
-header-y += efs_fs_sb.h
-header-y += elfcore.h
-header-y += elf-em.h
-header-y += elf-fdpic.h
-header-y += elf.h
-header-y += errno.h
-header-y += errqueue.h
-header-y += esoc_ctrl.h
-header-y += ethtool.h
-header-y += eventpoll.h
-header-y += fadvise.h
-header-y += falloc.h
-header-y += fanotify.h
-header-y += fb.h
-header-y += fcntl.h
-header-y += fd.h
-header-y += fdreg.h
-header-y += fib_rules.h
-header-y += fiemap.h
-header-y += filter.h
-header-y += fips_status.h
-header-y += firewire-cdev.h
-header-y += firewire-constants.h
-header-y += flat.h
-header-y += fou.h
-header-y += fs.h
-header-y += fsl_hypervisor.h
-header-y += fuse.h
-header-y += futex.h
-header-y += gameport.h
-header-y += genetlink.h
-header-y += gen_stats.h
-header-y += gfs2_ondisk.h
-header-y += gigaset_dev.h
-header-y += gpio.h
-header-y += gsmmux.h
-header-y += gtp.h
 header-y += hbtp_input.h
-header-y += hdlcdrv.h
-header-y += hdlc.h
-header-y += hdreg.h
-header-y += hiddev.h
-header-y += hid.h
-header-y += hidraw.h
-header-y += hpet.h
-header-y += hsr_netlink.h
-header-y += hyperv.h
-header-y += hysdn_if.h
-header-y += i2c-dev.h
-header-y += i2c.h
-header-y += i2o-dev.h
-header-y += i8k.h
-header-y += icmp.h
-header-y += icmpv6.h
-header-y += if_addr.h
-header-y += if_addrlabel.h
-header-y += if_alg.h
-header-y += if_arcnet.h
-header-y += if_arp.h
-header-y += if_bonding.h
-header-y += if_bridge.h
-header-y += if_cablemodem.h
-header-y += if_eql.h
-header-y += if_ether.h
-header-y += if_fc.h
-header-y += if_fddi.h
-header-y += if_frad.h
-header-y += if.h
-header-y += if_hippi.h
-header-y += if_infiniband.h
-header-y += if_link.h
-header-y += if_ltalk.h
-header-y += if_macsec.h
-header-y += if_packet.h
-header-y += if_phonet.h
-header-y += if_plip.h
-header-y += if_ppp.h
-header-y += if_pppol2tp.h
-header-y += if_pppox.h
-header-y += if_slip.h
-header-y += if_team.h
-header-y += if_tun.h
-header-y += if_tunnel.h
-header-y += if_vlan.h
-header-y += if_x25.h
-header-y += igmp.h
-header-y += ila.h
-header-y += in6.h
-header-y += inet_diag.h
-header-y += in.h
-header-y += inotify.h
-header-y += input.h
-header-y += input-event-codes.h
-header-y += in_route.h
-header-y += ioctl.h
-header-y += ion.h
-header-y += ip6_tunnel.h
-header-y += ipc.h
-header-y += ip.h
-header-y += ipmi.h
-header-y += ipmi_msgdefs.h
-header-y += ipsec.h
-header-y += ipv6.h
-header-y += ipv6_route.h
-header-y += ip_vs.h
-header-y += ipx.h
-header-y += irda.h
-header-y += irqnr.h
-header-y += isdn_divertif.h
-header-y += isdn.h
-header-y += isdnif.h
-header-y += isdn_ppp.h
-header-y += iso_fs.h
-header-y += ivtvfb.h
-header-y += ivtv.h
-header-y += ixjuser.h
-header-y += jffs2.h
-header-y += joystick.h
-header-y += kcmp.h
-header-y += kdev_t.h
-header-y += kd.h
-header-y += kernelcapi.h
-header-y += kernel.h
-header-y += kernel-page-flags.h
-header-y += kexec.h
-header-y += keyboard.h
-header-y += keyctl.h
-
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h \
-		  $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h),)
-header-y += kvm.h
-endif
-
-
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h \
-		  $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h),)
-header-y += kvm_para.h
-endif
-
-header-y += hw_breakpoint.h
-header-y += l2tp.h
-header-y += libc-compat.h
-header-y += lirc.h
-header-y += limits.h
-header-y += llc.h
-header-y += loop.h
-header-y += lp.h
-header-y += lwtunnel.h
-header-y += magic.h
-header-y += major.h
-header-y += map_to_7segment.h
-header-y += matroxfb.h
-header-y += mdio.h
-header-y += mdss_rotator.h
-header-y += media.h
-header-y += media-bus-format.h
-header-y += mei.h
-header-y += membarrier.h
-header-y += memfd.h
-header-y += mempolicy.h
-header-y += meye.h
-header-y += mhi.h
-header-y += mic_common.h
-header-y += mic_ioctl.h
-header-y += mii.h
-header-y += minix_fs.h
-header-y += mman.h
-header-y += mmtimer.h
-header-y += mpls.h
-header-y += mpls_iptunnel.h
-header-y += mqueue.h
-header-y += mroute6.h
-header-y += mroute.h
-header-y += msdos_fs.h
-header-y += msg.h
-header-y += msm_ion.h
-header-y += msm_ipc.h
-header-y += msm_kgsl.h
-header-y += msm_mdp.h
-header-y += msm_mdp_ext.h
-header-y += msm_rmnet.h
-header-y += mtio.h
-header-y += nbd.h
-header-y += ncp_fs.h
-header-y += ncp.h
-header-y += ncp_mount.h
-header-y += ncp_no.h
-header-y += ndctl.h
-header-y += neighbour.h
-header-y += netconf.h
-header-y += netdevice.h
-header-y += net_dropmon.h
-header-y += netfilter_arp.h
-header-y += netfilter_bridge.h
-header-y += netfilter_decnet.h
-header-y += netfilter.h
-header-y += netfilter_ipv4.h
-header-y += netfilter_ipv6.h
-header-y += net.h
-header-y += netlink_diag.h
-header-y += netlink.h
-header-y += netrom.h
-header-y += net_map.h
-header-y += net_namespace.h
-header-y += net_tstamp.h
-header-y += nfc.h
-header-y += nfs2.h
-header-y += nfs3.h
-header-y += nfs4.h
-header-y += nfs4_mount.h
-header-y += nfsacl.h
-header-y += nfs_fs.h
-header-y += nfs.h
-header-y += nfs_idmap.h
-header-y += nfs_mount.h
-header-y += nl80211.h
-header-y += n_r3964.h
-header-y += nubus.h
-header-y += nvme_ioctl.h
-header-y += nvram.h
-header-y += omap3isp.h
-header-y += omapfb.h
-header-y += oom.h
-header-y += openvswitch.h
-header-y += packet_diag.h
-header-y += param.h
-header-y += parport.h
-header-y += patchkey.h
-header-y += pci.h
-header-y += pci_regs.h
-header-y += perf_event.h
-header-y += personality.h
-header-y += pfkeyv2.h
-header-y += pg.h
-header-y += phantom.h
-header-y += phonet.h
-header-y += pktcdvd.h
-header-y += pkt_cls.h
-header-y += pkt_sched.h
-header-y += pmu.h
-header-y += poll.h
-header-y += posix_acl.h
-header-y += posix_acl_xattr.h
-header-y += posix_types.h
-header-y += ppdev.h
-header-y += ppp-comp.h
-header-y += ppp_defs.h
-header-y += ppp-ioctl.h
-header-y += pps.h
-header-y += prctl.h
-header-y += psci.h
-header-y += ptp_clock.h
-header-y += ptrace.h
 header-y += qbt1000.h
-header-y += qcedev.h
-header-y += qcota.h
-header-y += qg.h
-header-y += qg-profile.h
-header-y += qnx4_fs.h
-header-y += qnxtypes.h
-header-y += qrng.h
-header-y += qseecom.h
-header-y += quota.h
-header-y += radeonfb.h
-header-y += random.h
-header-y += raw.h
-header-y += rds.h
-header-y += reboot.h
-header-y += reiserfs_fs.h
-header-y += reiserfs_xattr.h
-header-y += resource.h
-header-y += rfkill.h
-header-y += rio_cm_cdev.h
-header-y += rio_mport_cdev.h
-header-y += romfs_fs.h
-header-y += rmnet_data.h
-header-y += rose.h
-header-y += route.h
-header-y += rtc.h
-header-y += rtnetlink.h
-header-y += scc.h
-header-y += sched.h
-header-y += scif_ioctl.h
-header-y += screen_info.h
-header-y += sctp.h
-header-y += sdla.h
-header-y += seccomp.h
-header-y += securebits.h
+
+ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h),)
+no-export-headers += kvm.h
+endif
+
+ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),)
+no-export-headers += kvm_para.h
+endif
+
+no-export-headers += auto_dev-ioctl.h
+no-export-headers += batman_adv.h
+no-export-headers += bcache.h
+no-export-headers += btrfs_tree.h
+no-export-headers += cryptouser.h
+no-export-headers += dma-buf.h
+no-export-headers += hash_info.h
+no-export-headers += kcm.h
+no-export-headers += kcov.h
+no-export-headers += kfd_ioctl.h
+no-export-headers += lightnvm.h
+no-export-headers += module.h
+no-export-headers += nilfs2_api.h
+no-export-headers += nilfs2_ondisk.h
+no-export-headers += nsfs.h
+no-export-headers += pr.h
+no-export-headers += qrtr.h
+no-export-headers += stm.h
+no-export-headers += tee.h
+no-export-headers += userio.h
+no-export-headers += wil6210_uapi.h
+
+header-y += mhi.h
+header-y += sockev.h
+header-y += nfc/
 header-y += seemp_api.h
 header-y += seemp_param_id.h
-header-y += selinux_netlink.h
-header-y += sem.h
-header-y += serial_core.h
-header-y += serial.h
-header-y += serial_reg.h
-header-y += serio.h
-header-y += shm.h
-header-y += signalfd.h
-header-y += signal.h
-header-y += smcinvoke.h
-header-y += smiapp.h
-header-y += snmp.h
-header-y += sock_diag.h
-header-y += socket.h
-header-y += sockev.h
-header-y += sockios.h
-header-y += sonet.h
-header-y += sonypi.h
-header-y += soundcard.h
-header-y += sound.h
-header-y += spcom.h
-header-y += stat.h
-header-y += stddef.h
-header-y += string.h
-header-y += suspend_ioctls.h
-header-y += swab.h
-header-y += synclink.h
-header-y += sync_file.h
-header-y += sysctl.h
-header-y += sysinfo.h
-header-y += target_core_user.h
-header-y += taskstats.h
-header-y += tcp.h
-header-y += tcp_metrics.h
-header-y += telephony.h
-header-y += termios.h
-header-y += thermal.h
-header-y += time.h
-header-y += times.h
-header-y += timex.h
-header-y += tiocl.h
-header-y += tipc_config.h
-header-y += tipc_netlink.h
-header-y += tipc.h
-header-y += toshiba.h
-header-y += tty_flags.h
-header-y += tty.h
-header-y += types.h
-header-y += udf_fs_i.h
-header-y += udp.h
-header-y += uhid.h
-header-y += uinput.h
-header-y += uio.h
-header-y += ultrasound.h
-header-y += un.h
-header-y += unistd.h
-header-y += unix_diag.h
-header-y += usbdevice_fs.h
-header-y += usbip.h
-header-y += utime.h
-header-y += utsname.h
-header-y += uuid.h
-header-y += uvcvideo.h
-header-y += v4l2-common.h
-header-y += v4l2-controls.h
-header-y += v4l2-dv-timings.h
-header-y += v4l2-mediabus.h
-header-y += v4l2-subdev.h
-header-y += msm_vidc_dec.h
-header-y += msm_vidc_enc.h
-header-y += veth.h
-header-y += vfio.h
-header-y += vhost.h
-header-y += videodev2.h
-header-y += virtio_9p.h
-header-y += virtio_balloon.h
-header-y += virtio_blk.h
-header-y += virtio_config.h
-header-y += virtio_console.h
-header-y += virtio_gpu.h
-header-y += virtio_ids.h
-header-y += virtio_input.h
-header-y += virtio_net.h
-header-y += virtio_pci.h
-header-y += virtio_ring.h
-header-y += virtio_rng.h
-header-y += virtio_scsi.h
-header-y += virtio_types.h
-header-y += virtio_vsock.h
-header-y += vm_bms.h
-header-y += vm_sockets.h
-header-y += vt.h
-header-y += vtpm_proxy.h
-header-y += wait.h
-header-y += wanrouter.h
-header-y += watchdog.h
-header-y += wimax.h
-header-y += wireless.h
-header-y += x25.h
-header-y += xattr.h
-header-y += xfrm.h
-header-y += xilinx-v4l2-controls.h
-header-y += zorro.h
-header-y += zorro_ids.h
-header-y += userfaultfd.h
-header-y += ipa_qmi_service_v01.h
-header-y += msm_ipa.h
-header-y += rmnet_ipa_fd_ioctl.h
-header-y += msm_dsps.h
-header-y += msm-core-interface.h
-header-y += msm_rotator.h
-header-y += bgcom_interface.h
-header-y += nfc/
 
 ifneq ($(VSERVICES_SUPPORT), "")
 include include/linux/Kbuild.vservices
diff --git a/include/uapi/linux/android/Kbuild b/include/uapi/linux/android/Kbuild
deleted file mode 100644
index ca011ee..0000000
--- a/include/uapi/linux/android/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += binder.h
diff --git a/include/uapi/linux/byteorder/Kbuild b/include/uapi/linux/byteorder/Kbuild
deleted file mode 100644
index 619225b..0000000
--- a/include/uapi/linux/byteorder/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
-# UAPI Header export list
-header-y += big_endian.h
-header-y += little_endian.h
diff --git a/include/uapi/linux/caif/Kbuild b/include/uapi/linux/caif/Kbuild
deleted file mode 100644
index 4339661..0000000
--- a/include/uapi/linux/caif/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
-# UAPI Header export list
-header-y += caif_socket.h
-header-y += if_caif.h
diff --git a/include/uapi/linux/can/Kbuild b/include/uapi/linux/can/Kbuild
deleted file mode 100644
index 21c91bf..0000000
--- a/include/uapi/linux/can/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-# UAPI Header export list
-header-y += bcm.h
-header-y += error.h
-header-y += gw.h
-header-y += netlink.h
-header-y += raw.h
diff --git a/include/uapi/linux/cifs/Kbuild b/include/uapi/linux/cifs/Kbuild
new file mode 100644
index 0000000..c922dbe
--- /dev/null
+++ b/include/uapi/linux/cifs/Kbuild
@@ -0,0 +1,2 @@
+# UAPI Header export list
+no-export-headers += cifs_mount.h
diff --git a/include/uapi/linux/dvb/Kbuild b/include/uapi/linux/dvb/Kbuild
deleted file mode 100644
index d40942c..0000000
--- a/include/uapi/linux/dvb/Kbuild
+++ /dev/null
@@ -1,9 +0,0 @@
-# UAPI Header export list
-header-y += audio.h
-header-y += ca.h
-header-y += dmx.h
-header-y += frontend.h
-header-y += net.h
-header-y += osd.h
-header-y += version.h
-header-y += video.h
diff --git a/include/uapi/linux/genwqe/Kbuild b/include/uapi/linux/genwqe/Kbuild
new file mode 100644
index 0000000..b50fc21
--- /dev/null
+++ b/include/uapi/linux/genwqe/Kbuild
@@ -0,0 +1,2 @@
+# UAPI Header export list
+no-export-headers += genwqe_card.h
diff --git a/include/uapi/linux/hdlc/Kbuild b/include/uapi/linux/hdlc/Kbuild
deleted file mode 100644
index 8c1d2cb..0000000
--- a/include/uapi/linux/hdlc/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += ioctl.h
diff --git a/include/uapi/linux/hsi/Kbuild b/include/uapi/linux/hsi/Kbuild
deleted file mode 100644
index a16a005..0000000
--- a/include/uapi/linux/hsi/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += hsi_char.h cs-protocol.h
diff --git a/include/uapi/linux/iio/Kbuild b/include/uapi/linux/iio/Kbuild
deleted file mode 100644
index 86f76d8..0000000
--- a/include/uapi/linux/iio/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
-# UAPI Header export list
-header-y += events.h
-header-y += types.h
diff --git a/include/uapi/linux/isdn/Kbuild b/include/uapi/linux/isdn/Kbuild
deleted file mode 100644
index 89e5285..0000000
--- a/include/uapi/linux/isdn/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += capicmd.h
diff --git a/include/uapi/linux/mmc/Kbuild b/include/uapi/linux/mmc/Kbuild
deleted file mode 100644
index ce4e885..0000000
--- a/include/uapi/linux/mmc/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-# UAPI Header export list
-header-y += core.h
-header-y += core.h
-header-y += ioctl.h
-header-y += mmc.h
-header-y += mmc.h
diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
index 03f194a..6b00ca2 100644
--- a/include/uapi/linux/netfilter/Kbuild
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -1,89 +1,2 @@
 # UAPI Header export list
-header-y += ipset/
-header-y += nf_conntrack_common.h
-header-y += nf_conntrack_ftp.h
-header-y += nf_conntrack_sctp.h
-header-y += nf_conntrack_tcp.h
-header-y += nf_conntrack_tuple_common.h
-header-y += nf_log.h
-header-y += nf_tables.h
-header-y += nf_tables_compat.h
-header-y += nf_nat.h
-header-y += nfnetlink.h
-header-y += nfnetlink_acct.h
-header-y += nfnetlink_compat.h
-header-y += nfnetlink_conntrack.h
-header-y += nfnetlink_cthelper.h
-header-y += nfnetlink_cttimeout.h
-header-y += nfnetlink_log.h
-header-y += nfnetlink_queue.h
-header-y += x_tables.h
-header-y += xt_AUDIT.h
-header-y += xt_CHECKSUM.h
-header-y += xt_CLASSIFY.h
-header-y += xt_CONNMARK.h
-header-y += xt_CONNSECMARK.h
-header-y += xt_CT.h
-header-y += xt_DSCP.h
-header-y += xt_HMARK.h
-header-y += xt_IDLETIMER.h
-header-y += xt_LED.h
-header-y += xt_LOG.h
-header-y += xt_MARK.h
-header-y += xt_NFLOG.h
-header-y += xt_NFQUEUE.h
-header-y += xt_RATEEST.h
-header-y += xt_SECMARK.h
-header-y += xt_SYNPROXY.h
-header-y += xt_TCPMSS.h
-header-y += xt_TCPOPTSTRIP.h
-header-y += xt_TEE.h
-header-y += xt_TPROXY.h
-header-y += xt_addrtype.h
-header-y += xt_bpf.h
-header-y += xt_cgroup.h
-header-y += xt_cluster.h
-header-y += xt_comment.h
-header-y += xt_connbytes.h
-header-y += xt_connlabel.h
-header-y += xt_connlimit.h
-header-y += xt_connmark.h
-header-y += xt_conntrack.h
-header-y += xt_cpu.h
-header-y += xt_dccp.h
-header-y += xt_devgroup.h
-header-y += xt_dscp.h
-header-y += xt_ecn.h
-header-y += xt_esp.h
-header-y += xt_hashlimit.h
-header-y += xt_helper.h
-header-y += xt_ipcomp.h
-header-y += xt_iprange.h
-header-y += xt_ipvs.h
-header-y += xt_l2tp.h
-header-y += xt_length.h
-header-y += xt_limit.h
-header-y += xt_mac.h
-header-y += xt_mark.h
-header-y += xt_multiport.h
-header-y += xt_nfacct.h
-header-y += xt_osf.h
-header-y += xt_owner.h
-header-y += xt_physdev.h
-header-y += xt_pkttype.h
-header-y += xt_policy.h
-header-y += xt_quota.h
-header-y += xt_rateest.h
-header-y += xt_realm.h
-header-y += xt_recent.h
-header-y += xt_rpfilter.h
-header-y += xt_sctp.h
-header-y += xt_set.h
-header-y += xt_socket.h
-header-y += xt_state.h
-header-y += xt_statistic.h
-header-y += xt_string.h
-header-y += xt_tcpmss.h
-header-y += xt_tcpudp.h
-header-y += xt_time.h
-header-y += xt_u32.h
+no-export-headers += xt_HARDIDLETIMER.h
diff --git a/include/uapi/linux/netfilter/ipset/Kbuild b/include/uapi/linux/netfilter/ipset/Kbuild
deleted file mode 100644
index d268042..0000000
--- a/include/uapi/linux/netfilter/ipset/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-# UAPI Header export list
-header-y += ip_set.h
-header-y += ip_set_bitmap.h
-header-y += ip_set_hash.h
-header-y += ip_set_list.h
diff --git a/include/uapi/linux/netfilter_arp/Kbuild b/include/uapi/linux/netfilter_arp/Kbuild
deleted file mode 100644
index 62d5637..0000000
--- a/include/uapi/linux/netfilter_arp/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
-# UAPI Header export list
-header-y += arp_tables.h
-header-y += arpt_mangle.h
diff --git a/include/uapi/linux/netfilter_bridge/Kbuild b/include/uapi/linux/netfilter_bridge/Kbuild
deleted file mode 100644
index 0fbad8e..0000000
--- a/include/uapi/linux/netfilter_bridge/Kbuild
+++ /dev/null
@@ -1,18 +0,0 @@
-# UAPI Header export list
-header-y += ebt_802_3.h
-header-y += ebt_among.h
-header-y += ebt_arp.h
-header-y += ebt_arpreply.h
-header-y += ebt_ip.h
-header-y += ebt_ip6.h
-header-y += ebt_limit.h
-header-y += ebt_log.h
-header-y += ebt_mark_m.h
-header-y += ebt_mark_t.h
-header-y += ebt_nat.h
-header-y += ebt_nflog.h
-header-y += ebt_pkttype.h
-header-y += ebt_redirect.h
-header-y += ebt_stp.h
-header-y += ebt_vlan.h
-header-y += ebtables.h
diff --git a/include/uapi/linux/netfilter_ipv4/Kbuild b/include/uapi/linux/netfilter_ipv4/Kbuild
deleted file mode 100644
index 7391cdc..0000000
--- a/include/uapi/linux/netfilter_ipv4/Kbuild
+++ /dev/null
@@ -1,11 +0,0 @@
-# UAPI Header export list
-header-y += ip_tables.h
-header-y += ipt_CLUSTERIP.h
-header-y += ipt_ECN.h
-header-y += ipt_LOG.h
-header-y += ipt_REJECT.h
-header-y += ipt_TTL.h
-header-y += ipt_ah.h
-header-y += ipt_ecn.h
-header-y += ipt_ttl.h
-header-y += ipt_NATTYPE.h
diff --git a/include/uapi/linux/netfilter_ipv6/Kbuild b/include/uapi/linux/netfilter_ipv6/Kbuild
deleted file mode 100644
index 75a668c..0000000
--- a/include/uapi/linux/netfilter_ipv6/Kbuild
+++ /dev/null
@@ -1,13 +0,0 @@
-# UAPI Header export list
-header-y += ip6_tables.h
-header-y += ip6t_HL.h
-header-y += ip6t_LOG.h
-header-y += ip6t_NPT.h
-header-y += ip6t_REJECT.h
-header-y += ip6t_ah.h
-header-y += ip6t_frag.h
-header-y += ip6t_hl.h
-header-y += ip6t_ipv6header.h
-header-y += ip6t_mh.h
-header-y += ip6t_opts.h
-header-y += ip6t_rt.h
diff --git a/include/uapi/linux/nfsd/Kbuild b/include/uapi/linux/nfsd/Kbuild
deleted file mode 100644
index c11bc40..0000000
--- a/include/uapi/linux/nfsd/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-# UAPI Header export list
-header-y += cld.h
-header-y += debug.h
-header-y += export.h
-header-y += nfsfh.h
-header-y += stats.h
diff --git a/include/uapi/linux/qrtr.h b/include/uapi/linux/qrtr.h
index 66c0748..4b25d2f 100644
--- a/include/uapi/linux/qrtr.h
+++ b/include/uapi/linux/qrtr.h
@@ -3,10 +3,45 @@
 
 #include <linux/socket.h>
 
+#define QRTR_NODE_BCAST        0xffffffffu
+#define QRTR_PORT_CTRL 0xfffffffeu
+
 struct sockaddr_qrtr {
 	__kernel_sa_family_t sq_family;
 	__u32 sq_node;
 	__u32 sq_port;
 };
 
+enum qrtr_pkt_type {
+	QRTR_TYPE_DATA		= 1,
+	QRTR_TYPE_HELLO		= 2,
+	QRTR_TYPE_BYE		= 3,
+	QRTR_TYPE_NEW_SERVER	= 4,
+	QRTR_TYPE_DEL_SERVER	= 5,
+	QRTR_TYPE_DEL_CLIENT	= 6,
+	QRTR_TYPE_RESUME_TX	= 7,
+	QRTR_TYPE_EXIT          = 8,
+	QRTR_TYPE_PING          = 9,
+	QRTR_TYPE_NEW_LOOKUP	= 10,
+	QRTR_TYPE_DEL_LOOKUP	= 11,
+};
+
+struct qrtr_ctrl_pkt {
+	__le32 cmd;
+
+	union {
+		struct {
+			__le32 service;
+			__le32 instance;
+			__le32 node;
+			__le32 port;
+		} server;
+
+		struct {
+			__le32 node;
+			__le32 port;
+		} client;
+	};
+} __packed;
+
 #endif /* _LINUX_QRTR_H */
diff --git a/include/uapi/linux/raid/Kbuild b/include/uapi/linux/raid/Kbuild
deleted file mode 100644
index e2c3d25..0000000
--- a/include/uapi/linux/raid/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
-# UAPI Header export list
-header-y += md_p.h
-header-y += md_u.h
diff --git a/include/uapi/linux/spi/Kbuild b/include/uapi/linux/spi/Kbuild
deleted file mode 100644
index 0cc747e..0000000
--- a/include/uapi/linux/spi/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += spidev.h
diff --git a/include/uapi/linux/sunrpc/Kbuild b/include/uapi/linux/sunrpc/Kbuild
deleted file mode 100644
index 8e02e47..0000000
--- a/include/uapi/linux/sunrpc/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += debug.h
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
deleted file mode 100644
index e3db740..0000000
--- a/include/uapi/linux/tc_act/Kbuild
+++ /dev/null
@@ -1,15 +0,0 @@
-# UAPI Header export list
-header-y += tc_csum.h
-header-y += tc_defact.h
-header-y += tc_gact.h
-header-y += tc_ipt.h
-header-y += tc_mirred.h
-header-y += tc_nat.h
-header-y += tc_pedit.h
-header-y += tc_skbedit.h
-header-y += tc_vlan.h
-header-y += tc_bpf.h
-header-y += tc_connmark.h
-header-y += tc_ife.h
-header-y += tc_tunnel_key.h
-header-y += tc_skbmod.h
diff --git a/include/uapi/linux/tc_ematch/Kbuild b/include/uapi/linux/tc_ematch/Kbuild
deleted file mode 100644
index 53fca39..0000000
--- a/include/uapi/linux/tc_ematch/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-# UAPI Header export list
-header-y += tc_em_cmp.h
-header-y += tc_em_meta.h
-header-y += tc_em_nbyte.h
-header-y += tc_em_text.h
diff --git a/include/uapi/linux/usb/Kbuild b/include/uapi/linux/usb/Kbuild
index ba153d5..e511bf6 100644
--- a/include/uapi/linux/usb/Kbuild
+++ b/include/uapi/linux/usb/Kbuild
@@ -1,13 +1,3 @@
 # UAPI Header export list
-header-y += audio.h
-header-y += cdc.h
-header-y += cdc-wdm.h
-header-y += ch11.h
-header-y += ch9.h
-header-y += functionfs.h
-header-y += g_printer.h
-header-y += gadgetfs.h
-header-y += midi.h
-header-y += tmc.h
-header-y += usb_ctrl_qti.h
-header-y += video.h
+no-export-headers += f_accessory.h
+no-export-headers += f_mtp.h
diff --git a/include/uapi/linux/wimax/Kbuild b/include/uapi/linux/wimax/Kbuild
deleted file mode 100644
index 1c97be4..0000000
--- a/include/uapi/linux/wimax/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += i2400m.h
diff --git a/include/uapi/misc/Kbuild b/include/uapi/misc/Kbuild
deleted file mode 100644
index e96cae7..0000000
--- a/include/uapi/misc/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# misc Header export list
-header-y += cxl.h
diff --git a/include/uapi/mtd/Kbuild b/include/uapi/mtd/Kbuild
deleted file mode 100644
index 5a691e1..0000000
--- a/include/uapi/mtd/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-# UAPI Header export list
-header-y += inftl-user.h
-header-y += mtd-abi.h
-header-y += mtd-user.h
-header-y += nftl-user.h
-header-y += ubi-user.h
diff --git a/include/uapi/rdma/Kbuild b/include/uapi/rdma/Kbuild
index f14ab7f..c2a45be 100644
--- a/include/uapi/rdma/Kbuild
+++ b/include/uapi/rdma/Kbuild
@@ -1,16 +1,2 @@
 # UAPI Header export list
-header-y += ib_user_cm.h
-header-y += ib_user_mad.h
-header-y += ib_user_sa.h
-header-y += ib_user_verbs.h
-header-y += rdma_netlink.h
-header-y += rdma_user_cm.h
-header-y += hfi/
-header-y += rdma_user_rxe.h
-header-y += cxgb3-abi.h
-header-y += cxgb4-abi.h
-header-y += mlx4-abi.h
-header-y += mlx5-abi.h
-header-y += mthca-abi.h
-header-y += nes-abi.h
-header-y += ocrdma-abi.h
+no-export-headers += qedr-abi.h
diff --git a/include/uapi/rdma/hfi/Kbuild b/include/uapi/rdma/hfi/Kbuild
deleted file mode 100644
index ef23c29..0000000
--- a/include/uapi/rdma/hfi/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
-# UAPI Header export list
-header-y += hfi1_user.h
diff --git a/include/uapi/scsi/Kbuild b/include/uapi/scsi/Kbuild
deleted file mode 100644
index 9a0da84..0000000
--- a/include/uapi/scsi/Kbuild
+++ /dev/null
@@ -1,9 +0,0 @@
-# UAPI Header export list
-header-y += fc/
-header-y += ufs/
-header-y += scsi_bsg_fc.h
-header-y += sg.h
-header-y += scsi_ioctl.h
-header-y += scsi_netlink.h
-header-y += scsi_netlink_fc.h
-header-y += cxlflash_ioctl.h
diff --git a/include/uapi/scsi/fc/Kbuild b/include/uapi/scsi/fc/Kbuild
deleted file mode 100644
index 5ead9fa..0000000
--- a/include/uapi/scsi/fc/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-# UAPI Header export list
-header-y += fc_els.h
-header-y += fc_fs.h
-header-y += fc_gs.h
-header-y += fc_ns.h
diff --git a/include/uapi/sound/Kbuild b/include/uapi/sound/Kbuild
deleted file mode 100644
index 9578d8b..0000000
--- a/include/uapi/sound/Kbuild
+++ /dev/null
@@ -1,16 +0,0 @@
-# UAPI Header export list
-header-y += asequencer.h
-header-y += asoc.h
-header-y += asound.h
-header-y += asound_fm.h
-header-y += compress_offload.h
-header-y += compress_params.h
-header-y += emu10k1.h
-header-y += firewire.h
-header-y += hdsp.h
-header-y += hdspm.h
-header-y += sb16_csp.h
-header-y += sfnt_info.h
-header-y += tlv.h
-header-y += usb_stream.h
-header-y += snd_sst_tokens.h
diff --git a/include/uapi/video/Kbuild b/include/uapi/video/Kbuild
index b98fa51..35ee3b6 100644
--- a/include/uapi/video/Kbuild
+++ b/include/uapi/video/Kbuild
@@ -1,6 +1,2 @@
 # UAPI Header export list
-header-y += edid.h
-header-y += msm_hdmi_hdcp_mgr.h
-header-y += msm_hdmi_modes.h
-header-y += sisfb.h
-header-y += uvesafb.h
+no-export-headers += adf.h
diff --git a/include/uapi/xen/Kbuild b/include/uapi/xen/Kbuild
deleted file mode 100644
index 5c45962..0000000
--- a/include/uapi/xen/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-# UAPI Header export list
-header-y += evtchn.h
-header-y += gntalloc.h
-header-y += gntdev.h
-header-y += privcmd.h
diff --git a/include/video/Kbuild b/include/video/Kbuild
deleted file mode 100644
index e69de29..0000000
--- a/include/video/Kbuild
+++ /dev/null
diff --git a/kernel_headers.py b/kernel_headers.py
new file mode 100644
index 0000000..d36ca87
--- /dev/null
+++ b/kernel_headers.py
@@ -0,0 +1,1076 @@
+# Copyright 2019 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Generates gen_headers_<arch>.bp or generates/checks kernel headers."""
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+import argparse
+import filecmp
+import os
+import re
+import subprocess
+import sys
+
+
+def gen_version_h(verbose, gen_dir, version_makefile):
+  """Generate linux/version.h
+
+  Scan the version_makefile for the version info, and then generate
+  linux/version.h in the gen_dir as done in kernel Makefile function
+  filechk_version.h
+
+  Args:
+    verbose: Set True to print progress messages.
+    gen_dir: Where to place the generated files.
+    version_makefile: The makefile that contains version info.
+  Return:
+    If version info not found, False. Otherwise, True.
+  """
+
+  version_re = re.compile(r'VERSION\s*=\s*(\d+)')
+  patchlevel_re = re.compile(r'PATCHLEVEL\s*=\s*(\d+)')
+  sublevel_re = re.compile(r'SUBLEVEL\s*=\s*(\d+)')
+
+  version_str = None
+  patchlevel_str = None
+  sublevel_str = None
+
+  if verbose:
+    print('gen_version_h: processing [%s]' % version_makefile)
+
+  with open(version_makefile, 'r') as f:
+    while not version_str or not patchlevel_str or not sublevel_str:
+      line = f.readline()
+
+      if not line:
+        print(
+            'error: gen_version_h: failed to parse kernel version from %s' %
+            version_makefile)
+        return False
+
+      line = line.rstrip()
+
+      if verbose:
+        print('gen_version_h: line is %s' % line)
+
+      if not version_str:
+        match = version_re.match(line)
+        if match:
+          if verbose:
+            print('gen_version_h: matched version [%s]' % line)
+          version_str = match.group(1)
+          continue
+
+      if not patchlevel_str:
+        match = patchlevel_re.match(line)
+        if match:
+          if verbose:
+            print('gen_version_h: matched patchlevel [%s]' % line)
+          patchlevel_str = match.group(1)
+          continue
+
+      if not sublevel_str:
+        match = sublevel_re.match(line)
+        if match:
+          if verbose:
+            print('gen_version_h: matched sublevel [%s]' % line)
+          sublevel_str = match.group(1)
+          continue
+
+  version = int(version_str)
+  patchlevel = int(patchlevel_str)
+  sublevel = int(sublevel_str)
+
+  if verbose:
+    print(
+        'gen_version_h: found kernel version %d.%d.%d' %
+        (version, patchlevel, sublevel))
+
+  version_h = os.path.join(gen_dir, 'linux', 'version.h')
+
+  with open(version_h, 'w') as f:
+    # This code must match the code in Makefile in the make function
+    # filechk_version.h
+    version_code = (version << 16) + (patchlevel << 8) + sublevel
+    f.write('#define LINUX_VERSION_CODE %d\n' % version_code)
+    f.write(
+        '#define KERNEL_VERSION(a,b,c) ' +
+        '(((a) << 16) + ((b) << 8) + (c))\n')
+
+  return True
+
+
+def scan_arch_kbuild(verbose, arch_asm_kbuild, asm_generic_kbuild, arch_include_uapi):
+  """Scan arch_asm_kbuild for generated headers.
+
+  This function processes the Kbuild file to scan for three types of files that
+  need to be generated. The first type are syscall generated headers, which are
+  identified by adding to the generated-y make variable. The second type are
+  generic headers, which are arch-specific headers that simply wrap the
+  asm-generic counterpart, and are identified by adding to the generic-y make
+  variable. The third type are mandatory headers that should be present in the
+  /usr/include/asm folder.
+
+  Args:
+    verbose: Set True to print progress messages.
+    arch_asm_kbuild: The Kbuild file containing lists of headers to generate.
+    asm_generic_kbuild: The Kbuild file containing lists of mandatory headers.
+    arch_include_uapi: Headers in /arch/<arch>/include/uapi directory
+  Return:
+    Two lists of discovered headers, one for generated and one for generic.
+  """
+
+  generated_y_re = re.compile(r'generated-y\s*\+=\s*(\S+)')
+  generic_y_re = re.compile(r'generic-y\s*\+=\s*(\S+)')
+  mandatory_y_re = re.compile(r'mandatory-y\s*\+=\s*(\S+)')
+
+  # This loop parses arch_asm_kbuild for various kinds of headers to generate.
+
+  if verbose:
+    print('scan_arch_kbuild: processing [%s]' % arch_asm_kbuild)
+
+  generated_list = []
+  generic_list = []
+  arch_include_uapi_list = [os.path.basename(x) for x in arch_include_uapi]
+  mandatory_pre_list = []
+  mandatory_list = []
+
+
+  with open(arch_asm_kbuild, 'r') as f:
+    while True:
+      line = f.readline()
+
+      if not line:
+        break
+
+      line = line.rstrip()
+
+      if verbose:
+        print('scan_arch_kbuild: line is %s' % line)
+
+      match = generated_y_re.match(line)
+
+      if match:
+        if verbose:
+          print('scan_arch_kbuild: matched [%s]' % line)
+        generated_list.append(match.group(1))
+        continue
+
+      match = generic_y_re.match(line)
+
+      if match:
+        if verbose:
+          print('scan_arch_kbuild: matched [%s]' % line)
+        generic_list.append(match.group(1))
+        continue
+
+  # This loop parses asm_generic_kbuild for various kinds of headers to generate.
+
+  if verbose:
+    print('scan_arch_kbuild: processing [%s]' % asm_generic_kbuild)
+
+  with open(asm_generic_kbuild, 'r') as f:
+    while True:
+      line = f.readline()
+
+      if not line:
+        break
+
+      line = line.rstrip()
+
+      if verbose:
+        print('scan_arch_kbuild: line is %s' % line)
+
+      match = mandatory_y_re.match(line)
+
+      if match:
+        if verbose:
+          print('scan_arch_kbuild: matched [%s]' % line)
+        mandatory_pre_list.append(match.group(1))
+        continue
+
+  # Mandatory headers need to be generated if they are not already generated.
+  comb_list = generic_list + generated_list + arch_include_uapi_list
+  mandatory_list = [x for x in mandatory_pre_list if x not in comb_list]
+  if verbose:
+    print("generic")
+    for x in generic_list:
+      print(x)
+    print("generated")
+    for x in generated_list:
+      print(x)
+    print("mandatory")
+    for x in mandatory_list:
+      print(x)
+    print("arch_include_uapi_list")
+    for x in arch_include_uapi_list:
+      print(x)
+
+  return (generated_list, generic_list, mandatory_list)
+
+
+def gen_arch_headers(
+    verbose, gen_dir, arch_asm_kbuild, asm_generic_kbuild, arch_syscall_tool, arch_syscall_tbl, arch_include_uapi):
+  """Process arch-specific and asm-generic uapi/asm/Kbuild to generate headers.
+
+  The function consists of a call to scan_arch_kbuild followed by three loops.
+  The first loop generates headers found and placed in the generated_list by
+  scan_arch_kbuild. The second loop generates headers found and placed in the
+  generic_list by the scan_arch_kbuild. The third loop generates headers found
+  in mandatory_list by scan_arch_kbuild.
+
+  The function does some parsing of file names and tool invocations. If that
+  parsing fails for some reason (e.g., we don't know how to generate the
+  header) or a tool invocation fails, then this function will count that as
+  an error but keep processing. In the end, the function returns the number of
+  errors encountered.
+
+  Args:
+    verbose: Set True to print progress messages.
+    gen_dir: Where to place the generated files.
+    arch_asm_kbuild: The Kbuild file containing lists of headers to generate.
+    asm_generic_kbuild: The Kbuild file containing lists of mandatory headers.
+    arch_syscall_tool: The arch script that generates syscall headers, or None.
+    arch_syscall_tbl: The arch script that defines syscall vectors, or None.
+    arch_include_uapi: Headers in arch/<arch>/include/uapi directory.
+  Return:
+    The number of parsing errors encountered.
+  """
+
+  error_count = 0
+
+  # First generate the lists
+
+  (generated_list, generic_list, mandatory_list) = scan_arch_kbuild(verbose, arch_asm_kbuild, asm_generic_kbuild ,arch_include_uapi)
+
+  # Now we're at the first loop, which is able to generate syscall headers
+  # found in the first loop, and placed in generated_list. It's okay for this
+  # list to be empty. In that case, of course, the loop does nothing.
+
+  abi_re = re.compile(r'unistd-(\S+)\.h')
+
+  for generated in generated_list:
+    gen_h = os.path.join(gen_dir, 'asm', generated)
+    match = abi_re.match(generated)
+
+    if match:
+      abi = match.group(1)
+
+      cmd = [
+          '/bin/bash',
+          arch_syscall_tool,
+          arch_syscall_tbl,
+          gen_h,
+          abi,
+          '',
+          '__NR_SYSCALL_BASE',
+      ]
+
+      if verbose:
+        print('gen_arch_headers: cmd is %s' % cmd)
+
+      result = subprocess.call(cmd)
+
+      if result != 0:
+        print('error: gen_arch_headers: cmd %s failed %d' % (cmd, result))
+        error_count += 1
+    else:
+      print('error: gen_arch_headers: syscall header has bad filename: %s' % generated)
+      error_count += 1
+
+  # Now we're at the second loop, which generates wrappers from arch-specific
+  # headers listed in generic_list to the corresponding asm-generic header.
+
+  for generic in generic_list:
+    wrap_h = os.path.join(gen_dir, 'asm', generic)
+    with open(wrap_h, 'w') as f:
+      f.write('#include <asm-generic/%s>\n' % generic)
+
+  # Now we're at the third loop, which generates wrappers from asm
+  # headers listed in mandatory_list to the corresponding asm-generic header.
+
+  for mandatory in mandatory_list:
+    wrap_h = os.path.join(gen_dir, 'asm', mandatory)
+    with open(wrap_h, 'w') as f:
+      f.write('#include <asm-generic/%s>\n' % mandatory)
+  return error_count
+
+
+def run_headers_install(verbose, gen_dir, headers_install, prefix, h):
+  """Process a header through the headers_install script.
+
+  The headers_install script does some processing of a header so that it is
+  appropriate for inclusion in a userland program. This function invokes that
+  script for one header file.
+
+  The input file is a header file found in the directory named by prefix. This
+  function stips the prefix from the header to generate the name of the
+  processed header.
+
+  Args:
+    verbose: Set True to print progress messages.
+    gen_dir: Where to place the generated files.
+    headers_install: The script that munges the header.
+    prefix: The prefix to strip from h to generate the output filename.
+    h: The input header to process.
+  Return:
+    If parsing or the tool fails, False. Otherwise, True
+  """
+
+  if not h.startswith(prefix):
+    print('error: expected prefix [%s] on header [%s]' % (prefix, h))
+    return False
+
+  out_h = os.path.join(gen_dir, h[len(prefix):])
+  (out_h_dirname, out_h_basename) = os.path.split(out_h)
+  h_dirname = os.path.dirname(h)
+
+  cmd = [headers_install, out_h_dirname, h_dirname, out_h_basename]
+
+  if verbose:
+    print('run_headers_install: cmd is %s' % cmd)
+
+  result = subprocess.call(cmd)
+
+  if result != 0:
+    print('error: run_headers_install: cmd %s failed %d' % (cmd, result))
+    return False
+
+  return True
+
+
+def glob_headers(prefix, rel_glob, excludes):
+  """Recursively scan the a directory for headers.
+
+  This function recursively scans the directory identified by prefix for
+  headers. We don't yet have a new enough version of python3 to use the
+  better glob function, so right now we assume the glob is '**/*.h'.
+
+  The function filters out any files that match the items in excludes.
+
+  Args:
+    prefix: The directory to recursively scan for headers.
+    rel_glob: The shell-style glob that identifies the header pattern.
+    excludes: A list of headers to exclude from the glob.
+  Return:
+    A list of headers discovered with excludes excluded.
+  """
+
+  # If we had python 3.5+, we could use the fancy new glob.glob.
+  # full_glob = os.path.join(prefix, rel_glob)
+  # full_srcs = glob.glob(full_glob, recursive=True)
+
+  full_dirs = [prefix]
+  full_srcs = []
+
+  while full_dirs:
+    full_dir = full_dirs.pop(0)
+    items = sorted(os.listdir(full_dir))
+
+    for item in items:
+      full_item = os.path.join(full_dir, item)
+
+      if os.path.isdir(full_item):
+        full_dirs.append(full_item)
+        continue
+
+      if full_item in excludes:
+        continue
+
+      if full_item.endswith('.h'):
+        full_srcs.append(full_item)
+
+  return full_srcs
+
+
+def find_out(verbose, module_dir, prefix, rel_glob, excludes, outs):
+  """Build a list of outputs for the genrule that creates kernel headers.
+
+  This function scans for headers in the source tree and produces a list of
+  output (generated) headers.
+
+  Args:
+    verbose: Set True to print progress messages.
+    module_dir: The root directory of the kernel source.
+    prefix: The prefix with in the kernel source tree to search for headers.
+    rel_glob: The pattern to use when matching headers under prefix.
+    excludes: A list of files to exclude from the glob.
+    outs: The list to populdate with the headers that will be generated.
+  Return:
+    The number of errors encountered.
+  """
+
+  # Turn prefix, which is relative to the soong module, to a full prefix that
+  # is relative to the Android source tree.
+
+  full_prefix = os.path.join(module_dir, prefix)
+
+  # Convert the list of excludes, which are relative to the soong module, to a
+  # set of excludes (for easy hashing), relative to the Android source tree.
+
+  full_excludes = set()
+
+  if excludes:
+    for exclude in excludes:
+      full_exclude = os.path.join(full_prefix, exclude)
+      full_excludes.add(full_exclude)
+
+  # Glob those headers.
+
+  full_srcs = glob_headers(full_prefix, rel_glob, full_excludes)
+
+  # Now convert the file names, which are relative to the Android source tree,
+  # to be relative to the gen dir. This means stripping off the module prefix
+  # and the directory within this module.
+
+  module_dir_sep = module_dir + os.sep
+  prefix_sep = prefix + os.sep
+
+  if verbose:
+    print('find_out: module_dir_sep [%s]' % module_dir_sep)
+    print('find_out: prefix_sep [%s]' % prefix_sep)
+
+  error_count = 0
+
+  for full_src in full_srcs:
+    if verbose:
+      print('find_out: full_src [%s]' % full_src)
+
+    if not full_src.startswith(module_dir_sep):
+      print('error: expected %s to start with %s' % (full_src, module_dir_sep))
+      error_count += 1
+      continue
+
+    local_src = full_src[len(module_dir_sep):]
+
+    if verbose:
+      print('find_out: local_src [%s]' % local_src)
+
+    if not local_src.startswith(prefix_sep):
+      print('error: expected %s to start with %s' % (local_src, prefix_sep))
+      error_count += 1
+      continue
+
+    # After stripping the module directory and the prefix, we're left with the
+    # name of a header that we'll generate, relative to the base of of a the
+    # the include path.
+
+    local_out = local_src[len(prefix_sep):]
+
+    if verbose:
+      print('find_out: local_out [%s]' % local_out)
+
+    outs.append(local_out)
+
+  return error_count
+
+def scan_no_export_headers(verbose, module_dir, prefix):
+  """Scan include/uapi kbuild for no-export-headers
+
+  This function processes the Kbuild file to scan for no-export files that
+  should not export to usr/include/uapi which is identified by adding
+  to the no-export-headers make variable.
+
+  Args:
+    verbose: Set True to print progress messages.
+    module_dir: The root directory of the kernel source.
+    prefix: The prefix with in the kernel source tree to search for headers.
+  Return:
+    lists of no-export-headers.
+  """
+
+  no_export_headers_re = re.compile(r'no-export-headers\s*\+=\s*(\S+)')
+  header_re = re.compile(r'include/uapi/')
+  full_dirs_ = os.path.join(module_dir, prefix)
+  full_dirs = [full_dirs_]
+
+  if verbose:
+    print('scan_no_export_headers: processing [%s]' % full_dirs)
+
+  full_srcs = []
+  no_export_headers_lists = []
+
+  while full_dirs:
+    full_dir = full_dirs.pop(0)
+    items = sorted(os.listdir(full_dir))
+
+    for item in items:
+      full_item = os.path.join(full_dir, item)
+
+      if os.path.isdir(full_item):
+        full_dirs.append(full_item)
+        continue
+
+      if (full_item.find('Kbuild') != -1):
+        full_srcs.append(full_item)
+
+  for full_src in full_srcs:
+    with open(full_src, 'r') as f:
+      while True:
+        line = f.readline()
+
+        if not line:
+          break
+
+        line = line.rstrip()
+
+        match = no_export_headers_re.match(line)
+
+        if match:
+          if verbose:
+            print('scan_no_export_headers: matched [%s]' % line)
+
+          if (match.group(1) == "kvm.h" or
+              match.group(1) == "kvm_para.h" or
+              match.group(1) == "a.out.h"):
+              continue
+
+          (full_src_dir_name, full_src_base_name) = full_src.split('include/uapi/')
+          no_export_header_file_name = os.path.join(os.path.dirname(full_src_base_name),match.group(1))
+
+          if verbose:
+            print('scan_no_export_headers: no_export_header_file_name = ',no_export_header_file_name)
+
+          no_export_headers_lists.append(no_export_header_file_name)
+          continue
+
+  if verbose:
+    for x in no_export_headers_lists:
+      print('scan_no_export_headers: no_export_headers_lists [%s]' % x)
+
+  return no_export_headers_lists
+
+def gen_blueprints(
+    verbose, header_arch, gen_dir, arch_asm_kbuild, asm_generic_kbuild, module_dir,
+    rel_arch_asm_kbuild, rel_asm_generic_kbuild, arch_include_uapi, techpack_include_uapi):
+  """Generate a blueprints file containing modules that invoke this script.
+
+  This function generates a blueprints file that contains modules that
+  invoke this script to generate kernel headers. We generate the blueprints
+  file as needed, but we don't actually use the generated file. The blueprints
+  file that we generate ends up in the out directory, and we can use it to
+  detect if the checked-in version of the file (in the source directory) is out
+  of date. This pattern occurs in the Android source tree in several places.
+
+  Args:
+    verbose: Set True to print progress messages.
+    header_arch: The arch for which to generate headers.
+    gen_dir: Where to place the generated files.
+    arch_asm_kbuild: The Kbuild file containing lists of headers to generate.
+    asm_generic_kbuild: The Kbuild file containing lists of mandatory headers.
+    module_dir: The root directory of the kernel source.
+    rel_arch_asm_kbuild: arch_asm_kbuild relative to module_dir.
+  Return:
+    The number of errors encountered.
+  """
+  error_count = 0
+
+  # The old and new blueprints files. We generate the new one, but we need to
+  # refer to the old one in the modules that we generate.
+  old_gen_headers_bp = 'gen_headers_%s.bp' % header_arch
+  new_gen_headers_bp = os.path.join(gen_dir, old_gen_headers_bp)
+
+  # Tools and tool files.
+  headers_install_sh = 'headers_install.sh'
+  kernel_headers_py = 'kernel_headers.py'
+  arm_syscall_tool = 'arch/arm/tools/syscallhdr.sh'
+
+  # Sources
+  makefile = 'Makefile'
+  arm_syscall_tbl = 'arch/arm/tools/syscall.tbl'
+  rel_glob = '**/*.h'
+  generic_prefix = 'include/uapi'
+  arch_prefix = os.path.join('arch', header_arch, generic_prefix)
+  generic_src = os.path.join(generic_prefix, rel_glob)
+  arch_src = os.path.join(arch_prefix, rel_glob)
+  techpack_src = os.path.join('techpack/*',generic_prefix, '*',rel_glob)
+
+  # Excluded sources, architecture specific.
+  exclude_srcs = []
+
+  if header_arch == "arm":
+    exclude_srcs = ['linux/a.out.h']
+
+  if header_arch == "arm64":
+    exclude_srcs = ['linux/a.out.h', 'linux/kvm_para.h']
+
+  no_export_headers_lists = scan_no_export_headers(verbose, module_dir, generic_prefix)
+
+  for no_export_headers_list in no_export_headers_lists:
+    exclude_srcs.append(no_export_headers_list)
+
+  if verbose:
+    for x in exclude_srcs:
+      print('gen_blueprints : exclude_srcs [%s]' % x)
+
+  # Scan the arch_asm_kbuild file for files that need to be generated and those
+  # that are generic (i.e., need to be wrapped).
+
+  (generated_list, generic_list, mandatory_list) = scan_arch_kbuild(verbose,
+					arch_asm_kbuild, asm_generic_kbuild, arch_include_uapi)
+
+  generic_out = []
+  error_count += find_out(
+      verbose, module_dir, generic_prefix, rel_glob, exclude_srcs, generic_out)
+
+  arch_out = []
+  error_count += find_out(
+      verbose, module_dir, arch_prefix, rel_glob, None, arch_out)
+
+  techpack_out = [x.split('include/uapi/')[1] for x in techpack_include_uapi]
+
+  if error_count != 0:
+    return error_count
+
+  # Generate the blueprints file.
+
+  if verbose:
+    print('gen_blueprints: generating %s' % new_gen_headers_bp)
+
+  with open(new_gen_headers_bp, 'w') as f:
+    f.write('// ***** DO NOT EDIT *****\n')
+    f.write('// This file is generated by %s\n' % kernel_headers_py)
+    f.write('\n')
+    f.write('gen_headers_srcs_%s = [\n' % header_arch)
+    f.write('    "%s",\n' % rel_arch_asm_kbuild)
+    f.write('    "%s",\n' % rel_asm_generic_kbuild)
+    f.write('    "%s",\n' % makefile)
+
+    if header_arch == "arm":
+      f.write('    "%s",\n' % arm_syscall_tbl)
+
+    f.write('    "%s",\n' % generic_src)
+    f.write('    "%s",\n' % arch_src)
+    f.write(']\n')
+    f.write('\n')
+
+    if exclude_srcs:
+      f.write('gen_headers_exclude_srcs_%s = [\n' % header_arch)
+      for h in exclude_srcs:
+        f.write('    "%s",\n' % os.path.join(generic_prefix, h))
+      f.write(']\n')
+      f.write('\n')
+
+    f.write('gen_headers_out_%s = [\n' % header_arch)
+
+    if generated_list:
+      f.write('\n')
+      f.write('    // Matching generated-y:\n')
+      f.write('\n')
+      for h in generated_list:
+        f.write('    "asm/%s",\n' % h)
+
+    if generic_list:
+      f.write('\n')
+      f.write('    // Matching generic-y:\n')
+      f.write('\n')
+      for h in generic_list:
+        f.write('    "asm/%s",\n' % h)
+
+    if mandatory_list:
+      f.write('\n')
+      f.write('    // Matching mandatory-y:\n')
+      f.write('\n')
+      for h in mandatory_list:
+        f.write('    "asm/%s",\n' % h)
+
+    if generic_out:
+      f.write('\n')
+      f.write('    // From %s\n' % generic_src)
+      f.write('\n')
+      for h in generic_out:
+        f.write('    "%s",\n' % h)
+
+    if arch_out:
+      f.write('\n')
+      f.write('    // From %s\n' % arch_src)
+      f.write('\n')
+      for h in arch_out:
+        f.write('    "%s",\n' % h)
+
+    if techpack_out:
+      f.write('\n')
+      f.write('    // From %s\n' % techpack_src)
+      f.write('\n')
+      for h in techpack_out:
+        f.write('    "%s",\n' % h)
+
+    f.write(']\n')
+    f.write('\n')
+
+    gen_blueprints_module_name = 'qti_generate_gen_headers_%s' % header_arch
+
+    f.write('genrule {\n')
+    f.write('    // This module generates the gen_headers_<arch>.bp file\n')
+    f.write('    // (i.e., a new version of this file) so that it can be\n')
+    f.write('    // checked later to ensure that it matches the checked-\n')
+    f.write('    // in version (this file).\n')
+    f.write('    name: "%s",\n' % gen_blueprints_module_name)
+    f.write('    srcs: gen_headers_srcs_%s,\n' % header_arch)
+    if exclude_srcs:
+      f.write('    exclude_srcs: gen_headers_exclude_srcs_%s,\n' % header_arch)
+
+    f.write('    tool_files: ["kernel_headers.py"],\n')
+    f.write('    cmd: "python3 $(location kernel_headers.py) " +\n')
+    f.write('        kernel_headers_verbose +\n')
+    f.write('        "--header_arch %s " +\n' % header_arch)
+    f.write('        "--gen_dir $(genDir) " +\n')
+    f.write('        "--arch_asm_kbuild $(location %s) " +\n' % rel_arch_asm_kbuild)
+    f.write('        "--arch_include_uapi $(locations %s) " +\n' % arch_src)
+    f.write('        "--asm_generic_kbuild $(location %s) " +\n' % rel_asm_generic_kbuild)
+    f.write('        "blueprints " +\n')
+    f.write('        "# $(in)",\n')
+    f.write('    out: ["gen_headers_%s.bp"],\n' % header_arch)
+    f.write('}\n')
+    f.write('\n')
+
+    f.write('genrule {\n')
+    f.write('    name: "qti_generate_kernel_headers_%s",\n' % header_arch)
+    f.write('    tools: ["%s"],\n' % headers_install_sh)
+    f.write('    tool_files: [\n')
+    f.write('        "%s",\n' % kernel_headers_py)
+
+    if header_arch == "arm":
+      f.write('        "%s",\n' % arm_syscall_tool)
+
+    f.write('    ],\n')
+    f.write('    srcs: gen_headers_srcs_%s +[\n' % header_arch)
+    f.write('        "%s",\n' % old_gen_headers_bp)
+    f.write('        ":%s",\n' % gen_blueprints_module_name)
+    f.write('    ],\n')
+
+    if exclude_srcs:
+      f.write('    exclude_srcs: gen_headers_exclude_srcs_%s,\n' % header_arch)
+
+    f.write('    cmd: "python3 $(location %s) " +\n' % kernel_headers_py)
+    f.write('        kernel_headers_verbose +\n')
+    f.write('        "--header_arch %s " +\n' % header_arch)
+    f.write('        "--gen_dir $(genDir) " +\n')
+    f.write('        "--arch_asm_kbuild $(location %s) " +\n' % rel_arch_asm_kbuild)
+    f.write('        "--arch_include_uapi $(locations %s) " +\n' % arch_src)
+    f.write('        "--asm_generic_kbuild $(location %s) " +\n' % rel_asm_generic_kbuild)
+    f.write('        "headers " +\n')
+    f.write('        "--old_gen_headers_bp $(location %s) " +\n' % old_gen_headers_bp)
+    f.write('        "--new_gen_headers_bp $(location :%s) " +\n' % gen_blueprints_module_name)
+    f.write('        "--version_makefile $(location %s) " +\n' % makefile)
+
+    if header_arch == "arm":
+      f.write('        "--arch_syscall_tool $(location %s) " +\n' % arm_syscall_tool)
+      f.write('        "--arch_syscall_tbl $(location %s) " +\n' % arm_syscall_tbl)
+
+    f.write('        "--headers_install $(location %s) " +\n' % headers_install_sh)
+    f.write('        "--include_uapi $(locations %s)",\n' % generic_src)
+    f.write('    out: ["linux/version.h"] + gen_headers_out_%s,\n' % header_arch)
+    f.write('}\n')
+
+    return 0
+
+def parse_bp_for_headers(file_name, headers):
+  parsing_headers = False
+  pattern = re.compile("gen_headers_out_[a-zA-Z0-9]+\s*=\s*\[\s*")
+  with open(file_name, 'r') as f:
+    for line in f:
+      line = line.strip()
+      if pattern.match(line):
+        parsing_headers = True
+        continue
+
+      if line.find("]") != -1 and parsing_headers:
+        break
+
+      if not parsing_headers:
+        continue
+
+      if line.find("//") == 0:
+        continue
+
+      headers.add(line[1:-2])
+
+def headers_diff(old_file, new_file):
+  old_headers = set()
+  new_headers = set()
+  diff_detected = False
+
+  parse_bp_for_headers(old_file, old_headers)
+  parse_bp_for_headers(new_file, new_headers)
+
+  diff = old_headers - new_headers
+  if len(diff):
+    diff_detected = True
+    print("Headers to remove:")
+    for x in diff:
+      print("\t{}".format(x))
+
+  diff = new_headers - old_headers
+  if len(diff):
+    diff_detected = True
+    print("Headers to add:")
+    for x in diff:
+      print("\t{}".format(x))
+
+  return diff_detected
+
+def gen_headers(
+    verbose, header_arch, gen_dir, arch_asm_kbuild, asm_generic_kbuild, module_dir,
+    old_gen_headers_bp, new_gen_headers_bp, version_makefile,
+    arch_syscall_tool, arch_syscall_tbl, headers_install, include_uapi,
+    arch_include_uapi, techpack_include_uapi):
+  """Generate the kernel headers.
+
+  This script generates the version.h file, the arch-specific headers including
+  syscall-related generated files and wrappers around generic files, and uses
+  the headers_install tool to process other generic uapi and arch-specific uapi
+  files.
+
+  Args:
+    verbose: Set True to print progress messages.
+    header_arch: The arch for which to generate headers.
+    gen_dir: Where to place the generated files.
+    arch_asm_kbuild: The Kbuild file containing lists of headers to generate.
+    asm_generic_kbuild: The Kbuild file containing mandatory headers.
+    module_dir: The root directory of the kernel source.
+    old_gen_headers_bp: The old gen_headers_<arch>.bp file to check.
+    new_gen_headers_bp: The new gen_headers_<arch>.bp file to check.
+    version_makefile: The kernel Makefile that contains version info.
+    arch_syscall_tool: The arch script that generates syscall headers.
+    arch_syscall_tbl: The arch script that defines syscall vectors.
+    headers_install: The headers_install tool to process input headers.
+    include_uapi: The list of include/uapi header files.
+    arch_include_uapi: The list of arch/<arch>/include/uapi header files.
+  Return:
+    The number of errors encountered.
+  """
+
+  if headers_diff(old_gen_headers_bp, new_gen_headers_bp):
+    print('error: gen_headers blueprints file is out of date, suggested fix:')
+    print('#######Please add or remove the above mentioned headers from %s' % (old_gen_headers_bp))
+    print('then re-run the build')
+    return 1
+
+  error_count = 0
+
+  if not gen_version_h(verbose, gen_dir, version_makefile):
+    error_count += 1
+
+  error_count += gen_arch_headers(
+      verbose, gen_dir, arch_asm_kbuild, asm_generic_kbuild, arch_syscall_tool, arch_syscall_tbl ,arch_include_uapi)
+
+  uapi_include_prefix = os.path.join(module_dir, 'include', 'uapi') + os.sep
+
+  arch_uapi_include_prefix = os.path.join(
+      module_dir, 'arch', header_arch, 'include', 'uapi') + os.sep
+
+  for h in include_uapi:
+    if not run_headers_install(
+        verbose, gen_dir, headers_install,
+        uapi_include_prefix, h):
+      error_count += 1
+
+  for h in arch_include_uapi:
+    if not run_headers_install(
+        verbose, gen_dir, headers_install,
+        arch_uapi_include_prefix, h):
+      error_count += 1
+
+  for h in techpack_include_uapi:
+    techpack_uapi_include_prefix = os.path.join(h.split('/include/uapi')[0], 'include', 'uapi') + os.sep
+    if not run_headers_install(
+        verbose, gen_dir, headers_install,
+        techpack_uapi_include_prefix, h):
+      error_count += 1
+
+  return error_count
+
+def extract_techpack_uapi_headers(verbose, module_dir):
+
+  """EXtract list of uapi headers from techpack/* directories. We need to export
+     these headers to userspace.
+
+  Args:
+      verbose: Verbose option is provided to script
+      module_dir: Base directory
+  Returs:
+      List of uapi headers
+  """
+
+  techpack_subdir = []
+  techpack_dir = os.path.join(module_dir,'techpack')
+  techpack_uapi = []
+  techpack_uapi_sub = []
+
+  #get list of techpack directories under techpack/
+  if os.path.isdir(techpack_dir):
+    items = sorted(os.listdir(techpack_dir))
+    for x in items:
+      p = os.path.join(techpack_dir, x)
+      if os.path.isdir(p):
+        techpack_subdir.append(p)
+
+  #Print list of subdirs obtained
+  if (verbose):
+    for x in techpack_subdir:
+      print(x)
+
+  #For every subdirectory get list of .h files under include/uapi and append to techpack_uapi list
+  for x in techpack_subdir:
+    techpack_uapi_path = os.path.join(x, 'include/uapi')
+    if (os.path.isdir(techpack_uapi_path)):
+      techpack_uapi_sub = []
+      find_out(verbose, x, 'include/uapi', '**/*.h', None, techpack_uapi_sub)
+      tmp = [os.path.join(techpack_uapi_path, y) for y in techpack_uapi_sub]
+      techpack_uapi = techpack_uapi + tmp
+
+  if (verbose):
+    for x in techpack_uapi:
+      print(x)
+
+  return techpack_uapi
+
+def main():
+  """Parse command line arguments and perform top level control."""
+
+  parser = argparse.ArgumentParser(
+      description=__doc__,
+      formatter_class=argparse.RawDescriptionHelpFormatter)
+
+  # Arguments that apply to every invocation of this script.
+
+  parser.add_argument(
+      '--verbose',
+      action='store_true',
+      help='Print output that describes the workings of this script.')
+  parser.add_argument(
+      '--header_arch',
+      required=True,
+      help='The arch for which to generate headers.')
+  parser.add_argument(
+      '--gen_dir',
+      required=True,
+      help='Where to place the generated files.')
+  parser.add_argument(
+      '--arch_asm_kbuild',
+      required=True,
+      help='The Kbuild file containing lists of headers to generate.')
+  parser.add_argument(
+      '--asm_generic_kbuild',
+      required=True,
+      help='The Kbuild file containing lists of mandatory headers.')
+  parser.add_argument(
+      '--arch_include_uapi',
+      required=True,
+      nargs='*',
+      help='The list of arch/<arch>/include/uapi header files.')
+
+  # The modes.
+
+  subparsers = parser.add_subparsers(
+      dest='mode',
+      help='Select mode')
+  parser_blueprints = subparsers.add_parser(
+      'blueprints',
+      help='Generate the gen_headers_<arch>.bp file.')
+  parser_headers = subparsers.add_parser(
+      'headers',
+      help='Check blueprints, then generate kernel headers.')
+
+  # Arguments that apply to headers mode.
+
+  parser_headers.add_argument(
+      '--old_gen_headers_bp',
+      required=True,
+      help='The old gen_headers_<arch>.bp file to check.')
+  parser_headers.add_argument(
+      '--new_gen_headers_bp',
+      required=True,
+      help='The new gen_headers_<arch>.bp file to check.')
+  parser_headers.add_argument(
+      '--version_makefile',
+      required=True,
+      help='The kernel Makefile that contains version info.')
+  parser_headers.add_argument(
+      '--arch_syscall_tool',
+      help='The arch script that generates syscall headers, if applicable.')
+  parser_headers.add_argument(
+      '--arch_syscall_tbl',
+      help='The arch script that defines syscall vectors, if applicable.')
+  parser_headers.add_argument(
+      '--headers_install',
+      required=True,
+      help='The headers_install tool to process input headers.')
+  parser_headers.add_argument(
+      '--include_uapi',
+      required=True,
+      nargs='*',
+      help='The list of include/uapi header files.')
+
+  args = parser.parse_args()
+
+  if args.verbose:
+    print('mode [%s]' % args.mode)
+    print('header_arch [%s]' % args.header_arch)
+    print('gen_dir [%s]' % args.gen_dir)
+    print('arch_asm_kbuild [%s]' % args.arch_asm_kbuild)
+    print('asm_generic_kbuild [%s]' % args.asm_generic_kbuild)
+
+  # Extract the module_dir from args.arch_asm_kbuild and rel_arch_asm_kbuild.
+
+  rel_arch_asm_kbuild = os.path.join(
+      'arch', args.header_arch, 'include/uapi/asm/Kbuild')
+
+  suffix = os.sep + rel_arch_asm_kbuild
+
+  if not args.arch_asm_kbuild.endswith(suffix):
+    print('error: expected %s to end with %s' % (args.arch_asm_kbuild, suffix))
+    return 1
+
+  module_dir = args.arch_asm_kbuild[:-len(suffix)]
+
+  rel_asm_generic_kbuild = os.path.join('include/uapi/asm-generic', os.path.basename(args.asm_generic_kbuild))
+
+
+  if args.verbose:
+    print('module_dir [%s]' % module_dir)
+
+  techpack_include_uapi = []
+
+
+  if args.mode == 'blueprints':
+    return gen_blueprints(
+        args.verbose, args.header_arch, args.gen_dir, args.arch_asm_kbuild,
+        args.asm_generic_kbuild, module_dir, rel_arch_asm_kbuild, rel_asm_generic_kbuild, args.arch_include_uapi, techpack_include_uapi)
+
+  if args.mode == 'headers':
+    if args.verbose:
+      print('old_gen_headers_bp [%s]' % args.old_gen_headers_bp)
+      print('new_gen_headers_bp [%s]' % args.new_gen_headers_bp)
+      print('version_makefile [%s]' % args.version_makefile)
+      print('arch_syscall_tool [%s]' % args.arch_syscall_tool)
+      print('arch_syscall_tbl [%s]' % args.arch_syscall_tbl)
+      print('headers_install [%s]' % args.headers_install)
+
+    return gen_headers(
+        args.verbose, args.header_arch, args.gen_dir, args.arch_asm_kbuild,
+        args.asm_generic_kbuild, module_dir, args.old_gen_headers_bp, args.new_gen_headers_bp,
+        args.version_makefile, args.arch_syscall_tool, args.arch_syscall_tbl,
+        args.headers_install, args.include_uapi, args.arch_include_uapi, techpack_include_uapi)
+
+  print('error: unknown mode: %s' % args.mode)
+  return 1
+
+
+if __name__ == '__main__':
+  sys.exit(main())
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index ee930b3..a419201 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -26,18 +26,6 @@
 #define QRTR_MIN_EPH_SOCKET 0x4000
 #define QRTR_MAX_EPH_SOCKET 0x7fff
 
-enum qrtr_pkt_type {
-	QRTR_TYPE_DATA		= 1,
-	QRTR_TYPE_HELLO		= 2,
-	QRTR_TYPE_BYE		= 3,
-	QRTR_TYPE_NEW_SERVER	= 4,
-	QRTR_TYPE_DEL_SERVER	= 5,
-	QRTR_TYPE_DEL_CLIENT	= 6,
-	QRTR_TYPE_RESUME_TX	= 7,
-	QRTR_TYPE_EXIT		= 8,
-	QRTR_TYPE_PING		= 9,
-};
-
 /**
  * struct qrtr_hdr - (I|R)PCrouter packet header
  * @version: protocol version
@@ -61,8 +49,6 @@
 } __packed;
 
 #define QRTR_HDR_SIZE sizeof(struct qrtr_hdr)
-#define QRTR_NODE_BCAST ((unsigned int)-1)
-#define QRTR_PORT_CTRL ((unsigned int)-2)
 
 struct qrtr_sock {
 	/* WARNING: sk must be the first member */
diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic
index e4d017d5..95f7d80 100644
--- a/scripts/Makefile.asm-generic
+++ b/scripts/Makefile.asm-generic
@@ -15,7 +15,7 @@
 
 # Stale wrappers when the corresponding files are removed from generic-y
 # need removing.
-generated-y   := $(generic-y) $(genhdr-y) $(generated-y)
+generated-y   := $(generic-y) $(generated-y)
 all-files     := $(patsubst %, $(obj)/%, $(generated-y))
 old-headers   := $(wildcard $(obj)/*.h)
 unwanted      := $(filter-out $(all-files),$(old-headers))
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1106d6c..82abf5a 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -1,33 +1,56 @@
 # ==========================================================================
 # Installing headers
 #
-# header-y  - list files to be installed. They are preprocessed
-#             to remove __KERNEL__ section of the file
-# genhdr-y  - Same as header-y but in a generated/ directory
+# All headers under include/uapi, include/generated/uapi,
+# arch/<arch>/include/uapi and arch/<arch>/include/generated/uapi are
+# exported.
+# They are preprocessed to remove __KERNEL__ section of the file.
 #
 # ==========================================================================
 
+PHONY := __headers
+__headers:
+
+include scripts/Kbuild.include
+
+srcdir        := $(srctree)/$(obj)
+subdirs       := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.))
+# caller may set destination dir (when installing to asm/)
+_dst          := $(if $(dst),$(dst),$(obj))
+
+# Recursion
+__headers: $(subdirs)
+
+.PHONY: $(subdirs)
+$(subdirs):
+	$(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
+
+# Skip header install/check for include/uapi and arch/$(hdr-arch)/include/uapi.
+# We have only sub-directories there.
+skip-inst := $(if $(filter %/uapi,$(obj)),1)
+
+ifeq ($(skip-inst),)
+
 # generated header directory
 gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
 
+# Kbuild file is optional
 kbuild-file := $(srctree)/$(obj)/Kbuild
-include $(kbuild-file)
-
-# called may set destination dir (when installing to asm/)
-_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+-include $(kbuild-file)
 
 old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
 ifneq ($(wildcard $(old-kbuild-file)),)
 include $(old-kbuild-file)
 endif
 
-include scripts/Kbuild.include
-
 installdir    := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
 
-header-y      := $(sort $(header-y))
-subdirs       := $(patsubst %/,%,$(filter %/, $(header-y)))
-header-y      := $(filter-out %/, $(header-y))
+gendir        := $(objtree)/$(gen)
+header-files  := $(notdir $(wildcard $(srcdir)/*.h))
+header-files  += $(notdir $(wildcard $(srcdir)/*.agh))
+header-files  := $(filter-out $(no-export-headers), $(header-files))
+genhdr-files  := $(notdir $(wildcard $(gendir)/*.h))
+genhdr-files  := $(filter-out $(header-files), $(genhdr-files))
 
 # files used to track state of install/check
 install-file  := $(installdir)/.install
@@ -35,36 +58,22 @@
 
 # generic-y list all files an architecture uses from asm-generic
 # Use this to build a list of headers which require a wrapper
-wrapper-files := $(filter $(header-y), $(generic-y))
-
-srcdir        := $(srctree)/$(obj)
-gendir        := $(objtree)/$(gen)
+generic-files := $(notdir $(wildcard $(srctree)/include/uapi/asm-generic/*.h))
+wrapper-files := $(filter $(generic-files), $(generic-y))
+wrapper-files := $(filter-out $(header-files), $(wrapper-files))
 
 oldsrcdir     := $(srctree)/$(subst /uapi,,$(obj))
 
 # all headers files for this dir
-header-y      := $(filter-out $(generic-y), $(header-y))
-all-files     := $(header-y) $(genhdr-y) $(wrapper-files)
+all-files     := $(header-files) $(genhdr-files) $(wrapper-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
-input-files1  := $(foreach hdr, $(header-y), \
-		   $(if $(wildcard $(srcdir)/$(hdr)), \
-			$(wildcard $(srcdir)/$(hdr))) \
-		   )
-input-files1-name := $(notdir $(input-files1))
-input-files2  := $(foreach hdr, $(header-y), \
-		   $(if  $(wildcard $(srcdir)/$(hdr)),, \
-			$(if $(wildcard $(oldsrcdir)/$(hdr)), \
-				$(wildcard $(oldsrcdir)/$(hdr)), \
-				$(error Missing UAPI file $(srcdir)/$(hdr))) \
-		   ))
-input-files2-name := $(notdir $(input-files2))
-input-files3  := $(foreach hdr, $(genhdr-y), \
-		   $(if	$(wildcard $(gendir)/$(hdr)), \
-			$(wildcard $(gendir)/$(hdr)), \
-			$(error Missing generated UAPI file $(gendir)/$(hdr)) \
-		   ))
-input-files3-name := $(notdir $(input-files3))
+ifneq ($(mandatory-y),)
+missing       := $(filter-out $(all-files),$(mandatory-y))
+ifneq ($(missing),)
+$(error Some mandatory headers ($(missing)) are missing in $(obj))
+endif
+endif
 
 # Work out what needs to be removed
 oldheaders    := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -78,9 +87,8 @@
 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
                             file$(if $(word 2, $(all-files)),s))
       cmd_install = \
-        $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
-        $(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
-        $(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
+	$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
+	$(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
         for F in $(wrapper-files); do                                   \
                 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F;    \
         done;                                                           \
@@ -98,21 +106,21 @@
                   $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
 	          touch $@
 
-PHONY += __headersinst __headerscheck
-
 ifndef HDRCHECK
 # Rules for installing headers
-__headersinst: $(subdirs) $(install-file)
+__headers: $(install-file)
 	@:
 
 targets += $(install-file)
-$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE
+$(install-file): scripts/headers_install.sh \
+		$(addprefix $(srcdir)/,$(header-files)) \
+		$(addprefix $(gendir)/,$(genhdr-files)) FORCE
 	$(if $(unwanted),$(call cmd,remove),)
 	$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
 	$(call if_changed,install)
 
 else
-__headerscheck: $(subdirs) $(check-file)
+__headers: $(check-file)
 	@:
 
 targets += $(check-file)
@@ -121,11 +129,6 @@
 
 endif
 
-# Recursion
-.PHONY: $(subdirs)
-$(subdirs):
-	$(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
-
 targets := $(wildcard $(sort $(targets)))
 cmd_files := $(wildcard \
              $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
@@ -134,6 +137,8 @@
 	include $(cmd_files)
 endif
 
+endif # skip-inst
+
 .PHONY: $(PHONY)
 PHONY += FORCE
 FORCE: ;