From 50327f3450f1a032950135288d4f691bd6ddd02d Mon Sep 17 00:00:00 2001 From: Bryan Huntsman Date: Tue, 2 Aug 2016 22:36:01 -0700 Subject: [PATCH] techpack: add tech package support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable tech packages to have kernel drivers that are physically located in the kernel source tree but not present in the kernel repository. This is done via a manifest line item to fetch a techpackage-module into $KERNEL/techpack/$techpackage-module. $KERNEL/techpack/Kbuild will automatically detect any subdirectories and link them to the kernel's kbuild system. The resulting layout of techpack within kernel source would be as follows :- kernel/ └── techpack/ ├── Kbuild ├── stub/ │ ├── Makefile │ ├── include/ │ │   └── uapi/ │ │   └── Kbuild │ └── stub.c └── techpackage-module/    ├── Makefile    └── include/       └── uapi/       └── Kbuild $KERNEL/techpack only contains Kbuild (no Makefile) at the toplevel and this Kbuild takes care of both compiling the subdirectories and of exporting the needed header files therein. The reason for having only Kbuild at the top is that Kbuild and Makefile cannot exist together in same directory and Makefile doesn't cater to uapi header installation. stub is an empty techpackage-module which serves both as a sample layout and satisfies the requirement of kernel build system, by providing necessary buit-in.o, when no other techpackage-module has been pulled under techpack/. $KERNEL/techpack/techpackage-module should have a Makefile at the top and Kbuild under $KERNEL/techpack/techpackage-module/include/uapi directory. The uapi headers pertaining to a techpackage-module should reside under $KERNEL/techpack/techpackage-module/include/uapi and associated Kbuild should have necessary rules to export it. Change-Id: I0d0ced38566907d2074831edde0934833f666eff Signed-off-by: Bryan Huntsman --- .gitignore | 3 --- Makefile | 4 +++- techpack/.gitignore | 4 ++++ techpack/Kbuild | 8 ++++++++ techpack/stub/Makefile | 3 +++ techpack/stub/include/uapi/Kbuild | 2 ++ techpack/stub/stub.c | 5 +++++ 7 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 techpack/.gitignore create mode 100644 techpack/Kbuild create mode 100644 techpack/stub/Makefile create mode 100644 techpack/stub/include/uapi/Kbuild create mode 100644 techpack/stub/stub.c diff --git a/.gitignore b/.gitignore index 4cee9c090825..0554f5eb179f 100644 --- a/.gitignore +++ b/.gitignore @@ -146,6 +146,3 @@ x509.genkey arch/*/configs/vendor/*-gki_defconfig arch/*/configs/vendor/*-qgki_defconfig arch/*/configs/vendor/*-qgki-debug_defconfig - -# Tech package directories -techpack/ diff --git a/Makefile b/Makefile index 43fa032c8d85..bcd07e2a4bf9 100644 --- a/Makefile +++ b/Makefile @@ -614,7 +614,7 @@ endif ifeq ($(KBUILD_EXTMOD),) # Objects we will link into vmlinux / subdirs we need to visit init-y := init/ -drivers-y := drivers/ sound/ +drivers-y := drivers/ sound/ techpack/ drivers-$(CONFIG_SAMPLES) += samples/ net-y := net/ libs-y := lib/ @@ -1210,6 +1210,7 @@ headers_install: __headers $(error Headers not exportable for the $(SRCARCH) architecture)) $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) + $(Q)$(MAKE) $(hdr-inst)=techpack PHONY += headers_check_all headers_check_all: headers_install_all @@ -1219,6 +1220,7 @@ PHONY += headers_check headers_check: headers_install $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=techpack HDRCHECK=1 ifdef CONFIG_HEADERS_CHECK all: headers_check diff --git a/techpack/.gitignore b/techpack/.gitignore new file mode 100644 index 000000000000..42f1c7a2a8b9 --- /dev/null +++ b/techpack/.gitignore @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +# ignore all subdirs except stub +!/stub/ +*/ diff --git a/techpack/Kbuild b/techpack/Kbuild new file mode 100644 index 000000000000..aef74e688e2a --- /dev/null +++ b/techpack/Kbuild @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-only +TECHPACK?=y + +techpack-dirs := $(shell find $(srctree)/$(src) -maxdepth 1 -mindepth 1 -type d -not -name ".*") +obj-${TECHPACK} += stub/ $(addsuffix /,$(subst $(srctree)/$(src)/,,$(techpack-dirs))) + +techpack-header-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*") +header-${TECHPACK} += $(addsuffix /include/uapi/,$(subst $(srctree)/techpack/,,$(techpack-header-dirs))) diff --git a/techpack/stub/Makefile b/techpack/stub/Makefile new file mode 100644 index 000000000000..305e07bb8293 --- /dev/null +++ b/techpack/stub/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only +ccflags-y := -Wno-unused-function +obj-y := stub.o diff --git a/techpack/stub/include/uapi/Kbuild b/techpack/stub/include/uapi/Kbuild new file mode 100644 index 000000000000..ef0f400666f4 --- /dev/null +++ b/techpack/stub/include/uapi/Kbuild @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note +#Stub place holder diff --git a/techpack/stub/stub.c b/techpack/stub/stub.c new file mode 100644 index 000000000000..d69a1b889a09 --- /dev/null +++ b/techpack/stub/stub.c @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-only + +static void _techpack_stub(void) +{ +}