Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
ok, im creating a system call function called getThreadInfo, which basically outputs the max and current running threads. i have the function set up in funcThreadInfo.c and h.
i have a driver.c program that should call the function.
my biggest confusion (im very new to kernel's) is how to get up the makefiles. i keep my funcThreadInfo.c function in the kernel directory. i edited the one in my /usr/src/linux-2.4/kernel/ one to have the funcThreadInfo.o file onto it (again, i wasnt sure exactly which list to append it onto), and i added the same .o file into the makefile in folder /usr/src/linux-2.4/ (the big one).
my other confusion is, they have us set up a link in the /usr/include directory to point to the include/asm-i386 folder (where i keep my funcThreadInfo.h file). is this user/include folder where the driver program goes for the user (aside from root user)?
Once you've added the object file to the Makefile, you can rebuild the kernel and it should just build right in. Also, since you're writing a syscall, you'll need to add it to the syscall table in arch/i386/entry.S (assuming you're on x86 and haven't done so). The /usr/include directory is for header files, not userland programs -- they go into the normal bin or lib directory (depending on whether you have an executable or library). Also, are you sure there's no existent function that does this?
where would i put the driver.c file then? they told us we have to log on as a normal user in order to use the system call through driver.c. i forgot to mention i have a driver.h file in usr/include/. i where should the .c file go for the normal user to run?
as for the kernel makefile. i added the funcThreadInfo.o object file (this is the system call function) at the end of "export-objs", is this correct? or should it be under obj-y or O_TARGET's lists of .o files?
The location of the driver.c file doesn't matter to the kernel. After all, it's the user space functionality -- the kernel doesn't care about it. As for where to put the .o -- I think either will work, but the exported objects will be accessible from modules. I'm really not sure, though, as the only time I did this was with 2.6 which handles things somewhat differently.