From 7750ee45a62c7834f170f817232e432b8d2a14d3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 4 Apr 2022 22:45:03 +0200 Subject: sandbox: add function os_printf() Before setting up the devices U-Boot's printf() function cannot be used for console output. Provide function os_printf() to print to stderr. Signed-off-by: Heinrich Schuchardt --- arch/sandbox/cpu/os.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'arch/sandbox/cpu') diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 3b230606a9..f937991139 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,18 @@ ssize_t os_write(int fd, const void *buf, size_t count) return write(fd, buf, count); } +int os_printf(const char *fmt, ...) +{ + va_list args; + int i; + + va_start(args, fmt); + i = vfprintf(stdout, fmt, args); + va_end(args); + + return i; +} + off_t os_lseek(int fd, off_t offset, int whence) { if (whence == OS_SEEK_SET) -- cgit v1.2.3