Acpi call

From Hybridgraphics

(Difference between revisions)
Jump to: navigation, search
(Correct makefile)
Line 40: Line 40:
and paste this into it and save it:
and paste this into it and save it:
-
  obj-m := acpi_call.o
+
obj-m := acpi_call.o
-
 
+
-
  KDIR := /lib/modules/$(shell uname -r)/build
+
-
  PWD := $(shell pwd)
+
-
 
+
-
  default:
+
-
      $(MAKE) -C $(KDIR) M=$(PWD) modules
+
-
 
+
-
  clean:
+
-
      $(MAKE) -C $(KDIR) M=$(PWD) clean
+
-
 
+
-
  load:
+
-
      -sudo /sbin/rmmod acpi_call
+
-
      sudo /sbin/insmod acpi_call.ko
+
   
   
 +
default:
 +
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
 +
 +
clean:
 +
rm acpi_call.mod.o acpi_call.o acpi_call.ko
 +
5. Add the module to dkms and build and install it:
5. Add the module to dkms and build and install it:

Revision as of 11:58, 26 May 2011

https://github.com/mkottman/acpi_call

acpi_call lets you send ACPI commands to turn your optimus nvidia card on or off (the actual commands to send will vary based on your laptop).

If you get and build the code from the link above, you can build and insert (insmod) the acpi_call module, but you will need to re-insert it after every reboot. In Ubuntu 11.04, you can try using dkms to make this module permanently available.

1. Install dkms and some useful packages:

sudo apt-get install dkms git build-essential
sudo apt-get install linux-headers-$(uname -r)


2. Clone the acpi_call repository from git and copy it to where dkms will look for it. We'll call it version 0.0.1 for now:

git clone http://github.com/mkottman/acpi_call.git
mkdir /usr/src/acpi_call-0.0.1
cp -rp acpi_call/* /usr/src/acpi_call-0.0.1


3. Create a file dkms.conf for it:

sudo gedit /usr/src/acpi_call-0.0.1/dkms.conf

and paste this into it and save it:

PACKAGE_NAME="acpi_call"
PACKAGE_VERSION="0.0.1"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="acpi_call"
DEST_MODULE_NAME[0]="acpi_call"
MAKE[0]="make IGNORE_CC_MISMATCH=1 KDIR=$kernel_source_dir PWD=$dkms_tree/acpi_call/0.0.1/build"
DEST_MODULE_LOCATION[0]="/kernel/drivers/acpi"
AUTOINSTALL="yes"


4. Edit the Makefile:

sudo gedit /usr/src/acpi_call-0.0.1/Makefile

and paste this into it and save it:

obj-m := acpi_call.o

default: 
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
	rm acpi_call.mod.o acpi_call.o acpi_call.ko


5. Add the module to dkms and build and install it:

sudo dkms add -m acpi_call -v 0.0.1
sudo dkms build -m acpi_call -v 0.0.1
sudo dkms install -m acpi_call -v 0.0.1

If all went well, you should now be able to load the module with:

sudo modprobe acpi_call

and this will give some information about it:

modinfo acpi_call


Notes:

  • The AUTOINSTALL="yes" line in dkms.conf is supposed to tell dkms to automatically build and install the module if you upgrade the kernel, but if it doesn't work you can manually execute the dkms build and install commands in the new kernel.
  • If you want to remove the module (eg from all kernels), do:
sudo dkms remove -m acpi_call -v 0.0.1 --all
Personal tools