-
Notifications
You must be signed in to change notification settings - Fork 18
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
add installation with dkms #31
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,3 @@ | |
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,13 @@ Any feedback on how it works on other Acer laptops would be appreciated. | |
## Building | ||
|
||
Make sure that you have the kernel headers for your kernel installed | ||
and type `make` in the cloned project directory. In more detail, | ||
and type `make KERNELVERSION=$(uname -r)` in the cloned project directory. In more detail, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The build instructions should not need to change once you adapt the Makefile as described above. |
||
on a Debian or Ubuntu system, you can build by: | ||
``` | ||
sudo apt install build-essential linux-headers-$(uname -r) git | ||
git clone https://github.com/frederik-h/acer-wmi-battery.git | ||
cd acer-wmi-battery | ||
make | ||
make KERNELVERSION=$(uname -r) | ||
``` | ||
|
||
## Using | ||
|
@@ -72,7 +72,33 @@ of the calibration is not yet handled by the module: | |
echo 0 | sudo tee /sys/bus/wmi/drivers/acer-wmi-battery/calibration_mode | ||
``` | ||
|
||
### Related work | ||
## Persistent installation (DKMS) | ||
|
||
If you found this driver to be working on your laptop, you may want to install it into your system for ease of use. | ||
|
||
1) Install DKMS and generic kernel headers (this will always get you the latest headers), on Debian or Ubuntu it can be done with: | ||
|
||
``` | ||
sudo apt install dkms linux-headers-generic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked what linux-headers-generic would install on my system and you are right, it depends on the package for the latest kernel headers. But what if you are not running the latest kernel version - as I am. Since the build instructions already describe how to install the headers for the current kernel, I would remove the "linux-headers-generic" from this apt invocation. |
||
``` | ||
|
||
2) Install the driver: in the cloned project directory execute: | ||
|
||
``` | ||
chmod +x install.sh uninstall.sh | ||
sudo ./install.sh | ||
``` | ||
|
||
The driver will now automatically load at boot and be recompiled after a kernel upgrade. Reboot to use it. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
### Uninstallation | ||
In the cloned project directory execute: | ||
|
||
``` | ||
sudo ./uninstall.sh | ||
``` | ||
|
||
## Related work | ||
|
||
There exists [another driver](https://github.com/maxco2/acer-battery-wmi) with | ||
similar functionality of which I have not been aware when starting the work | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Load Acer battery health driver | ||
acer_wmi_battery |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PACKAGE_NAME=acer_wmi_battery | ||
PACKAGE_VERSION=1.0 | ||
MAKE[0]="make KERNELVERSION=${kernelver}" | ||
CLEAN[0]="make clean KERNELVERSION=${kernelver}" | ||
BUILT_MODULE_NAME[0]=acer-wmi-battery | ||
BUILT_MODULE_LOCATION[0]="./" | ||
DEST_MODULE_LOCATION[0]="/kernel/updates/dkms" | ||
AUTOINSTALL="YES" |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you move this file and the other dkms related files to a new directory contrib/dkms, move your instructions to contrib/dkms/README.md and link to this file from README.md? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# remove previous version if present | ||
./uninstall.sh | ||
|
||
# copy project directory into kernel sources | ||
cp -R . /usr/src/acer-wmi-battery-1.0 | ||
|
||
# register module in dkms and install | ||
dkms add -m acer-wmi-battery -v 1.0 | ||
dkms build -m acer-wmi-battery -v 1.0 | ||
dkms install -m acer-wmi-battery -v 1.0 | ||
|
||
# auto-load module at boot | ||
cp acer-wmi-battery.conf /etc/modules-load.d |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
dkms remove -m acer-wmi-battery/1.0 --all | ||
rm -rf /usr/src/acer-wmi-battery-1.0 | ||
rm /etc/modules-load.d/acer-wmi-battery.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to be able to pass a kernel version to the Makefile, it would be better to make this optional, i.e. specify a default value for
KERNELVERSION
. This can be accomplished by defining the variable at the top of the Makefile like this:KERNELVERSION ?= "$(shell uname -r)"
.