Index: /trunk/Config.kmk
===================================================================
--- /trunk/Config.kmk	(revision 53978)
+++ /trunk/Config.kmk	(revision 53979)
@@ -695,5 +695,5 @@
 #VBOX_WITH_EXTPACK_VNC = 1
 # Enables the VBoxDTrace extension pack.
-VBOX_WITH_EXTPACK_VBOXDTRACE = 1
+#VBOX_WITH_EXTPACK_VBOXDTRACE = 1
 ## @}
 
Index: /trunk/src/VBox/ExtPacks/Makefile.kmk
===================================================================
--- /trunk/src/VBox/ExtPacks/Makefile.kmk	(revision 53978)
+++ /trunk/src/VBox/ExtPacks/Makefile.kmk	(revision 53979)
@@ -5,5 +5,5 @@
 
 #
-# Copyright (C) 2010-2012 Oracle Corporation
+# Copyright (C) 2010-2016 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
@@ -22,4 +22,12 @@
  include $(PATH_SUB_CURRENT)/Puel/Makefile.kmk
 endif
+if    defined(VBOX_WITH_EXTPACK_VBOXDTRACE) \
+   || defined(VBOX_WITH_DTRACE) \
+   || defined(VBOX_WITH_DTRACE_R3) \
+   || defined(VBOX_WITH_DTRACE_R0) \
+   || defined(VBOX_WITH_DTRACE_R0DRV) \
+   || defined(VBOX_WITH_DTRACE_RC)
+ include $(PATH_SUB_CURRENT)/VBoxDTrace/Makefile.kmk
+endif
 ifdef VBOX_WITH_EXTPACK_VNC
  include $(PATH_SUB_CURRENT)/VNC/Makefile.kmk
Index: /trunk/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk
===================================================================
--- /trunk/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk	(revision 53978)
+++ /trunk/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk	(revision 53979)
@@ -44,8 +44,9 @@
 
 
-#
-# Extend the extension pack templates.
-#
 ifdef VBOX_WITH_EXTPACK_VBOXDTRACE
+
+ #
+ # Extend the extension pack templates.
+ #
  TEMPLATE_VBoxR3ExtPackDTrace = For the ring-3 context modules in the VBoxDTrace extension pack.
  TEMPLATE_VBoxR3ExtPackDTrace_EXTENDS = VBoxR3ExtPack
@@ -59,239 +60,238 @@
  TEMPLATE_VBoxInsExtPackDTrace_EXTENDS = VBoxR0ExtPack
  TEMPLATE_VBoxInsExtPackDTrace_INST = $(INST_EXTPACK_VBOXDTRACE)
