~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/HostDrivers/freebsd/export_modules

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
#
 
4
# Create a tar archive containing the sources of the vboxdrv kernel module
 
5
#
 
6
# Copyright (C) 2007 Sun Microsystems, Inc.
 
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
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
 
17
# Clara, CA 95054 USA or visit http://www.sun.com if you need
 
18
# additional information or have any questions.
 
19
#
 
20
 
 
21
if [ -z "$1" ]; then
 
22
    echo "Usage: $0 <filename.tar.gz> [--without-hardening]"
 
23
    echo "  Export VirtualBox kernel modules to <filename.tar.gz>"
 
24
    exit 1
 
25
fi
 
26
 
 
27
VBOX_WITH_HARDENING=1
 
28
if [ "$2" = "--without-hardening" ]; then
 
29
    VBOX_WITH_HARDENING=
 
30
fi
 
31
 
 
32
PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
 
33
PATH_OUT=$PATH_TMP
 
34
FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
 
35
PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
 
36
PATH_FREEBSD="$PATH_ROOT/src/VBox/HostDrivers/freebsd"
 
37
PATH_VBOXDRV="$PATH_ROOT/src/VBox/HostDrivers/Support"
 
38
PATH_VBOXNET="$PATH_ROOT/src/VBox/HostDrivers/VBoxNetFlt"
 
39
PATH_VBOXNETADP="$PATH_ROOT/src/VBox/HostDrivers/VBoxNetAdp"
 
40
 
 
41
VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
 
42
VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
 
43
VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
 
44
VBOX_VERSION_STRING=$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD
 
45
 
 
46
. $PATH_VBOXDRV/freebsd/files_vboxdrv
 
47
. $PATH_VBOXNET/freebsd/files_vboxnetflt
 
48
. $PATH_VBOXNETADP/freebsd/files_vboxnetadp
 
49
 
 
50
# Temporary path for creating the modules, will be removed later
 
51
mkdir $PATH_TMP || exit 1
 
52
 
 
53
# Create auto-generated version file, needed by all modules
 
54
echo "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
 
55
echo "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
 
56
echo "" >> $PATH_TMP/version-generated.h
 
57
echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
 
58
echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
 
59
echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
 
60
echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_STRING\"" >> $PATH_TMP/version-generated.h
 
61
echo "" >> $PATH_TMP/version-generated.h
 
62
echo "#endif" >> $PATH_TMP/version-generated.h
 
63
 
 
64
# vboxdrv (VirtualBox host kernel module)
 
65
mkdir $PATH_TMP/vboxdrv || exit 1
 
66
for f in $FILES_VBOXDRV_NOBIN; do
 
67
    install -d -m 755 "$PATH_TMP/vboxdrv/`dirname $f|cut -d'>' -f2`"
 
68
    install -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
 
69
done
 
70
for f in $FILES_VBOXDRV_BIN; do
 
71
    install -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
 
72
done
 
73
sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_FREEBSD/build_in_tmp > $PATH_TMP/vboxdrv/build_in_tmp
 
74
if [ -n "$VBOX_WITH_HARDENING" ]; then
 
75
    cat                                   $PATH_VBOXDRV/freebsd/Makefile > $PATH_TMP/vboxdrv/Makefile
 
76
else
 
77
    sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXDRV/freebsd/Makefile > $PATH_TMP/vboxdrv/Makefile
 
78
fi
 
79
 
 
80
# vboxnetflt (VirtualBox netfilter kernel module)
 
81
mkdir $PATH_TMP/vboxnetflt || exit 1
 
82
for f in $VBOX_VBOXNETFLT_SOURCES; do
 
83
    install -d -m 755 "$PATH_TMP/vboxnetflt/`dirname $f|cut -d'>' -f2`"
 
84
    install -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxnetflt/`echo $f|cut -d'>' -f2`"
 
85
done
 
86
sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_FREEBSD/build_in_tmp > $PATH_TMP/vboxnetflt/build_in_tmp
 
87
if [ -n "$VBOX_WITH_HARDENING" ]; then
 
88
    cat                                   $PATH_VBOXNET/freebsd/Makefile > $PATH_TMP/vboxnetflt/Makefile
 
89
else
 
90
    sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXNET/freebsd/Makefile > $PATH_TMP/vboxnetflt/Makefile
 
91
fi
 
92
 
 
93
# vboxnetadp (VirtualBox network adapter kernel module)
 
94
mkdir $PATH_TMP/vboxnetadp || exit 1
 
95
for f in $VBOX_VBOXNETADP_SOURCES; do
 
96
    install -d -m 755 "$PATH_TMP/vboxnetadp/`dirname $f|cut -d'>' -f2`"
 
97
    install -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxnetadp/`echo $f|cut -d'>' -f2`"
 
98
done
 
99
sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_FREEBSD/build_in_tmp > $PATH_TMP/vboxnetadp/build_in_tmp
 
100
if [ -n "$VBOX_WITH_HARDENING" ]; then
 
101
    cat                                   $PATH_VBOXNETADP/freebsd/Makefile > $PATH_TMP/vboxnetadp/Makefile
 
102
else
 
103
    sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXNETADP/freebsd/Makefile > $PATH_TMP/vboxnetadp/Makefile
 
104
fi
 
105
 
 
106
install -m 0644 $PATH_FREEBSD/Makefile $PATH_TMP/Makefile
 
107
 
 
108
# Only temporary, omit from archive
 
109
rm $PATH_TMP/version-generated.h
 
110
 
 
111
# Create the archive
 
112
tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
 
113
 
 
114
# Remove the temporary directory
 
115
rm -r $PATH_TMP
 
116