Skip to content
Snippets Groups Projects
Verified Commit 8834db0f authored by Richard Acayan's avatar Richard Acayan Committed by Alexey Minnekhanov
Browse files

linux-postmarketos-qcom-sdm670: enable null tty (MR 5856)

The Google Pixel 3a automatically appends console=null to the command
line. In the kernel, the preferred console is set to ttynull. Since
ttynull is not automatically enabled, a warning is currently emitted:

	[    0.909853] Warning: unable to open an initial console.

This also causes stdin, stdout, and stderr to be missing from the init
process.

In the busybox implementation, syslogd creates the /dev/log socket and
opens /dev/kmsg. This happens just before daemonizing, which opens
/dev/null and aliases stdin, stdout, and stderr to it. After daemonizing
and potentially closing the socket, stdin is aliased to the socket to
save stack memory. If the program starts without stdin under Linux, the
socket gains the constant STDIN_FILENO file descriptor, which is cleared
when daemonizing.

Syscalls when the 0, 1, 2 file descriptors aren't open:

	socket(AF_UNIX, SOCK_DGRAM, 0)    = 0
	openat(AT_FDCWD, "/dev/kmsg", O_WRONLY|O_LARGEFILE) = 1
	openat(AT_FDCWD, "/dev/null", O_RDWR|O_LARGEFILE) = 2

Enable the CONFIG_NULL_TTY option and update the configuration to allow
the kernel to open stdin, stdout, and stderr for the init and (by
inheritance) syslogd processes. It's technically an expert option but
isn't enabled by default (and can be enabled in config fragments).

Closes #3269
[ci:skip-build]: already built successfully in CI
parent e60c77ac
No related branches found
No related tags found
1 merge request!5856linux-postmarketos-qcom-sdm670: enable null tty
Pipeline #211151 passed
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment