Index: trunk/src/VBox/Additions/linux/module/Makefile.module
===================================================================
--- trunk/src/VBox/Additions/linux/module/Makefile.module	(revision 11512)
+++ trunk/src/VBox/Additions/linux/module/Makefile.module	(revision 11519)
@@ -18,4 +18,42 @@
 # additional information or have any questions.
 #
+
+#
+# First, figure out which architecture we're targeting and the build type.
+# (We have to support basic cross building (ARCH=i386|x86_64).)
+# While at it, warn about BUILD_* vars found to help with user problems.
+#
+ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
+ $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
+ BUILD_TARGET_ARCH :=
+endif
+ifeq ($(BUILD_TARGET_ARCH),)
+ ifeq ($(ARCH),x86_64)
+  BUILD_TARGET_ARCH := amd64
+ else
+  ifeq ($(ARCH),i386)
+   BUILD_TARGET_ARCH := x86
+  else
+   ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
+    BUILD_TARGET_ARCH := amd64
+   else
+    BUILD_TARGET_ARCH := x86
+   endif
+  endif
+ endif
+else
+ $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
+endif
+
+ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
+ $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
+ BUILD_TYPE :=
+endif
+ifeq ($(BUILD_TYPE),)
+ BUILD_TYPE := release
+else
+ $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
+endif
+
 
 # override is required by the Debian guys
@@ -48,4 +86,9 @@
 	strformattype.o \
 	strformat-vbox.o
+ifeq ($(BUILD_TARGET_ARCH),amd64)
+OBJS += \
+	alloc/heapsimple.o \
+	r0drv/linux/spinlock-r0drv-linux.o
+endif
 
 ifneq ($(MAKECMDGOALS),clean)
Index: trunk/src/VBox/Additions/linux/module/files_vboxadd
===================================================================
--- trunk/src/VBox/Additions/linux/module/files_vboxadd	(revision 11512)
+++ trunk/src/VBox/Additions/linux/module/files_vboxadd	(revision 11519)
@@ -27,8 +27,10 @@
     ${PATH_ROOT}/include/iprt/ctype.h=>include/iprt/ctype.h \
     ${PATH_ROOT}/include/iprt/err.h=>include/iprt/err.h \
+    ${PATH_ROOT}/include/iprt/heap.h=>include/iprt/heap.h \
     ${PATH_ROOT}/include/iprt/log.h=>include/iprt/log.h \
     ${PATH_ROOT}/include/iprt/mem.h=>include/iprt/mem.h \
     ${PATH_ROOT}/include/iprt/param.h=>include/iprt/param.h \
     ${PATH_ROOT}/include/iprt/semaphore.h=>include/iprt/semaphore.h \
+    ${PATH_ROOT}/include/iprt/spinlock.h=>include/iprt/spinlock.h \
     ${PATH_ROOT}/include/iprt/stdarg.h=>include/iprt/stdarg.h \
     ${PATH_ROOT}/include/iprt/stdint.h=>include/iprt/stdint.h \
@@ -55,4 +57,5 @@
     ${PATH_ROOT}/src/VBox/Runtime/include/internal/magics.h=>include/internal/magics.h \
     ${PATH_ROOT}/src/VBox/Runtime/include/internal/string.h=>include/internal/string.h \
+    ${PATH_ROOT}/src/VBox/Runtime/common/alloc/heapsimple.cpp=>alloc/heapsimple.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp=>RTErrConvertToErrno.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/log/logformat.cpp=>logformat.c \
@@ -73,4 +76,5 @@
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c=>r0drv/linux/semeventmulti-r0drv-linux.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c=>r0drv/linux/semfastmutex-r0drv-linux.c \
+    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c=>r0drv/linux/spinlock-r0drv-linux.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/string.h=>r0drv/linux/string.h \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h=>r0drv/linux/the-linux-kernel.h \
Index: trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module	(revision 11512)
+++ trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module	(revision 11519)
@@ -18,4 +18,42 @@
 # additional information or have any questions.
 #
+
+#
+# First, figure out which architecture we're targeting and the build type.
+# (We have to support basic cross building (ARCH=i386|x86_64).)
+# While at it, warn about BUILD_* vars found to help with user problems.
+#
+ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
+ $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
+ BUILD_TARGET_ARCH :=
+endif
+ifeq ($(BUILD_TARGET_ARCH),)
+ ifeq ($(ARCH),x86_64)
+  BUILD_TARGET_ARCH := amd64
+ else
+  ifeq ($(ARCH),i386)
+   BUILD_TARGET_ARCH := x86
+  else
+   ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
+    BUILD_TARGET_ARCH := amd64
+   else
+    BUILD_TARGET_ARCH := x86
+   endif
+  endif
+ endif
+else
+ $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
+endif
+
+ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
+ $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
+ BUILD_TYPE :=
+endif
+ifeq ($(BUILD_TYPE),)
+ BUILD_TYPE := release
+else
+ $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
+endif
+
 
 # override is required by the Debian guys
Index: trunk/src/VBox/Additions/linux/sharedfolders/files_vboxvfs
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/files_vboxvfs	(revision 11512)
+++ trunk/src/VBox/Additions/linux/sharedfolders/files_vboxvfs	(revision 11519)
@@ -26,4 +26,5 @@
     ${PATH_ROOT}/include/iprt/err.h=>include/iprt/err.h \
     ${PATH_ROOT}/include/iprt/fs.h=>include/iprt/fs.h \
+    ${PATH_ROOT}/include/iprt/heap.h=>include/iprt/heap.h \
     ${PATH_ROOT}/include/iprt/log.h=>include/iprt/log.h \
     ${PATH_ROOT}/include/iprt/mem.h=>include/iprt/mem.h \
@@ -31,4 +32,5 @@
     ${PATH_ROOT}/include/iprt/path.h=>include/iprt/path.h \
     ${PATH_ROOT}/include/iprt/semaphore.h=>include/iprt/semaphore.h \
+    ${PATH_ROOT}/include/iprt/spinlock.h=>include/iprt/spinlock.h \
     ${PATH_ROOT}/include/iprt/stdarg.h=>include/iprt/stdarg.h \
     ${PATH_ROOT}/include/iprt/stdint.h=>include/iprt/stdint.h \
