VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/solaris/load.sh@ 78039

Last change on this file since 78039 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1#!/bin/bash
2# $Id: load.sh 76553 2019-01-01 01:45:53Z vboxsync $
3## @file
4# For development.
5#
6
7#
8# Copyright (C) 2006-2019 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18# The contents of this file may alternatively be used under the terms
19# of the Common Development and Distribution License Version 1.0
20# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
21# VirtualBox OSE distribution, in which case the provisions of the
22# CDDL are applicable instead of those of the GPL.
23#
24# You may elect to license modified versions of this file under the
25# terms and conditions of either the GPL or the CDDL or both.
26#
27
28DRVNAME="vboxdrv"
29DRIVERS_USING_IT="vboxusb vboxusbmon vboxnet vboxflt vboxbow"
30
31DRVFILE=`dirname "$0"`
32DRVFILE=`cd "$DRVFILE" && pwd`
33DRVFILE="$DRVFILE/$DRVNAME"
34if [ ! -f "$DRVFILE" ]; then
35 echo "load.sh: Cannot find $DRVFILE or it's not a file..."
36 exit 1;
37fi
38if [ ! -f "$DRVFILE.conf" ]; then
39 echo "load.sh: Cannot find $DRVFILE.conf or it's not a file..."
40 exit 1;
41fi
42
43SUDO=sudo
44#set -x
45
46# Disable the zone access service.
47servicefound=`svcs -H "virtualbox/zoneaccess" 2>/dev/null | grep '^online'`
48if test ! -z "$servicefound"; then
49 $SUDO svcadm disable svc:/application/virtualbox/zoneaccess:default
50fi
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# Reconfigure the driver so it get a major number.
71#
72# Note! We have to copy the driver and config files to somewhere the kernel can
73# find them. It is searched for as drv/${DRVNAME}.conf in
74# kobj_module_path, which is usually:
75# /platform/i86pc/kernel /kernel /usr/kernel
76# To try prevent bad drivers from being loaded on the next boot, we remove
77# always the files.
78#
79MY_RC=1
80set -e
81$SUDO rm -f \
82 "/platform/i86pc/kernel/drv/${DRVNAME}.conf" \
83 "/platform/i86pc/kernel/drv/${DRVNAME}" \
84 "/platform/i86pc/kernel/drv/amd64/${DRVNAME}"
85sync
86$SUDO cp "${DRVFILE}" /platform/i86pc/kernel/drv/amd64/
87$SUDO cp "${DRVFILE}.conf" /platform/i86pc/kernel/drv/
88set +e
89
90$SUDO rem_drv $DRVNAME
91if $SUDO add_drv -v $DRVNAME; then
92 sync
93 if $SUDO modload "/platform/i86pc/kernel/drv/amd64/${DRVNAME}"; then
94 echo "load.sh: successfully loaded the driver"
95 modinfo | grep -w "$DRVNAME"
96 MY_RC=0
97 if test ! -h "/dev/vboxdrv"; then
98 $SUDO ln -sf "/devices/pseudo/vboxdrv@0:vboxdrv" /dev/vboxdrv
99 $SUDO chmod 0666 /dev/vboxdrv
100 fi
101 else
102 dmesg | tail
103 echo "load.sh: modload failed"
104 fi
105else
106 dmesg | tail
107 echo "load.sh: add_drv failed."
108fi
109
110$SUDO rm -f \
111 "/platform/i86pc/kernel/drv/${DRVNAME}.conf" \
112 "/platform/i86pc/kernel/drv/${DRVNAME}" \
113 "/platform/i86pc/kernel/drv/amd64/${DRVNAME}"
114sync
115
116exit $MY_RC;
117
Note: See TracBrowser for help on using the repository browser.

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