summaryrefslogtreecommitdiff
path: root/sgx/eurasiacon/build
diff options
context:
space:
mode:
authorRicardo Salveti de Araujo <ricardo.salveti@linaro.org>2012-03-25 18:58:25 -0300
committerRicardo Salveti de Araujo <ricardo.salveti@linaro.org>2012-03-25 18:58:25 -0300
commita5f51dee3f8480b7bfb309a9cd6a05c87d013858 (patch)
treec5b886b6c1d44b2dca15ba4e92a59f7294886a93 /sgx/eurasiacon/build
Imported Upstream version 1.7.10.0.1.21 (ARMHF)upstream/1.7.10.0.1.21
Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
Diffstat (limited to 'sgx/eurasiacon/build')
-rwxr-xr-xsgx/eurasiacon/build/linux2/bits.mk87
-rwxr-xr-xsgx/eurasiacon/build/linux2/buildvars.mk131
-rwxr-xr-xsgx/eurasiacon/build/linux2/commands.mk205
-rwxr-xr-xsgx/eurasiacon/build/linux2/common/apis/xorg.mk4
-rwxr-xr-xsgx/eurasiacon/build/linux2/common/dridrm.mk47
-rwxr-xr-xsgx/eurasiacon/build/linux2/common/omap4.mk27
-rwxr-xr-xsgx/eurasiacon/build/linux2/common/opencl.mk24
-rwxr-xr-xsgx/eurasiacon/build/linux2/common/xorg.mk28
-rwxr-xr-xsgx/eurasiacon/build/linux2/common/xorg_test.mk33
-rwxr-xr-xsgx/eurasiacon/build/linux2/config/core.mk507
-rwxr-xr-xsgx/eurasiacon/build/linux2/defs.mk103
-rw-r--r--sgx/eurasiacon/build/linux2/kbuild/Makefile.template71
-rwxr-xr-xsgx/eurasiacon/build/linux2/kbuild/external_tarball.mk34
-rwxr-xr-xsgx/eurasiacon/build/linux2/kbuild/kbuild.mk83
-rwxr-xr-xsgx/eurasiacon/build/linux2/kernel_module.mk59
-rwxr-xr-xsgx/eurasiacon/build/linux2/kernel_version.mk61
-rwxr-xr-xsgx/eurasiacon/build/linux2/moduledefs.mk81
-rwxr-xr-xsgx/eurasiacon/build/linux2/modules.mk33
-rwxr-xr-xsgx/eurasiacon/build/linux2/omap4430_linux/Makefile181
-rwxr-xr-xsgx/eurasiacon/build/linux2/prepare_tree.mk47
-rwxr-xr-xsgx/eurasiacon/build/linux2/this_makefile.mk53
-rwxr-xr-xsgx/eurasiacon/build/linux2/tools/cc-check.sh44
-rwxr-xr-xsgx/eurasiacon/build/linux2/toplevel.mk207
23 files changed, 2150 insertions, 0 deletions
diff --git a/sgx/eurasiacon/build/linux2/bits.mk b/sgx/eurasiacon/build/linux2/bits.mk
new file mode 100755
index 0000000..173e1ef
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/bits.mk
@@ -0,0 +1,87 @@
+#
+# 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
+#
+#
+
+# Useful special targets which don't build anything
+
+ifneq ($(filter dumpvar-%,$(MAKECMDGOALS)),)
+dumpvar-%: ;
+$(foreach _var_to_dump,$(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))),$(info $(if $(filter undefined,$(origin $(_var_to_dump))),# $$($(_var_to_dump)) is not set,$(_var_to_dump) := $($(_var_to_dump)))))
+endif
+
+ifneq ($(filter whereis-%,$(MAKECMDGOALS)),)
+whereis-%: ;
+$(foreach _module_to_find,$(patsubst whereis-%,%,$(filter whereis-%,$(MAKECMDGOALS))),$(info $(if $(INTERNAL_MAKEFILE_FOR_MODULE_$(_module_to_find)),$(INTERNAL_MAKEFILE_FOR_MODULE_$(_module_to_find)),# No module $(_module_to_find))))
+endif
+
+ifneq ($(filter whatis-%,$(MAKECMDGOALS)),)
+whatis-$(RELATIVE_OUT)/target/%: ;
+whatis-$(RELATIVE_OUT)/host/%: ;
+$(foreach _file_to_find,$(patsubst whatis-%,%,$(filter whatis-%,$(MAKECMDGOALS))),$(info $(strip $(foreach _m,$(ALL_MODULES),$(if $(filter $(_file_to_find),$(INTERNAL_TARGETS_FOR_$(_m))),$(_file_to_find) is in $(_m) which is defined in $(INTERNAL_MAKEFILE_FOR_MODULE_$(_m)),)))))
+endif
+
+.PHONY: ls-modules ls-modules-v
+ls-modules:
+ @: $(foreach _m,$(ALL_MODULES),$(info $(_m)))
+ls-modules-v:
+ @: $(foreach _m,$(ALL_MODULES),$(info $($(_m)_type) $(_m) $(patsubst $(TOP)/%,%,$(INTERNAL_MAKEFILE_FOR_MODULE_$(_m)))))
+
+ifeq ($(strip $(MAKECMDGOALS)),visualise)
+FORMAT ?= xlib
+GRAPHVIZ ?= neato
+visualise: $(OUT)/MAKE_RULES.dot
+ $(GRAPHVIZ) -T$(FORMAT) -o $(OUT)/MAKE_RULES.$(FORMAT) $<
+$(OUT)/MAKE_RULES.dot: $(OUT)/MAKE_RULES
+ perl $(MAKE_TOP)/tools/depgraph.pl -t $(TOP) -g $(firstword $(GRAPHVIZ)) $(OUT)/MAKE_RULES >$(OUT)/MAKE_RULES.dot
+$(OUT)/MAKE_RULES: $(ALL_MAKEFILES)
+ -$(MAKE) -C $(TOP) -f $(MAKE_TOP)/toplevel.mk TOP=$(TOP) OUT=$(OUT) ls-modules -qp >$(OUT)/MAKE_RULES 2>&1
+else
+visualise:
+ @: $(error visualise specified along with other goals. This is not supported)
+endif
+
+.PHONY: help
+help:
+ @echo 'Build targets'
+ @echo ' make, make build Build the UM/KM components of the build and scripts'
+ @echo ' make components Build only the UM components'
+ @echo ' make kbuild Build only the KM components'
+ @echo ' make scripts Build only the scripts (rc.pvr and install.sh)'
+ @echo ' make MODULE Build the module MODULE and all its dependencies'
+ @echo ' make eurasiacon/binary2_.../target/libsomething.so'
+ @echo ' Build a particular file (including intermediates)'
+ @echo 'Variables'
+ @echo ' make V=1 ... Print the commands that are executed'
+ @echo ' make OUT=dir ... Place output+intermediates in specified directory'
+ @echo ' make SOMEOPTION=1 ... Set configuration options (see Makefile.config)'
+ @echo ''
+ @echo 'Clean targets'
+ @echo ' make clean Remove only intermediates for the current build'
+ @echo ' make clobber As "make clean", but remove output files too'
+ @echo ' make clean-MODULE Clean (or clobber) only files for MODULE'
+ @echo ''
+ @echo 'Special targets'
+ @echo ' make whereis-MODULE Show the path to the Linux.mk defining MODULE'
+ @echo ' make whatis-FILE Show which module builds an output FILE'
+ @echo ' make ls-modules[-v] List all modules [with type+makefile]'
diff --git a/sgx/eurasiacon/build/linux2/buildvars.mk b/sgx/eurasiacon/build/linux2/buildvars.mk
new file mode 100755
index 0000000..5026fdf
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/buildvars.mk
@@ -0,0 +1,131 @@
+#
+# 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 file is read once at the start of the build, after reading in
+# config.mk. It should define the non-MODULE_* variables used in commands,
+# like ALL_CFLAGS
+#
+
+ifeq ($(BUILD),debug)
+COMMON_FLAGS := -O0
+else
+OPTIM ?= -O2
+COMMON_FLAGS := $(OPTIM)
+endif
+
+# FIXME: We should probably audit the driver for aliasing
+#
+COMMON_FLAGS += -fno-strict-aliasing
+
+# We always enable debugging. Either the release binaries are stripped
+# and the symbols put in the symbolpackage, or we're building debug.
+#
+COMMON_FLAGS += -g
+
+# These flags are used for kernel, User C and User C++
+#
+COMMON_FLAGS += \
+ -W -Wall -Wno-missing-field-initializers -Wmissing-format-attribute
+
+# Some GCC warnings are C only, so we must mask them from C++
+#
+COMMON_CFLAGS := $(COMMON_FLAGS) \
+ -Wdeclaration-after-statement -Wno-format-zero-length \
+ -Wmissing-prototypes -Wstrict-prototypes
+
+# If we saw W=1, turn on some extra warnings.
+# Most of these flags are new, so cc-option check them.
+#
+ifeq ($(W),1)
+COMMON_CFLAGS += \
+ $(call cc-option,-Wbad-function-cast) \
+ $(call cc-option,-Wcast-qual) \
+ $(call cc-option,-Wcast-align) \
+ $(call cc-option,-Wconversion) \
+ $(call cc-option,-Wdisabled-optimization) \
+ $(call cc-option,-Wlogical-op) \
+ $(call cc-option,-Wmissing-declarations) \
+ $(call cc-option,-Wmissing-include-dirs) \
+ $(call cc-option,-Wnested-externs) \
+ $(call cc-option,-Wold-style-definition) \
+ $(call cc-option,-Woverlength-strings) \
+ $(call cc-option,-Wpacked) \
+ $(call cc-option,-Wpacked-bitfield-compat) \
+ $(call cc-option,-Wpadded) \
+ $(call cc-option,-Wredundant-decls) \
+ $(call cc-option,-Wshadow) \
+ $(call cc-option,-Wswitch-default) \
+ $(call cc-option,-Wvla) \
+ $(call cc-option,-Wwrite-strings)
+endif
+
+# User C only
+#
+ALL_CFLAGS := \
+ $(COMMON_CFLAGS) -Wpointer-arith -Wunused-parameter $(SYS_CFLAGS)
+ALL_HOST_CFLAGS := \
+ $(COMMON_CFLAGS) -Wpointer-arith -Wunused-parameter
+
+# User C++ only
+#
+ALL_CXXFLAGS := \
+ $(COMMON_FLAGS) -fno-rtti -fno-exceptions \
+ -Wpointer-arith -Wunused-parameter $(SYS_CXXFLAGS)
+
+# User C and C++
+#
+# NOTE: ALL_HOST_LDFLAGS should probably be using -rpath-link too, and if we
+# ever need to support building host shared libraries, it's required.
+#
+# We can't use it right now because we want to support non-GNU-compatible
+# linkers like the Darwin 'ld' which doesn't support -rpath-link.
+#
+ALL_HOST_LDFLAGS := -L$(HOST_OUT)
+ALL_LDFLAGS := -L$(TARGET_OUT) -Xlinker -rpath-link=$(TARGET_OUT)
+
+ifneq ($(strip $(TOOLCHAIN)),)
+ALL_LDFLAGS += -L$(TOOLCHAIN)/lib -Xlinker -rpath-link=$(TOOLCHAIN)/lib
+endif
+
+ifneq ($(strip $(LINKER_RPATH)),)
+ALL_LDFLAGS += $(addprefix -Xlinker -rpath=,$(LINKER_RPATH))
+endif
+
+ALL_LDFLAGS += $(SYS_LDFLAGS)
+
+# Kernel C only
+#
+ALL_KBUILD_CFLAGS := $(COMMON_CFLAGS) -Wno-unused-parameter -Wno-sign-compare \
+ $(call cc-option,-Wno-type-limits)
+
+# This variable contains a list of all modules built by kbuild
+ALL_KBUILD_MODULES :=
+
+# This variable contains a list of all modules which contain C++ source files
+ALL_CXX_MODULES :=
+
+# Toolchain triple for cross environment
+CROSS_TRIPLE := $(patsubst %-,%,$(CROSS_COMPILE))
diff --git a/sgx/eurasiacon/build/linux2/commands.mk b/sgx/eurasiacon/build/linux2/commands.mk
new file mode 100755
index 0000000..35d1988
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/commands.mk
@@ -0,0 +1,205 @@
+#
+# 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
+#
+
+# from-one-* recipes make a thing from one source file, so they use $<. Others
+# use $(MODULE_something) instead of $^
+
+# We expect that MODULE_*FLAGS contains all the flags we need, including the
+# flags for all modules (like $(ALL_CFLAGS) and $(ALL_HOST_CFLAGS)), and
+# excluding flags for include search dirs or for linking libraries. The
+# exceptions are ALL_EXE_LDFLAGS and ALL_LIB_LDFLAGS, since they depend on the
+# type of thing being linked, so they appear in the commands below
+
+define host-o-from-one-c
+$(if $(V),,@echo " HOST_CC " $(call relative-to-top,$<))
+$(HOST_CC) -MD -c $(MODULE_HOST_CFLAGS) $(MODULE_INCLUDE_FLAGS) \
+ -include $(CONFIG_H) $< -o $@
+endef
+
+define target-o-from-one-c
+$(if $(V),,@echo " CC " $(call relative-to-top,$<))
+$(CC) -MD -c $(MODULE_CFLAGS) $(MODULE_INCLUDE_FLAGS) \
+ -include $(CONFIG_H) $< -o $@
+endef
+
+# We use $(CC) to compile C++ files, and expect it to detect that it's
+# compiling C++
+define host-o-from-one-cxx
+$(if $(V),,@echo " HOST_CC " $(call relative-to-top,$<))
+$(HOST_CC) -MD -c $(MODULE_HOST_CXXFLAGS) $(MODULE_INCLUDE_FLAGS) \
+ -include $(CONFIG_H) $< -o $@
+endef
+
+define target-o-from-one-cxx
+$(if $(V),,@echo " CC " $(call relative-to-top,$<))
+$(CC) -MD -c $(MODULE_CXXFLAGS) $(MODULE_INCLUDE_FLAGS) \
+ -include $(CONFIG_H) $< -o $@
+endef
+
+define host-executable-from-o
+$(if $(V),,@echo " HOST_LD " $(call relative-to-top,$@))
+$(HOST_CC) $(MODULE_HOST_LDFLAGS) \
+ -o $@ $(sort $(MODULE_ALL_OBJECTS)) $(MODULE_LIBRARY_DIR_FLAGS) \
+ $(MODULE_LIBRARY_FLAGS)
+endef
+
+define host-executable-cxx-from-o
+$(if $(V),,@echo " HOST_LD " $(call relative-to-top,$@))
+$(HOST_CXX) $(MODULE_HOST_LDFLAGS) \
+ -o $@ $(sort $(MODULE_ALL_OBJECTS)) $(MODULE_LIBRARY_DIR_FLAGS) \
+ $(MODULE_LIBRARY_FLAGS)
+endef
+
+define target-executable-from-o
+$(if $(V),,@echo " LD " $(call relative-to-top,$@))
+$(CC) \
+ $(SYS_EXE_LDFLAGS) $(MODULE_LDFLAGS) -o $@ \
+ $(SYS_EXE_CRTBEGIN) $(sort $(MODULE_ALL_OBJECTS)) $(SYS_EXE_CRTEND) \
+ $(MODULE_LIBRARY_DIR_FLAGS) $(MODULE_LIBRARY_FLAGS) $(LIBGCC)
+endef
+
+define target-executable-cxx-from-o
+$(if $(V),,@echo " LD " $(call relative-to-top,$@))
+$(CXX) \
+ $(SYS_EXE_LDFLAGS) $(MODULE_LDFLAGS) -o $@ \
+ $(SYS_EXE_CRTBEGIN) $(sort $(MODULE_ALL_OBJECTS)) $(SYS_EXE_CRTEND) \
+ $(MODULE_LIBRARY_DIR_FLAGS) $(MODULE_LIBRARY_FLAGS) $(LIBGCC)
+endef
+
+define target-shared-library-from-o
+$(if $(V),,@echo " LD " $(call relative-to-top,$@))
+$(CC) -shared -Wl,-Bsymbolic \
+ $(SYS_LIB_LDFLAGS) $(MODULE_LDFLAGS) -o $@ \
+ $(SYS_LIB_CRTBEGIN) $(sort $(MODULE_ALL_OBJECTS)) $(SYS_LIB_CRTEND) \
+ $(MODULE_LIBRARY_DIR_FLAGS) $(MODULE_LIBRARY_FLAGS) $(LIBGCC)
+endef
+
+# If there were any C++ source files in a shared library, we use this recipe,
+# which runs the C++ compiler to link the final library
+define target-shared-library-cxx-from-o
+$(if $(V),,@echo " LD " $(call relative-to-top,$@))
+$(CXX) -shared -Wl,-Bsymbolic \
+ $(SYS_LIB_LDFLAGS) $(MODULE_LDFLAGS) -o $@ \
+ $(SYS_LIB_CRTBEGIN) $(sort $(MODULE_ALL_OBJECTS)) $(SYS_LIB_CRTEND) \
+ $(MODULE_LIBRARY_DIR_FLAGS) $(MODULE_LIBRARY_FLAGS) $(LIBGCC)
+endef
+
+define target-copy-debug-information
+$(OBJCOPY) --only-keep-debug $@ $(basename $@).dbg
+endef
+
+define host-strip-debug-information
+$(HOST_STRIP) --strip-unneeded $@
+endef
+
+define target-strip-debug-information
+$(STRIP) --strip-unneeded $@
+endef
+
+define target-add-debuglink
+$(if $(V),,@echo " DBGLINK " $(call relative-to-top,$(basename $@).dbg))
+$(OBJCOPY) --add-gnu-debuglink=$(basename $@).dbg $@
+endef
+
+define host-static-library-from-o
+$(if $(V),,@echo " HOST_AR " $(call relative-to-top,$@))
+$(HOST_AR) cru $@ $(sort $(MODULE_ALL_OBJECTS))
+endef
+
+define target-static-library-from-o
+$(if $(V),,@echo " AR " $(call relative-to-top,$@))
+$(AR) cru $@ $(sort $(MODULE_ALL_OBJECTS))
+endef
+
+define tab-c-from-y
+$(if $(V),,@echo " BISON " $(call relative-to-top,$<))
+$(BISON) $(MODULE_BISON_FLAGS) -o $@ -d $<
+endef
+
+define l-c-from-l
+$(if $(V),,@echo " FLEX " $(call relative-to-top,$<))
+$(FLEX) $(MODULE_FLEX_FLAGS) -o$@ $<
+endef
+
+define clean-dirs
+$(if $(V),,@echo " RM " $(call relative-to-top,$(MODULE_DIRS_TO_REMOVE)))
+$(RM) -rf $(MODULE_DIRS_TO_REMOVE)
+endef
+
+define make-directory
+$(MKDIR) -p $@
+endef
+
+define check-exports
+endef
+
+# Programs used in recipes
+
+BISON ?= bison
+CC ?= gcc
+CXX ?= g++
+HOST_CC ?= gcc
+HOST_CXX ?= g++
+JAR ?= jar
+JAVA ?= java
+JAVAC ?= javac
+ZIP ?= zip
+
+override AR := $(if $(V),,@)$(CROSS_COMPILE)ar
+override BISON := $(if $(V),,@)$(BISON)
+override BZIP2 := $(if $(V),,@)bzip2 -9
+override CC := $(if $(V),,@)$(CROSS_COMPILE)$(CC)
+override CC_CHECK := $(if $(V),,@)$(MAKE_TOP)/tools/cc-check.sh
+override CXX := $(if $(V),,@)$(CROSS_COMPILE)$(CXX)
+override CHMOD := $(if $(V),,@)chmod
+override CP := $(if $(V),,@)cp
+override DOS2UNIX := $(if $(V),,@)\
+ $(shell if [ -z `which fromdos` ]; then echo dos2unix -f -q; else echo fromdos -f -p; fi)
+override ECHO := $(if $(V),,@)echo
+override FLEX := $(if $(V),,@)flex
+override GAWK := $(if $(V),,@)gawk
+override GREP := $(if $(V),,@)grep
+override HOST_AR := $(if $(V),,@)ar
+override HOST_CC := $(if $(V),,@)$(HOST_CC)
+override HOST_CXX := $(if $(V),,@)$(HOST_CXX)
+override HOST_STRIP := $(if $(V),,@)strip
+override INSTALL := $(if $(V),,@)install
+override JAR := $(if $(V),,@)$(JAR)
+override JAVA := $(if $(V),,@)$(JAVA)
+override JAVAC := $(if $(V),,@)$(JAVAC)
+override M4 := $(if $(V),,@)m4
+override MKDIR := $(if $(V),,@)mkdir
+override MV := $(if $(V),,@)mv
+override OBJCOPY := $(if $(V),,@)$(CROSS_COMPILE)objcopy
+override PDSASM := $(if $(V),,@)$(HOST_OUT)/pdsasm
+override RANLIB := $(if $(V),,@)$(CROSS_COMPILE)ranlib
+override RM := $(if $(V),,@)rm -f
+override SED := $(if $(V),,@)sed
+override STRIP := $(if $(V),,@)$(CROSS_COMPILE)strip
+override TAR := $(if $(V),,@)tar
+override TOUCH := $(if $(V),,@)touch
+override USEASM := $(if $(V),,@)$(HOST_OUT)/useasm
+override USELINK := $(if $(V),,@)$(HOST_OUT)/uselink
+override VHD2INC := $(if $(V),,@)$(HOST_OUT)/vhd2inc
+override ZIP := $(if $(V),,@)$(ZIP)
diff --git a/sgx/eurasiacon/build/linux2/common/apis/xorg.mk b/sgx/eurasiacon/build/linux2/common/apis/xorg.mk
new file mode 100755
index 0000000..27e04b3
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/common/apis/xorg.mk
@@ -0,0 +1,4 @@
+ifeq ($(filter xorg,$(EXCLUDED_APIS)),)
+ COMPONENTS += xorg pvr_conf pvr_video wsegl_dri2_linux
+ -include ../common/apis/xorg_opengl.mk
+endif
diff --git a/sgx/eurasiacon/build/linux2/common/dridrm.mk b/sgx/eurasiacon/build/linux2/common/dridrm.mk
new file mode 100755
index 0000000..86b2f08
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/common/dridrm.mk
@@ -0,0 +1,47 @@
+#
+# 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
+#
+#
+
+$(eval $(call TunableBothConfigC,SUPPORT_DRI_DRM,))
+$(eval $(call TunableBothConfigC,SUPPORT_DRI_DRM_EXT,))
+$(eval $(call TunableBothConfigC,SUPPORT_DRI_DRM_EXTERNAL,))
+
+
+$(eval $(call TunableBothConfigMake,SUPPORT_DRI_DRM,))
+$(eval $(call TunableBothConfigMake,SUPPORT_DRI_DRM_EXTERNAL,))
+
+ifeq ($(SUPPORT_DRI_DRM),1)
+ifeq ($(SUPPORT_DRI_DRM_NO_LIBDRM),1)
+endif
+$(eval $(call TunableKernelConfigC,PVR_SECURE_DRM_AUTH_EXPORT,))
+endif
+
+$(eval $(call TunableKernelConfigC,PVR_DISPLAY_CONTROLLER_DRM_IOCTL,))
+
+$(eval $(call TunableBothConfigC,PVR_DRI_DRM_NOT_PCI))
+$(eval $(call TunableBothConfigMake,PVR_DRI_DRM_NOT_PCI))
+
+$(eval $(call TunableKernelConfigC,PVR_DRI_DRM_PLATFORM_DEV,))
+
+export EXTERNAL_3PDD_TARBALL
diff --git a/sgx/eurasiacon/build/linux2/common/omap4.mk b/sgx/eurasiacon/build/linux2/common/omap4.mk
new file mode 100755
index 0000000..8c0a172
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/common/omap4.mk
@@ -0,0 +1,27 @@
+#
+# 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
+#
+#
+
+$(eval $(call TunableBothConfigC,PVR_NO_FULL_CACHE_OPS,))
+$(eval $(call TunableKernelConfigC,PVR_NO_OMAP_TIMER,))
diff --git a/sgx/eurasiacon/build/linux2/common/opencl.mk b/sgx/eurasiacon/build/linux2/common/opencl.mk
new file mode 100755
index 0000000..42c0ed0
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/common/opencl.mk
@@ -0,0 +1,24 @@
+#
+# 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
+#
+
diff --git a/sgx/eurasiacon/build/linux2/common/xorg.mk b/sgx/eurasiacon/build/linux2/common/xorg.mk
new file mode 100755
index 0000000..f503460
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/common/xorg.mk
@@ -0,0 +1,28 @@
+#
+# 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
+#
+
+PVR_SECURE_DRM_AUTH_EXPORT := 1
+
+$(eval $(call TunableKernelConfigC,XPROC_WORKAROUND_NUM_SHAREABLES,4095))
+
diff --git a/sgx/eurasiacon/build/linux2/common/xorg_test.mk b/sgx/eurasiacon/build/linux2/common/xorg_test.mk
new file mode 100755
index 0000000..6e7552f
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/common/xorg_test.mk
@@ -0,0 +1,33 @@
+#
+# 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
+#
+#
+
+# FIXME: Will go away when SUPPORT_DRI_DRM is untangled from
+# the old meaning of SUPPORT_XORG=1.
+
+ifeq ($(filter xorg,$(EXCLUDED_APIS)),)
+ifneq ($(wildcard ../common/apis/xorg.mk),)
+want_xorg := 1
+endif
+endif
diff --git a/sgx/eurasiacon/build/linux2/config/core.mk b/sgx/eurasiacon/build/linux2/config/core.mk
new file mode 100755
index 0000000..04a17a1
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/config/core.mk
@@ -0,0 +1,507 @@
+#
+# 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
+#
+#
+
+# Configuration wrapper for new build system. This file deals with
+# configuration of the build. Add to this file anything that deals
+# with switching driver options on/off and altering the defines or
+# objects the build uses.
+#
+# At the end of this file is an exhaustive list of all variables
+# that are passed between the platform/config stage and the generic
+# build. PLEASE refrain from adding more variables than necessary
+# to this stage -- almost all options can go through config.h.
+#
+
+################################# MACROS ####################################
+
+# Write out a kernel GNU make option.
+#
+define KernelConfigMake
+$$(shell echo "override $(1) := $(2)" >>$(CONFIG_KERNEL_MK).new)
+endef
+
+# Write out a GNU make option for both user & kernel
+#
+define BothConfigMake
+$$(eval $$(call KernelConfigMake,$(1),$(2)))
+endef
+
+# Conditionally write out a kernel GNU make option
+#
+define TunableKernelConfigMake
+ifneq ($$($(1)),)
+ifneq ($$($(1)),0)
+$$(eval $$(call KernelConfigMake,$(1),$$($(1))))
+endif
+else
+ifneq ($(2),)
+$$(eval $$(call KernelConfigMake,$(1),$(2)))
+endif
+endif
+endef
+
+# Conditionally write out a GNU make option for both user & kernel
+#
+define TunableBothConfigMake
+$$(eval $$(call TunableKernelConfigMake,$(1),$(2)))
+endef
+
+# Write out a kernel-only option
+#
+define KernelConfigC
+$$(shell echo "#define $(1) $(2)" >>$(CONFIG_KERNEL_H).new)
+endef
+
+# Write out an option for both user & kernel
+#
+define BothConfigC
+$$(eval $$(call KernelConfigC,$(1),$(2)))
+endef
+
+# Conditionally write out a kernel-only option
+#
+define TunableKernelConfigC
+ifneq ($$($(1)),)
+ifneq ($$($(1)),0)
+ifeq ($$($(1)),1)
+$$(eval $$(call KernelConfigC,$(1),))
+else
+$$(eval $$(call KernelConfigC,$(1),$$($(1))))
+endif
+endif
+else
+ifneq ($(2),)
+ifeq ($(2),1)
+$$(eval $$(call KernelConfigC,$(1),))
+else
+$$(eval $$(call KernelConfigC,$(1),$(2)))
+endif
+endif
+endif
+endef
+
+# Conditionally write out an option for both user & kernel
+#
+define TunableBothConfigC
+$$(eval $$(call TunableKernelConfigC,$(1),$(2)))
+endef
+
+############################### END MACROS ##################################
+
+DOS2UNIX := $(shell \
+ if [ -z `which fromdos` ]; then echo dos2unix -f -q; else echo fromdos -f -p; fi \
+)
+
+# Check we have a new enough version of GNU make.
+#
+need := 3.81
+ifeq ($(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need)))),)
+$(error A version of GNU make >= $(need) is required - this is version $(MAKE_VERSION))
+endif
+
+# Try to guess EURASIAROOT if it wasn't set. Check this location.
+#
+_GUESSED_EURASIAROOT := $(abspath ../../../..)
+ifneq ($(strip $(EURASIAROOT)),)
+# We don't want to warn about EURASIAROOT if it's empty: this might mean that
+# it's not set at all anywhere, but it could also mean that it's set like
+# "export EURASIAROOT=" or "make EURASIAROOT= sometarget". If it is set but
+# empty, we'll act as if it's unset and not warn.
+ifneq ($(strip $(EURASIAROOT)),$(_GUESSED_EURASIAROOT))
+nothing :=
+space := $(nothing) $(nothing)
+$(warning EURASIAROOT is set (via: $(origin EURASIAROOT)), but its value does not)
+$(warning match the root of this source tree, so it is being ignored)
+$(warning EURASIAROOT is set to: $(EURASIAROOT))
+$(warning $(space)The detected root is: $(_GUESSED_EURASIAROOT))
+$(warning To suppress this message, unset EURASIAROOT or set it empty)
+endif
+# else, EURASIAROOT matched the actual root of the source tree: don't warn
+endif
+override EURASIAROOT := $(_GUESSED_EURASIAROOT)
+TOP := $(EURASIAROOT)
+$(call directory-must-exist,$(TOP))
+
+include ../defs.mk
+
+# Infer PVR_BUILD_DIR from the directory configuration is launched from.
+# Check anyway that such a directory exists.
+#
+PVR_BUILD_DIR := $(notdir $(abspath .))
+$(call directory-must-exist,$(TOP)/eurasiacon/build/linux2/$(PVR_BUILD_DIR))
+
+# Output directory for configuration, object code,
+# final programs/libraries, and install/rc scripts.
+#
+BUILD ?= release
+OUT ?= $(TOP)/eurasiacon/binary2_$(PVR_BUILD_DIR)_$(BUILD)
+
+# Without a build date drm fails to load
+DATE := $(shell date +%Y-%m-%d)
+
+CONFIG_MK := $(OUT)/config.mk
+CONFIG_H := $(OUT)/config.h
+CONFIG_KERNEL_MK := $(OUT)/config_kernel.mk
+CONFIG_KERNEL_H := $(OUT)/config_kernel.h
+
+# Create the OUT directory and delete any previous intermediary files
+#
+$(shell mkdir -p $(OUT))
+$(shell \
+ for file in $(CONFIG_MK).new $(CONFIG_H).new \
+ $(CONFIG_KERNEL_MK).new $(CONFIG_KERNEL_H).new; do \
+ rm -f $$file; \
+ done)
+
+# Some targets don't need information about any modules. If we only specify
+# these targets on the make command line, set INTERNAL_CLOBBER_ONLY to
+# indicate that toplevel.mk shouldn't read any makefiles
+CLOBBER_ONLY_TARGETS := clean clobber help install
+INTERNAL_CLOBBER_ONLY :=
+ifneq ($(strip $(MAKECMDGOALS)),)
+INTERNAL_CLOBBER_ONLY := \
+$(if \
+ $(strip $(foreach _cmdgoal,$(MAKECMDGOALS),\
+ $(if $(filter $(_cmdgoal),$(CLOBBER_ONLY_TARGETS)),,x))),,true)
+endif
+
+# For a clobber-only build, we shouldn't regenerate any config files, or
+# require things like SGXCORE to be set
+ifneq ($(INTERNAL_CLOBBER_ONLY),true)
+
+-include ../config/user-defs.mk
+
+# FIXME: Backwards compatibility remaps.
+#
+ifeq ($(SUPPORT_SLC),1)
+SGX_FEATURE_SYSTEM_CACHE := 1
+endif
+ifeq ($(BYPASS_SLC),1)
+SGX_BYPASS_SYSTEM_CACHE := 1
+endif
+ifeq ($(BYPASS_DCU),1)
+SGX_BYPASS_DCU := 1
+endif
+ifneq ($(SGXCOREREV),)
+SGX_CORE_REV := $(SGXCOREREV)
+endif
+
+# Core handling
+#
+ifeq ($(SGXCORE),)
+$(error Must specify SGXCORE)
+endif
+ifeq ($(SGX_CORE_REV),)
+override USE_SGX_CORE_REV_HEAD := 1
+else ifeq ($(SGX_CORE_REV),000)
+override USE_SGX_CORE_REV_HEAD := 1
+override SGX_CORE_REV :=
+else
+override USE_SGX_CORE_REV_HEAD := 0
+endif
+
+# Enforced dependencies. Move this to an include.
+#
+ifeq ($(SUPPORT_LINUX_USING_WORKQUEUES),1)
+override PVR_LINUX_USING_WORKQUEUES := 1
+override PVR_LINUX_MISR_USING_PRIVATE_WORKQUEUE := 1
+override PVR_LINUX_TIMERS_USING_WORKQUEUES := 1
+override SYS_CUSTOM_POWERLOCK_WRAP := 1
+else ifeq ($(SUPPORT_LINUX_USING_SHARED_WORKQUEUES),1)
+override PVR_LINUX_USING_WORKQUEUES := 1
+override PVR_LINUX_MISR_USING_WORKQUEUE := 1
+override PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE := 1
+override SYS_CUSTOM_POWERLOCK_WRAP := 1
+endif
+
+ifneq ($(PDUMP),1)
+override SUPPORT_PDUMP_MULTI_PROCESS := 0
+endif
+
+ifeq ($(SUPPORT_HYBRID_PB),1)
+override SUPPORT_SHARED_PB := 1
+override SUPPORT_PERCONTEXT_PB := 1
+else ifeq ($(SUPPORT_PERCONTEXT_PB),1)
+override SUPPORT_SHARED_PB := 0
+endif
+
+ifeq ($(NO_HARDWARE),1)
+override SYS_USING_INTERRUPTS := 0
+override SUPPORT_HW_RECOVERY := 0
+override SUPPORT_ACTIVE_POWER_MANAGEMENT := 0
+endif
+
+ifeq ($(SGXCORE),535)
+PVR2D_ALT_2DHW ?= 0
+endif
+
+# Multi-core handling must be done separately to other options
+# Also do some sanity checks
+#
+ifeq ($(SGX_FEATURE_MP),1)
+ifeq ($(SGX_FEATURE_MP_CORE_COUNT),)
+ifeq ($(SGX_FEATURE_MP_CORE_COUNT_TA),)
+$(error Must specify SGX_FEATURE_MP_CORE_COUNT or both SGX_FEATURE_MP_CORE_COUNT_TA and SGX_FEATURE_MP_CORE_COUNT_3D with SGX_FEATURE_MP)
+else
+$(eval $(call BothConfigC,SGX_FEATURE_MP_CORE_COUNT_TA,$(SGX_FEATURE_MP_CORE_COUNT_TA)))
+endif
+ifeq ($(SGX_FEATURE_MP_CORE_COUNT_3D),)
+$(error Must specify SGX_FEATURE_MP_CORE_COUNT or both SGX_FEATURE_MP_CORE_COUNT_TA and SGX_FEATURE_MP_CORE_COUNT_3D with SGX_FEATURE_MP)
+else
+$(eval $(call BothConfigC,SGX_FEATURE_MP_CORE_COUNT_3D,$(SGX_FEATURE_MP_CORE_COUNT_3D)))
+endif
+else
+$(eval $(call BothConfigC,SGX_FEATURE_MP_CORE_COUNT,$(SGX_FEATURE_MP_CORE_COUNT)))
+endif
+endif
+
+# Rather than requiring the user to have to define two variables (one quoted,
+# one not), make PVRSRV_MODNAME a non-tunable and give it an overridable
+# default here.
+#
+PVRSRV_MODNAME ?= omapdrm
+
+# The user didn't set CROSS_COMPILE. There's probably nothing wrong
+# with that, but we'll let them know anyway.
+#
+ifeq ($(CROSS_COMPILE),)
+$(warning CROSS_COMPILE is not set. Target components will be built with the host compiler)
+endif
+
+# The user is trying to set one of the old SUPPORT_ options on the
+# command line or in the environment. This isn't supported any more
+# and will often break the build. The user is generally only trying
+# to remove a component from the list of targets to build, so we'll
+# point them at the new way of doing this.
+define sanity-check-support-option-origin
+ifeq ($$(filter undefined file,$$(origin $(1))),)
+$$(warning *** Setting $(1) via $$(origin $(1)) is deprecated)
+$$(error If you are trying to disable a component, use e.g. EXCLUDED_APIS="opengles1 opengl")
+endif
+endef
+$(foreach _o,SYS_CFLAGS SYS_CXXFLAGS SYS_EXE_LDFLAGS SYS_LIB_LDFLAGS SUPPORT_EWS SUPPORT_OPENGLES1 SUPPORT_OPENGLES2 SUPPORT_OPENVG SUPPORT_OPENCL SUPPORT_OPENGL SUPPORT_UNITTESTS SUPPORT_XORG,$(eval $(call sanity-check-support-option-origin,$(_o))))
+
+# Check for words in EXCLUDED_APIS that aren't understood by the
+# common/apis/*.mk files. This should be kept in sync with all the tests on
+# EXCLUDED_APIS in those files
+_excludable_apis := opencl opengl opengles1 opengles2 openvg ews unittests xorg xorg_unittests
+_unrecognised := $(strip $(filter-out $(_excludable_apis),$(EXCLUDED_APIS)))
+ifneq ($(_unrecognised),)
+$(warning *** Unrecognised entries in EXCLUDED_APIS: $(_unrecognised))
+$(warning *** EXCLUDED_APIS was set via: $(origin EXCLUDED_APIS))
+$(error Excludable APIs are: $(_excludable_apis))
+endif
+
+# Build's selected list of components
+#
+-include components.mk
+
+# PDUMP needs extra components
+#
+ifeq ($(PDUMP),1)
+ifneq ($(COMPONENTS),)
+COMPONENTS += pdump
+endif
+ifeq ($(SUPPORT_DRI_DRM),1)
+EXTRA_PVRSRVKM_COMPONENTS += dbgdrv
+else
+KERNEL_COMPONENTS += dbgdrv
+endif
+endif
+
+# If KERNELDIR is set, write it out to the config.mk, with
+# KERNEL_COMPONENTS and KERNEL_ID
+#
+ifneq ($(strip $(KERNELDIR)),)
+include ../kernel_version.mk
+$(eval $(call KernelConfigMake,KERNELDIR,$(KERNELDIR)))
+# Needed only by install script
+$(eval $(call KernelConfigMake,KERNEL_COMPONENTS,$(KERNEL_COMPONENTS)))
+$(eval $(call TunableKernelConfigMake,KERNEL_CROSS_COMPILE,))
+$(eval $(call TunableKernelConfigMake,EXTRA_PVRSRVKM_COMPONENTS,))
+$(eval $(call TunableKernelConfigMake,EXTRA_KBUILD_SOURCE,))
+endif
+
+# Ideally configured by platform Makefiles, as necessary
+#
+
+# Invariant options for Linux
+#
+$(eval $(call BothConfigC,LINUX,))
+
+$(eval $(call BothConfigC,PVR_BUILD_DIR,"\"$(PVR_BUILD_DIR)\""))
+$(eval $(call BothConfigC,PVR_BUILD_DATE,"\"$(DATE)\""))
+$(eval $(call BothConfigC,PVR_BUILD_TYPE,"\"$(BUILD)\""))
+$(eval $(call BothConfigC,PVRSRV_MODNAME,"\"$(PVRSRV_MODNAME)\""))
+$(eval $(call BothConfigMake,PVRSRV_MODNAME,$(PVRSRV_MODNAME)))
+
+$(eval $(call TunableBothConfigC,SGXCORE,))
+$(eval $(call BothConfigC,SGX$(SGXCORE),))
+$(eval $(call BothConfigC,SUPPORT_SGX$(SGXCORE),))
+
+$(eval $(call TunableBothConfigC,SUPPORT_SGX,1))
+$(eval $(call TunableBothConfigC,SGX_CORE_REV,))
+$(eval $(call TunableBothConfigC,USE_SGX_CORE_REV_HEAD,))
+
+$(eval $(call BothConfigC,TRANSFER_QUEUE,))
+$(eval $(call BothConfigC,PVR_SECURE_HANDLES,))
+
+$(eval $(call KernelConfigC,DISPLAY_CONTROLLER,$(DISPLAY_CONTROLLER)))
+
+$(eval $(call TunableKernelConfigC,FLIP_TECHNIQUE_FRAMEBUFFER,))
+$(eval $(call TunableKernelConfigC,FLIP_TECHNIQUE_OVERLAY,))
+
+$(eval $(call BothConfigMake,PVR_SYSTEM,$(PVR_SYSTEM)))
+
+
+# Build-type dependent options
+#
+$(eval $(call BothConfigMake,BUILD,$(BUILD)))
+
+ifeq ($(BUILD),debug)
+$(eval $(call BothConfigC,DEBUG,))
+$(eval $(call KernelConfigC,DEBUG_LINUX_MEMORY_ALLOCATIONS,))
+$(eval $(call KernelConfigC,DEBUG_LINUX_MEM_AREAS,))
+$(eval $(call KernelConfigC,DEBUG_LINUX_MMAP_AREAS,))
+$(eval $(call KernelConfigC,DEBUG_BRIDGE_KM,))
+$(eval $(call TunableBothConfigC,PVRSRV_USSE_EDM_STATUS_DEBUG,1))
+else ifeq ($(BUILD),release)
+$(eval $(call BothConfigC,RELEASE,))
+$(eval $(call TunableBothConfigMake,DEBUGLINK,1))
+$(eval $(call TunableBothConfigC,PVRSRV_USSE_EDM_STATUS_DEBUG,))
+else ifeq ($(BUILD),timing)
+$(eval $(call BothConfigC,TIMING,))
+$(eval $(call TunableBothConfigMake,DEBUGLINK,1))
+$(eval $(call TunableBothConfigC,PVRSRV_USSE_EDM_STATUS_DEBUG,))
+else
+$(error BUILD= must be either debug, release or timing)
+endif
+
+# User-configurable options
+#
+$(eval $(call TunableBothConfigC,SUPPORT_PERCONTEXT_PB,1))
+$(eval $(call TunableBothConfigC,SUPPORT_SHARED_PB,))
+$(eval $(call TunableBothConfigC,SUPPORT_HYBRID_PB,))
+$(eval $(call TunableBothConfigC,SUPPORT_HW_RECOVERY,1))
+$(eval $(call TunableBothConfigC,SUPPORT_ACTIVE_POWER_MANAGEMENT,1))
+$(eval $(call TunableBothConfigC,SUPPORT_SGX_HWPERF,1))
+$(eval $(call TunableBothConfigC,SUPPORT_SGX_LOW_LATENCY_SCHEDULING,1))
+$(eval $(call TunableBothConfigC,SUPPORT_MEMINFO_IDS,))
+$(eval $(call TunableBothConfigC,SUPPORT_SGX_NEW_STATUS_VALS,1))
+$(eval $(call TunableBothConfigC,SUPPORT_PDUMP_MULTI_PROCESS,))
+$(eval $(call TunableBothConfigC,SUPPORT_DBGDRV_EVENT_OBJECTS,1))
+$(eval $(call TunableBothConfigC,PVR_DBG_BREAK_ASSERT_FAIL,))
+$(eval $(call TunableBothConfigC,SGX_FEATURE_SYSTEM_CACHE,))
+$(eval $(call TunableBothConfigC,SGX_BYPASS_SYSTEM_CACHE,))
+$(eval $(call TunableBothConfigC,SGX_BYPASS_DCU,))
+$(eval $(call TunableBothConfigC,SGX_FAST_DPM_INIT,))
+$(eval $(call TunableBothConfigC,SGX_FEATURE_MP,))
+$(eval $(call TunableBothConfigC,SGX_FEATURE_MP_PLUS,))
+$(eval $(call TunableBothConfigC,FPGA,))
+$(eval $(call TunableBothConfigC,PDUMP,))
+$(eval $(call TunableBothConfigC,NO_HARDWARE,))
+$(eval $(call TunableBothConfigC,PDUMP_DEBUG_OUTFILES,))
+$(eval $(call TunableBothConfigC,PVRSRV_RESET_ON_HWTIMEOUT,))
+$(eval $(call TunableBothConfigC,SYS_USING_INTERRUPTS,1))
+$(eval $(call TunableBothConfigC,SUPPORT_EXTERNAL_SYSTEM_CACHE,))
+$(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_DPF,))
+$(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_ASSERT,))
+$(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_TRACE,))
+$(eval $(call TunableBothConfigC,SUPPORT_SECURE_33657_FIX,))
+
+$(eval $(call TunableKernelConfigC,SUPPORT_LINUX_X86_WRITECOMBINE,1))
+$(eval $(call TunableKernelConfigC,SUPPORT_LINUX_X86_PAT,1))
+$(eval $(call TunableKernelConfigC,SGX_DYNAMIC_TIMING_INFO,))
+$(eval $(call TunableKernelConfigC,SYS_SGX_ACTIVE_POWER_LATENCY_MS,))
+$(eval $(call TunableKernelConfigC,SYS_CUSTOM_POWERLOCK_WRAP,))
+$(eval $(call TunableKernelConfigC,PVR_LINUX_USING_WORKQUEUES,))
+$(eval $(call TunableKernelConfigC,PVR_LINUX_MISR_USING_WORKQUEUE,))
+$(eval $(call TunableKernelConfigC,PVR_LINUX_MISR_USING_PRIVATE_WORKQUEUE,))
+$(eval $(call TunableKernelConfigC,PVR_LINUX_TIMERS_USING_WORKQUEUES,))
+$(eval $(call TunableKernelConfigC,PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE,))
+$(eval $(call TunableKernelConfigC,LDM_PLATFORM,))
+$(eval $(call TunableKernelConfigC,PVR_LDM_PLATFORM_PRE_REGISTERED,))
+$(eval $(call TunableKernelConfigC,LDM_PCI,))
+$(eval $(call TunableKernelConfigC,PVRSRV_DUMP_MK_TRACE,))
+$(eval $(call TunableKernelConfigC,PVRSRV_DUMP_KERNEL_CCB,))
+$(eval $(call TunableKernelConfigC,HYBRID_SHARED_PB_SIZE,))
+
+
+$(eval $(call TunableBothConfigMake,LDM_PLATFORM,))
+$(eval $(call TunableBothConfigMake,LDM_PCI,))
+
+
+$(eval $(call TunableBothConfigMake,OPTIM,))
+
+$(eval $(call TunableBothConfigMake,SUPPORT_V4L2_GFX,))
+$(eval $(call TunableBothConfigMake,SUPPORT_BC_EXAMPLE,))
+
+endif # INTERNAL_CLOBBER_ONLY
+
+export INTERNAL_CLOBBER_ONLY
+export TOP
+export OUT
+
+MAKE_ETC := -Rr --no-print-directory -C $(TOP) TOP=$(TOP) \
+ -f eurasiacon/build/linux2/toplevel.mk
+
+# This must match the default value of MAKECMDGOALS below, and the default
+# goal in toplevel.mk
+.DEFAULT_GOAL := build
+
+ifeq ($(MAKECMDGOALS),)
+MAKECMDGOALS := build
+else
+# We can't pass autogen to toplevel.mk
+MAKECMDGOALS := $(filter-out autogen,$(MAKECMDGOALS))
+endif
+
+.PHONY: autogen
+autogen:
+ifeq ($(INTERNAL_CLOBBER_ONLY),)
+ @$(MAKE) -s --no-print-directory -C $(EURASIAROOT) \
+ DOS2UNIX="$(DOS2UNIX)" \
+ -f eurasiacon/build/linux2/prepare_tree.mk
+else
+ @:
+endif
+
+# This deletes built-in suffix rules. Otherwise the submake isn't run when
+# saying e.g. "make thingy.a"
+.SUFFIXES:
+
+# Because we have a match-anything rule below, we'll run the main build when
+# we're actually trying to remake various makefiles after they're read in.
+# These rules try to prevent that
+%.mk: ;
+Makefile%: ;
+Makefile: ;
+
+.PHONY: build kbuild install
+build kbuild install: autogen
+ @$(if $(MAKECMDGOALS),$(MAKE) $(MAKE_ETC) $(MAKECMDGOALS) $(eval MAKECMDGOALS :=),:)
+
+%: autogen
+ @$(if $(MAKECMDGOALS),$(MAKE) $(MAKE_ETC) $(MAKECMDGOALS) $(eval MAKECMDGOALS :=),:)
diff --git a/sgx/eurasiacon/build/linux2/defs.mk b/sgx/eurasiacon/build/linux2/defs.mk
new file mode 100755
index 0000000..d4cfe29
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/defs.mk
@@ -0,0 +1,103 @@
+#
+# 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
+#
+#
+
+define must-be-defined
+$(if $(filter undefined,$(origin $(1))),$(error In makefile $(THIS_MAKEFILE): $$($(1)) must be defined),)
+endef
+
+define must-be-nonempty
+$(if $(strip $($(1))),,$(error In makefile $(THIS_MAKEFILE): $$($(1)) must contain a value))
+endef
+
+define directory-must-exist
+$(if $(wildcard $(abspath $(1)/)),,$(error Directory $(1) must exist))
+endef
+
+define one-word-only
+$(if $(filter-out $(firstword $($(1))),$($(1))),$(error In makefile $(THIS_MAKEFILE): $$($(1)) must contain only one word),)
+endef
+
+define target-intermediates-of
+$(addprefix $(TARGET_OUT)/intermediates/$(1)/,$(2))
+endef
+
+define host-intermediates-of
+$(addprefix $(HOST_OUT)/intermediates/$(1)/,$(2))
+endef
+
+define module-library
+$(patsubst lib%.so,%,$(if $($(1)_target),$($(1)_target),$(1).so))
+endef
+
+# This is done to allow module type makefiles to use $(THIS_MAKEFILE)
+define register-module
+INTERNAL_MAKEFILE_FOR_MODULE_$(1) := $(THIS_MAKEFILE)
+endef
+
+define process-module
+THIS_MODULE := $(1)
+THIS_MAKEFILE := $(INTERNAL_MAKEFILE_FOR_MODULE_$(1))
+include $$(MAKE_TOP)/this_makefile.mk
+$$(call must-be-nonempty,THIS_MAKEFILE)
+$$(call must-be-nonempty,$(1)_type)
+MODULE_HOST_BUILD := $$(if $(filter host_%,$($(1)_type)),true,)
+include $$(MAKE_TOP)/moduledefs.mk
+include $$(MAKE_TOP)/$$(patsubst host_%,%,$($(1)_type)).mk
+INTERNAL_TARGETS_FOR_$(THIS_MODULE) := $(MODULE_TARGETS)
+endef
+
+# This can be used by module_type.mk files to indicate that they can't be
+# built as host_module_type
+define target-build-only
+$(if $(filter true,$(MODULE_HOST_BUILD)),$(error In makefile $(THIS_MAKEFILE): Module $(THIS_MODULE) attempted to build a host $(1), which is not supported))
+endef
+
+define relative-to-top
+$(patsubst $(TOP)/%,%,$(1))
+endef
+
+define cc-check
+$(shell \
+ CC_CHECK=$(patsubst @%,%,$(CC_CHECK)) && \
+ $(patsubst @%,%,$(DOS2UNIX)) $$CC_CHECK && \
+ $(patsubst @%,%,$(CHMOD)) +x $$CC_CHECK && \
+ $$CC_CHECK --cc "$(1)" --out "$(2)" $(3))
+endef
+
+define cc-is-64bit
+$(call cc-check,$(1),$(OUT),--64)
+endef
+
+define cc-option
+$(call cc-check,$(patsubst @%,%,$(CC)),$(OUT),$(1))
+endef
+
+define cxx-option
+$(call cc-check,$(patsubst @%,%,$(CXX)),$(OUT),$(1))
+endef
+
+define host-cc-option
+$(call cc-check,$(patsubst @%,%,$(HOST_CC)),$(OUT),$(1))
+endef
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
diff --git a/sgx/eurasiacon/build/linux2/kernel_module.mk b/sgx/eurasiacon/build/linux2/kernel_module.mk
new file mode 100755
index 0000000..4cd5328
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/kernel_module.mk
@@ -0,0 +1,59 @@
+#
+# 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
+#
+
+# Rules for making kernel modules with kbuild. This makefile doesn't define
+# any rules that build the modules, it only copies the kbuild Makefile into
+# the right place and then invokes kbuild to do the actual build
+
+$(call target-build-only,kernel module)
+
+MODULE_KBUILD_DIR := $(MODULE_OUT)/kbuild
+
+# $(THIS_MODULE)_makefile names the kbuild makefile fragment used to build
+# this module's objects
+$(call must-be-nonempty,$(THIS_MODULE)_makefile)
+MODULE_KBUILD_MAKEFILE := $($(THIS_MODULE)_makefile)
+$(if $(wildcard $(abspath $(MODULE_KBUILD_MAKEFILE))),,$(error In makefile $(THIS_MAKEFILE): Module $(THIS_MODULE) requires kbuild makefile $(MODULE_KBUILD_MAKEFILE), which is missing))
+
+# $(THIS_MODULE)_target specifies the name of the kernel module
+$(call must-be-nonempty,$(THIS_MODULE)_target)
+MODULE_KBUILD_OBJECTS := $($(THIS_MODULE)_target:.ko=.o)
+
+# Here we could maybe include $(MODULE_KBUILD_MAKEFILE) and look at
+# $(MODULE_KBUILD_OBJECTS)-y to see which source files might be built
+
+.PHONY: $(THIS_MODULE)
+$(THIS_MODULE): MODULE_KBUILD_MAKEFILE := $(MODULE_KBUILD_MAKEFILE)
+$(THIS_MODULE): MODULE_KBUILD_OBJECTS := $(MODULE_KBUILD_OBJECTS)
+$(THIS_MODULE):
+ @echo "kbuild module '$@'"
+ @echo " MODULE_KBUILD_MAKEFILE := $(MODULE_KBUILD_MAKEFILE)"
+ @echo " MODULE_KBUILD_OBJECTS := $(MODULE_KBUILD_OBJECTS)"
+ @echo ' Being built:' $(if $(filter $@,$(KERNEL_COMPONENTS)),"yes (separate module)",$(if $(filter $@,$(EXTRA_PVRSRVKM_COMPONENTS)),"yes (into omapdrm)","no"))
+ @echo "Module $@ is a kbuild module. Run 'make kbuild' to make it"
+ @false
+
+ALL_KBUILD_MODULES += $(THIS_MODULE)
+INTERNAL_KBUILD_MAKEFILE_FOR_$(THIS_MODULE) := $(MODULE_KBUILD_MAKEFILE)
+INTERNAL_KBUILD_OBJECTS_FOR_$(THIS_MODULE) := $(MODULE_KBUILD_OBJECTS)
diff --git a/sgx/eurasiacon/build/linux2/kernel_version.mk b/sgx/eurasiacon/build/linux2/kernel_version.mk
new file mode 100755
index 0000000..ef604e9
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/kernel_version.mk
@@ -0,0 +1,61 @@
+#
+# 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 $(KERNELDIR),,$(error KERNELDIR must be set to obtain a version))
+
+override KERNEL_VERSION := \
+ $(shell grep "^VERSION = " $(KERNELDIR)/Makefile | cut -f3 -d' ')
+override KERNEL_PATCHLEVEL := \
+ $(shell grep "^PATCHLEVEL = " $(KERNELDIR)/Makefile | cut -f3 -d' ')
+override KERNEL_SUBLEVEL := \
+ $(shell grep "^SUBLEVEL = " $(KERNELDIR)/Makefile | cut -f3 -d' ')
+override KERNEL_EXTRAVERSION := \
+ $(shell grep "^EXTRAVERSION = " $(KERNELDIR)/Makefile | cut -f3 -d' ')
+
+# The base ID doesn't have to be accurate; we only use it for
+# feature checks which will not care about extraversion bits
+#
+override KERNEL_BASE_ID := \
+ $(KERNEL_VERSION).$(KERNEL_PATCHLEVEL).$(KERNEL_SUBLEVEL)
+
+# UTS_RELEASE is more accurate, if we can find it
+# If we can't, fall back to manufacturing the version
+#
+KERNEL_ID ?= \
+ $(shell grep -h '\#define UTS_RELEASE' \
+ $(KERNELDIR)/include/*/* | cut -f3 -d' ' | sed s/\"//g)
+
+ifeq ($(strip $(KERNEL_ID)),)
+# kernel.release, it it exists, contains what UTS_RELEASE would have
+# been set to.
+#
+KERNEL_ID := \
+ $(shell cat $(KERNELDIR)/include/config/kernel.release 2>/dev/null)
+endif
+
+ifeq ($(strip $(KERNEL_ID)),)
+KERNEL_ID := \
+ $(KERNEL_VERSION).$(KERNEL_PATCHLEVEL).$(KERNEL_SUBLEVEL)$(KERNEL_EXTRAVERSION)
+endif
diff --git a/sgx/eurasiacon/build/linux2/moduledefs.mk b/sgx/eurasiacon/build/linux2/moduledefs.mk
new file mode 100755
index 0000000..2569099
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/moduledefs.mk
@@ -0,0 +1,81 @@
+#
+# 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
+#
+#
+
+MODULE_TARGETS :=
+MODULE_CFLAGS := $(ALL_CFLAGS) $($(THIS_MODULE)_cflags)
+MODULE_CXXFLAGS := $(ALL_CXXFLAGS) $($(THIS_MODULE)_cxxflags)
+MODULE_HOST_CFLAGS := $(ALL_HOST_CFLAGS) $($(THIS_MODULE)_cflags)
+MODULE_HOST_CXXFLAGS := $(ALL_HOST_CXXFLAGS) $($(THIS_MODULE)_cxxflags)
+MODULE_LDFLAGS := $(ALL_LDFLAGS) $($(THIS_MODULE)_ldflags)
+MODULE_HOST_LDFLAGS := $(ALL_HOST_LDFLAGS) $($(THIS_MODULE)_ldflags)
+MODULE_BISON_FLAGS := $(ALL_BISON_FLAGS) $($(THIS_MODULE)_bisonflags)
+MODULE_FLEX_FLAGS := $(ALL_FLEX_FLAGS) $($(THIS_MODULE)_flexflags)
+
+# -L flags for library search dirs
+MODULE_LIBRARY_DIR_FLAGS := $(foreach _path,$($(THIS_MODULE)_libpaths),$(if $(filter /%,$(_path)),-L$(call relative-to-top,$(_path)),-L$(_path)))
+# -I flags for header search dirs
+MODULE_INCLUDE_FLAGS := $(foreach _path,$($(THIS_MODULE)_includes),$(if $(filter /%,$(_path)),-I$(call relative-to-top,$(_path)),-I$(_path)))
+
+# Variables used to differentiate between host/target builds
+MODULE_OUT := $(if $(MODULE_HOST_BUILD),$(HOST_OUT),$(TARGET_OUT))
+MODULE_INTERMEDIATES_DIR := $(if $(MODULE_HOST_BUILD),$(HOST_INTERMEDIATES)/$(THIS_MODULE),$(TARGET_INTERMEDIATES)/$(THIS_MODULE))
+
+.SECONDARY: $(MODULE_INTERMEDIATES_DIR)
+$(MODULE_INTERMEDIATES_DIR):
+ $(make-directory)
+
+Host_or_target := $(if $(MODULE_HOST_BUILD),Host,Target)
+
+# These define the rules for finding source files.
+# - If a name begins with a slash, we strip $(TOP) off the front if it begins
+# with $(TOP). This is so that we don't get really long error messages from
+# the compiler if the source tree is in a deeply nested directory, but we
+# still do get absolute paths if you say "make OUT=/tmp/somewhere"
+# - Otherwise, if a name contains a slash and begins with $(OUT), we leave it
+# as it is. This is so you can say "module_src :=
+# $(TARGET_INTERMEDIATES)/something/generated.c"
+# - Otherwise, we assume it's a path referring to somewhere under the
+# directory containing Linux.mk, and add $(THIS_DIR) to it
+_SOURCES_WITHOUT_SLASH := $(strip $(foreach _s,$($(THIS_MODULE)_src),$(if $(findstring /,$(_s)),,$(_s))))
+_SOURCES_WITH_SLASH := $(strip $(foreach _s,$($(THIS_MODULE)_src),$(if $(findstring /,$(_s)),$(_s),)))
+MODULE_SOURCES := $(addprefix $(THIS_DIR)/,$(_SOURCES_WITHOUT_SLASH))
+MODULE_SOURCES += $(call relative-to-top,$(filter /%,$(_SOURCES_WITH_SLASH)))
+_RELATIVE_SOURCES_WITH_SLASH := $(filter-out /%,$(_SOURCES_WITH_SLASH))
+_OUTDIR_RELATIVE_SOURCES_WITH_SLASH := $(filter $(RELATIVE_OUT)/%,$(_RELATIVE_SOURCES_WITH_SLASH))
+_THISDIR_RELATIVE_SOURCES_WITH_SLASH := $(filter-out $(RELATIVE_OUT)/%,$(_RELATIVE_SOURCES_WITH_SLASH))
+MODULE_SOURCES += $(_OUTDIR_RELATIVE_SOURCES_WITH_SLASH)
+MODULE_SOURCES += $(addprefix $(THIS_DIR)/,$(_THISDIR_RELATIVE_SOURCES_WITH_SLASH))
+MODULE_SOURCES += $(addprefix $(MODULE_OUT)/intermediates/,$($(THIS_MODULE)_gensrc))
+MODULE_GENERATED_HEADERS := $(addprefix $(MODULE_OUT)/intermediates/,$($(THIS_MODULE)_genheaders))
+
+# -l flags for each library
+MODULE_LIBRARY_FLAGS := $(addprefix -l, $($(THIS_MODULE)_staticlibs)) $(addprefix -l,$($(THIS_MODULE)_libs)) $(foreach _lib,$($(THIS_MODULE)_extlibs),$(if $(filter undefined,$(origin lib$(_lib)_ldflags)),-l$(_lib),$(lib$(_lib)_ldflags)))
+
+# pkg-config integration; primarily used by X.org
+# FIXME: We don't support arbitrary CFLAGS yet (just includes)
+$(foreach _package,$($(THIS_MODULE)_packages),\
+ $(eval MODULE_INCLUDE_FLAGS += `pkg-config --cflags-only-I $(_package)`)\
+ $(eval MODULE_LIBRARY_FLAGS += `pkg-config --libs-only-l $(_package)`)\
+ $(eval MODULE_LIBRARY_DIR_FLAGS += `pkg-config --libs-only-L $(_package)`))
diff --git a/sgx/eurasiacon/build/linux2/modules.mk b/sgx/eurasiacon/build/linux2/modules.mk
new file mode 100755
index 0000000..9bc52a3
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/modules.mk
@@ -0,0 +1,33 @@
+#
+# 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
+#
+#
+
+# Bits for processing $(modules) after reading in each Linux.mk
+
+#$(info ---- $(modules) ----)
+$(call must-be-nonempty,modules)
+
+$(foreach _m,$(modules),$(if $(filter $(_m),$(ALL_MODULES)),$(error In makefile $(THIS_MAKEFILE): Duplicate module $(_m) (first seen in $(INTERNAL_MAKEFILE_FOR_MODULE_$(_m))) listed in $$(modules)),$(eval $(call register-module,$(_m)))))
+
+ALL_MODULES += $(modules)
diff --git a/sgx/eurasiacon/build/linux2/omap4430_linux/Makefile b/sgx/eurasiacon/build/linux2/omap4430_linux/Makefile
new file mode 100755
index 0000000..3afa681
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/omap4430_linux/Makefile
@@ -0,0 +1,181 @@
+#
+# 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
+#
+#
+
+PVR_SYSTEM := omap4
+
+KERNEL_COMPONENTS := srvkm
+
+# Confirm kernel version with KERNELDIR if supplied, otherwise assume
+# a 2.6.35+ kernel.
+ifneq ($(KERNELDIR),)
+include ../kernel_version.mk
+OMAP_KERNEL_AT_LEAST_2_6_35 := $(shell test $(KERNEL_VERSION) -ge 3 || \
+ test $(KERNEL_VERSION) -ge 2 -a \
+ $(KERNEL_PATCHLEVEL) -ge 6 -a \
+ $(KERNEL_SUBLEVEL) -ge 35 && echo 1 || echo 0)
+else
+OMAP_KERNEL_AT_LEAST_2_6_35 := 1
+endif
+
+include ../common/xorg_test.mk
+
+ifeq ($(want_xorg),1)
+SUPPORT_DRI_DRM := 1
+SUPPORT_DRI_DRM_EXTERNAL := 1
+SUPPORT_BC_EXAMPLE ?= 0
+else
+SUPPORT_BC_EXAMPLE ?= 1
+endif
+
+# Only enable active power management if passive power management is
+# enabled, as indicated by LDM_PLATFORM being set to 1. On OMAP,
+# the system can suspend in the case where active power management is
+# enabled in the SGX driver, but passive power management isn't. As
+# passive power management isn't enabled, the driver won't see the
+# system suspend/resume events, and so won't take appropriate action.
+LDM_PLATFORM ?= 1
+
+ifeq ($(LDM_PLATFORM),1)
+SUPPORT_LINUX_USING_WORKQUEUES := 1
+DISPLAY_CONTROLLER_COMPONENT += dc_omapdrm_linux
+DISPLAY_CONTROLLER := omaplfb
+else
+SUPPORT_LINUX_USING_SHARED_WORKQUEUES := 1
+OMAP_NON_FLIP_DISPLAY := 1
+DISPLAY_CONTROLLER_COMPONENT += linux_framebuffer
+DISPLAY_CONTROLLER := pvrlfb
+endif
+
+# When flipping is enabled, the Framebuffer API will be used to
+# present the frames to the display in the 3PDD
+FLIP_TECHNIQUE_FRAMEBUFFER := 1
+
+OPTIM := -Os
+
+SYS_CFLAGS := -march=armv7-a
+
+ifneq ($(CROSS_COMPILE),)
+SYS_CFLAGS += -mtls-dialect=arm
+endif
+
+SUPPORT_OMAP4430_NEON ?= 1
+
+ifeq ($(SUPPORT_OMAP4430_NEON),1)
+SYS_CFLAGS += -ftree-vectorize -mfpu=neon -mfloat-abi=hard
+endif
+
+PVR_NO_FULL_CACHE_OPS := 0
+
+LIBGCC := $(shell $(CROSS_COMPILE)gcc -print-libgcc-file-name)
+
+SGXCORE := 540
+SGX_CORE_REV := 120
+
+SGX_DYNAMIC_TIMING_INFO := 1
+SYS_CUSTOM_POWERLOCK_WRAP := 1
+
+ifeq ($(OMAP_KERNEL_AT_LEAST_2_6_35),1)
+ifeq ($(LDM_PLATFORM),1)
+PVR_LDM_PLATFORM_PRE_REGISTERED := 1
+endif
+endif
+
+BUILD_OPENCL ?= 0
+ifneq ($(BUILD_OPENCL),1)
+EXCLUDED_APIS += opencl
+endif
+
+ifeq ($(want_xorg),1)
+
+ifeq ($(OMAP_KERNEL_AT_LEAST_2_6_35),1)
+PVR_DRI_DRM_PLATFORM_DEV := 1
+else
+PVR_DRI_DRM_NOT_PCI := 1
+endif
+
+XORG_PREFIX := /usr
+XORG_TOOLCHAIN := extern
+XORG_PVR_CONF := omap4
+XORG_PVR_VIDEO := omap4
+XF86_VIDEO ?= ti-pvr_video
+
+OPK_DEFAULT := libpvrPVR2D_DRIWSEGL.so
+OPK_FALLBACK := libpvrPVR2D_DRIWSEGL.so
+
+ifneq ($(OMAP_NON_FLIP_DISPLAY),1)
+XORG_PVR_VIDEO ?= $(PVR_SYSTEM)
+PVR_DISPLAY_CONTROLLER_DRM_IOCTL := 1
+endif
+
+else # xorg isn't excluded
+
+ifeq ($(OMAP_NON_FLIP_DISPLAY),1)
+OPK_DEFAULT := libpvrPVR2D_BLITWSEGL.so
+else
+OPK_DEFAULT := libpvrPVR2D_FLIPWSEGL.so
+endif
+OPK_FALLBACK := libpvrPVR2D_BLITWSEGL.so
+
+endif # xorg isn't excluded
+
+ifeq ($(SUPPORT_DRI_DRM),1)
+ifeq ($(PVR_DRI_DRM_NOT_PCI),1)
+KERNEL_COMPONENTS += linux_drm
+EXTRA_KBUILD_SOURCE := $(KERNELDIR)
+endif
+EXTRA_PVRSRVKM_COMPONENTS += $(DISPLAY_CONTROLLER_COMPONENT)
+else
+KERNEL_COMPONENTS += $(DISPLAY_CONTROLLER_COMPONENT)
+endif
+
+SUPPORT_V4L2_GFX ?= 0
+
+SUPPORT_MEMINFO_IDS ?= 1
+
+SUPPORT_MESA_SONAME ?= 1
+
+ifeq ($(SUPPORT_V4L2_GFX),1)
+KERNEL_COMPONENTS += v4l2-gfx
+endif
+
+ifeq ($(SUPPORT_BC_EXAMPLE),1)
+KERNEL_COMPONENTS += bufferclass_example
+endif
+
+PVRSRV_MODNAME := omapdrm_pvr
+
+PVRSRV_BUSID := platform:omapdrm:00
+
+include ../config/core.mk
+include ../common/xorg.mk
+include ../common/dridrm.mk
+include ../common/opencl.mk
+include ../common/omap4.mk
+
+# We only need this for pvr_video's includes, which should
+# really be done differently, as DISPLAY_CONTROLLER_DIR is
+# now obsolete..
+#
+$(eval $(call UserConfigMake,DISPLAY_CONTROLLER_DIR,3rdparty/$(DISPLAY_CONTROLLER_COMPONENT)))
diff --git a/sgx/eurasiacon/build/linux2/prepare_tree.mk b/sgx/eurasiacon/build/linux2/prepare_tree.mk
new file mode 100755
index 0000000..e1e18da
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/prepare_tree.mk
@@ -0,0 +1,47 @@
+#
+# 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
+#
+#
+
+-include $(OUT)/config.mk.new
+
+.PHONY: prepare_tree
+
+-include eurasiacon/build/linux2/kbuild/external_tarball.mk
+
+# If there's no external tarball, there's nothing to do
+#
+prepare_tree:
+
+INTERNAL_INCLUDED_PREPARE_HEADERS :=
+-include eurasiacon/build/linux2/prepare_headers.mk
+ifneq ($(INTERNAL_INCLUDED_PREPARE_HEADERS),true)
+missing_headers := $(strip $(shell test ! -e include4/pvrversion.h && echo true))
+ifdef missing_headers
+$(info )
+$(info ** include4/pvrversion.h is missing, and cannot be rebuilt.)
+$(info ** Cannot continue.)
+$(info )
+$(error Missing headers)
+endif
+endif
diff --git a/sgx/eurasiacon/build/linux2/this_makefile.mk b/sgx/eurasiacon/build/linux2/this_makefile.mk
new file mode 100755
index 0000000..2410804
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/this_makefile.mk
@@ -0,0 +1,53 @@
+#
+# 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
+#
+#
+
+# Find out the path of the Linux.mk makefile currently being processed, and
+# set paths used by the build rules
+
+# This magic is used so we can use this_makefile.mk twice: first when reading
+# in each Linux.mk, and then again when generating rules. There we set
+# $(THIS_MAKEFILE), and $(REMAINING_MAKEFILES) should be empty
+ifneq ($(strip $(REMAINING_MAKEFILES)),)
+
+# Absolute path to the Linux.mk being processed
+THIS_MAKEFILE := $(firstword $(REMAINING_MAKEFILES))
+
+# The list of makefiles left to process
+REMAINING_MAKEFILES := $(wordlist 2,$(words $(REMAINING_MAKEFILES)),$(REMAINING_MAKEFILES))
+
+else
+
+# When generating rules, we should have read in every Linux.mk
+$(if $(INTERNAL_INCLUDED_ALL_MAKEFILES),,$(error No makefiles left in $$(REMAINING_MAKEFILES), but $$(INTERNAL_INCLUDED_ALL_MAKEFILES) is not set))
+
+endif
+
+# Path to the directory containing Linux.mk
+THIS_DIR := $(patsubst %/,%,$(dir $(THIS_MAKEFILE)))
+ifeq ($(strip $(THIS_DIR)),)
+$(error Empty $$(THIS_DIR) for makefile "$(THIS_MAKEFILE)")
+endif
+
+modules :=
diff --git a/sgx/eurasiacon/build/linux2/tools/cc-check.sh b/sgx/eurasiacon/build/linux2/tools/cc-check.sh
new file mode 100755
index 0000000..ac7f9cb
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/tools/cc-check.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+usage() {
+ echo "usage: $0 [--64] --cc CC --out OUT [cflag]"
+ exit 1
+}
+
+do_cc() {
+ echo "int main(void){return 0;}" | $CC $1 -xc -c - -o $ccof 2>/dev/null
+}
+
+while [ 1 ]; do
+ if [ "$1" = "--64" ]; then
+ BIT_CHECK=1
+ elif [ "$1" = "--cc" ]; then
+ [ "x$2" = "x" ] && usage
+ CC="$2" && shift
+ elif [ "$1" = "--out" ]; then
+ [ "x$2" = "x" ] && usage
+ OUT="$2" && shift
+ elif [ "${1#--}" != "$1" ]; then
+ usage
+ else
+ break
+ fi
+ shift
+done
+
+[ "x$CC" = "x" ] && usage
+[ "x$OUT" = "x" ] && usage
+ccof=$OUT/cc-sanity-check
+
+if [ "x$BIT_CHECK" = "x1" ]; then
+ do_cc ""
+ file $ccof | grep -q 64-bit
+ [ "$?" = "0" ] && echo true || echo false
+else
+ [ "x$1" = "x" ] && usage
+ do_cc $1
+ [ "$?" = "0" ] && echo $1
+fi
+
+rm -f $ccof
+exit 0
diff --git a/sgx/eurasiacon/build/linux2/toplevel.mk b/sgx/eurasiacon/build/linux2/toplevel.mk
new file mode 100755
index 0000000..e9f8aca
--- /dev/null
+++ b/sgx/eurasiacon/build/linux2/toplevel.mk
@@ -0,0 +1,207 @@
+#
+# 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
+#
+#
+
+
+# Define the default goal. This masks a previous definition of the default
+# goal in Makefile.config, which must match this one
+.PHONY: build
+build: components kbuild scripts
+
+ifeq ($(OUT),)
+$(error "Must specify output directory with OUT=")
+endif
+
+ifeq ($(TOP),)
+$(error "Must specify root of source tree with TOP=")
+endif
+$(call directory-must-exist,$(TOP))
+
+# Output directory for configuration, object code,
+# final programs/libraries, and install/rc scripts.
+#
+
+# RELATIVE_OUT is relative only if it's under $(TOP)
+RELATIVE_OUT := $(patsubst $(TOP)/%,%,$(OUT))
+HOST_OUT := $(RELATIVE_OUT)/host
+TARGET_OUT := $(RELATIVE_OUT)/target
+CONFIG_MK := $(RELATIVE_OUT)/config.mk
+CONFIG_H := $(RELATIVE_OUT)/config.h
+CONFIG_KERNEL_MK := $(RELATIVE_OUT)/config_kernel.mk
+CONFIG_KERNEL_H := $(RELATIVE_OUT)/config_kernel.h
+MAKE_TOP := eurasiacon/build/linux2
+THIS_MAKEFILE := (top-level makefiles)
+
+include $(MAKE_TOP)/defs.mk
+
+ifneq ($(INTERNAL_CLOBBER_ONLY),true)
+# Create the out directory
+#
+$(shell mkdir -p $(OUT))
+
+# Provide rules to create $(HOST_OUT) and $(TARGET_OUT)
+.SECONDARY: $(HOST_OUT) $(TARGET_OUT)
+$(HOST_OUT) $(TARGET_OUT):
+ $(make-directory)
+
+# If these generated files differ from any pre-existing ones,
+# replace them, causing affected parts of the driver to rebuild.
+#
+$(shell \
+ for file in $(CONFIG_MK) $(CONFIG_H) \
+ $(CONFIG_KERNEL_MK) $(CONFIG_KERNEL_H); do \
+ diff -q $$file $$file.new >/dev/null 2>/dev/null \
+ && rm -f $$file.new \
+ || mv -f $$file.new $$file >/dev/null 2>/dev/null; \
+ done)
+endif
+
+MAKEFLAGS := -Rr --no-print-directory
+
+ifneq ($(INTERNAL_CLOBBER_ONLY),true)
+
+# This is so you can say "find $(TOP) -name Linux.mk > /tmp/something; export
+# ALL_MAKEFILES=/tmp/something; make" and avoid having to run find. This is
+# handy if your source tree is mounted over NFS or something
+override ALL_MAKEFILES := $(call relative-to-top,$(if $(strip $(ALL_MAKEFILES)),$(shell cat $(ALL_MAKEFILES)),$(shell find $(TOP) -type f -name Linux.mk)))
+ifeq ($(strip $(ALL_MAKEFILES)),)
+$(info ** Unable to find any Linux.mk files under $$(TOP). This could mean that)
+$(info ** there are no makefiles, or that ALL_MAKEFILES is set in the environment)
+$(info ** and points to a nonexistent or empty file.)
+$(error No makefiles)
+endif
+
+else # clobber-only
+ALL_MAKEFILES :=
+endif
+
+REMAINING_MAKEFILES := $(ALL_MAKEFILES)
+ALL_MODULES :=
+INTERNAL_INCLUDED_ALL_MAKEFILES :=
+
+ifneq ($(INTERNAL_CLOBBER_ONLY),true)
+-include $(CONFIG_MK)
+-include $(CONFIG_KERNEL_MK)
+# These files may not exist in GPL km source packages
+-include $(MAKE_TOP)/xorgconf.mk
+-include $(MAKE_TOP)/llvm.mk
+endif
+
+include $(MAKE_TOP)/commands.mk
+include $(MAKE_TOP)/buildvars.mk
+
+HOST_INTERMEDIATES := $(HOST_OUT)/intermediates
+TARGET_INTERMEDIATES := $(TARGET_OUT)/intermediates
+
+# Include each Linux.mk, then include modules.mk to save some information
+# about each module
+include $(foreach _Linux.mk,$(ALL_MAKEFILES),$(MAKE_TOP)/this_makefile.mk $(_Linux.mk) $(MAKE_TOP)/modules.mk)
+
+ifeq ($(strip $(REMAINING_MAKEFILES)),)
+INTERNAL_INCLUDED_ALL_MAKEFILES := true
+else
+$(error Impossible: $(words $(REMAINING_MAKEFILES)) makefiles were mysteriously ignored when reading $$(ALL_MAKEFILES))
+endif
+
+# At this point, all Linux.mks have been included. Now generate rules to build
+# each module: for each module in $(ALL_MODULES), set per-makefile variables
+$(foreach _m,$(ALL_MODULES),$(eval $(call process-module,$(_m))))
+
+.PHONY: kbuild scripts install
+kbuild scripts install:
+
+ifneq ($(INTERNAL_CLOBBER_ONLY),true)
+-include $(MAKE_TOP)/scripts.mk
+-include $(MAKE_TOP)/kbuild/kbuild.mk
+else
+# We won't depend on 'build' here so that people can build subsets of
+# components and still have the install script attempt to install the
+# subset.
+install:
+ @if [ ! -d "$(DISCIMAGE)" ]; then \
+ echo; \
+ echo "** DISCIMAGE was not set or does not point to a valid directory."; \
+ echo "** Cannot continue with install."; \
+ echo; \
+ exit 1; \
+ fi
+ @if [ ! -f $(TARGET_OUT)/install.sh ]; then \
+ echo; \
+ echo "** install.sh not found in $(TARGET_OUT)."; \
+ echo "** Cannot continue with install."; \
+ echo; \
+ exit 1; \
+ fi
+ @cd $(TARGET_OUT) && ./install.sh
+endif
+
+# You can say 'make all_modules' to attempt to make everything, or 'make
+# components' to only make the things which are listed (in the per-build
+# makefiles) as components of the build. 'make scripts' generates the
+# install.sh and rc.pvr scripts.
+.PHONY: all_modules components scripts
+all_modules: $(ALL_MODULES)
+components: $(COMPONENTS)
+
+# 'make opk' builds the OEM Porting Kit. The build should set OPK_COMPONENTS
+# in components.mk if it should be possible to build the OPK for it
+.PHONY: opk
+ifneq ($(strip $(OPK_COMPONENTS)),)
+opk: $(OPK_COMPONENTS)
+
+opk_clobber: MODULE_DIRS_TO_REMOVE := $(addprefix $(OUT)/target/intermediates/,$(OPK_COMPONENTS))
+opk_clobber: OPK_OUTFILES := $(addprefix $(RELATIVE_OUT)/target/,$(foreach _c,$(OPK_COMPONENTS),$(if $($(_c)_target),$($(_c)_target),$(error Module $(_c) must be a shared library which sets $$($(_c)_target) for OPK clobbering))))
+opk_clobber:
+ $(clean-dirs)
+ $(if $(V),,@echo " RM " $(call relative-to-top,$(OPK_OUTFILES)))
+ $(RM) -f $(OPK_OUTFILES)
+else
+# OPK_COMPONENTS is empty or unset
+opk:
+ @echo
+ @echo "** This build ($(PVR_BUILD_DIR)) is unable to build the OPK, because"
+ @echo "** OPK_COMPONENTS is empty or unset. Cannot continue."
+ @echo
+ @false
+endif
+
+# Cleaning
+.PHONY: clean clobber
+clean: MODULE_DIRS_TO_REMOVE := $(OUT)/host/intermediates $(OUT)/target/intermediates $(OUT)/target/kbuild
+clean:
+ $(clean-dirs)
+clobber: MODULE_DIRS_TO_REMOVE := $(OUT)
+clobber:
+ $(clean-dirs)
+
+# Saying 'make clean-MODULE' removes the intermediates for MODULE.
+# clobber-MODULE deletes the output files as well
+clean-%:
+ $(if $(V),,@echo " RM " $(call relative-to-top,$(OUT)/host/intermediates/$* $(OUT)/target/intermediates/$*))
+ $(RM) -rf $(OUT)/host/intermediates/$*/* $(OUT)/target/intermediates/$*/*
+clobber-%:
+ $(if $(V),,@echo " RM " $(call relative-to-top,$(OUT)/host/intermediates/$* $(OUT)/target/intermediates/$* $(INTERNAL_TARGETS_FOR_$*)))
+ $(RM) -rf $(OUT)/host/intermediates/$* $(OUT)/target/intermediates/$* $(INTERNAL_TARGETS_FOR_$*)
+
+include $(MAKE_TOP)/bits.mk