how to disable serial console in Linux to allow application to use serial port UART

Open Digi Embedded Linux 5.7 and create a project with kernel.
Configure the kernel and disable (just search for it in config):
CONFIG_SERIAL_CORE_CONSOLE
CONFIG_SERIAL_NS921X_CONSOLE

you may disable the serial port completely or enable any features you need (e.g. RTS485.. or CONFIG_CME9210JS_SERIAL_PORTA_FULL=y)

Rebuild and install your kernel. Before deploying the kernel, you need to change /etc/inittab in your rootfs. When using read only squashfs modify /etc/inittab on compile/build time by using the add_files.sh in your project config. When using a read/write JFFS2 as root filesystem, you may also modify /etc/inittab by editing it on the booted module.

In /etc/inittab you have to add "#" = comment the following lines:
# ::respawn:/bin/cttyhack /bin/login -f root
# ::ctrlaltdel:/sbin/reboot

deploy your modified root filesystem to the module.
deploy your modified Linux kernel to the module: update linux tftp

Modify dynamic U-Boot variable "console":
CME9210 # printenv_dynamic
console=console=ttyNS0,38400

CME9210 # setenv console console=none
CME9210 # saveenv

Boot/reset/power cycle the module. You should still see U-Boot output until:
Uncompressing Linux... done, booting the kernel.

Now connect via telnet or ssh to the module by logging in as root with password root.
This should prove that Linux has booted.
If you still have enabled the serial UART you may use it for application.
Example to test it from telnet/ssh login shell:

# stty -F /dev/ttyNS0 38400
# echo hello >/dev/ttyNS0

You should see "hello" on the terminal program where you are getting U-Boot output.

If U-Boot output is also disturbing your external devices during boot up, you need to disable (=make silent) U-Boot also. For this look into U-Boot reference manual and create a U-Boot project in Digi Embedded Linux and configure it for silent console.

Caution: if you program such an U-Boot and your Linux is not booting anymore, your module might be lost, if it has no JTAG interface to reprogram some working firmware.

Last updated: Oct 29, 2024

Filed Under

Embedded

Recently Viewed

No recently viewed articles

Did you find this article helpful?