VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/linux/export_modules@ 28964

Last change on this file since 28964 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 4.2 KB
Line 
1#!/bin/sh
2
3#
4# Create a tar archive containing the sources of the vboxdrv kernel module
5#
6# Copyright (C) 2007 Oracle Corporation
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License (GPL) as published by the Free Software
12# Foundation, in version 2 as it comes in the "COPYING" file of the
13# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17if [ -z "$1" ]; then
18 echo "Usage: $0 <filename.tar.gz> [--without-hardening]"
19 echo " Export VirtualBox kernel modules to <filename.tar.gz>"
20 exit 1
21fi
22
23VBOX_WITH_HARDENING=1
24if [ "$2" = "--without-hardening" ]; then
25 VBOX_WITH_HARDENING=
26fi
27
28PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
29PATH_OUT=$PATH_TMP
30FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
31PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
32PATH_LINUX="$PATH_ROOT/src/VBox/HostDrivers/linux"
33PATH_VBOXDRV="$PATH_ROOT/src/VBox/HostDrivers/Support"
34PATH_VBOXNET="$PATH_ROOT/src/VBox/HostDrivers/VBoxNetFlt"
35
36VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
37VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
38VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
39VBOX_VERSION_STRING=$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD
40
41. $PATH_VBOXDRV/linux/files_vboxdrv
42. $PATH_VBOXNET/linux/files_vboxnetflt
43
44# Temporary path for creating the modules, will be removed later
45mkdir $PATH_TMP || exit 1
46
47# Create auto-generated version file, needed by all modules
48echo "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
49echo "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
50echo "" >> $PATH_TMP/version-generated.h
51echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
52echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
53echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
54echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_STRING\"" >> $PATH_TMP/version-generated.h
55echo "" >> $PATH_TMP/version-generated.h
56echo "#endif" >> $PATH_TMP/version-generated.h
57
58# vboxdrv (VirtualBox host kernel module)
59mkdir $PATH_TMP/vboxdrv || exit 1
60for f in $FILES_VBOXDRV_NOBIN; do
61 install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
62done
63for f in $FILES_VBOXDRV_BIN; do
64 install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
65done
66sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_LINUX/build_in_tmp > $PATH_TMP/vboxdrv/build_in_tmp
67chmod 0755 $PATH_TMP/vboxdrv/build_in_tmp
68sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_VBOXDRV/linux/dkms.conf > $PATH_TMP/vboxdrv/dkms.conf
69if [ -n "$VBOX_WITH_HARDENING" ]; then
70 cat $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
71else
72 sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
73fi
74
75# vboxnetflt (VirtualBox netfilter kernel module)
76mkdir $PATH_TMP/vboxnetflt || exit 1
77for f in $VBOX_VBOXNETFLT_SOURCES; do
78 install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxnetflt/`echo $f|cut -d'>' -f2`"
79done
80sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_LINUX/build_in_tmp > $PATH_TMP/vboxnetflt/build_in_tmp
81chmod 0755 $PATH_TMP/vboxnetflt/build_in_tmp
82sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_VBOXNET/linux/dkms.conf > $PATH_TMP/vboxnetflt/dkms.conf
83if [ -n "$VBOX_WITH_HARDENING" ]; then
84 cat $PATH_VBOXNET/linux/Makefile > $PATH_TMP/vboxnetflt/Makefile
85else
86 sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXNET/linux/Makefile > $PATH_TMP/vboxnetflt/Makefile
87fi
88
89install -D -m 0644 $PATH_LINUX/Makefile $PATH_TMP/Makefile
90
91# Only temporary, omit from archive
92rm $PATH_TMP/version-generated.h
93
94# Create the archive
95tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
96
97# Remove the temporary directory
98rm -r $PATH_TMP
99
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette