When using embedded development of Linux system, it is often necessary for the device to bypass the Linux login system so that it can start automatically, such as our common SSH client. Online does have a lot of methods, do not know is because our ARM9 board is a private custom reason or what reason, tried a lot of methods can not, only one way feasible, hereby record.
First, update Mingetty:
1, to the website http://www.filewatcher.com/m/mingetty-1.07.tar.gz.13435-html download mingetty-1.07.tar.gz;
2, Decompression: TAR-ZXVF mingetty-1.07.tar.gz, into the directory after decompression;
3, modify the code in the MINGETTY.C, only need two steps:
(1) The Char *logname,*s in line No. 352 is changed to char *logname = "root", *s;
(2) Comment out the 第409-415 line, the following code:
/* if (autologin) {
Do_prompt (0);
printf ("login:%s (automatic login) \ n", autologin);
LogName = Autologin;
}else
while ((logname = Get_logname ()) = = 0)
/* Do nothing */*; */
4, modify Makefile:
CC = ARM-NONE-LONUX-GNUEABI-GCC; (This should be a cross-compiled installation path)
5. Compile and generate mingetty:# make;
6, Update Mingetty program copy to the root file system/sbin directory, mingetty the source of the changes completed.
Second, update login:
1, to the website: http://www.filewatcher.com/_/?q=util-linux-2.13-pre7.tar.bz2 download source code;
2, Decompression: TAR-JXVF util-linux-2.13-pre7.tar.bz2, extracted folder for Util-linux-2.13-pre7, enter this directory, where the source directory of login is Util-linux-2.13-pre7 /login-utils, however, the make file does not exist in the Login-utils file, so you need to write your own command to generate login;
3, modify the code in the LOGIN.C:
(1) Change the No. 344 line of passwd_req = 1 to passwd_req = 0;
(2) Add locale.h header file to file: #include <locale.h>;
4. Compile and Generate login:
# arm-none-linux-gnueabi-gcc-o Login Login.c. /lib/setproctitle.c checktty.c-wall-lcrypt-i. /inlucde/;
5. Update Login:
Copy the generated login program to the/bin directory of the root file system.
Third, modify the Inittab file:
#S2 the last logon statement in the root file system/etc/inittab file: 2345:respawn:/sbin/getty 115200 ttyS2 changed to S2:2345:respawn:/sbin/mingetty ttyS2;
The modified root file system is re-downloaded to the system, and the system will log in directly when it starts, without entering the user name and password.
Implement automatic login for Arm--linux