LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   bug me out (https://www.linuxquestions.org/questions/linux-software-2/bug-me-out-641630/)

siddhi817 05-12-2008 07:53 AM

bug me out
 
I m a rookie in linux fc7..trying to compile a c code for building a dummy network device driver. . but whenever I try to compile the code , I get a long list of errors. firstly it says that header files not found...someone suggested to install glibc-devel package for inclusion of header files in gcc...I did download the package but it failed to install as it required dependencies...now I m in dire need of help from experts in two areas

1. tell me what dependencies shud I search for the glibc package installation and which folder I shud install it! with complete txt commands.

2. does anyone know ho to build a dummy driver for rtl8139 in linux?

btw I m running fc7...on a 32 bit intel processors......


this was the code I was trying to compile

http://linuxgazette.net/issue93/bhaskaran.html

#define MODULE
#define __KERNEL__

#include < linux/module.h >
#include < linux/config.h >

#include < linux/netdevice.h >

int rtl8139_open (struct net_device *dev)
{
printk("rtl8139_open called\n");
netif_start_queue (dev);
return 0;
}

int rtl8139_release (struct net_device *dev)
{
printk ("rtl8139_release called\n");
netif_stop_queue(dev);
return 0;
}

static int rtl8139_xmit (struct sk_buff *skb,
struct net_device *dev)
{
printk ("dummy xmit function called....\n");
dev_kfree_skb(skb);
return 0;
}

int rtl8139_init (struct net_device *dev)
{
dev->open = rtl8139_open;
dev->stop = rtl8139_release;
dev->hard_start_xmit = rtl8139_xmit;
printk ("8139 device initialized\n");
return 0;
}

struct net_device rtl8139 = {init: rtl8139_init};

int rtl8139_init_module (void)
{
int result;

strcpy (rtl8139.name, "rtl8139");
if ((result = register_netdev (&rtl8139))) {
printk ("rtl8139: Error %d initializing card rtl8139 card",result);
return result;
}
return 0;
}

void rtl8139_cleanup (void)
{
printk ("<0> Cleaning Up the Module\n");
unregister_netdev (&rtl8139);
return;
}

module_init (rtl8139_init_module);
module_exit (rtl8139_cleanup);

bathory 05-12-2008 01:43 PM

In order to compile a device driver you need the kernel headers, that match your kernel version. Run:
Code:

uname -r
to find your kernel version and then install the kernel source package.
You can use yum to install packages, as it can find and resolve dependencies.

Regards

siddhi817 05-13-2008 12:24 AM

please tell me the command to install kernel source package...

bathory 05-13-2008 01:46 AM

If you have the installation CDs you can use rpm to install it. Else you can d/l it from here (make sure you get the correct kernel-devel that matches your installed kernel version) and use again rpm to install.
You can also use yum to d/l and install:
Code:

yum install kernel-devel


All times are GMT -5. The time now is 05:14 AM.