Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make kernel version customizable #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dkms-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ if [ "$sproc" -gt 1 ]; then
fi
fi

kernelver=${kernelver:-$(uname -r)}
make "-j$sproc" "KVER=$kernelver" "KSRC=/lib/modules/$kernelver/build"
KVER="${KVER:-$(uname -r)}"
KSRC="/lib/modules/$KVER/build"
make "-j$sproc" "KVER=$KVER" "KSRC=$KSRC"
13 changes: 7 additions & 6 deletions install-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ SCRIPT_VERSION="20230126"
MODULE_NAME="88x2bu"
DRV_VERSION="5.13.1"

KARCH="$(uname -m)"
KVER="$(uname -r)"
KARCH="${KARCH:-$(uname -m)}"
KVER="${KVER:-$(uname -r)}"
KSRC="/lib/modules/$KVER/build"
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"

DRV_NAME="rtl${MODULE_NAME}"
Expand Down Expand Up @@ -91,7 +92,7 @@ if ! command -v make >/dev/null 2>&1; then
fi

# check to see if the correct header files are installed
if [ ! -d "/lib/modules/$(uname -r)/build" ]; then
if [ ! -d "$KSRC" ]; then
echo "Your kernel header files aren't properly installed."
echo "Please consult your distro documentation or user support forums."
echo "Once the header files are properly installed, please run \"sudo ./${SCRIPT_NAME}\""
Expand Down Expand Up @@ -309,9 +310,9 @@ else
fi

if command -v /usr/bin/time >/dev/null 2>&1; then
/usr/bin/time -f "Compile time: %U seconds" dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
/usr/bin/time -f "Compile time: %U seconds" dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -k "$KVER" --kernelsourcedir "$KSRC"
else
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -k "$KVER" --kernelsourcedir "$KSRC"
fi
RESULT=$?

Expand All @@ -326,7 +327,7 @@ else
echo "The driver was built by dkms successfully."
fi

dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
dkms install -m ${DRV_NAME} -v ${DRV_VERSION} -k "$KVER" --kernelsourcedir "$KSRC"
RESULT=$?

if [ "$RESULT" != "0" ]; then
Expand Down
7 changes: 4 additions & 3 deletions remove-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ SCRIPT_VERSION="20230126"
MODULE_NAME="88x2bu"
DRV_VERSION="5.13.1"

KARCH="$(uname -m)"
KVER="$(uname -r)"
KARCH="${KARCH:-$(uname -m)}"
KVER="${KVER:-$(uname -r)}"
KSRC="/lib/modules/$KVER/build"
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"

DRV_NAME="rtl${MODULE_NAME}"
Expand Down Expand Up @@ -104,7 +105,7 @@ fi
if command -v dkms >/dev/null 2>&1; then
echo "Removing a dkms installation."
# 2>/dev/null suppresses the output of dkms
dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} --all 2>/dev/null
dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} -k "$KVER" --kernelsourcedir "$KSRC" --all 2>/dev/null
RESULT=$?
#echo "Result=${RESULT}"

Expand Down