Add hal api (get_boot_mode) 34/279734/1
authorSangYoun Kwak <sy.kwak@samsung.com>
Wed, 17 Aug 2022 05:47:16 +0000 (14:47 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Wed, 17 Aug 2022 05:47:16 +0000 (14:47 +0900)
Change-Id: I7b4e338cd86e339dccc26319711b5be09c5d8a09
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
hw/board/board.c

index 775a725992dc341585706e11a5dd7232869b7cac..070bc8adc41c8548932d07311d18036a35850e01 100644 (file)
@@ -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;