A root file system is generated using tools such as Freescale ltib, but it is found that the program cannot be terminated when Ctrl-C is pressed.
Write a test program
# Include <stdio. h>
# Include <signal. h>
Void sig_handle (INT sig)
{
If (SIGINT = sig)
{
Printf ("press again! /N ");
}
}
Int main (void)
{
Signal (SIGINT, sig_handle );
While (1)
Sleep (10 );
Return 0;
}
The test program did not print the press again. It seems that the kernel has not sent the signal to the current process. Why?
Suddenly, when the system is started, a message is prompted:
/Bin/sh: can't access tty; Job control turned off
It seems that the question is related to this error prompt. Open the/etc/inittab, with a line in it.
: Respawn:/bin/sh
Change this line to: respawn:/sbin/Getty-l ttymxc0 115200 after VT100, CTRL + C can work, but the account and password are required for logon.
I am too lazy to study the automatic login of Getty. I read the example in busybox and found that I can add a terminal.
Ttymxc0: respawn:/bin/sh
Ttymxc0 is the name of the device node used by the serial port. Some systems may be tty1 or ttys1.