diff options
author | SangYoun Kwak <sy.kwak@samsung.com> | 2022-08-17 14:47:16 +0900 |
---|---|---|
committer | SangYoun Kwak <sy.kwak@samsung.com> | 2022-08-17 14:47:16 +0900 |
commit | 6bb329e39830ea5a11bec8182aef5481c3688fa2 (patch) | |
tree | 0db4df736ea94c8b35aae433f89a5a24dbe5f062 | |
parent | 992fa5ec277802ab3e053cc5855dd02d2077561a (diff) | |
download | device-rpi-6bb329e39830ea5a11bec8182aef5481c3688fa2.tar.gz device-rpi-6bb329e39830ea5a11bec8182aef5481c3688fa2.tar.bz2 device-rpi-6bb329e39830ea5a11bec8182aef5481c3688fa2.zip |
Add hal api (get_boot_mode)
Change-Id: I7b4e338cd86e339dccc26319711b5be09c5d8a09
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
-rw-r--r-- | hw/board/board.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/board/board.c b/hw/board/board.c index 775a725..070bc8a 100644 --- a/hw/board/board.c +++ b/hw/board/board.c @@ -99,6 +99,22 @@ static int switch_partition(char partition_ab) return sys_write_buf(PARTITION_AB_PATH, next_partition_ab); } +static int get_boot_mode(char *buffer, const int max_len) +{ + char scan_format[32] = { 0, }; + int ret = 0; + + snprintf(scan_format, sizeof(scan_format), "bootmode=%%%ds", max_len - 1); + + ret = libsys_parse_cmdline_scanf(scan_format, buffer); + + if (ret <= 0) { + return -ENOENT; + } + + return 0; +} + static int set_partition_ab_cloned(void) { return sys_write_buf(PARTITION_AB_CLONED_PATH, "1"); @@ -156,6 +172,7 @@ static int board_init(void **data) return -ENOMEM; board_funcs->get_device_serial_number = get_device_serial_number; + board_funcs->get_boot_mode = get_boot_mode; board_funcs->get_current_partition = get_current_partition; board_funcs->switch_partition = switch_partition; board_funcs->set_partition_ab_cloned = set_partition_ab_cloned; |