I want a c program which copies a file from one location to another to run at boot time that is before operating system starts.......Any body please help.....
I want a c program which copies a file from one location to another to run at boot time that is before operating system starts.......Any body please help.....
What you are talking about here is a rootkit ... a technique commonly used to implant viruses into computers...
Can't speak for anyone else, but I think I'll follow the Forum policy and not discuss it here.
Just a rhetorical question really but...
Why is it the first thing I usually see from noobs is the burning desire to do something awful?
Last edited by CommonTater; 03-11-2011 at 03:12 PM.
@CommonTater
Actually i was planning to create a software which backups the system files in ubuntu....As a part of my mini project......And i need c program to run on boot time while restoring the os files...That is why i am seeking help..I need only how to make my c object file to execute on boot time...
Last edited by muhammed irshad; 03-11-2011 at 03:16 PM.
What about using a bootable CD?
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
That is totally dependent on your operating system. You'd want to ask this question on the Ubuntu forums, or the General section because this isn't really related to C coding. Most Linux distributions have some kind of initialization/boot system that handles things like mounting file systems and loading kernel modules. Often times these initialization systems allow you to write "hooks" where you can do your own stuff. But I'm not an expert nor do I know what Ubuntu uses.
Originally Posted by Plato
I believe /etc/rc is a shell script that's executed once on boot. You could call your programs from the shell script, but make sure it doesn't drag down your computer.
Originally Posted by The Jargon File
The only way to do anything useful before the OS starts is to boot another OS on another partition, then mount the partition of the original OS in read-only mode.
To that, the easiest thing to do is install one of the small Linux distributions on another partition (ones which give you only a console), and then run your normal C program from there.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.