3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync# Create a tar archive containing the sources of the Linux guest kernel
c58f1213e628a545081c70e26c6b67a841cff880vboxsync# Copyright (C) 2006-2010 Oracle Corporation
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# available from http://www.virtualbox.org. This file is free software;
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncif [ -z "$1" ]; then
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync echo "Usage: $0 <filename.tar.gz>"
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync echo " Export VirtualBox kernel modules to <filename.tar.gz>"
7b1a1a5dea048e6a23a740ed5b5ef456f3958a0avboxsyncPATH_VBOXGUEST="$PATH_ROOT/src/VBox/Additions/common/VBoxGuest"
80096fb54d147045204dcc7e3ff273158de03f81vboxsyncPATH_VBOXSF="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
a52f845969b3de1f85d02c4e9b8dd7942aca3c37vboxsyncPATH_VBOXVIDEO="$PATH_ROOT/src/VBox/Additions/linux/drm"
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncVBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncVBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncVBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncVBOX_SVN_REV=`sed -e 's/^ *VBOX_SVN_REV_FALLBACK *:= \+\$(patsubst *%:,, *\$Rev: *\([0-9]\+\) *\$ *) */\1/;t;d' $PATH_ROOT/Config.kmk`
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncVBOX_VENDOR=`sed -e 's/^ *VBOX_VENDOR *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncVBOX_VENDOR_SHORT=`sed -e 's/^ *VBOX_VENDOR_SHORT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncVBOX_PRODUCT=`sed -e 's/^ *VBOX_PRODUCT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync# Temporary path for creating the modules, will be removed later
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync# Create auto-generated version file, needed by all modules
fcfca16ae0b575f4a0a8baf45928c6684c265de2vboxsyncecho "#ifndef ___version_generated_h___" > $PATH_TMP/version-generated.h
fcfca16ae0b575f4a0a8baf45928c6684c265de2vboxsyncecho "#define ___version_generated_h___" >> $PATH_TMP/version-generated.h
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncecho "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncecho "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncecho "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
fcfca16ae0b575f4a0a8baf45928c6684c265de2vboxsyncecho "#define VBOX_VERSION_STRING_RAW \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsyncecho "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
fcfca16ae0b575f4a0a8baf45928c6684c265de2vboxsyncecho "#define VBOX_API_VERSION_STRING \"${VBOX_VERSION_MAJOR}_${VBOX_VERSION_MINOR}\"" >> $PATH_TMP/version-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsync# Create auto-generated revision file, needed by all modules
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncecho "#ifndef __revision_generated_h__" > $PATH_TMP/revision-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncecho "#define __revision_generated_h__" >> $PATH_TMP/revision-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncecho "#define VBOX_SVN_REV $VBOX_SVN_REV" >> $PATH_TMP/revision-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsync# Create auto-generated product file, needed by all modules
fcfca16ae0b575f4a0a8baf45928c6684c265de2vboxsyncecho "#ifndef ___product_generated_h___" > $PATH_TMP/product-generated.h
fcfca16ae0b575f4a0a8baf45928c6684c265de2vboxsyncecho "#define ___product_generated_h___" >> $PATH_TMP/product-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncecho "#define VBOX_VENDOR \"$VBOX_VENDOR\"" >> $PATH_TMP/product-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncecho "#define VBOX_VENDOR_SHORT \"$VBOX_VENDOR_SHORT\"" >> $PATH_TMP/product-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncecho "#define VBOX_PRODUCT \"$VBOX_PRODUCT\"" >> $PATH_TMP/product-generated.h
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncecho "#define VBOX_C_YEAR \"$VBOX_C_YEAR\"" >> $PATH_TMP/product-generated.h
7b1a1a5dea048e6a23a740ed5b5ef456f3958a0avboxsync# vboxguest (VirtualBox guest kernel module)
7b1a1a5dea048e6a23a740ed5b5ef456f3958a0avboxsync install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
7b1a1a5dea048e6a23a740ed5b5ef456f3958a0avboxsync install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
80096fb54d147045204dcc7e3ff273158de03f81vboxsync# vboxsf (VirtualBox guest kernel module for shared folders)
80096fb54d147045204dcc7e3ff273158de03f81vboxsync install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
80096fb54d147045204dcc7e3ff273158de03f81vboxsync install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
a52f845969b3de1f85d02c4e9b8dd7942aca3c37vboxsync# vboxvideo (VirtualBox guest kernel module for drm support)
a52f845969b3de1f85d02c4e9b8dd7942aca3c37vboxsync install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvideo/`echo $f|cut -d'>' -f2`"
a52f845969b3de1f85d02c4e9b8dd7942aca3c37vboxsync install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvideo/`echo $f|cut -d'>' -f2`"
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsync# convenience Makefile
8d974ced0dc3540dd1b3ec85f8663388e246461avboxsyncinstall -D -m 0644 $PATH_LINUX/Makefile "$PATH_TMP/Makefile"
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync# Only temporary, omit from archive
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync# Create the archive
3bf4bd3347c2bc3bc7c6b24672096f514235ad76vboxsync# Remove the temporary directory