PDA

View Full Version : How to Compile kernel headers


ikkem
8th February 2007, 02:43
Hi I had a question
I wanted to ask how to build kernel_headers for the 2.6.19.3 kernel on debian sarge in order to build the dazuko module
The how to by Falko worked nicely for compiling the kernel source 2.6.19.3 from kernel.org ....thanks for the how to
http://www.howtoforge.com/kernel_compilation_debian

falko
8th February 2007, 21:53
If you compiled a kernel from the sources, the kernel headers are already installed. :)

ikkem
8th February 2007, 22:51
hi....:)
thanks for reacting I get a kernel headers not found error when building the dazuko module maybe I am missing something....
thanks in advance

falko
9th February 2007, 16:42
Did you boot into your new kernel, or are you still using your old one? You can find out by running
uname -r

ikkem
9th February 2007, 16:49
I boot into my new kernel but for some reason the headers can't be found....
uname -r
2.6.19.3-386


I am trying to build the dazuko module to run with antivir

dpkg -i dazuko-source_2.3.2-1_all.deb
m-a a-i dazuko


module-assistant, error message
Bad luck, the kernel headers for the target kernel version could not be found and you did not specify other valid kernel headers to use.

If the running kernel has been shipped with the Debian distribution, please
install the package kernel-headers-2.6.19.3-386. If your kernel source tree (or headers) is located in some non-usual location, please set the KERNELDIRS environment variable to the path of this directory, alternatively) specify the source directory we build for with the --kernel-dir option in module-assistant calls.

thanks in advance

falko
10th February 2007, 21:34
If I think about it - it's possible that the kernel headers aren't installed because in the Debian kernel howto we create a kernel .deb package which doesn't contain the headers.

You can try to combine the Debian kernel howto with this one: http://www.howtoforge.com/kernel_compilation_ubuntu_p2

Run
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
instead of
fakeroot make deb-pkgThis should create a kernel headers deb package.

If that doesn't work, you can still compile a kernel the traditional way, without creating a deb package, as shown here: http://www.howtoforge.com/kernel_compilation_fedora_p2
That way the headers will be installed for sure.

ikkem
10th February 2007, 22:55
thanks for reacting I will try the traditional way hopefully that will be sufficient I could not install the kernel_image with the ubuntu way and the kernel headers were not installed in full because the kernel module builder could not find the kernel headers even after I installed the kernel header package
darkstar:/usr/src# dpkg -i kernel-image-2.6.19.3-custom686_10.00.Custom_i386.deb
Selecteren van voorheen niet geselecteerd pakket kernel-image-2.6.19.3-custom686.
(Database inlezen ... 142554 bestanden en mappen geïnstalleerd.)
Uitpakken van kernel-image-2.6.19.3-custom686 (uit kernel-image-2.6.19.3-custom686_10.00.Custom_i386.deb) ...
Instellen van kernel-image-2.6.19.3-custom686 (10.00.Custom) ...
/usr/sbin/mkinitrd: /lib/modules/2.6.19.3-custom686: Not a directory
/usr/sbin/mkinitrd: MODULES needs to be set to none?
Failed to create initrd image.
dpkg: fout bij afhandelen van kernel-image-2.6.19.3-custom686 (--install):
subproces post-installation script gaf een foutwaarde 2 terug
Fouten gevonden tijdens behandelen van:
kernel-image-2.6.19.3-custom686


I will try the traditional way hopefully it will help....
ikkem....

ikkem
11th February 2007, 04:20
I followed the how to

make all
make modules_install
make headers_install
make install

I checked in /boot the ramdisk was not build which made reboot into the new kernel fail (I guess)

I will continue tomorrow.....

ikkem
13th February 2007, 17:37
I made the ramdisk mkinitrd.yaird -o /boot/initrd.img-2.6.19.3-raysun1 2.6.19.3-raysun1 updated grub update-grub
but I still get a error message of kernel headers not found maybe I missed something....

thanks in advance

falko
14th February 2007, 20:32
What's the exact error message, and what kernel version did you try to compile?

ikkem
14th February 2007, 20:58
The error message I get is

Bad luck, the kernel headers for the target kernel version could not be found and you did not specify other valid kernel headers to use.


If the running kernel has been shipped with the Debian distribution, please
install the package kernel-headers-2.6.19.3-raysun1. If your kernel source tree (or headers) is located in some non-usual location, please set the KERNELDIRS environment variable to the path of this directory, alternatively) specify the source directory we build for with the --kernel-dir option in module-assistant calls.

I am new to Linux so please tell me if I have to be more specific....

Thanks in advance....

falko
15th February 2007, 20:21
What's the output of ls -la /lib/modules/2.6.19.3-raysun1 and ls -la /boot?

ikkem
15th February 2007, 21:36
The output of those commands is

ls -la /lib/modules/2.6.19.3-raysun1
totaal 1044
drwxr-xr-x 3 root root 4096 2007-02-13 15:53 .
drwxr-xr-x 5 root root 4096 2007-02-11 02:34 ..
lrwxrwxrwx 1 root root 23 2007-02-11 02:34 build -> /usr/src/linux-2.6.19.3
drwxr-xr-x 10 root root 4096 2007-02-13 15:53 kernel
-rw-r--r-- 1 root root 207692 2007-02-13 15:53 modules.alias
-rw-r--r-- 1 root root 69 2007-02-13 15:53 modules.ccwmap
-rw-r--r-- 1 root root 232896 2007-02-13 15:53 modules.dep
-rw-r--r-- 1 root root 813 2007-02-13 15:53 modules.ieee1394map
-rw-r--r-- 1 root root 394 2007-02-13 15:53 modules.inputmap
-rw-r--r-- 1 root root 21531 2007-02-13 15:53 modules.isapnpmap
-rw-r--r-- 1 root root 180188 2007-02-13 15:53 modules.pcimap
-rw-r--r-- 1 root root 94667 2007-02-13 15:53 modules.symbols
-rw-r--r-- 1 root root 277481 2007-02-13 15:53 modules.usbmap
lrwxrwxrwx 1 root root 23 2007-02-13 15:51 source -> /usr/src/linux-2.6.19.3


