[vbox-dev] NetBSD patch 0018: Add support in Makefile.kmk to build RuntimeR0Drv for NetBSD

Kamil Rytarowski n54 at gmx.com
Sat Aug 13 15:38:25 GMT 2016


Add support in Makefile.kmk to build RuntimeR0Drv for NetBSD

There are several changes:
 - we need to build this code with the _KERNEL symbol defined
   in order to enable kernel specific interfaces

 - add include path /usr/src/sys to handle the <sys/*.h> header space
   the /usr/src path is the standard to keep the system sources
   kernel headers are stored in /usr/src/sys/sys/*.h

 - simulate the <machine/*.h> and <x86/*.h> header space by cherry-picking
   files and putting to a local machine/ and x86/ directories
   normally this part is done automatically by NetBSD source build scripts
   and as we are building out-of-them we need to do it on our own
   machine headers are stored in /usr/src/sys/arch/amd64/include/*.h
   x86 headers are stored in /usr/src/sys/arch/x86/include/*.h

At the moment head only for the amd64 support.

This patch is MIT-licensed.

Author: Kamil Rytarowski
-------------- next part --------------
Add support in Makefile.kmk to build RuntimeR0Drv for NetBSD

There are several changes:
 - we need to build this code with the _KERNEL symbol defined
   in order to enable kernel specific interfaces

 - add include path /usr/src/sys to handle the <sys/*.h> header space
   the /usr/src path is the standard to keep the system sources
   kernel headers are stored in /usr/src/sys/sys/*.h

 - simulate the <machine/*.h> and <x86/*.h> header space by cherry-picking
   files and putting to a local machine/ and x86/ directories
   normally this part is done automatically by NetBSD source build scripts
   and as we are building out-of-them we need to do it on our own
   machine headers are stored in /usr/src/sys/arch/amd64/include/*.h
   x86 headers are stored in /usr/src/sys/arch/x86/include/*.h

At the moment head only for the amd64 support.

This patch is MIT-licensed.

Author: Kamil Rytarowski

Index: src/VBox/Runtime/Makefile.kmk
===================================================================
--- src/VBox/Runtime/Makefile.kmk	(wersja 63343)
+++ src/VBox/Runtime/Makefile.kmk	(kopia robocza)
@@ -1978,6 +1978,7 @@
 RuntimeR0Drv_DEFS       = IN_RT_R0 RT_WITH_VBOX RT_WITHOUT_NOCRT_WRAPPERS RT_NO_EXPORT_SYMBOL
 RuntimeR0Drv_DEFS.win   = IN_SUP_R0 LDR_ONLY_PE
 RuntimeR0Drv_DEFS.linux = MODULE KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) IN_SUP_R0
+RuntimeR0Drv_DEFS.netbsd = _KERNEL
 
 RuntimeR0Drv_INCS      := $(PATH_SUB_CURRENT) include
 RuntimeR0Drv_INCS.freebsd = \
@@ -1984,6 +1985,8 @@
 	$(PATH_STAGE)/gen-sys-hdrs
 RuntimeR0Drv_INCS.linux = \
 	r0drv/linux
+RuntimeR0Drv_INCS.netbsd  = \
+	/usr/src/sys
 RuntimeR0Drv_INCS.solaris = \
 	r0drv/solaris/vbi/i86pc \
 	r0drv/solaris/vbi/i86pc/sys
@@ -2514,7 +2517,18 @@
 	$(PATH_STAGE)/gen-sys-hdrs/bus_if.h \
 	$(PATH_STAGE)/gen-sys-hdrs/device_if.h
 
+RuntimeR0Drv_ORDERDEPS.netbsd = \
+	$(PATH_STAGE)/machine/bus_defs.h \
+	$(PATH_STAGE)/machine/bus_funcs.h \
+	$(PATH_STAGE)/machine/cpufunc.h \
+	$(PATH_STAGE)/machine/pic.h \
+	$(PATH_STAGE)/x86/bus_defs.h \
+	$(PATH_STAGE)/x86/bus_funcs.h \
+	$(PATH_STAGE)/x86/busdefs.h \
+	$(PATH_STAGE)/x86/cpufunc.h \
+	$(PATH_STAGE)/x86/pic.h
 
+
 #
 # RuntimeGuestR0 - Guest driver runtime.
 #                  This is almost the same as the RuntimeR0Drv, the main difference
@@ -2830,6 +2844,56 @@
 endif # FreeBSD
 
 
+if "$(KBUILD_TARGET)" == "netbsd"
+# Cherry-pick useful headers and simulate the <machine/*.h> header space
+INSTALLS += NetBSDGeneratedKernelHeadersMachine
+NetBSDGeneratedKernelHeadersMachine_INST = machine/
+NetBSDGeneratedKernelHeadersMachine_SOURCES = \
+	$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/bus_defs.h \
+	$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/bus_funcs.h \
+	$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/cpufunc.h \
+	$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/pic.h
+NetBSDGeneratedKernelHeadersMachine_CLEAN = $(NetBSDGeneratedKernelHeadersMachine_SOURCES)
+
+$$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/bus_defs.h: /usr/src/sys/arch/amd64/include/bus_defs.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/bus_defs.h
+
+$$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/bus_funcs.h: /usr/src/sys/arch/amd64/include/bus_funcs.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/bus_funcs.h
+
+$$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/cpufunc.h: /usr/src/sys/arch/amd64/include/cpufunc.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/cpufunc.h
+
+$$(NetBSDGeneratedKernelHeadersMachine_0_OUTDIR)/pic.h: /usr/src/sys/arch/amd64/include/pic.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/pic.h
+
+# Cherry-pick useful headers and simulate the <x86/*.h> header space
+INSTALLS += NetBSDGeneratedKernelHeadersX86
+NetBSDGeneratedKernelHeadersX86_INST = x86/
+NetBSDGeneratedKernelHeadersX86_SOURCES = \
+	$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/bus_defs.h \
+	$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/bus_funcs.h \
+	$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/busdefs.h \
+	$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/cpufunc.h \
+	$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/pic.h
+NetBSDGeneratedKernelHeadersX86_CLEAN = $(NetBSDGeneratedKernelHeadersX86_SOURCES)
+
+$$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/bus_defs.h: /usr/src/sys/arch/x86/include/bus_defs.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/bus_defs.h
+
+$$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/bus_funcs.h: /usr/src/sys/arch/x86/include/bus_funcs.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/bus_funcs.h
+
+$$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/busdefs.h: /usr/src/sys/arch/x86/include/busdefs.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/busdefs.h
+
+$$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/cpufunc.h: /usr/src/sys/arch/x86/include/cpufunc.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/cpufunc.h
+
+$$(NetBSDGeneratedKernelHeadersX86_0_OUTDIR)/pic.h: /usr/src/sys/arch/x86/include/pic.h | $$(dir $$@)
+	$(QUIET)$(CP) -f $< $(@D)/pic.h
+endif # NetBSD
+
 #
 # Aliases for .cpp.h files so we can more easily do syntax checking from the editor.
 #
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20160813/433d9e12/attachment.sig>


More information about the vbox-dev mailing list