load.sh revision c7cd98a3e0c214e3bb1adf79883105c008ec317a
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# For development.
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# Copyright (C) 2006-2012 Oracle Corporation
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# available from http://www.virtualbox.org. This file is free software;
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# you can redistribute it and/or modify it under the terms of the GNU
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# General Public License (GPL) as published by the Free Software
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# The contents of this file may alternatively be used under the terms
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# of the Common Development and Distribution License Version 1.0
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# VirtualBox OSE distribution, in which case the provisions of the
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# CDDL are applicable instead of those of the GPL.
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# You may elect to license modified versions of this file under the
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# terms and conditions of either the GPL or the CDDL or both.
c7cd98a3e0c214e3bb1adf79883105c008ec317avboxsyncDRIVERS_USING_IT="vboxusb vboxusbmon vboxnet vboxflt vboxbow"
d318c6184dca5599e44f8c67a7983b30065448f9vboxsyncif [ ! -f "$DRVFILE" ]; then
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync echo "load.sh: Cannot find $DRVFILE or it's not a file..."
d318c6184dca5599e44f8c67a7983b30065448f9vboxsyncif [ ! -f "$DRVFILE.conf" ]; then
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync echo "load.sh: Cannot find $DRVFILE.conf or it's not a file..."
c7cd98a3e0c214e3bb1adf79883105c008ec317avboxsync# Disable the zone access service.
c7cd98a3e0c214e3bb1adf79883105c008ec317avboxsync$SUDO svcadm disable svc:/application/virtualbox/zoneaccess:default
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# Unload driver that may depend on the driver we're going to (re-)load
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# as well as the driver itself.
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync if test -n "$LOADED"; then
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync if test -n "$LOADED"; then
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync echo "load.sh: failed to unload $drv";
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# Reconfigure the driver so it get a major number.
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# Note! We have to copy the driver and config files to somewhere the kernel can
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# find them. It is searched for as drv/${DRVNAME}.conf in
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# kobj_module_path, which is usually:
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# To try prevent bad drivers from being loaded on the next boot, we remove
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync# always the files.
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync$SUDO cp "${DRVFILE}" /platform/i86pc/kernel/drv/amd64/
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync$SUDO cp "${DRVFILE}.conf" /platform/i86pc/kernel/drv/
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync if $SUDO modload "/platform/i86pc/kernel/drv/amd64/${DRVNAME}"; then
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync echo "load.sh: successfully loaded the driver"
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync echo "load.sh: modload failed"
d318c6184dca5599e44f8c67a7983b30065448f9vboxsync echo "load.sh: add_drv failed."