LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-18-2004, 01:30 AM   #1
sonika_singhi
Member
 
Registered: Oct 2004
Location: india
Distribution: fedora core
Posts: 34

Rep: Reputation: 15
Question linux kernel programming


we want for our project purpose that a module created by us(actually it is a c executable) should startup as soon as the system comes up.
should we embed our source code in kernel source code and recompile it.
pls anyone could guide us how to proceed for this.
thanx
 
Old 12-18-2004, 03:14 AM   #2
hk_linux
Member
 
Registered: Nov 2004
Location: India
Distribution: RedHat, PCQLinux, Fedora
Posts: 95

Rep: Reputation: 15
If you are looking ONLY for startup after bootup, there are many ways to achieve it,
1. Call the script from rc.local
2. Put the appropriate startup/shutdown scripts in runlevel dir e.g /etc/rc.d/rc3.d/

HTH
 
Old 12-18-2004, 03:16 AM   #3
bm17
Member
 
Registered: Sep 2004
Location: Santa Cruz, CA, USA
Distribution: Redhat 9.0
Posts: 104

Rep: Reputation: 15
Just check out the Linux Loadable kernel Module HowTo. (Try google)

You should be able to activate the kernel module very early in the boot process. The frame buffer code does this, I believe. Are you trying to put up a splash screen?

Be aware that if you modify the kernel itself then you must publish those changes if you want to sell the new kernel. This is a GPL requirement. The same is not true if you use a module.

Last edited by bm17; 12-18-2004 at 03:18 AM.
 
Old 12-20-2004, 03:20 AM   #4
sonika_singhi
Member
 
Registered: Oct 2004
Location: india
Distribution: fedora core
Posts: 34

Original Poster
Rep: Reputation: 15
pls b specific

Quote:
Originally posted by hk_linux
If you are looking ONLY for startup after bootup, there are many ways to achieve it,
1. Call the script from rc.local
2. Put the appropriate startup/shutdown scripts in runlevel dir e.g /etc/rc.d/rc3.d/

HTH
thanx a lot
but i did not understand your second step.
what do u mean by startup/shutdown script?
suppose my executable is myprog then
i will place ./myprog in rc.local
what should i do to carry out second step?
please reply soon
we need it immediately
thanx
hoping for fast reply-------------
 
Old 12-20-2004, 03:45 AM   #5
hk_linux
Member
 
Registered: Nov 2004
Location: India
Distribution: RedHat, PCQLinux, Fedora
Posts: 95

Rep: Reputation: 15
Whenever you enter a run level, the scripts in the corresponding runlevel will be executed. For example in runlevel 3, the scripts in rc3.d will be executed. The order of execution will be in the first S scripts (startup) followed by K scripts (kill) scripts. You have write a wrapper script for ur C executable with arguments start/stop/restart/condrestart. You can refer any script in that dir for more answers.

Then for starting the scripts in init run levels 3 and 5, u have to place the script in the rc3.d and rc5.d dirs. Usually it will be a link to the /etc/init.d directory.

This is in RedHat and Fedora distros. Am not sure abt others.
 
Old 12-21-2004, 12:43 AM   #6
sonika_singhi
Member
 
Registered: Oct 2004
Location: india
Distribution: fedora core
Posts: 34

Original Poster
Rep: Reputation: 15
thanx a lot for your help
but by mistake the executable which we have placed in
/etc/rc.d/rc3.d is a server program. and hence is having in it's coding an infinite while loop
now we have come to know that we should have called it as
a background process.
but now whenever we turn on our machine only console appears. the desktop does not appear.
we get the reply from the server when the client requests but i can't do anything else on the server. it is continuoslly in listening mode.
how to kill this process
pls help us.
ctrl+c and ctrl+z are not working.
plsssssssssssssssssssssss reply soooooooooooooooooooon
 
Old 12-21-2004, 01:41 AM   #7
bm17
Member
 
Registered: Sep 2004
Location: Santa Cruz, CA, USA
Distribution: Redhat 9.0
Posts: 104

Rep: Reputation: 15
Reboot and stop the boot process at the grub prompt. Add runlevel=3 to the kernel command line or else add emergency ot the command line. Then proceed with the boot. This should get you into a "text" login. then you can login and kill the runaway process, and/or remove the errant entry from /etc/init.d<br><br>
For more details, try google "linux grub emergency booting".
 
Old 12-21-2004, 03:05 AM   #8
hk_linux
Member
 
Registered: Nov 2004
Location: India
Distribution: RedHat, PCQLinux, Fedora
Posts: 95

Rep: Reputation: 15
Quote:
[i]
but now whenever we turn on our machine only console appears. the desktop does not appear.
I am not clear on this sentence. I think you are in runlevel 3. Are u talking about the GUI desktop? That should come only in run level 5.

For logging into the system, if you have the Linux installation CD in hand, boot with that CD, go to "linux rescue" in the boot prompt. That will give you a shell. You can do a chroot to the actual filesystem in the hard disk. Then remove the entry from the rc3.d/. Then reboot the system. This will boot the system properly. Now put the proper entries in the rc3.d.

Exercise caution while doing the same.

HTH.
 
Old 12-22-2004, 05:22 AM   #9
Genjix
Member
 
Registered: Oct 2003
Location: Pico
Distribution: SUSE 9.1
Posts: 83

Rep: Reputation: 15
does anyone have a good source of information on the programming internals of the kernel as so far ive only really dipped my toes in the water but would like to learn some more (e.g the processes, important functions, header descriptions...).

Thanks
 
Old 12-22-2004, 04:59 PM   #10
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
Understanding the Linux Kernel by Bovet and Cesati is a great explanation of the 2.4 series of kernel. They have yet to update there book to cover 2.6.

Robert Love has a called Linux Kernel Development that is the best I have found on 2.6 details. It doesn't go into as much detail as Bovet and Cesati do, but it was still pretty useful.

Both books explain how to implement new sys calls, how the memory management works, how to implement file systems, how the scheduler works, file-mapped i/o, ect. ect. ect.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Kernel Module Programming astronaut3000 Linux - Software 1 09-23-2005 02:02 AM
Linux kernel debugging and Linux kernel module programming Igor007 Programming 2 08-13-2005 05:12 AM
Linux kernel debugging and Linux kernel module programming Igor007 Linux - Enterprise 3 08-12-2005 02:47 PM
linux kernel programming poojavarshneya Red Hat 2 09-19-2004 10:54 PM
Linux kernel module programming(Signal and semaphore) eshwar_ind Programming 1 02-16-2004 12:10 PM


All times are GMT -5. The time now is 03:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration