Compiling virtual network adapter driver problem (net_device struct)


 
Thread Tools Search this Thread
Top Forums Programming Compiling virtual network adapter driver problem (net_device struct)
# 15  
Old 10-26-2010
You only have the headers installed, then. There's probably a way to install kernel source in your distro, but I don't know your distro.

You can get raw kernel source at kernel.org.
# 16  
Old 10-26-2010
I found this:

Linux/arch/ppc/8260_io/enet.c

It is complete source of a network driver. I will try to get something from this and build my own simple driver.
Quick questions:
- there is no 'module_init' and 'module_exit' functions. Is 'module_init' sort of replacement for '__init' ?
- what is more - there is no 'module_exit' nor '__exit'. Isn't it necessary?

Well... it is also based on old net_structure :/
# 17  
Old 10-26-2010
I don't think that's a generic network driver. It's for PowerPC only, it seems, and may be some kind of odd builtin.

Install some kernel source already(It's free) so you can use the files I suggested. Preferably the same version as the kernel you have, which you can get with 'cat /proc/verson'. If you can't find a way to install source in your distro you can still download tarballs from kernel.org

Last edited by Corona688; 10-26-2010 at 03:46 PM..
# 18  
Old 10-27-2010
You seem to be having great difficulty getting going on building a simple network module. Let me try and help you. It is not difficult but can be a bit daunting the first time around.

1. Install the Ubuntu kernel sources for your current kernel See https://help.ubuntu.com/community/Kernel/Compile and elsewhere for how to do this. Follow the instructions to the letter. Do not try and take any shortcuts.

2. Copy the following source file from your kernel source tree to your work area: .../drivers/net/dummy.c. Read the comments at the top of this file for an explanation of the dummy network driver. This driver is about as simple as a 2.6 kernel network driver gets.

3. Create the following Makefile in your work area:
Code:
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
        obj-m := dummy.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
        KERNELDIR ?= /lib/modules/$(shell uname -r)/build
        PWD := $(shell pwd)
default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif

4. Type 'make'. dummy.ko should be built.

5. Install the dummy network driver using "inmod ./dummy.ko"

6. Possible operations:
To list this driver: ifconfig -a. It will show up as dummy0
To remove the driver: rmmod dummy0
To config the driver: ifconfig dummy0 192.168.0.100 netmask 255.255.255.0

Note you can have more than one dummy interface.
These 2 Users Gave Thanks to fpmurphy For This Post:
# 19  
Old 10-28-2010
Thank you man. You made my day. I got working virtual driver at this moment. Now I add new features and work on makefile (that one you posted does not work for me: "nothing to do in 'default'").
Great job.

Last edited by Chrisdot; 10-28-2010 at 03:40 PM..
# 20  
Old 10-28-2010
Quote:
makefile (that one you posted does not work for me: "nothing to do in 'default'").
There is probably something wrong with your development/build environment if the Makefile did not work. It is basically the standard default build-a-module-outside-of-kernel-build-tree Makefile.
# 21  
Old 10-28-2010
You are right. Typing 'echo $KERNELDIR' I got empty line. Typing 'uname -r' I got '2.6.31-14-generic'.

Normally I make using:
Code:
make -C /usr/src/linux-headers-2.6.31-14-generic/ M=$(pwd) modules

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Attach Solaris 11.1 rwn driver to RaLink RT8200/8260 Wi Fi Adapter

I installed Solaris 11.1 on a X86 PC. It's working except for one glaring problem : I cannot get a driver attached to the RaLink RT2800 (Wi Fi Adapter). Can someone point me in the direction where " the correct" driver exists, or let me know how I can tell Solaris to attach the device to the... (1 Reply)
Discussion started by: JWH
1 Replies

2. Hardware

Need Sun 10-Gigabit Ethernet Adapter CD or ixge driver

Hi, Does anybody have a "Sun 10-Gigabit Ethernet Adapter installation CD" or driver ixge for Sun 10-Gigabit Ethernet PCI-X adapter? I need it but can't find it anywhere. So if you know where I can download it or purchase it, please let me know. (Already tried Oracle's website, don't have it) ... (5 Replies)
Discussion started by: Lhao
5 Replies

3. IP Networking

Virtual Adapter MAC address..

Hi, I just want to know whether two MAC address can exist in a adapter.. I mean one there will be mandatory one And another as user defined one.. Any replies will be more helpful.. Please help.. :wall: (0 Replies)
Discussion started by: Priya Amaresh
0 Replies

4. AIX

Adding Virtual Adapter to LPAR

Hello, hopefully someone can help me out with this, I have created a virtual Ethernet adapter on the VIO but would like to add it to my new LPAR. On my VIO only my disk is mapped. $ lsmap -all SVSA Physloc Client Partition ID --------------- --------------------------------------------... (5 Replies)
Discussion started by: audis$
5 Replies

5. Programming

Storing C++-struct in file - problem when adding new item in struct

Hi, I have received an application that stores some properties in a file. The existing struct looks like this: struct TData { UINT uSizeIncludingStrings; // copy of Telnet data struct UINT uSize; // basic properties: TCHAR szHost; //defined in Sshconfig UINT iPortNr; TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies

6. AIX

Setting up an Integrated Virtual Ethernet adapter

All I am trying allocate an IVE to an LPAR (not a VIO) running AIX 7.1. I am getting the error: HSCL068A Explanation Logical port can not be assigned to Logical Partition because this Logical Partition is not the promiscuous LPAR for the physical port. Has anyone encountered this... (1 Reply)
Discussion started by: johnf
1 Replies

7. UNIX for Dummies Questions & Answers

Simulated driver for Network Interface Adapter

Hi all, I got sort of a task to do. I have to write in C "simulated network driver". What does it mean? - It has to run on all network adapters - It has to be as simple as it can be - It has to run on all linux distributions (or at least most of them) - It does not have to run a network... (4 Replies)
Discussion started by: Chrisdot
4 Replies

8. AIX

How to active this network adapter?

When I configure two VIO Servers, VIOS1 used to ping its gateway, after I configured second VIOS2, VIOS1 cannpt ping its gateway, when I run this command: entstat -all ent#|grep -i priority Priority: 5 Active: False How to make Active to True? (1 Reply)
Discussion started by: rainbow_bean
1 Replies

9. AIX

Power6 Virtual Fibre Channel Adapter

Hello, Searched in all IBM Redbooks and on the internet and couldn't find anything about the new feature of POWER 6 which Virtual Fibre ( Fiber ) channel adapter. It is similar to virtual scsi adapter. In my client partition I created the virtual Fibre Adapter mapped it with the VIO... (1 Reply)
Discussion started by: filosophizer
1 Replies

10. Programming

freeBSD device driver (use struct uio)

Hi, everybody I have next problem... 1) My Example program code void main() { int fd; int len; int buf; fd=open("mydev", O_RDONLY); lseek(fd, 0, SEEK_SET); len=read(fd, buf, sizeof(buf)); } 2) My Example Driver code static int mydev_read(dev_t dev, ?, ?, struct uio* uio) {... (0 Replies)
Discussion started by: Alex_T
0 Replies
Login or Register to Ask a Question