Add offset support of key-value pairs to get_cmdline_val() for getting
multiple values of the same keys.
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
The default serial console can be set in the device tree
using the linux,stdout-path parameter (or equivalent from ACPI).
This is important for universal booting (EFI/EBBR) on ARM platforms
where the default console can be different (e.g ttyS0 vs ttyAMA0).
Signed-off-by: Mathew McBride <matt@traverse.com.au>
Introduce two new helper functions to deal with stdio redirecation in a
uniform, reliable manner:
The patch_fd() function will attempt to redirect the given fd number to the
specified file, using the supplied flags for the open() syscall. When the
device is NULL, "/dev/null" is asumed, when the device is a relative path,
openat() is used to open it relative to the "/dev" directory. When the device
cannot be openend, a fallback to "/dev/null" is attempted.
The patch_stdio() function is essentially a wrapper around patch_fd(),
providing an easy interface to redirect stdin, stdout and stderr to the same
given device.
Both function return 0 on success and -1 on error. The errno variable will
be set accordingly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>