-endif
-
-
-#
-# Install the description.
-#
-INSTALLS += VBoxDTraceIns
-VBoxDTraceIns_TEMPLATE = VBoxInsExtPackDTrace
-VBoxDTraceIns_SOURCES = \
-	$(VBoxDTraceIns_0_OUTDIR)/ExtPack.xml \
-	COPYING=>ExtPack-SourceCodeLicense.txt
-$(call VBOX_EDIT_VERSION_RULE_FN,VBoxDTraceIns,ExtPack.xml)
-
-
-#
-# VBoxDTraceMain - The module which the VirtualBox Main API talks to.
-#
-DLLS += VBoxDTraceMain
-VBoxDTraceMain_TEMPLATE = VBoxR3ExtPackDTrace
-VBoxDTraceMain_SOURCES = VBoxDTraceMain.cpp
-
-
-#
-# The ring-3 VBoxDTrace command implementation (library).
-#
-DLLS += VBoxDTraceCmd
-VBoxDTraceCmd_TEMPLATE = VBoxR3ExtPackDTrace
-VBoxDTraceCmd_DEFS = RTMEM_WRAP_TO_EF_APIS
-#VBoxDTraceCmd_DEFS += YYDEBUG
-VBoxDTraceCmd_SDKS = VBOX_ZLIB
-ifn1of ($(KBUILD_TARGET), win)
- VBoxDTraceCmd_CFLAGS = -Wno-format -Wno-overlength-strings -Wno-sign-compare -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow
-endif
-VBoxDTraceCmd_INCS = \
-	include \
-	$(VBOXDT_PATH_UTS)/common \
-	$(VBOXDT_PATH_LIBCTF)/common \
-	$(VBOXDT_PATH_LIBDTRACE)/common \
-	$(VBOXDT_PATH_CMN_CTF)
-VBoxDTraceCmd_SOURCES = \
-	$(VBOXDT_PATH_CMD)/dtrace/dtrace.c \
-	\
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_cc.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_cg.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_consume.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_decl.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_dis.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_dof.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_handle.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_ident.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_inttab.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_map.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_module.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_program.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_parser.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pcb.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pragma.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_provider.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_string.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c \
-	\
-	$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c \
-	$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c \
-	\
-	$(VBOXDT_PATH_CMN_CTF)/ctf_create.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_error.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_decl.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_hash.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_labels.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_lookup.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_open.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_types.c \
-	$(VBOXDT_PATH_CMN_CTF)/ctf_util.c \
-	\
-	$(VBOXDT_PATH_LIBCTF)/common/ctf_subr.c \
-	$(VBOXDT_PATH_LIBCTF)/common/ctf_lib.c
-
-if 1
- USES                   += yacc
- VBoxDTraceCmd_USES     += yacc
- VBoxDTraceCmd_YACCTOOL  = BISON
- VBoxDTraceCmd_YACCFLAGS = -d -y
- VBoxDTraceCmd_SOURCES  += \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_grammar.y
- VBoxDTraceCmd_INCS     += $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common
-else
- # TODO: generate these.
-endif
-
-if 1
- USES                   += lex
- VBoxDTraceCmd_USES     += lex
- VBoxDTraceCmd_LEXTOOL   = FLEX
- VBoxDTraceCmd_LEXFLAGS  = -l -B #-d -T
- VBoxDTraceCmd_DEFS     += USING_FLEX
- VBoxDTraceCmd_SOURCES  += \
-	$(VBOXDT_PATH_LIBDTRACE)/common/dt_lex.l
-else
- # TODO: generate this.
-endif
-
-VBoxDTraceCmd_LIBS = \
-	$(LIB_RUNTIME)
+
+
+ #
+ # Install the description.
+ #
+ INSTALLS += VBoxDTraceIns
+ VBoxDTraceIns_TEMPLATE = VBoxInsExtPackDTrace
+ VBoxDTraceIns_SOURCES = \
+ 	$(VBoxDTraceIns_0_OUTDIR)/ExtPack.xml \
+ 	COPYING=>ExtPack-SourceCodeLicense.txt
+ $(call VBOX_EDIT_VERSION_RULE_FN,VBoxDTraceIns,ExtPack.xml)
+
+
+ #
+ # VBoxDTraceMain - The module which the VirtualBox Main API talks to.
+ #
+ DLLS += VBoxDTraceMain
+ VBoxDTraceMain_TEMPLATE = VBoxR3ExtPackDTrace
+ VBoxDTraceMain_SOURCES = VBoxDTraceMain.cpp
+
+
+ #
+ # The ring-3 VBoxDTrace command implementation (library).
+ #
+ DLLS += VBoxDTraceCmd
+ VBoxDTraceCmd_TEMPLATE = VBoxR3ExtPackDTrace
+ VBoxDTraceCmd_DEFS = RTMEM_WRAP_TO_EF_APIS
+ #VBoxDTraceCmd_DEFS += YYDEBUG
+ VBoxDTraceCmd_SDKS = VBOX_ZLIB
+ ifn1of ($(KBUILD_TARGET), win)
+  VBoxDTraceCmd_CFLAGS = -Wno-format -Wno-overlength-strings -Wno-sign-compare -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow
+ endif
+ VBoxDTraceCmd_INCS = \
+ 	include \
+ 	$(VBOXDT_PATH_UTS)/common \
+ 	$(VBOXDT_PATH_LIBCTF)/common \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common \
+ 	$(VBOXDT_PATH_CMN_CTF)
+ VBoxDTraceCmd_SOURCES = \
+ 	$(VBOXDT_PATH_CMD)/dtrace/dtrace.c \
+ 	\
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_cc.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_cg.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_consume.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_decl.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_dis.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_dof.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_handle.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_ident.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_inttab.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_map.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_module.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_program.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_parser.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pcb.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pragma.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_provider.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_string.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c \
+ 	\
+ 	$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c \
+ 	$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c \
+ 	\
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_create.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_error.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_decl.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_hash.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_labels.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_lookup.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_open.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_types.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_util.c \
+ 	\
+ 	$(VBOXDT_PATH_LIBCTF)/common/ctf_subr.c \
+ 	$(VBOXDT_PATH_LIBCTF)/common/ctf_lib.c
+
+ if 1
+  USES                   += yacc
+  VBoxDTraceCmd_USES     += yacc
+  VBoxDTraceCmd_YACCTOOL  = BISON
+  VBoxDTraceCmd_YACCFLAGS = -d -y
+  VBoxDTraceCmd_SOURCES  += \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_grammar.y
+  VBoxDTraceCmd_INCS     += $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common
+ else
+  # TODO: generate these.
+ endif
+
+ if 1
+  USES                   += lex
+  VBoxDTraceCmd_USES     += lex
+  VBoxDTraceCmd_LEXTOOL   = FLEX
+  VBoxDTraceCmd_LEXFLAGS  = -l -B #-d -T
+  VBoxDTraceCmd_DEFS     += USING_FLEX
+  VBoxDTraceCmd_SOURCES  += \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_lex.l
+ else
+  # TODO: generate this.
+ endif
+
+ VBoxDTraceCmd_LIBS = \
+ 	$(LIB_RUNTIME)
 
 
 # Generate sources
