* Stopping VirtualBox kernel modules [ OK ]
* Uninstalling old VirtualBox DKMS kernel modules [ OK ]
* Trying to register the VirtualBox kernel modules using DKMS Error! Your kernel headers for kernel 2.6.38 cannot be found.
Please install the linux-headers-2.6.38 package,
or use the --kernelsourcedir option to tell DKMS where it's located
* Failed, trying without DKMS
* Recompiling VirtualBox kernel modules
* Look at /var/log/vbox-install.log to find out what went wrong
# cat /var/log/vbox-install.log
Makefile:169: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
# ll /lib/modules/2.6.38/
drwxr-xr-x 4 root root 4096 2012-06-20 13:04 ./
drwxr-xr-x 4 root root 4096 2012-06-20 12:59 ../
lrwxrwxrwx 1 root root 14 2012-06-20 12:35 build -> /usr/src/linux
drwxr-xr-x 10 root root 4096 2011-03-19 13:41 kernel/
-rw-r--r-- 1 root root 675129 2012-06-20 13:04 modules.alias
-rw-r--r-- 1 root root 653896 2012-06-20 13:04 modules.alias.bin
-rw-r--r-- 1 root root 5646 2011-03-18 09:34 modules.builtin
-rw-r--r-- 1 root root 6664 2012-06-20 13:04 modules.builtin.bin
-rw-r--r-- 1 root root 69 2012-06-20 13:04 modules.ccwmap
-rw-r--r-- 1 root root 309481 2012-06-20 13:04 modules.dep
-rw-r--r-- 1 root root 456671 2012-06-20 13:04 modules.dep.bin
-rw-r--r-- 1 root root 665 2012-06-20 13:04 modules.ieee1394map
-rw-r--r-- 1 root root 295 2012-06-20 13:04 modules.inputmap
-rw-r--r-- 1 root root 25711 2012-06-20 13:04 modules.isapnpmap
-rw-r--r-- 1 root root 74 2012-06-20 13:04 modules.ofmap
-rw-r--r-- 1 root root 123806 2011-03-18 09:34 modules.order
-rw-r--r-- 1 root root 432531 2012-06-20 13:04 modules.pcimap
-rw-r--r-- 1 root root 1723 2012-06-20 13:04 modules.seriomap
-rw-r--r-- 1 root root 247451 2012-06-20 13:04 modules.symbols
-rw-r--r-- 1 root root 314768 2012-06-20 13:04 modules.symbols.bin
-rw-r--r-- 1 root root 992069 2012-06-20 13:04 modules.usbmap
drwxr-xr-x 3 root root 4096 2012-06-19 10:04 updates/
/usr/share/virtualbox/src/vboxhostvboxdrv/Makefile
ifndef KERN_DIR
# build for the current kernel, version checkKERN_DIR := /lib/modules/$(shell uname -r)/build
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
KERN_DIR := /usr/src/linux
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
$(error Error: unable to find the sources of your current Linux kernel. \
Specify KERN_DIR=<directory> and run Make again)
#ls /usr/src
linux linux-headers-2.6.38 linux-headers-3.2.6
#ln -s linux-headers-2.6.38 linux
create softlink
主要是将KERN_DIR 设置好即可编译vboxdrv DKMS