Click to See Complete Forum and Search --> : HELLO KERNEL (vampire--)
khokhar
06-21-2001, 07:01 AM
I know all the stuff that is required to tame (compile) the ogre(linux kernel).but now i want to tame this vampire little more.what i want to do is that
i want to add a new command "HELLO KERNEL" and it display the message "i am fine".
would u tell me which file is responsible for all this.
it should behaves like the other linux commands "ifconfig" etc.
Derango
06-21-2001, 07:15 AM
The kernel is not responsible for the commands such as ifconfig. Realy, all the kernel does is allow the software to interact with the hardware. Once the kernel starts, you realy have no way of interacting with it at the command line (except loading and unloading modules, but thats a different story)
Most every command you type in linux is its own program on your hard drive. These programs are generaly located in /usr/bin , /bin , /usr/sbin . Some programs are functions of your shell (thats getting a little advanded though)
Instead of changing the kernel, you need to create either a new linux program, or a shell script to do what you want. It won't be in the kernel (because the kernel dosen't accept commands like that), but it will do what you ask it to.
You might want to check the programming forum for help with this.
[Edit] Editied that last sentance to improve the grammer somewhat.
[ 21 June 2001: Message edited by: Derango ]
[ 21 June 2001: Message edited by: Derango ]
[ 21 June 2001: Message edited by: Derango ]
nopun
06-21-2001, 08:36 AM
As I understand, you are more concerned with method than outcome - ie creating a "hello" script that produces that outcome is too trivial to deserve explanation (am I right?).
Sure, the hello part would have to be a user space program, but it would have to talk to the kernel and the response would have to come from the kernel.
Kernel hacking is a bit out of my league :) but I am sure it's not as simple as changing some file - you would have to get into understanding how the kernel works (at least to some degree). A bit of reading and tinkering is called for....
Derango
06-21-2001, 11:05 AM
from what I read, It sounded like he was trying to code somthing into the kernel so that when you typed HELLO KERNEL it would say "I'm doing fine". That would definitly have to be a user space program, In fact, the only thing the kernel has to do with that is to display the message.
From what he said, he didn't want it checking to see if the kernel was actualy fine, just that it would say its fine.
ille_pugil42
06-21-2001, 12:41 PM
*****************
#include <iostream.h>
int main()
{
cout << "\nI am fine.\n";
return 0;
}
********************
put that in a file, compile it with g++ and there you go. Call it 'Hello'. Put it in /usr/bin. Oh, make sure to chmod +x it as well to make sure it's executeable.