diff options
author | Tom Rini <trini@konsulko.com> | 2023-08-26 11:25:08 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-26 11:25:08 -0400 |
commit | 11cf91f755c7b1f1c8e7865743ac589bd23b7099 (patch) | |
tree | ac16ffe5e84057ffa0d1c7e93d47c00d5c3ed532 /arch/sandbox/cpu/os.c | |
parent | 05763b71d2fcfe9729bf5ef0b14bd00c3af0c985 (diff) | |
parent | 453c3fb48141f60eb9b7ab5545d94c88dc5af40c (diff) |
Merge branch '2023-08-26-bootstd-chromeos-impreovements-and-move-to-gcc-13.2' into next
First, update CI to using gcc-13.2 from 13.1, and rebuild the CI
containers. This is needed because the second part adds utilities for
tests and provides, to quote the author:
This updates the ChromiumOS bootmeth to detect multiple kernel
partitions on a disk.
It also includes minor code improvements to the partition drivers,
including accessors for the optional fields.
This series also includes some other related tweaks in testing.
Diffstat (limited to 'arch/sandbox/cpu/os.c')
-rw-r--r-- | arch/sandbox/cpu/os.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 9e93a0fa571..85d0d6a1703 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -258,6 +258,30 @@ int os_unmap(void *buf, int size) return 0; } +int os_persistent_file(char *buf, int maxsize, const char *fname) +{ + const char *dirname = getenv("U_BOOT_PERSISTENT_DATA_DIR"); + char *ptr; + int len; + + len = strlen(fname) + (dirname ? strlen(dirname) + 1 : 0) + 1; + if (len > maxsize) + return -ENOSPC; + + ptr = buf; + if (dirname) { + strcpy(ptr, dirname); + ptr += strlen(dirname); + *ptr++ = '/'; + } + strcpy(ptr, fname); + + if (access(buf, F_OK) == -1) + return -ENOENT; + + return 0; +} + /* Restore tty state when we exit */ static struct termios orig_term; static bool term_setup; |