summaryrefslogtreecommitdiffstats
path: root/src/VBox/HostDrivers/linux
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/HostDrivers/linux')
-rw-r--r--src/VBox/HostDrivers/linux/Makefile248
-rw-r--r--src/VBox/HostDrivers/linux/Makefile.kmk50
-rwxr-xr-xsrc/VBox/HostDrivers/linux/build_in_tmp104
-rwxr-xr-xsrc/VBox/HostDrivers/linux/export_modules.sh258
-rwxr-xr-xsrc/VBox/HostDrivers/linux/load.sh65
-rwxr-xr-xsrc/VBox/HostDrivers/linux/loadall.sh85
6 files changed, 810 insertions, 0 deletions
diff --git a/src/VBox/HostDrivers/linux/Makefile b/src/VBox/HostDrivers/linux/Makefile
new file mode 100644
index 00000000..c32cb136
--- /dev/null
+++ b/src/VBox/HostDrivers/linux/Makefile
@@ -0,0 +1,248 @@
+#
+# Makefile for the VirtualBox Linux Host Drivers.
+#
+
+#
+# Copyright (C) 2008-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# 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, see <https://www.gnu.org/licenses>.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+# in the VirtualBox distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+#
+
+ifneq ($(KERNELRELEASE),)
+
+# Building from kBuild (make -C <kernel_directory> M=`pwd`),
+# or inside a kernel source tree.
+
+obj-m = vboxdrv/
+ ifneq ($(wildcard $(CURDIR)/vboxnetflt/Makefile),)
+obj-m += vboxnetflt/
+ endif
+ ifneq ($(wildcard $(CURDIR)/vboxnetadp/Makefile),)
+obj-m += vboxnetadp/
+ endif
+ ifneq ($(wildcard $(CURDIR)/vboxpci/Makefile),)
+obj-m += vboxpci/
+ endif
+
+else # ! KERNELRELEASE
+
+# convenience Makefile without KERNELRELEASE
+
+ifndef SUDO
+ ifneq ($(shell id -u),0)
+SUDO := $(firstword $(wildcard /usr/bin/sudo /bin/sudo /usr/sbin/sudo))
+ else
+SUDO :=
+ endif
+endif
+
+KBUILD_VERBOSE ?=
+.PHONY: all install clean check unload load \
+ vboxdrv vboxnetflt vboxnetadp vboxpci \
+ install-vboxdrv install-vboxnetflt install-vboxnetadp install-vboxpci \
+ clean-vboxdrv clean-vboxnetflt clean-vboxnetadp clean-vboxpci
+
+all: vboxdrv vboxnetflt vboxnetadp vboxpci
+
+# We want to build on Linux 2.6.18 and later kernels.
+KERN_VER ?= $(shell uname -r)
+ ifneq ($(filter-out 1.% 2.0.% 2.1.% 2.2.% 2.3.% 2.4.% 2.5.%,$(KERN_VER)),)
+
+vboxdrv:
+ @echo "=== Building 'vboxdrv' module ==="
+ +@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv
+ @cp vboxdrv/vboxdrv.ko .
+ @echo
+
+vboxnetflt: vboxdrv
+ +@if [ -d vboxnetflt ]; then \
+ if [ -f vboxdrv/Module.symvers ]; then \
+ cp vboxdrv/Module.symvers vboxnetflt; \
+ fi; \
+ echo "=== Building 'vboxnetflt' module ==="; \
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxnetflt/Module.symvers) -C vboxnetflt || exit 1; \
+ cp vboxnetflt/vboxnetflt.ko .; \
+ echo; \
+ fi
+
+vboxnetadp: vboxdrv
+ +@if [ -d vboxnetadp ]; then \
+ if [ -f vboxdrv/Module.symvers ]; then \
+ cp vboxdrv/Module.symvers vboxnetadp; \
+ fi; \
+ echo "=== Building 'vboxnetadp' module ==="; \
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxnetadp/Module.symvers) -C vboxnetadp || exit 1; \
+ cp vboxnetadp/vboxnetadp.ko .; \
+ echo; \
+ fi
+
+vboxpci: vboxdrv
+ +@if [ -d vboxpci ]; then \
+ if [ -f vboxdrv/Module.symvers ]; then \
+ cp vboxdrv/Module.symvers vboxpci; \
+ fi; \
+ echo "=== Building 'vboxpci' module ==="; \
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxpci/Module.symvers) -C vboxpci || exit 1; \
+ cp vboxpci/vboxpci.ko .; \
+ echo; \
+ fi
+
+install-vboxdrv:
+ +@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
+
+install-vboxnetflt:
+ +@if [ -d vboxnetflt ]; then \
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
+ fi
+
+install-vboxnetadp:
+ +@if [ -d vboxnetadp ]; then \
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
+ fi
+
+install-vboxpci:
+ +@if [ -d vboxpci ]; then \
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci install; \
+ fi
+
+install: install-vboxdrv install-vboxnetflt install-vboxnetadp install-vboxpci
+
+# Look for wrapper modules, sorting them so vmmr0 is first.
+VBOX_WRAPPER_DIRS := $(notdir $(wildcard $(CURDIR)/vbox_*))
+ ifneq ($(VBOX_WRAPPER_DIRS),)
+VBOX_WRAPPER_DIRS := $(filter vbox_vmmr0,$(VBOX_WRAPPER_DIRS)) $(sort $(filter-out vbox_vmmr0,$(VBOX_WRAPPER_DIRS)))
+ endif
+ define wrapper_template
+$(wrapper): $(subst $(wrapper),,vbox_vmmr0)
+ +$$(MAKE) KBUILD_VERBOSE=$$(KBUILD_VERBOSE) -C $(wrapper)/
+
+load-$(wrapper): $(subst load-$(wrapper),,load-vbox_vmmr0)
+ @if ! grep -q "^$(wrapper) " /proc/modules; then \
+ echo "Loading $(wrapper)..."; \
+ $(SUDO) /sbin/insmod $(wrapper)/$(wrapper).ko; \
+ else \
+ echo "Skipping loading $(wrapper) module (already loaded)."; \
+ fi
+
+unload-$(wrapper):
+ @if grep -q "^$(wrapper) " /proc/modules; then \
+ echo "Unloading $(wrapper)..."; \
+ $(SUDO) /sbin/rmmod $(wrapper)/$(wrapper).ko; \
+ fi
+ endef
+$(foreach wrapper,$(VBOX_WRAPPER_DIRS), $(eval $(wrapper_template)))
+
+wrappers: $(VBOX_WRAPPER_DIRS)
+wrappers-load: $(addprefix load-,$(VBOX_WRAPPER_DIRS))
+wrappers-unload:
+ @for module in $(filter-out vbox_vmmr0,$(VBOX_WRAPPER_DIRS)) $(filter vbox_vmmr0,$(VBOX_WRAPPER_DIRS)); \
+ do \
+ if grep -q "^$${module} " /proc/modules; then \
+ echo "Unloading $${module}..."; \
+ $(SUDO) /sbin/rmmod "$${module}"; \
+ fi \
+ done
+wrappers-reload: wrappers-unload
+ +$(MAKE) -f $(lastword $(MAKEFILE_LIST)) --no-print-directory wrappers-load
+
+buildid:
+ @for module in $(foreach module,vboxdrv vboxnetflt vboxnetadp $(VBOX_WRAPPER_DIRS),$(module)/$(module).ko); \
+ do \
+ buildid=`readelf -n $${module} | sed -ne 's/^.*Build ID: *\([[:xdigit:]][[:xdigit:]]\)\(.*\)$$/\1\/\2/p' `; \
+ if [ -n "$${buildid}" ]; then \
+ mkdir -p ~/.debug/.build-id/`dirname $${buildid}`; \
+ ln -sfn -- "$(CURDIR)/$${module}" ~/.debug/.build-id/$${buildid}; \
+ else \
+ echo "warning: No build ID for $${module}"; \
+ fi \
+ done
+
+.PHONY: wrappers wrappers-load wrappers-unload buildid $(VBOX_WRAPPER_DIRS) \
+ $(addprefix load-,$(VBOX_WRAPPER_DIRS)) $(addprefix unload-,$(VBOX_WRAPPER_DIRS))
+
+ else # Too old:
+
+VBOX_WRAPPER_DIRS :=
+
+vboxdrv:
+vboxnetflt:
+vboxnetadp:
+vboxpci:
+install:
+wrappers:
+wrappers-load:
+wrappers-unload:
+buildid:
+
+ endif
+
+clean-vboxdrv:
+ +@$(MAKE) -C vboxdrv clean
+ rm -rf vboxdrv.ko
+
+clean-vboxnetflt:
+ +@if [ -d vboxnetflt ]; then \
+ $(MAKE) -C vboxnetflt clean; \
+ fi
+ rm -rf vboxnetflt.ko
+
+clean-vboxnetadp:
+ +@if [ -d vboxnetadp ]; then \
+ $(MAKE) -C vboxnetadp clean; \
+ fi
+ rm -rf vboxnetadp.ko
+
+clean-vboxpci:
+ +@if [ -d vboxpci ]; then \
+ $(MAKE) -C vboxpci clean; \
+ fi
+ rm -f vboxpci.ko
+
+clean: clean-vboxdrv clean-vboxnetflt clean-vboxnetadp clean-vboxpci
+
+check:
+ +@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv check
+
+unload:
+ @for module in vboxpci vboxnetadp vboxnetflt vboxdrv; do \
+ if grep "^$$module " /proc/modules >/dev/null; then \
+ echo "Removing previously installed $$module module"; \
+ $(SUDO) /sbin/rmmod $$module; \
+ fi; \
+ done
+
+load: unload
+ @for module in vboxdrv vboxnetflt vboxnetadp vboxpci; do \
+ if test -f $$module.ko; then \
+ echo "Installing $$module module"; \
+ $(SUDO) /sbin/insmod $$module.ko; \
+ fi; \
+ done
+
+endif # ! KERNELRELEASE
+
diff --git a/src/VBox/HostDrivers/linux/Makefile.kmk b/src/VBox/HostDrivers/linux/Makefile.kmk
new file mode 100644
index 00000000..3d012c47
--- /dev/null
+++ b/src/VBox/HostDrivers/linux/Makefile.kmk
@@ -0,0 +1,50 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-makefile for the Linux host driver helper scripts.
+#
+
+#
+# Copyright (C) 2006-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# 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, see <https://www.gnu.org/licenses>.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+# in the VirtualBox distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+INSTALLS += HostDrivers-scripts
+HostDrivers-scripts_INST = $(INST_DIST)
+HostDrivers-scripts_SOURCES = \
+ Makefile=>src/Makefile
+HostDrivers-scripts_EXEC_SOURCES = \
+ loadall.sh \
+ load.sh \
+ build_in_tmp=>src/build_in_tmp
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/HostDrivers/linux/build_in_tmp b/src/VBox/HostDrivers/linux/build_in_tmp
new file mode 100755
index 00000000..e70c9b04
--- /dev/null
+++ b/src/VBox/HostDrivers/linux/build_in_tmp
@@ -0,0 +1,104 @@
+#!/bin/sh
+# $Id: build_in_tmp $
+## @file
+# Script to build a kernel module in /tmp.
+#
+# Useful if the module sources are installed in read-only directory.
+#
+
+#
+# Copyright (C) 2007-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# 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, see <https://www.gnu.org/licenses>.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+# in the VirtualBox distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+#
+
+# find a unique temp directory
+num=0
+while true; do
+ tmpdir="/tmp/vbox.$num"
+ if mkdir -m 0755 "$tmpdir" 2> /dev/null; then
+ break
+ fi
+ num=`expr $num + 1`
+ if [ $num -gt 200 ]; then
+ echo "Could not find a valid tmp directory"
+ exit 1
+ fi
+done
+
+# Guest optimal number of make jobs.
+MAKE_JOBS=`grep vendor_id /proc/cpuinfo | wc -l`
+if [ "${MAKE_JOBS}" -le "0" ]; then MAKE_JOBS=1; fi
+
+# Parse our arguments, anything we don't grok is for make.
+while true; do
+ if [ "$1" = "--save-module-symvers" ]; then
+ shift
+ SAVE_MOD_SYMVERS="$1"
+ shift
+ elif [ "$1" = "--use-module-symvers" ]; then
+ shift
+ USE_MOD_SYMVERS="$1"
+ shift
+ elif [ "$1" = "--module-source" ]; then
+ shift
+ MODULE_SOURCE="$1"
+ shift
+ else
+ break
+ fi
+done
+
+# copy
+if [ -n "$MODULE_SOURCE" ]; then
+ cp -a "$MODULE_SOURCE"/* $tmpdir/
+else
+ cp -a ${0%/*}/* $tmpdir/
+fi
+if [ -n "$USE_MOD_SYMVERS" ]; then
+ cp $USE_MOD_SYMVERS $tmpdir/Module.symvers
+ MAKE_EXTRAOPTS="KBUILD_EXTRA_SYMBOLS=$tmpdir/Module.symvers"
+fi
+
+# make, cleanup if success
+cd "$tmpdir"
+if make CONFIG_MODULE_COMPRESS_GZIP= CONFIG_MODULE_COMPRESS_XZ= CONFIG_MODULE_COMPRESS_ZSTD= "-j`echo ${MAKE_JOBS}`" "$@" ${MAKE_EXTRAOPTS}; then # strip leading space from "MAKE_JOBS"
+ if [ -n "$SAVE_MOD_SYMVERS" ]; then
+ if [ -f Module.symvers ]; then
+ cp -f Module.symvers $SAVE_MOD_SYMVERS
+ else
+ cat /dev/null > $SAVE_MOD_SYMVERS
+ fi
+ fi
+ rm -rf $tmpdir
+ exit 0
+fi
+
+# failure
+rm -rf $tmpdir
+exit 1
diff --git a/src/VBox/HostDrivers/linux/export_modules.sh b/src/VBox/HostDrivers/linux/export_modules.sh
new file mode 100755
index 00000000..11c49d47
--- /dev/null
+++ b/src/VBox/HostDrivers/linux/export_modules.sh
@@ -0,0 +1,258 @@
+#!/bin/sh
+# $Id$
+## @file
+# Create a tar archive containing the sources of the vboxdrv kernel module.
+#
+
+#
+# Copyright (C) 2007-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# 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, see <https://www.gnu.org/licenses>.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+# in the VirtualBox distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+#
+
+# The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_DIR="${TARGET%/[!/]*}"
+
+# What this script does:
+usage_msg="\
+Usage: `basename ${0}` --file <path>|--folder <path> \
+ [--override-svn-rev <rev>] [--extra-version-string <string>] [--without-hardening]
+
+Exports the VirtualBox host kernel modules to the tar.gz archive or folder in \
+<path>, optionally adjusting the Make files to build them without hardening.
+
+Examples:
+ `basename ${0}` --file /tmp/vboxhost.tar.gz
+ `basename ${0}` --folder /tmp/tmpdir --without-hardening"
+
+usage()
+{
+ case "${1}" in
+ 0)
+ echo "${usage_msg}" | fold -s -w80 ;;
+ *)
+ echo "${usage_msg}" | fold -s -w80 >&2 ;;
+ esac
+ exit "${1}"
+}
+
+fail()
+{
+ echo "${1}" | fold -s -w80 >&2
+ exit 1
+}
+
+unset FILE FOLDER
+VBOX_WITH_HARDENING=1
+while test -n "${1}"; do
+ case "${1}" in
+ --file)
+ FILE="${2}"
+ shift 2 ;;
+ --folder)
+ FOLDER="${2}"
+ shift 2 ;;
+ --override-svn-rev)
+ OVERRIDE_SVN_REV="${2}"
+ shift 2 ;;
+ --extra-version-string)
+ EXTRA_VERSION_STRING="${2}"
+ shift 2 ;;
+ --without-hardening)
+ unset VBOX_WITH_HARDENING
+ shift ;;
+ -h|--help)
+ usage 0 ;;
+ *)
+ echo "Unknown parameter ${1}" >&2
+ usage 1 ;;
+ esac
+done
+test -z "$FILE" || test -z "$FOLDER" ||
+ fail "Only one of --file and --folder may be used"
+test -n "$FILE" || test -n "$FOLDER" || usage 1
+
+if test -n "$FOLDER"; then
+ PATH_TMP="$FOLDER"
+else
+ PATH_TMP="`cd \`dirname $FILE\`; pwd`/.vbox_modules"
+ FILE_OUT="`cd \`dirname $FILE\`; pwd`/`basename $FILE`"
+fi
+PATH_OUT=$PATH_TMP
+PATH_ROOT="`cd ${MY_DIR}/../../../..; pwd`"
+PATH_LOG=/tmp/vbox-export-host.log
+PATH_LINUX="$PATH_ROOT/src/VBox/HostDrivers/linux"
+PATH_VBOXDRV="$PATH_ROOT/src/VBox/HostDrivers/Support"
+PATH_VBOXNET="$PATH_ROOT/src/VBox/HostDrivers/VBoxNetFlt"
+PATH_VBOXADP="$PATH_ROOT/src/VBox/HostDrivers/VBoxNetAdp"
+PATH_VBOXPCI="$PATH_ROOT/src/VBox/HostDrivers/VBoxPci"
+
+VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk`
+VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk`
+VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk`
+VBOX_VERSION_STRING=$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD
+VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk`
+VBOX_SVN_CONFIG_REV=`sed -e 's/^ *VBOX_SVN_REV_CONFIG_FALLBACK *:= \+\$(patsubst *%:,, *\$Rev: *\([0-9]\+\) *\$ *) */\1/;t;d' $PATH_ROOT/Config.kmk`
+VBOX_SVN_VERSION_REV=`sed -e 's/^ *VBOX_SVN_REV_VERSION_FALLBACK *:= \+\$(patsubst *%:,, *\$Rev: *\([0-9]\+\) *\$ *) */\1/;t;d' $PATH_ROOT/Version.kmk`
+
+if [ -n "$OVERRIDE_SVN_REV" ]; then
+ VBOX_SVN_REV=$OVERRIDE_SVN_REV
+elif [ "$VBOX_SVN_CONFIG_REV" -gt "$VBOX_SVN_VERSION_REV" ]; then
+ VBOX_SVN_REV=$VBOX_SVN_CONFIG_REV
+else
+ VBOX_SVN_REV=$VBOX_SVN_VERSION_REV
+fi
+VBOX_VENDOR=`sed -e 's/^ *VBOX_VENDOR *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
+VBOX_VENDOR_SHORT=`sed -e 's/^ *VBOX_VENDOR_SHORT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
+VBOX_PRODUCT=`sed -e 's/^ *VBOX_PRODUCT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
+VBOX_C_YEAR=`date +%Y`
+VBOX_WITH_PCI_PASSTHROUGH=`sed -e '/^ *VBOX_WITH_PCI_PASSTHROUGH *[:]\?= */!d' -e 's/ *#.*$//' -e 's/^.*= *//' $PATH_ROOT/Config.kmk`
+
+. $PATH_VBOXDRV/linux/files_vboxdrv
+. $PATH_VBOXNET/linux/files_vboxnetflt
+. $PATH_VBOXADP/linux/files_vboxnetadp
+if [ "${VBOX_WITH_PCI_PASSTHROUGH}" = "1" ]; then
+ . $PATH_VBOXPCI/linux/files_vboxpci
+fi
+
+# Temporary path for creating the modules, will be removed later
+rm -rf "$PATH_TMP"
+mkdir $PATH_TMP || exit 1
+
+# Create auto-generated version file, needed by all modules
+echo "#ifndef ___version_generated_h___" > $PATH_TMP/version-generated.h
+echo "#define ___version_generated_h___" >> $PATH_TMP/version-generated.h
+echo "" >> $PATH_TMP/version-generated.h
+echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
+echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
+echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
+echo "#define VBOX_VERSION_STRING_RAW \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
+echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_STRING\"" >> $PATH_TMP/version-generated.h
+echo "#define VBOX_API_VERSION_STRING \"${VBOX_VERSION_MAJOR}_${VBOX_VERSION_MINOR}\"" >> $PATH_TMP/version-generated.h
+[ -n "$EXTRA_VERSION_STRING" ] && echo "#define VBOX_EXTRA_VERSION_STRING \" ${EXTRA_VERSION_STRING}\"" >> $PATH_TMP/version-generated.h
+echo "#define VBOX_PRIVATE_BUILD_DESC \"Private build with export_modules\"" >> $PATH_TMP/version-generated.h
+echo "" >> $PATH_TMP/version-generated.h
+echo "#endif" >> $PATH_TMP/version-generated.h
+
+# Create auto-generated revision file, needed by all modules
+echo "#ifndef __revision_generated_h__" > $PATH_TMP/revision-generated.h
+echo "#define __revision_generated_h__" >> $PATH_TMP/revision-generated.h
+echo "" >> $PATH_TMP/revision-generated.h
+echo "#define VBOX_SVN_REV $VBOX_SVN_REV" >> $PATH_TMP/revision-generated.h
+echo "" >> $PATH_TMP/revision-generated.h
+echo "#endif" >> $PATH_TMP/revision-generated.h
+
+# Create auto-generated product file, needed by all modules
+echo "#ifndef ___product_generated_h___" > $PATH_TMP/product-generated.h
+echo "#define ___product_generated_h___" >> $PATH_TMP/product-generated.h
+echo "" >> $PATH_TMP/product-generated.h
+echo "#define VBOX_VENDOR \"$VBOX_VENDOR\"" >> $PATH_TMP/product-generated.h
+echo "#define VBOX_VENDOR_SHORT \"$VBOX_VENDOR_SHORT\"" >> $PATH_TMP/product-generated.h
+echo "" >> $PATH_TMP/product-generated.h
+echo "#define VBOX_PRODUCT \"$VBOX_PRODUCT\"" >> $PATH_TMP/product-generated.h
+echo "#define VBOX_C_YEAR \"$VBOX_C_YEAR\"" >> $PATH_TMP/product-generated.h
+echo "" >> $PATH_TMP/product-generated.h
+echo "#endif" >> $PATH_TMP/product-generated.h
+
+# vboxdrv (VirtualBox host kernel module)
+mkdir $PATH_TMP/vboxdrv || exit 1
+for f in $FILES_VBOXDRV_NOBIN; do
+ install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
+done
+for f in $FILES_VBOXDRV_BIN; do
+ install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
+done
+if [ -n "$VBOX_WITH_HARDENING" ]; then
+ sed -e "s;VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV;;g" \
+ -e "s;IPRT_WITH_EFLAGS_AC_PRESERVING;;g" \
+ < $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
+else
+ sed -e "s;VBOX_WITH_HARDENING;;g" \
+ -e "s;VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV;;g" \
+ -e "s;IPRT_WITH_EFLAGS_AC_PRESERVING;;g" \
+ < $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
+fi
+
+# vboxnetflt (VirtualBox netfilter kernel module)
+mkdir $PATH_TMP/vboxnetflt || exit 1
+for f in $VBOX_VBOXNETFLT_SOURCES; do
+ install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxnetflt/`echo $f|cut -d'>' -f2`"
+done
+if [ -n "$VBOX_WITH_HARDENING" ]; then
+ cat $PATH_VBOXNET/linux/Makefile > $PATH_TMP/vboxnetflt/Makefile
+else
+ sed -e "s;VBOX_WITH_HARDENING;;g" < $PATH_VBOXNET/linux/Makefile > $PATH_TMP/vboxnetflt/Makefile
+fi
+
+# vboxnetadp (VirtualBox network adapter kernel module)
+mkdir $PATH_TMP/vboxnetadp || exit 1
+for f in $VBOX_VBOXNETADP_SOURCES; do
+ install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxnetadp/`echo $f|cut -d'>' -f2`"
+done
+if [ -n "$VBOX_WITH_HARDENING" ]; then
+ cat $PATH_VBOXADP/linux/Makefile > $PATH_TMP/vboxnetadp/Makefile
+else
+ sed -e "s;VBOX_WITH_HARDENING;;g" < $PATH_VBOXADP/linux/Makefile > $PATH_TMP/vboxnetadp/Makefile
+fi
+
+# vboxpci (VirtualBox host PCI access kernel module)
+if [ "${VBOX_WITH_PCI_PASSTHROUGH}" = "1" ]; then
+ mkdir $PATH_TMP/vboxpci || exit 1
+ for f in $VBOX_VBOXPCI_SOURCES; do
+ install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxpci/`echo $f|cut -d'>' -f2`"
+ done
+ if [ -n "$VBOX_WITH_HARDENING" ]; then
+ cat $PATH_VBOXPCI/linux/Makefile > $PATH_TMP/vboxpci/Makefile
+ else
+ sed -e "s;VBOX_WITH_HARDENING;;g" < $PATH_VBOXPCI/linux/Makefile > $PATH_TMP/vboxpci/Makefile
+ fi
+fi
+
+install -D -m 0644 $PATH_LINUX/Makefile $PATH_TMP/Makefile
+install -D -m 0755 $PATH_LINUX/build_in_tmp $PATH_TMP/build_in_tmp
+
+# Only temporary, omit from archive
+rm $PATH_TMP/version-generated.h
+rm $PATH_TMP/revision-generated.h
+rm $PATH_TMP/product-generated.h
+
+# If we are exporting to a folder then stop now.
+test -z "$FOLDER" || exit 0
+
+# Do a test build
+echo Doing a test build, this may take a while.
+make -C $PATH_TMP > $PATH_LOG 2>&1 &&
+ make -C $PATH_TMP clean >> $PATH_LOG 2>&1 ||
+ echo "Warning: test build failed. Please check $PATH_LOG"
+
+# Create the archive
+tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
+
+# Remove the temporary directory
+rm -r $PATH_TMP
diff --git a/src/VBox/HostDrivers/linux/load.sh b/src/VBox/HostDrivers/linux/load.sh
new file mode 100755
index 00000000..866951c4
--- /dev/null
+++ b/src/VBox/HostDrivers/linux/load.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+## @file
+# For development, builds and loads all the host drivers.
+#
+
+#
+# Copyright (C) 2010-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# 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, see <https://www.gnu.org/licenses>.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+# in the VirtualBox distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+#
+
+TARGET=`readlink -e -- "${0}"` || exit 1 # The GNU-specific way.
+MY_DIR="${TARGET%/[!/]*}"
+
+set -e
+
+# Parse parameters.
+OPT_UNLOAD_ONLY=
+if [ ${#} -ge 1 -a "${1}" = "-u" ]; then
+ OPT_UNLOAD_ONLY=yes
+ shift
+fi
+if [ ${#} -ge 1 -a '(' "${1}" = "-h" -o "${1}" = "--help" ')' ]; then
+ echo "usage: load.sh [-u] [make arguments]"
+ exit 1
+fi
+
+# Unload, but keep the udev rules.
+sudo "${MY_DIR}/vboxdrv.sh" stop
+
+if [ -z "${OPT_UNLOAD_ONLY}" ]; then
+ # Build and load.
+ MAKE_JOBS=`grep vendor_id /proc/cpuinfo | wc -l`
+ if [ "${MAKE_JOBS}" -le "0" ]; then MAKE_JOBS=1; fi
+ make "-j${MAKE_JOBS}" -C "${MY_DIR}/src/vboxdrv" "$@"
+
+ echo "Installing SUPDrv (aka VBoxDrv/vboxdrv)"
+ sudo /sbin/insmod "${MY_DIR}/src/vboxdrv/vboxdrv.ko"
+fi
+
diff --git a/src/VBox/HostDrivers/linux/loadall.sh b/src/VBox/HostDrivers/linux/loadall.sh
new file mode 100755
index 00000000..7d7d80a0
--- /dev/null
+++ b/src/VBox/HostDrivers/linux/loadall.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+## @file
+# For development, builds and loads all the host drivers.
+#
+
+#
+# Copyright (C) 2010-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# 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, see <https://www.gnu.org/licenses>.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+# in the VirtualBox distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+#
+
+TARGET=`readlink -e -- "${0}"` || exit 1 # The GNU-specific way.
+MY_DIR="${TARGET%/[!/]*}"
+MY_GROUPNAME="vboxusers"
+
+#
+# vboxusers membership check.
+#
+if ! (id -Gn | grep -w ${MY_GROUPNAME}); then
+ echo "loadall.sh: you're not a member of vboxusers...";
+ # Create the group.
+ if ! getent group ${MY_GROUPNAME}; then
+ set -e
+ sudo groupadd -r -f ${MY_GROUPNAME}
+ set +e
+ fi
+ # Add ourselves.
+ MY_USER=`id -un`
+ if [ -z "${MY_USER}" ]; then echo "loadall.sh: cannot figure user name"; exit 1; fi
+ sudo usermod -a -G ${MY_GROUPNAME} "${MY_USER}";
+
+ # Require relogon.
+ echo "loadall.sh: You must log on again to load the new group membership."
+ exit 1
+fi
+
+#
+# Normal action.
+#
+if [ ${#} -eq 0 ]; then
+ if [ -f "${MY_DIR}/src/vboxdrv/vboxdrv.ko" ]; then
+ echo "Cleaning build folder."
+ make -C "${MY_DIR}/src" clean > /dev/null
+ fi
+ sudo "${MY_DIR}/vboxdrv.sh" setup
+
+#
+# Unload and clean up when '-u' is given.
+#
+elif [ ${#} -eq 1 -a "x${1}" = x-u ]; then
+ sudo "${MY_DIR}/vboxdrv.sh" cleanup
+
+#
+# Invalid syntax.
+#
+else
+ echo "Usage: loadall.sh [-u]"
+ exit 1
+fi
+