Solved

how to include own C file in kernel source 2.4 ?

Posted on 2004-03-24
3
183 Views
Last Modified: 2013-11-18
i am writing a function that is stored in another C file and want to include it in kernel file in net directory. what should i do?
Is that require me to insert a include that C file if not then Is that require me to define that function prototype in that file in which i am includeing?
the problem is that i include it in a kernel file but it gives error while compiling kernel net/network.o(.text+0x1d40a): undefined reference to `fun' where fun is the function that is written in my own C file that i include in kernel source.
0
Comment
Question by:pancoder
3 Comments
 
LVL 12

Expert Comment

by:stefan73
ID: 10675600
Hi pancoder,
Check the include files for the net part of the kernel. There is for sure some "master include file" which is used by all .c sources. Modify this, include your own header file from there.

Cheers,

Stefan
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 50 total points
ID: 10682870
You need two things in order to add your own function to any program: A header file and an implementation file. If you duplicate the declaration of your function(s), you can get by without the header file. In your case, the problem shows up during the link phase, which means that you don't heave any problems with header files or declarations. You need to add your object file (the Makefile will know how to create the object file from your source file) to the list of files that get linked into network.o
On order to do this, add your file.o to the definition of obj-y in the Makefile in the network directory.
0
 

Expert Comment

by:namus
ID: 10694965
you need to modify the make file of the directory in which ur placing ur C code file. then include the header in that source file. then u need to compile the kernel. So that the code becomes part of the kernel code.
to compile the kernel... follow the simple steps mentioned at http://www.freeos.com/articles/2589/    (though ther r many places u can find it... its jus a reference i found out of a quick search).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now