HOW-TO: Installing Dazuko kernel module on Fedora Core 4 for use with AVGlinux-7.1-22_free_rh_avi0649. Presented by: John Flanigan Date: 2006-03-08 This HOW-TO is a step by step log of how I installed Dazuko as a kernel module on a DELL OPTIPLEX (~930MHz Pentium III) running Fedora Core 4 with kernel-2.6.15-1.1833_FC4. Most of the steps for building are from the DAZUKO HOWTO:Install and the FAQ subpage on Fedora issues . ***Read BOTH of these for details as to why I did the steps I did.*** The module startup stuff is my own monstrosity based on my limited linux experience. It works for me. If you know a better way to do it, write a HOW-TO yourself. I discovered the need for dazuko after installing the avg rpm. I refer to the avgd start/stop script in several places. Substitute you own dazuko dependent module/service in these places. Most of these steps are done as a normal user. Any steps requiring root privileges are done with sudo. You could also 'su -' in and out as needed. If you are logged on as root, well; Dia ·r s·bh·il! Preparation: 1) Download dazuko-2.2.0.tar.gz from www.dazuko.org 2) Download kernel-2.6.15-1.1833_FC4.src.rpm from Fedora Core mirror site. 3) Install the kernel source: [flanman@linux Downloads]$ rpm -ivh kernel-2.6.15-1.1833_FC4.src.rpm 4) Extract the dazuko source: [flanman@linux Downloads]$ cp dazuko-2.2.0.tar.gz ~/building [flanman@linux Downloads]$ cd ~/building [flanman@linux building]$ gunzip dazuko-2.2.0.tar.gz [flanman@linux building]$ tar xvf dazuko-2.2.0.tar Build: 5) Build custom kernel with capability as a module: [flanman@linux building]$ cd /usr/src/redhat/SPECS [flanman@linux SPECS]$ vi kernel-2.6.spec Change line 23 from: %define release %(R="$Revision: 1.1833 $"; RR="${R##: }"; echo ${RR%%?})_FC4%{rhbsys} to: %define release %(R="$Revision: 1.1833a $"; RR="${R##: }"; echo ${RR%%?})_FC4%{rhbsys} Here is the change -------------------^ NOTE: I forgot to turn off the buildsmp flag. If you don't need smp I recommend turning it off for a faster build. Lots faster... [flanman@linux SPECS]$ cd ../SOURCES I'm using an i686 machine so: [flanman@linux SOURCES]$ vi kernel-2.6.15-i686.config Change line 2531 from: CONFIG_SECURITY_CAPABILITIES=y to: CONFIG_SECURITY_CAPABILITIES=m [flanman@linux SOURCES]$ cd ../SPECS [flanman@linux SPECS]$ rpmbuild -bb --target i686 kernel-2.6.spec 2>../LOGS/krnl2615-err.log Once the build completes... [flanman@linux SPECS]$ cd ../RPMS/i686 [flanman@linux i686]$ sudo rpm -ivh kernel-2.6.15-1.1833a_FC4.flanman.i686.rpm [flanman@linux i686]$ sudo rpm -ivh kernel-devel-2.6.15-1.1833a_FC4.flanman.i686.rpm [flanman@linux i686]$ cd /boot [flanman@linux boot]$ sudo rm vmlinuz [flanman@linux boot]$ sudo ln -s /boot/vmlinuz-2.6.15-1.1833a_FC4.flanman ./vmlinuz [flanman@linux boot]$ sudo rm System.map [flanman@linux boot]$ sudo ln -s /boot/System.map-2.6.15-1.1833a_FC4.flanman ./System.map [flanman@linux boot]$ reboot After the system reboots and the new kernel checks out: 6) Build the dazuko kernel module: [flanman@linux ~]$ cd ~/building/dazuko-2.2.0 [flanman@linux dazuko-2.2.0]$ ./configure [flanman@linux dazuko-2.2.0]$ make [flanman@linux dazuko-2.2.0]$ chmod 744 dazuko.ko [flanman@linux dazuko-2.2.0]$ sudo cp dazuko.ko /lib/modules/2.6.15-1.1833a_FC4.flanman/kernel/security [flanman@linux dazuko-2.2.0]$ sudo depmod -ae `uname -r` 7) Test the module: [flanman@linux dazuko-2.2.0]$ /etc/init.d/avgd stop [flanman@linux dazuko-2.2.0]$ sudo /sbin/modprobe -i dazuko [flanman@linux dazuko-2.2.0]$ sudo /sbin/lsmod |grep dazuko You should see something like this: dazuko 55944 0 commoncap 7105 1 dazuko [flanman@linux dazuko-2.2.0]$ At this point you can do Step 4 of the Dazuko HOWTO:Install mentioned above. 8) Set up system to load module on startup: [flanman@linux dazuko-2.2.0]$ cd /etc/init.d [flanman@linux init.d]$ sudo vi dazuko_mod Create the following startup script: ================================================================ #!/bin/sh # # chkconfig: 2345 60 40 # description: Loads dazuko module # cobbled together from avgd startupscript # by john flanigan 2006-03-03 # if [ $(id -u) -ne 0 ]; then echo "ERROR: Try to run this as root." exit 1 fi # Source function library. if [ -f /etc/init.d/functions ] ; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else exit 0 fi # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 RETVAL=0 start() { echo -n "Loading Dazuko module..."; # check if dazuko exists DAZMOD=`/sbin/lsmod | grep dazuko`; if [ -z "${DAZMOD}" ]; then /sbin/modprobe -i dazuko; echo_success; echo; else echo " Dazuko already loaded."; fi RETVAL=$? return $RETVAL } stop() { echo -n "Unloading Dazuko module: " /sbin/modprobe -r dazuko RETVAL=$? echo_success; echo; return $RETVAL } restart() { stop; start; } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $? =============================================================== NOTE: My system does not seem to need the capability.ko module so I don't load it. If you need it modify my 'dazuko_mod' script to do the following: modprobe -r capability modprobe -i dazuko modprobe -i capability Don't forget to clean up after yourself in the stop) section. 9) Test the new startup script: [flanman@linux init.d]$ sudo chmod 755 ./dazuko_mod [flanman@linux init.d]$ sudo ./avgd stop [flanman@linux init.d]$ sudo ./dazuko_mod stop Unloading Dazuko module: [ OK ] [flanman@linux init.d]$ sudo /sbin/lsmod |grep dazu [flanman@linux init.d]$ [flanman@linux init.d]$ sudo ./dazuko_mod start Loading Dazuko module... [ OK ] [flanman@linux init.d]$ sudo /sbin/lsmod |grep dazu dazuko 55944 0 commoncap 7105 1 dazuko [flanman@linux init.d]$ sudo ./avgd start 10) Create link in rcx.d directory. I normally boot to command line (init level:3) so I'm working in rc3.d. If you boot directly to a GUI you need to place this link elsewhere, probably rc5.d. [flanman@linux init.d]$ cd ../rc3.d [flanman@linux rc3.d]$ ls -l S* [snip] lrwxrwxrwx 1 root root 16 Feb 19 2004 S56xinetd -> ../init.d/xinetd lrwxrwxrwx 1 root root 14 Feb 20 11:09 S60avgd -> ../init.d/avgd [snip] lrwxrwxrwx 1 root root 11 Dec 6 13:54 S99local -> ../rc.local [flanman@linux rc3.d]$ Since I want dazuko to load just before avgd I created the following: [flanman@linux rc3.d]$ sudo ln -s ../init.d/dazuko_mod ./S59dazuko_mod 11)[flanman@linux rc3.d]$ reboot Watch startup screens for: Loading Dazuko module... [ OK ] and Starting AVG7 Anti-Vir Daemon messages. That's all folks!