VirtualBox

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

最後變更 在這個檔案從15688是 15688,由 vboxsync 提交於 16 年 前

export_modules fix

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:executable 設為 *
檔案大小: 4.8 KB
 
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.alldomusa.eu.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# The contents of this file may alternatively be used under the terms
17# of the Common Development and Distribution License Version 1.0
18# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19# VirtualBox OSE distribution, in which case the provisions of the
20# CDDL are applicable instead of those of the GPL.
21#
22# You may elect to license modified versions of this file under the
23# terms and conditions of either the GPL or the CDDL or both.
24#
25# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26# Clara, CA 95054 USA or visit http://www.sun.com if you need
27# additional information or have any questions.
28#
29
30if [ -z "$1" ]; then
31 echo "Usage: $0 <filename.tar.gz> [--without-hardening]"
32 echo " Export VirtualBox kernel modules to <filename.tar.gz>"
33 exit 1
34fi
35
36VBOX_WITH_HARDENING=1
37if [ "$2" = "--without-hardening" ]; then
38 VBOX_WITH_HARDENING=
39fi
40
41PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
42PATH_OUT=$PATH_TMP
43FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
44PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
45PATH_LINUX="$PATH_ROOT/src/VBox/HostDrivers/linux"
46PATH_VBOXDRV="$PATH_ROOT/src/VBox/HostDrivers/Support"
47PATH_VBOXNET="$PATH_ROOT/src/VBox/HostDrivers/VBoxNetFlt"
48
49VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
50VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
51VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
52VBOX_VERSION_STRING=$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD
53
54. $PATH_VBOXDRV/linux/files_vboxdrv
55. $PATH_VBOXNET/linux/files_vboxnetflt
56
57# Temporary path for creating the modules, will be removed later
58mkdir $PATH_TMP || exit 1
59
60# Create auto-generated version file, needed by all modules
61echo "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
62echo "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
63echo "" >> $PATH_TMP/version-generated.h
64echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
65echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
66echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
67echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_STRING\"" >> $PATH_TMP/version-generated.h
68echo "" >> $PATH_TMP/version-generated.h
69echo "#endif" >> $PATH_TMP/version-generated.h
70
71# vboxdrv (VirtualBox host kernel module)
72mkdir $PATH_TMP/vboxdrv || exit 1
73for f in $FILES_VBOXDRV_NOBIN; do
74 install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
75done
76for f in $FILES_VBOXDRV_BIN; do
77 install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
78done
79sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_LINUX/build_in_tmp > $PATH_TMP/vboxdrv/build_in_tmp
80chmod 0755 $PATH_TMP/vboxdrv/build_in_tmp
81sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_VBOXDRV/linux/dkms.conf > $PATH_TMP/vboxdrv/dkms.conf
82if [ -n "$VBOX_WITH_HARDENING" ]; then
83 cat $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
84else
85 sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
86fi
87
88# vboxnetflt (VirtualBox netfilter kernel module)
89mkdir $PATH_TMP/vboxnetflt || exit 1
90for f in $VBOX_VBOXNETFLT_SOURCES; do
91 install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxnetflt/`echo $f|cut -d'>' -f2`"
92done
93sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_LINUX/build_in_tmp > $PATH_TMP/vboxnetflt/build_in_tmp
94chmod 0755 $PATH_TMP/vboxnetflt/build_in_tmp
95sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_VBOXNET/linux/dkms.conf > $PATH_TMP/vboxnetflt/dkms.conf
96if [ -n "$VBOX_WITH_HARDENING" ]; then
97 cat $PATH_VBOXNET/linux/Makefile > $PATH_TMP/vboxnetflt/Makefile
98else
99 sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXNET/linux/Makefile > $PATH_TMP/vboxnetflt/Makefile
100fi
101
102install -D -m 0644 $PATH_LINUX/Makefile $PATH_TMP/Makefile
103
104# Only temporary, omit from archive
105rm $PATH_TMP/version-generated.h
106
107# Create the archive
108tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
109
110# Remove the temporary directory
111rm -r $PATH_TMP
112
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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