Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 917caa94 authored by Bryan Huntsman's avatar Bryan Huntsman Committed by Satya Durga Srinivasu Prabhala
Browse files

techpack: add tech package support



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: default avatarBryan Huntsman <bryanh@codeaurora.org>
Signed-off-by: default avatarImran Khan <kimran@codeaurora.org>
[satyap@codeaurora.org: fix trivial merge conflict and add SPDX-License-Identifier]
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent e593b48b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -585,7 +585,7 @@ export KBUILD_MODULES KBUILD_BUILTIN
ifeq ($(KBUILD_EXTMOD),)
# Objects we will link into vmlinux / subdirs we need to visit
init-y		:= init/
drivers-y	:= drivers/ sound/ firmware/
drivers-y	:= drivers/ sound/ firmware/ techpack/
net-y		:= net/
libs-y		:= lib/
core-y		:= usr/
@@ -1238,6 +1238,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
@@ -1247,6 +1248,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

# ---------------------------------------------------------------------------
# Kernel selftest

techpack/.gitignore

0 → 100644
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
# ignore all subdirs except stub
!/stub/

techpack/Kbuild

0 → 100644
+6 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
techpack-dirs := $(shell find $(srctree)/$(src) -maxdepth 1 -mindepth 1 -type d -not -name ".*")
obj-y += stub/ $(addsuffix /,$(subst $(srctree)/$(src)/,,$(techpack-dirs)))

techpack-header-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*")
header-y += $(addsuffix /include/uapi/,$(subst $(srctree)/techpack/,,$(techpack-header-dirs)))

techpack/stub/Makefile

0 → 100644
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
ccflags-y := -Wno-unused-function
obj-y := stub.o
+2 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
#Stub place holder
Loading