VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/solaris/load.sh

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1#!/bin/bash
2# $Id: load.sh 98103 2023-01-17 14:15:46Z vboxsync $
3## @file
4# For GA development.
5#
6
7#
8# Copyright (C) 2006-2023 Oracle and/or its affiliates.
9#
10# This file is part of VirtualBox base platform packages, as
11# available from https://www.virtualbox.org.
12#
13# This program is free software; you can redistribute it and/or
14# modify it under the terms of the GNU General Public License
15# as published by the Free Software Foundation, in version 3 of the
16# License.
17#
18# This program is distributed in the hope that it will be useful, but
19# WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21# General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, see <https://www.gnu.org/licenses>.
25#
26# The contents of this file may alternatively be used under the terms
27# of the Common Development and Distribution License Version 1.0
28# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
29# in the VirtualBox distribution, in which case the provisions of the
30# CDDL are applicable instead of those of the GPL.
31#
32# You may elect to license modified versions of this file under the
33# terms and conditions of either the GPL or the CDDL or both.
34#
35# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
36#
37
38DRVNAME="vboxguest"
39DRIVERS_USING_IT="vboxfs"
40
41DRVFILE=`dirname "$0"`
42DRVFILE=`cd "$DRVFILE" && pwd`
43DRVFILE="$DRVFILE/$DRVNAME"
44if [ ! -f "$DRVFILE" ]; then
45 echo "load.sh: Cannot find $DRVFILE or it's not a file..."
46 exit 1;
47fi
48
49SUDO=sudo
50#set -x
51
52# Unload driver that may depend on the driver we're going to (re-)load
53# as well as the driver itself.
54for drv in $DRIVERS_USING_IT $DRVNAME;
55do
56 LOADED=`modinfo | grep -w "$drv"`
57 if test -n "$LOADED"; then
58 MODID=`echo "$LOADED" | cut -d ' ' -f 1`
59 $SUDO modunload -i $MODID;
60 LOADED=`modinfo | grep -w "$drv"`;
61 if test -n "$LOADED"; then
62 echo "load.sh: failed to unload $drv";
63 dmesg | tail
64 exit 1;
65 fi
66 fi
67done
68
69#
70# Update the devlink.tab file so we get a /dev/vboxguest node.
71#
72set -e
73sed -e '/name=vboxguest/d' /etc/devlink.tab > /tmp/devlink.vbox
74echo -e "type=ddi_pseudo;name=vboxguest\t\D" >> /tmp/devlink.vbox
75$SUDO cp /tmp/devlink.vbox /etc/devlink.tab
76$SUDO ln -fs ../devices/pci@0,0/pci80ee,cafe@4:vboxguest /dev/vboxguest
77set +e
78
79#
80# The add_drv command will load the driver, so we need to temporarily put it
81# in a place that is searched in order to load it.
82#
83MY_RC=1
84set -e
85$SUDO rm -f \
86 "/usr/kernel/drv/${DRVNAME}" \
87 "/usr/kernel/drv/amd64/${DRVNAME}"
88sync
89$SUDO cp "${DRVFILE}" /platform/i86pc/kernel/drv/amd64/
90set +e
91
92$SUDO rem_drv $DRVNAME
93if $SUDO add_drv -ipci80ee,cafe -m"* 0666 root sys" -v $DRVNAME; then
94 sync
95 $SUDO /usr/sbin/devfsadm -i $DRVNAME
96 MY_RC=0
97else
98 dmesg | tail
99 echo "load.sh: add_drv failed."
100fi
101
102$SUDO rm -f \
103 "/usr/kernel/drv/${DRVNAME}" \
104 "/usr/kernel/drv/amd64/${DRVNAME}"
105sync
106
107exit $MY_RC;
108
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use