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 |
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 |
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. |
pls b specific
Quote:
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------------- |
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. |
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 |
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". |
Quote:
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. |
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 |
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. |
All times are GMT -5. The time now is 05:15 AM. |