LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Compiling a linux kernel to run a command and quit (https://www.linuxquestions.org/questions/linux-general-1/compiling-a-linux-kernel-to-run-a-command-and-quit-727043/)

Mardok 05-19-2009 08:48 AM

Compiling a linux kernel to run a command and quit
 
Hello everyone

I'm attempting to create a Linux box that will be compatible with Macintosh's Netboot.

http://www.afp548.com/article.php?st...61220102102611

If the Mac is able to find the Linux box over Netboot, I'd like to be able to boot the Macintosh into a PPC Linux kernel. However, I want the kernel to run a command at boot time and quit instead of logging into a terminal.

Does anyone know how to create a custom Linux kernel to just boot, run a command, and quit?

pcardout 05-20-2009 02:26 AM

Are you sure you need a custom kernel? Linux is meant to be heavily configured. Read about the init process
for Debian.

Quote:

richard@elrond:/etc/rc2.d$ more README
The scripts in this directory are executed each time the system enters
this runlevel.

The scripts are all symbolic links whose targets are located in
/etc/init.d/ .

To disable a service in this runlevel, rename its script in this directory
so that the new name begins with a 'K' and a two-digit number, where the
number is the difference between the two-digit number following the 'S'
in its current name, and 100. To re-enable the service, rename the script
back to its original name beginning with 'S'.

For a more information see /etc/init.d/README.
You can insert you own "S" script that does whatever you want and probably even includes the command "runlevel 0" or some such
which means "shut down after you run me".

knudfl 05-20-2009 08:08 AM

The kernel makes your hardware work with the OS.
The kernel do not and cannot make commands.

Commands : See post #2, pcardout.


All times are GMT -5. The time now is 08:04 AM.