While echoing, e.g. echo "serial tx to ttyAMA0" > /dev/ttyAMA0
shows output towards serial console terminal on Linux initramfs loaded to /dev/ram0 on an arm64 platform, there's no connection to a shell when starting this sh
or bash
shell from /init script with e.g. /bin/busybox sh
.
Kernel command line:
root=/dev/ram0 rw earlyprintk console=ttyAMA0,115200 console=tty0,115200 initcall_debug=1
(Only successful attempt for interacting with a serial port prompt for a user program was with /bin/busybox getty 115200 ttyAMA0
, that shows login prompt, reacts to input from keyboard characters and prints 'login errors' to serial port ttyAMA0 terminal, since there is no getty
configuration enabled, because this would be unnecessary for a maintenance/rescue shell on boot-up and therefore no login possible to specified user accounts. Only hint for difference to 'normal' shell terminal access is /sbin/tty
command, what responds with 'not a tty'? Screen
, minicom
, several compatible sh
shell versions, bash
shell had been tried without being able to enable serial command line access to initramfs. There is no need, as far as i understand, and no possibility for changing code within the device tree. Maybe tty redirection for stdout/stdin is necessary, but there's no explanation for this on www search engines for providing a comprehensive solution to this difficulty. None of 'similar questions' suggestions provided a solution for this. Most answers here are with x86(_64) platforms.)
An adjusted minimal initramfs example was tested, by now, without access to serial terminal.
Thanks
setsid
(or untested c helper program, to be compiled before usage) and seems working reliably for ~15mins now. Thanks for contribution @all on Unix&Linux (upvoted for improved findability)