Add dkms support for bbswitch
This commit is contained in:
parent
62f9560821
commit
e8135e1dce
6
Makefile
6
Makefile
@ -14,3 +14,9 @@ clean:
|
|||||||
load:
|
load:
|
||||||
-/sbin/rmmod $(modname)
|
-/sbin/rmmod $(modname)
|
||||||
/sbin/insmod $(modname).ko
|
/sbin/insmod $(modname).ko
|
||||||
|
|
||||||
|
install_dkms_module:
|
||||||
|
./scripts/install_dkms.sh install
|
||||||
|
|
||||||
|
uninstall_dkms_module:
|
||||||
|
./scripts/install_dkms.sh uninstall
|
||||||
|
5
dkms/dkms.conf
Normal file
5
dkms/dkms.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
PACKAGE_NAME="bbswitch"
|
||||||
|
PACKAGE_VERSION="REPLACE"
|
||||||
|
BUILT_MODULE_NAME[0]="bbswitch"
|
||||||
|
DEST_MODULE_LOCATION[0]="/kernel"
|
||||||
|
AUTOINSTALL="yes"
|
57
scripts/install_dkms.sh
Executable file
57
scripts/install_dkms.sh
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
uninstall_bbswitch_modules()
|
||||||
|
{
|
||||||
|
local PKGVER="$(ls /usr/src/ | grep bbswitch | sed 's/^.*-//')"
|
||||||
|
|
||||||
|
|
||||||
|
# Warning: dmks say error if it doesn't know bbswitch module.
|
||||||
|
# This is the case for the first time, but it's not an error!
|
||||||
|
# TODO: Don't use the code below if PKGVER is empty (no return,
|
||||||
|
# no space...)
|
||||||
|
|
||||||
|
|
||||||
|
# Remove all version of bbswitch known by dkms
|
||||||
|
dkms remove -m bbswitch -v $PKGVER --all
|
||||||
|
depmod -a
|
||||||
|
|
||||||
|
# Remove all sources of bbswitch
|
||||||
|
# Keep rm after dkms remove because this last use dkms.conf
|
||||||
|
rm -fr /usr/src/bbswitch-$PKGVER
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
install_bbswitch_module()
|
||||||
|
{
|
||||||
|
# Before install, remove previous versions
|
||||||
|
uninstall_bbswitch_modules
|
||||||
|
|
||||||
|
# Give a version to this bbswitch module
|
||||||
|
local GITVERSION=`git describe --tags`
|
||||||
|
|
||||||
|
sudo mkdir -p "/usr/src/bbswitch-$GITVERSION"
|
||||||
|
|
||||||
|
cp *.c "/usr/src/bbswitch-$GITVERSION"
|
||||||
|
cp Makefile "/usr/src/bbswitch-$GITVERSION"
|
||||||
|
cp ./dkms/dkms.conf "/usr/src/bbswitch-$GITVERSION"
|
||||||
|
|
||||||
|
sed "s/REPLACE/$GITVERSION/" "/usr/src/bbswitch-$GITVERSION/dkms.conf"
|
||||||
|
|
||||||
|
# Compilation and installation
|
||||||
|
dkms add -m bbswitch -v $GITVERSION
|
||||||
|
dkms build -m bbswitch -v $GITVERSION
|
||||||
|
dkms install -m bbswitch -v $GITVERSION
|
||||||
|
depmod -a
|
||||||
|
|
||||||
|
#Now user can do : modprobe bbswitch
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
"install") install_bbswitch_module;;
|
||||||
|
|
||||||
|
"uninstall") uninstall_bbswitch_modules;;
|
||||||
|
|
||||||
|
*) echo "Error: Don't call this script directly";;
|
||||||
|
esac
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user