Due to taking a bit closer interest in the use of
serial interfaces I had the opportunity to read through BusyBox sources (e.g. related to 'inittab', and 'getty') and some more (e.g. this
article).
As a consequence I'd like to suggest to remove '/sbin/rungetty' from the initrd and replace it with a considerably smaller script (e.g. '/sbin/autologin'):
#!/bin/sh
cat /etc/issue
if [ -f /var/log/autologin ] ; then
exec login
else
touch /var/log/autologin
exec login -f root
fi
This would then require a further change in '/etc/inittab' to replace:
tty1::respawn:/sbin/rungetty tty1 --autologin rootwith:
tty1::respawn:/sbin/getty -nl /sbin/autologin 38400 tty1I believe this replicates what 'rungetty' does, i.e. to automatically execute an automated login of user 'root' (which itself continues to execute a login of the default user unless the 'noautologin' boot code was used), and to run a "standard" login process as soon as this initial session is terminated.
One IMHO minor difference is that the hard coded reference of the respective autologin user (i.e. 'root') needed to be moved from the '/etc/inittab' entry into the script (due to limitation of 'getty' to accept more complex arguments for the '-l' option).
I've done some testing (including for the 'ttyS0' case, where both occurrences of 'tty1' in the 'inittab' entry would have to be replaced with 'ttyS0') but obviously I can't promise that this proposal covers absolutely all possible cases, but I'm sure any limitations would become obvious with more exposure.
EDIT: Simplified the script even further by removing the apparently unnecessary assignments of the standard file descriptors.