I am working on an embedded Linux system (5.19.10), and I am using busybox as the main part of file system.
Now I am trying to run a test which should output logs to the serial port (ttyS0). But I did NOT configure console
in the kernel command line.
The /etc/inittab
is as follows,
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Put a getty on the serial port
#::respawn:/sbin/getty -L ttyS1 115200 vt100
#no login
::respawn:-/bin/sh
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
null::shutdown:/etc/init.d/rcK
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a
I changed the /etc/profile
as follows,
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
stty -F /dev/ttyS0 speed 38400
setconsole /dev/ttyS0
echo "Hello world" > /dev/ttyS0
/home/test/test_app 2>&1 &
When system booted up, I can see Hello world
in the serial port. But I cannot see the shell prompt or the logs from the test_app
.
I think the system console is NOT being configured correctly in this case.
So, I am wondering is there any gental way to set the system console in my own script (e.g. /etc/init.d/rcS or /etc/profile) without using getty
or console=XXX
and make the log output to the serial expected console??