-$$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c: \
-		$(VBOXDT_PATH_LIBDTRACE)/common/dt_errtags.h \
-		$(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed \
-		| $$(dir $$@)
+ $$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c: \
+ 		$(VBOXDT_PATH_LIBDTRACE)/common/dt_errtags.h \
+ 		$(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed \
+ 		| $$(dir $$@)
 	$(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
 	$(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed --output $@ $<
 
-$$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c: \
-		$(VBOXDT_PATH_UTS)/common/sys/dtrace.h \
-		$(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed \
-		| $$(dir $$@)
+ $$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c: \
+ 		$(VBOXDT_PATH_UTS)/common/sys/dtrace.h \
+ 		$(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed \
+ 		| $$(dir $$@)
 	$(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
 	$(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed --output $@ $<
 
 
-#
-# Source not used or wanted: \
-#	$(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c
-#	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pid.c
-#
-
-
-#
-# The ring-0 part of VBoxDTrace.
-#
-SYSMODS += VBoxDTraceR0
-VBoxDTraceR0_TEMPLATE = VBoxR0ExtPackDTrace
-VBoxDTraceR0_DEFS = IN_VBOXDTRACE_R0 IN_RT_R0
-ifeq ($(VBOX_LDR_FMT),elf)
- VBoxDTraceR0_LDFLAGS = -e ModuleInit
-endif
-VBoxDTraceR0_INCS = \
-	include \
-	$(VBOXDT_PATH_UTS)/common
-VBoxDTraceR0_SOURCES = \
-	VBoxDTraceR0.cpp \
-	VBoxDTraceR0A.asm \
-	$(VBOXDT_PATH_UTS)/common/dtrace/dtrace.c
-VBoxDTraceR0_LIBS = \
-	$(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
-ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
- VBoxDTraceR0_LIBS += \
- 	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
-endif
-
-
-#
-# Packing.
-#
-ifndef VBOX_WITHOUT_EXTPACK_VBOXDTRACE_PACKING
- PACKING += $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack
-endif
-
-ifndef VBOX_WITH_EXTPACK_OS_ARCHS
- ifeq ($(USER),bird) # for now
-  VBOX_WITH_EXTPACK_OS_ARCHS = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
- endif
-endif
-
-# Build the file list.  The macro takes 1=darwin.x86, 2=dist/VirtualBox.app/Contents/MacOS, 3=dylib
-VBOX_VBOXDTRACE_FILES_MACRO = \
-	$(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceMain.$(3)=>$(1)/VBoxDTraceMain.$(3) \
-	$(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceCmd.$(3)=>$(1)/VBoxDTraceCmd.$(3) \
-	$(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceR0.r0=>$(1)/VBoxDTraceR0.r0
-
-VBOX_VBOXDTRACE_FILES := \
-	$(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack.xml=>ExtPack.xml \
-	$(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack-SourceCodeLicense.txt=>ExtPack-SourceCodeLicense.txt
-
-if1of (darwin.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.amd64,dist/VirtualBox.app/Contents/MacOS,dylib)
-endif
-if1of (darwin.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.x86,dist/VirtualBox.app/Contents/MacOS,dylib)
-endif
-if1of (freebsd.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.amd64,bin,so)
-endif
-if1of (freebsd.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.x86,bin,so)
-endif
-if1of (linux.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.amd64,bin,so)
-endif
-if1of (linux.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.x86,bin,so)
-endif
-if1of (os2.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,os2.x86,bin,so)
-endif
-if1of (solaris.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.amd64,bin,so)
-endif
-if1of (solaris.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.x86,bin,so)
-endif
-if1of (win.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.amd64,bin,dll)
-endif
-if1of (win.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
- VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.x86,bin,dll)
-endif
-
-# Pack it all up using a temporary staging directory.
-$(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack: \
-		$$(foreach file, $$(VBOX_VBOXDTRACE_FILES), $$(firstword $$(subst =>,$$(SP),$$(file)))) \
-		| $(VBOX_PATH_PACKAGES)/
+ #
+ # Source not used or wanted: \
+ #	$(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c
+ #	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pid.c
+ #
+
+
+ #
+ # The ring-0 part of VBoxDTrace.
+ #
+ SYSMODS += VBoxDTraceR0
+ VBoxDTraceR0_TEMPLATE = VBoxR0ExtPackDTrace
+ VBoxDTraceR0_DEFS = IN_VBOXDTRACE_R0 IN_RT_R0
+ ifeq ($(VBOX_LDR_FMT),elf)
+  VBoxDTraceR0_LDFLAGS = -e ModuleInit
+ endif
+ VBoxDTraceR0_INCS = \
+ 	include \
+ 	$(VBOXDT_PATH_UTS)/common
+ VBoxDTraceR0_SOURCES = \
+ 	VBoxDTraceR0.cpp \
+ 	VBoxDTraceR0A.asm \
+ 	$(VBOXDT_PATH_UTS)/common/dtrace/dtrace.c
+ VBoxDTraceR0_LIBS = \
+ 	$(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
+ ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
+  VBoxDTraceR0_LIBS += \
+  	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
+ endif
+
+
+ #
+ # Packing.
+ #
+ ifndef VBOX_WITHOUT_EXTPACK_VBOXDTRACE_PACKING
+  PACKING += $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack
+ endif
+
+ ifndef VBOX_WITH_EXTPACK_OS_ARCHS
+  ifeq ($(USER),bird) # for now
+   VBOX_WITH_EXTPACK_OS_ARCHS = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
+  endif
+ endif
+
+ # Build the file list.  The macro takes 1=darwin.x86, 2=dist/VirtualBox.app/Contents/MacOS, 3=dylib
+ VBOX_VBOXDTRACE_FILES_MACRO = \
+ 	$(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceMain.$(3)=>$(1)/VBoxDTraceMain.$(3) \
+ 	$(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceCmd.$(3)=>$(1)/VBoxDTraceCmd.$(3) \
+ 	$(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceR0.r0=>$(1)/VBoxDTraceR0.r0
+
+ VBOX_VBOXDTRACE_FILES := \
+ 	$(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack.xml=>ExtPack.xml \
+ 	$(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack-SourceCodeLicense.txt=>ExtPack-SourceCodeLicense.txt
+
+ if1of (darwin.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.amd64,dist/VirtualBox.app/Contents/MacOS,dylib)
+ endif
+ if1of (darwin.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.x86,dist/VirtualBox.app/Contents/MacOS,dylib)
+ endif
+ if1of (freebsd.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.amd64,bin,so)
+ endif
+ if1of (freebsd.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.x86,bin,so)
+ endif
+ if1of (linux.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.amd64,bin,so)
+ endif
+ if1of (linux.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.x86,bin,so)
+ endif
+ if1of (os2.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,os2.x86,bin,so)
+ endif
+ if1of (solaris.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.amd64,bin,so)
+ endif
+ if1of (solaris.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.x86,bin,so)
+ endif
+ if1of (win.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.amd64,bin,dll)
+ endif
+ if1of (win.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.x86,bin,dll)
+ endif
+
+ # Pack it all up using a temporary staging directory.
+ $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack: \
+ 		$$(foreach file, $$(VBOX_VBOXDTRACE_FILES), $$(firstword $$(subst =>,$$(SP),$$(file)))) \
+ 		| $(VBOX_PATH_PACKAGES)/
 	$(RM) -f $(wildcard $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-*.vbox-extpack) \
 		$(VBoxDTraceIns_0_OUTDIR)/ExtPack.manifest \
 		$(VBoxDTraceIns_0_OUTDIR)/ExtPack.signature
-# Stage all the files
+ # Stage all the files
 	$(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
 	$(foreach file, $(VBOX_VBOXDTRACE_FILES),\
 		$(NLTAB)$(MKDIR) -p $(dir $(lastword $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)))) \
 		$(NLTAB)$(CP) $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)) )
-# Create the manifest
+ # Create the manifest
 	$(VBOX_RTMANIFEST) \
 		--manifest $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
@@ -302,11 +302,12 @@
 		$(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
 		$(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.signature
-# Tar it up.
+ # Tar it up.
 	tar -cvf - -C $(VBoxDTraceIns_0_OUTDIR)/Stage/ . | gzip -9c > $@
-# Clean up
+ # Clean up
 	$(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
 
-BLDDIRS += $(VBOX_PATH_PACKAGES)/
-
+ BLDDIRS += $(VBOX_PATH_PACKAGES)/
+
+endif # VBOX_WITH_EXTPACK_VBOXDTRACE
 
 include $(FILE_KBUILD_SUB_FOOTER)
