diff options
Diffstat (limited to 'sgx/eurasiacon/build/linux2/kbuild')
-rw-r--r-- | sgx/eurasiacon/build/linux2/kbuild/Makefile.template | 71 | ||||
-rwxr-xr-x | sgx/eurasiacon/build/linux2/kbuild/external_tarball.mk | 34 | ||||
-rwxr-xr-x | sgx/eurasiacon/build/linux2/kbuild/kbuild.mk | 83 |
3 files changed, 188 insertions, 0 deletions
diff --git a/sgx/eurasiacon/build/linux2/kbuild/Makefile.template b/sgx/eurasiacon/build/linux2/kbuild/Makefile.template new file mode 100644 index 0000000..803a208 --- /dev/null +++ b/sgx/eurasiacon/build/linux2/kbuild/Makefile.template @@ -0,0 +1,71 @@ +# +# Copyright (C) Imagination Technologies Ltd. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful but, except +# as otherwise stated in writing, without any warranty; without even the +# implied warranty of merchantability or fitness for a particular purpose. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". +# +# Contact Information: +# Imagination Technologies Ltd. <gpl-support@imgtec.com> +# Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK +# +# + +# This top-level kbuild makefile builds all the Linux kernel modules in the +# DDK. To run kbuild, this makefile is copied to $(TARGET_OUT)/kbuild/Makefile +# and make is invoked in $(TARGET_OUT)/kbuild. + +# This makefile doesn't define any kbuild special variables apart from +# ccflags-y and obj-m. The variables for objects are picked up by including +# the kbuild makefile fragments named in $(INTERNAL_KBUILD_MAKEFILES). The +# list of objects that these fragments make is collected in +# $(INTERNAL_KBUILD_OBJECTS) and $(INTERNAL_EXTRA_KBUILD_OBJECTS). These +# variables are set according to the build's $(KERNEL_COMPONENTS) and +# $(EXTRA_PVRSRVKM_COMPONENTS). To add a new kernel module to the build, edit +# these variables in the per-build Makefile. + +include $(OUT)/config_kernel.mk + +.SECONDARY: + +$(OUT)/target/kbuild/external/%.c: $(EXTRA_KBUILD_SOURCE)/%.c + @if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi + @if [ ! -h $@ ]; then ln -sf $< $@; fi + +$(OUT)/target/kbuild/%.c: $(TOP)/%.c + @if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi + @if [ ! -h $@ ]; then ln -sf $< $@; fi + +ccflags-y += -D__linux__ -include $(OUT)/config_kernel.h \ + -DDEBUG_LOG_PATH_TRUNCATE="\"$(OUT)/target/kbuild\"" \ + -I$(OUT)/include \ + -I$(TOP)/include4 \ + -I$(TOP)/services4/include \ + -I$(TOP)/services4/system/$(PVR_SYSTEM) \ + -I$(TOP)/services4/system/include \ + -I$(TOP)/services4/srvkm/hwdefs \ + -I$(TOP)/services4/srvkm/bridged \ + -I$(TOP)/services4/srvkm/bridged/sgx \ + -I$(TOP)/services4/srvkm/common \ + -I$(TOP)/services4/srvkm/devices/sgx \ + -I$(TOP)/services4/srvkm/env/linux \ + -I$(TOP)/services4/srvkm/include + +include $(INTERNAL_KBUILD_MAKEFILES) + +$(if $($(PVRSRV_MODNAME)-y),,$(error $(PVRSRV_MODNAME)-y was empty, which could mean that srvkm is missing from $$(KERNEL_COMPONENTS))) +$(PVRSRV_MODNAME)-y += $(foreach _m,$(INTERNAL_EXTRA_KBUILD_OBJECTS:.o=),$($(_m)-y)) + +obj-m += $(INTERNAL_KBUILD_OBJECTS) diff --git a/sgx/eurasiacon/build/linux2/kbuild/external_tarball.mk b/sgx/eurasiacon/build/linux2/kbuild/external_tarball.mk new file mode 100755 index 0000000..caa58ed --- /dev/null +++ b/sgx/eurasiacon/build/linux2/kbuild/external_tarball.mk @@ -0,0 +1,34 @@ +# +# Copyright (C) Imagination Technologies Ltd. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful but, except +# as otherwise stated in writing, without any warranty; without even the +# implied warranty of merchantability or fitness for a particular purpose. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". +# +# Contact Information: +# Imagination Technologies Ltd. <gpl-support@imgtec.com> +# Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK +# +# + +ifneq ($(EXTERNAL_3PDD_TARBALL),) +TAR_OPT_STRIP_COMPONENTS ?= --strip-components +prepare_tree: $(OUT)/target/kbuild/external +$(OUT)/target/kbuild/external: eurasiacon/external/$(EXTERNAL_3PDD_TARBALL) + @echo "Extracting $<.." + @mkdir -p $@ + @tar $(TAR_OPT_STRIP_COMPONENTS) 1 --touch -jxf $< -C $@ + @touch $(OUT)/target/kbuild/external +endif diff --git a/sgx/eurasiacon/build/linux2/kbuild/kbuild.mk b/sgx/eurasiacon/build/linux2/kbuild/kbuild.mk new file mode 100755 index 0000000..5763f87 --- /dev/null +++ b/sgx/eurasiacon/build/linux2/kbuild/kbuild.mk @@ -0,0 +1,83 @@ +# +# Copyright (C) Imagination Technologies Ltd. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful but, except +# as otherwise stated in writing, without any warranty; without even the +# implied warranty of merchantability or fitness for a particular purpose. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". +# +# Contact Information: +# Imagination Technologies Ltd. <gpl-support@imgtec.com> +# Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK +# +# + +$(if $(strip $(KERNELDIR)),,$(error KERNELDIR must be set)) +$(call directory-must-exist,$(KERNELDIR)) + +KERNEL_CROSS_COMPILE ?= $(CROSS_COMPILE) + +$(TARGET_OUT)/kbuild/Makefile: $(MAKE_TOP)/kbuild/Makefile.template + @[ ! -e $(dir $@) ] && mkdir -p $(dir $@) || true + $(CP) -f $< $@ + +# We need to make INTERNAL_KBUILD_MAKEFILES absolute because the files will be +# read while chdir'd into $(KERNELDIR) +INTERNAL_KBUILD_MAKEFILES := $(abspath $(foreach _m,$(KERNEL_COMPONENTS) $(EXTRA_PVRSRVKM_COMPONENTS),$(if $(INTERNAL_KBUILD_MAKEFILE_FOR_$(_m)),$(INTERNAL_KBUILD_MAKEFILE_FOR_$(_m)),$(error Unknown kbuild module "$(_m)")))) +INTERNAL_KBUILD_OBJECTS := $(foreach _m,$(KERNEL_COMPONENTS),$(if $(INTERNAL_KBUILD_OBJECTS_FOR_$(_m)),$(INTERNAL_KBUILD_OBJECTS_FOR_$(_m)),$(error BUG: Unknown kbuild module "$(_m)" should have been caught earlier))) +INTERNAL_EXTRA_KBUILD_OBJECTS := $(foreach _m,$(EXTRA_PVRSRVKM_COMPONENTS),$(if $(INTERNAL_KBUILD_OBJECTS_FOR_$(_m)),$(INTERNAL_KBUILD_OBJECTS_FOR_$(_m)),$(error BUG: Unknown kbuild module "$(_m)" should have been caught earlier))) +.PHONY: kbuild kbuild_clean + +kbuild: $(TARGET_OUT)/kbuild/Makefile + @$(MAKE) -Rr --no-print-directory -C $(KERNELDIR) M=$(abspath $(TARGET_OUT)/kbuild) \ + INTERNAL_KBUILD_MAKEFILES="$(INTERNAL_KBUILD_MAKEFILES)" \ + INTERNAL_KBUILD_OBJECTS="$(INTERNAL_KBUILD_OBJECTS)" \ + INTERNAL_EXTRA_KBUILD_OBJECTS="$(INTERNAL_EXTRA_KBUILD_OBJECTS)" \ + EXTRA_KBUILD_SOURCE="$(EXTRA_KBUILD_SOURCE)" \ + CROSS_COMPILE="$(KERNEL_CROSS_COMPILE)" \ + EXTRA_CFLAGS="$(ALL_KBUILD_CFLAGS)" \ + V=$(V) W=$(W) \ + TOP=$(TOP) +ifeq ($(DEBUGLINK),1) + @for kernel_module in $(addprefix $(TARGET_OUT)/kbuild/,$(INTERNAL_KBUILD_OBJECTS:.o=.ko)); do \ + $(patsubst @%,%,$(STRIP)) --strip-unneeded $$kernel_module; \ + done +endif + @for kernel_module in $(addprefix $(TARGET_OUT)/kbuild/,$(INTERNAL_KBUILD_OBJECTS:.o=.ko)); do \ + cp $$kernel_module $(TARGET_OUT); \ + done + +kbuild_clean: $(TARGET_OUT)/kbuild/Makefile + @$(MAKE) -Rr --no-print-directory -C $(KERNELDIR) M=$(abspath $(TARGET_OUT)/kbuild) \ + INTERNAL_KBUILD_MAKEFILES="$(INTERNAL_KBUILD_MAKEFILES)" \ + INTERNAL_KBUILD_OBJECTS="$(INTERNAL_KBUILD_OBJECTS)" \ + INTERNAL_EXTRA_KBUILD_OBJECTS="$(INTERNAL_EXTRA_KBUILD_OBJECTS)" \ + EXTRA_KBUILD_SOURCE="$(EXTRA_KBUILD_SOURCE)" \ + CROSS_COMPILE="$(KERNEL_CROSS_COMPILE)" \ + EXTRA_CFLAGS="$(ALL_KBUILD_CFLAGS)" \ + V=$(V) W=$(W) \ + TOP=$(TOP) clean + +kbuild_install: $(TARGET_OUT)/kbuild/Makefile + @: $(if $(strip $(DISCIMAGE)),,$(error $$(DISCIMAGE) was empty or unset while trying to use it to set INSTALL_MOD_PATH for modules_install)) + @$(MAKE) -Rr --no-print-directory -C $(KERNELDIR) M=$(abspath $(TARGET_OUT)/kbuild) \ + INTERNAL_KBUILD_MAKEFILES="$(INTERNAL_KBUILD_MAKEFILES)" \ + INTERNAL_KBUILD_OBJECTS="$(INTERNAL_KBUILD_OBJECTS)" \ + INTERNAL_EXTRA_KBUILD_OBJECTS="$(INTERNAL_EXTRA_KBUILD_OBJECTS)" \ + EXTRA_KBUILD_SOURCE="$(EXTRA_KBUILD_SOURCE)" \ + CROSS_COMPILE="$(KERNEL_CROSS_COMPILE)" \ + EXTRA_CFLAGS="$(ALL_KBUILD_CFLAGS)" \ + INSTALL_MOD_PATH="$(DISCIMAGE)" \ + V=$(V) W=$(W) \ + TOP=$(TOP) modules_install |