dazuko-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dazuko-help] A users HOWTO for Dazuko kernel module.


From: John Flanigan
Subject: [Dazuko-help] A users HOWTO for Dazuko kernel module.
Date: Mon, 13 Mar 2006 18:30:23 -0500

I hope someone finds this usefull.

-------------------------------------------------------------------------------------------

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 <http://www.dazuko.org/howto-install.shtml> and the FAQ subpage on Fedora issues <http://www.dazuko.org/files/dazuko-HOWTO-fedoracore-3.txt>.

***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:

   address@hidden Downloads]$ rpm -ivh kernel-2.6.15-1.1833_FC4.src.rpm

4) Extract the dazuko source:

   address@hidden Downloads]$ cp dazuko-2.2.0.tar.gz ~/building
   address@hidden Downloads]$ cd ~/building
   address@hidden building]$ gunzip dazuko-2.2.0.tar.gz
   address@hidden building]$ tar xvf dazuko-2.2.0.tar

Build:

5) Build custom kernel with capability as a module:

   address@hidden building]$ cd /usr/src/redhat/SPECS
   address@hidden 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...

   address@hidden SPECS]$ cd ../SOURCES

   I'm using an i686 machine so:

   address@hidden SOURCES]$ vi kernel-2.6.15-i686.config

   Change line 2531 from:
   CONFIG_SECURITY_CAPABILITIES=y
   to:
   CONFIG_SECURITY_CAPABILITIES=m

   address@hidden SOURCES]$ cd ../SPECS
address@hidden SPECS]$ rpmbuild -bb --target i686 kernel-2.6.spec 2>../LOGS/krnl2615-err.log

   Once the build completes...

   address@hidden SPECS]$ cd ../RPMS/i686
address@hidden i686]$ sudo rpm -ivh kernel-2.6.15-1.1833a_FC4.flanman.i686.rpm address@hidden i686]$ sudo rpm -ivh kernel-devel-2.6.15-1.1833a_FC4.flanman.i686.rpm
   address@hidden i686]$ cd /boot
   address@hidden boot]$ sudo rm vmlinuz
address@hidden boot]$ sudo ln -s /boot/vmlinuz-2.6.15-1.1833a_FC4.flanman ./vmlinuz
   address@hidden boot]$ sudo rm System.map
address@hidden boot]$ sudo ln -s /boot/System.map-2.6.15-1.1833a_FC4.flanman ./System.map
   address@hidden boot]$ reboot

After the system reboots and the new kernel checks out:

6) Build the dazuko kernel module:

   address@hidden ~]$ cd ~/building/dazuko-2.2.0
   address@hidden dazuko-2.2.0]$ ./configure
   address@hidden dazuko-2.2.0]$ make
   address@hidden dazuko-2.2.0]$ chmod 744 dazuko.ko
address@hidden dazuko-2.2.0]$ sudo cp dazuko.ko /lib/modules/2.6.15-1.1833a_FC4.flanman/kernel/security
   address@hidden dazuko-2.2.0]$ sudo depmod -ae `uname -r`

7) Test the module:

   address@hidden dazuko-2.2.0]$ /etc/init.d/avgd stop
   address@hidden dazuko-2.2.0]$ sudo /sbin/modprobe -i dazuko
   address@hidden dazuko-2.2.0]$ sudo /sbin/lsmod |grep dazuko

   You should see something like this:
   dazuko                 55944  0
   commoncap               7105  1 dazuko
   address@hidden 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:

   address@hidden dazuko-2.2.0]$ cd /etc/init.d
   address@hidden 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:

   address@hidden init.d]$ sudo chmod 755 ./dazuko_mod
   address@hidden init.d]$ sudo ./avgd stop
   address@hidden init.d]$ sudo ./dazuko_mod stop
   Unloading Dazuko module:                                   [  OK  ]
   address@hidden init.d]$ sudo /sbin/lsmod |grep dazu
   address@hidden init.d]$
   address@hidden init.d]$ sudo ./dazuko_mod start
   Loading Dazuko module...                                   [  OK  ]
   address@hidden init.d]$ sudo /sbin/lsmod |grep dazu
   dazuko                 55944  0
   commoncap               7105  1 dazuko
   address@hidden 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.
   address@hidden init.d]$ cd ../rc3.d
   address@hidden 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
   address@hidden rc3.d]$
   Since I want dazuko to load just before avgd I created the following:
   address@hidden rc3.d]$ sudo ln -s ../init.d/dazuko_mod ./S59dazuko_mod

11)address@hidden rc3.d]$ reboot

Watch startup screens for:
Loading Dazuko module...                                   [  OK  ]
and
Starting AVG7 Anti-Vir Daemon
messages.

That's all folks!
--
********************************************************************
John Flanigan   e-mail : address@hidden

(*  I'm NOT an engineer, I'm just a TINKER with a better education!!!  *)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]