How to mute logs on serial console

Hi, i want to mute logs on serial console. how to do that?
Any hint please...
thanks

remove serial/console parameter from kernel boot string.

where it is?

in the boot loader.

is it a file? if yes, then where it located?

where it is set, depends on your device, for most, in u-boot.

to change that i need to stop boot at u-boot ?

uboot-envtools package from within openwrt, or via serial.

fw_setenv
fw_printenv

etc.

FYI, this will disable your openwrt serial console.

ok I'll update after trying.
Thanks

The serial console settings are usually hardcoded in the dts, changing this requires recompiling OpenWrt. The dts settings take precedence over the bootloader provided cmdline, which is ignored in most cases.

However SOC boot ROM and (the various, partially secure boot enabled-) bootloader (-stages) will also use the serial console, so it's usually not possible to mute it completely.

It is typically more sensible to connect a usb2serial adapter, which can be used exclusively for your purpose.

Also keep in mind that the SOC's serial console is directly connected, usually without any safeguards. It is easy to kill the SOC (voltage spikes) and even more likely to keep it from initializing, by the voltage fed back into the SOC over rx. Unless you really know what you're doing, don't. The buck for cp2102, ch340g, fake ft232rl, pl2303 and friends is well spent (and opto isolation might not be out of line either).

3 Likes

ok i'll recompile openwrt if i know which dts file i need to edit in built root.

https://openwrt.org/docs/guide-user/hardware/terminate.console.on.serial

1 Like

by using this i'm building for mediatek. here in this path i do not have config-*

openwrt/target/linux/mediatek

so i have to create it ?

my mediatek chip mt7628 in here:

target/linux/ramips/mt76x8/config-5.15

please note, add:

CONFIG_MESSAGE_LOGLEVEL_DEFAULT=0

is outdate, should be:

CONFIG_MESSAGE_LOGLEVEL_DEFAULT=1

because the new building system, the LOGLEVEL= 1~7, no "0" level. If you set it to "0", the compiling should stop in process, and wait you manually input "1".
(wifi maintainer, please update, thanks)

ok thank you. i got these lines from generic

CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=4

will i need to change them also?

I do not know this CONFIG_CONSOLE_LOGLEVEL_xxxxx, and did not mod it.

how to handle these:

it will generic and override its value if present in other config file.like recompile kernel for ramips/mt7621, its config cones not contain CONFIG_CONSOLE_LOGLEVEL_XXX so, it take generic values form generic/confi-XXX

I had modded the 2 points of w/o Kernel Rebuild..... in the src also.

by adding in generic/config-XXX
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=1 CONFIG_CONSOLE_LOGLEVEL_QUIET=1

and in ramips/mt7621/config-xxx

CONFIG_MESSAGE_LOGLEVEL_DEFAULT=1

It show limited messages on console like

## Loading kernel from FIT Image at bfc90000 ...
   Using 'config@1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  MIPS OpenWrt Linux-5.10.176
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0xbfc900e4
     Data Size:    2716629 Bytes = 2.6 MiB
     Architecture: MIPS
     OS:           Linux
     Load Address: 0x80001000
     Entry Point:  0x80001000
     Hash algo:    crc32
     Hash value:   2e425929
     Hash algo:    sha1
     Hash value:   9d82f86a3ecb65316992ee56bae88a7779db43a6
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at bfc90000 ...
   Using 'config@1' configuration
   Trying 'fdt-1' fdt subimage
     Description:  MIPS OpenWrt tenbay_t-mb5eu-v01 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0xbff27600
     Data Size:    11174 Bytes = 10.9 KiB
     Architecture: MIPS
     Hash algo:    crc32
     Hash value:   bb604548
     Hash algo:    sha1
     Hash value:   5cb9688a743ef24e0929c4dc8a46afde9b357c86
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0xbff27600
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 8fe97000, end 8fe9cba5 ... OK
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
Please press Enter to activate this console.
[   31.828644] mtk_soc_eth 1e100000.ethernet eth0: Link is Down
[   31.847236] mtk_soc_eth 1e100000.ethernet eth0: configuring for fixed/rgmii link mode
[   31.861996] mtk_soc_eth 1e100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   31.870756] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   31.887601] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode

My router stopped here:

.......................

[    0.000000] Linux version 5.15.150 (builder@buildhost) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 12.3.0 r23809-234f1a2efa) 12.3.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Fri Mar 22 22:09:42 2024
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is Xiaomi Mi Router 4A Gigabit Edition
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
- config restore -