Skip to content

Replace `earlyprintk` by `earlycon` in `linux64_defconfig`

The earlyprintk command-line argument is not supported by the RISC-V architecture [1]. It is ignored during the boot process. However, even though the earlyprintk option is skipped, early boot logs are still available via the implicit earlycon, which is enabled through CONFIG_SERIAL_8250_CONSOLE=y. This works because SERIAL_EARLYCON is selected automatically in linux/drivers/tty/serial/8250/Kconfig when SERIAL_8250_CONSOLE is enabled:

config SERIAL_8250_CONSOLE
	bool "Console on 8250/16550 and compatible serial port"
	depends on SERIAL_8250=y
	select SERIAL_CORE_CONSOLE
	select SERIAL_EARLYCON

We can verify that earlyprintk is ignored by observing the behavior described in the documentation[1]:

The kernel parses parameters from the kernel command line up to “--“; if it doesn’t recognize a parameter and it doesn’t contain a ‘.’, the parameter gets passed to init: parameters with ‘=’ go into init’s environment, others are passed as command line arguments to init. Everything after “--” is passed as an argument to init.

Since earlyprintk is unrecognized, it is passed to the init process. This is confirmed by the dmesg output:

[   29.391887] Run /init as init process                                        
[   29.398821]   with arguments:                                                
[   29.399639]     /init                                                        
[   29.400437]     earlyprintk                                                  
[   29.401222]   with environment:                                              
[   29.402014]     HOME=/                                                       
[   29.402806]     TERM=linux    

This PR explicitly enables earlycon usage via the command-line argument.

  1. https://docs.kernel.org/admin-guide/kernel-parameters.html

Merge request reports

Loading