zxqv@darkstar:~$ ls -la /boot
totaal 13028
drwxr-xr-x 3 root root 4096 2007-02-13 15:56 .
drwxr-xr-x 22 root root 4096 2007-02-05 21:13 ..
lrwxrwxrwx 1 root root 23 2007-02-13 15:53 config -> config-2.6.19.3-raysun1
-rw-r--r-- 1 root root 69659 2007-02-06 16:32 config-2.6.19.2-386~
-rw-r--r-- 1 root root 70063 2007-01-23 02:37 config-2.6.19.2-686~
-rw-r--r-- 1 root root 67304 2007-02-11 00:37 config-2.6.19.3-386
-rw-r--r-- 1 root root 67304 2007-02-07 00:15 config-2.6.19.3-386~
-rw-r--r-- 1 root root 67314 2007-02-07 23:06 config-2.6.19.3-custom686~
-rw-r--r-- 1 root root 67484 2007-02-13 15:56 config-2.6.19.3-raysun1
-rw-r--r-- 1 root root 67482 2007-02-13 15:53 config-2.6.19.3-raysun1~
-rw-r--r-- 1 root root 66656 2007-02-06 18:55 config-2.6.20-686~
-rw-r--r-- 1 root root 55809 2005-08-16 14:41 config-2.6.8-2-386
drwxr-xr-x 2 root root 4096 2007-02-13 16:09 grub
-rw------- 1 root root 1046716 2007-02-07 00:21 initrd.img-2.6.19.3-386
-rw------- 1 root root 1048816 2007-02-13 15:56 initrd.img-2.6.19.3-raysun1
-rw-r--r-- 1 root root 4317184 2007-01-22 21:23 initrd.img-2.6.8-2-386
lrwxrwxrwx 1 root root 27 2007-02-13 15:53 System.map -> System.map-2.6.19.3-raysun1
-rw-r--r-- 1 root root 801058 2007-02-11 00:37 System.map-2.6.19.3-386
-rw-r--r-- 1 root root 800244 2007-02-13 15:53 System.map-2.6.19.3-raysun1
-rw-r--r-- 1 root root 865767 2005-08-16 17:14 System.map-2.6.8-2-386
lrwxrwxrwx 1 root root 31 2007-02-13 15:53 System.map.old -> System.map-2.6.19.3-raysun1.old
lrwxrwxrwx 1 root root 24 2007-02-13 15:53 vmlinuz -> vmlinuz-2.6.19.3-raysun1
-rw-r--r-- 1 root root 1308845 2007-02-11 00:37 vmlinuz-2.6.19.3-386
-rw-r--r-- 1 root root 1320322 2007-02-13 15:53 vmlinuz-2.6.19.3-raysun1
-rw-r--r-- 1 root root 1097554 2005-08-16 17:14 vmlinuz-2.6.8-2-386
lrwxrwxrwx 1 root root 28 2007-02-13 15:53 vmlinuz.old -> vmlinuz-2.6.19.3-raysun1.old


thanks in advance....

falko
16th February 2007, 19:20
But there's an initrd.img-2.6.19.3-raysun1 in the /boot directory, so you don't need to create another ramdisk.

ikkem
16th February 2007, 19:48
I made a ram disk after that I booted into the new kernel but I still get a error message when I try to compile dazuko....

Bad luck, the kernel headers for the target kernel version could not be found and you did not specify other valid kernel headers to use.


If the running kernel has been shipped with the Debian distribution, please
install the package kernel-headers-2.6.19.3-raysun1. If your kernel source tree (or headers) is located in some non-usual location, please set the KERNELDIRS environment variable to the path of this directory, alternatively) specify the source directory we build for with the --kernel-dir option in module-assistant calls.

ikkem
16th February 2007, 20:02
But there's an initrd.img-2.6.19.3-raysun1 in the /boot directory, so you don't need to create another ramdisk.

At first the ramdisk was not created with:make all
make modules_install
make headers_install
make install

I made the ramdisk with mkinitrd.yaird -o /boot/initrd.img-2.6.19.3-raysun1 2.6.19.3-raysun1

updated grub
update-grub

ikkem
21st February 2007, 17:42
I succeeded in installing dazuko I compiled it from source(followed the instructions for SuSE 9.1)

$ mkdir dazuko
$ cd dazuko
$ wget http://www.dazuko.de/files/dazuko-2.3.2.tar.gz
$ tar xzvf dazuko-2.3.2.tar.gz
$ cd dazuko-2.3.2
$ ./configure --enable-syscalls --mapfile=/boot/System.map-2.6.19.3-raysun1
$ su
# make
# cp dazuko.ko /lib/modules/2.6.19.3-raysun1/kernel/security
#depmod -a
#gedit /etc/modprobe.d/dazuko

Copy and paste the following code into the blank document and save it.

install dazuko modprobe -r capability;\
modprobe -i dazuko; \
modprobe -i capability

#gedit /etc/modules file. Add "dazuko" to the end of the list. Save and exit the file.

modify the boot parameters to disable NSA SELinux support

#gedit /boot/grub/menu.lst and add "selinux=0" to the end of the line:
kernel /boot/vmlinuz-2.6.19.3-raysun1 root=/dev/hda1 ro selinux=0

reboot

sources
http://www.dazuko.de/tgen.shtml
http://klamav.sourceforge.net/klamav...Eft_.286.10.29