Support silent boot via cmdline bootmode 82/272282/2 accepted/tizen/unified/20220318.132958 submit/tizen/20220317.053005
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 14 Mar 2022 05:32:36 +0000 (14:32 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 14 Mar 2022 06:47:27 +0000 (15:47 +0900)
The /proc/cmdline has changed to have bootmode=silent parameter on
silent booting.

Change-Id: I15ebb44bdd86155fc1a65489e23ec527fd9cbf86
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/core/main.c
tests/auto-test/boot.c
tests/auto-test/test.c
tests/auto-test/test.h

index fa1e4a1..ecbf942 100644 (file)
@@ -24,7 +24,7 @@
 #include <glib.h>
 #include <libsyscommon/libgdbus.h>
 #include <libsyscommon/libsystemd.h>
-#include <device/booting-internal.h>
+#include <device/board-internal.h>
 #include <argos.h>
 
 #include "display/core.h"
@@ -99,6 +99,8 @@ static int deviced_main(int argc, char **argv)
        int ret;
        dbus_handle_h handle = NULL;
        guint timer;
+       char bootmode[32] = "normal";
+       int retval;
 
        CRITICAL_LOG("Initializing deviced.");
        mainloop = g_main_loop_new(NULL, FALSE);
@@ -118,7 +120,9 @@ static int deviced_main(int argc, char **argv)
 
        load_plugins();
 
-       silent_boot = device_get_reboot_mode();
+       retval = device_board_get_boot_mode(bootmode, sizeof(bootmode));
+       silent_boot = (retval == 0 && strncmp(bootmode, "silent", sizeof("silent")) == 0);
+       CRITICAL_LOG("bootmode=%s", bootmode);
 
        devices_init(NULL);
 
index d589f8c..26f7193 100644 (file)
  * limitations under the License.
  */
 #include "test.h"
-#include <device/booting-internal.h>
+#include <device/board-internal.h>
 
 #define METHOD_GET_REBOOT_MODE         "GetRebootMode"
 
-static bool get_reboot_mode(void)
+static bool get_boot_mode(void)
 {
-       int ret;
+       int retval;
+       char bootmode[32] = {0, };
 
-       ret = device_get_reboot_mode();
+       retval = device_board_get_boot_mode(bootmode, sizeof(bootmode));
+       if (retval != 0) {
+               _E("bootmode not supported.");
+               return 1;
+       }
+
+       if (strncmp(bootmode, "normal", sizeof("normal")) == 0)
+               return 1;
+       if (strncmp(bootmode, "silent", sizeof("silent")) == 0)
+               return 1;
+       if (strncmp(bootmode, "fota", sizeof("fota")) == 0)
+               return 1;
+       if (strncmp(bootmode, "recovery", sizeof("recovery")) == 0)
+               return 1;
+       if (strncmp(bootmode, "download", sizeof("download")) == 0)
+               return 1;
 
-       return capi_reboot_result(METHOD_GET_REBOOT_MODE, ret);
+       _E("Invalid bootmode=%s", bootmode);
+
+       return 0;
 }
 
 static void booting_test_all(int *success, int *fail)
@@ -34,7 +52,7 @@ static void booting_test_all(int *success, int *fail)
        int s = 0;
        int f = 0;
 
-       (get_reboot_mode())             ? s++ : f++;
+       (get_boot_mode())               ? s++ : f++;
 
        if (NULL != success)    *success = s;
        if (NULL != fail)       *fail = f;
@@ -67,7 +85,7 @@ static int booting_unit(int argc, char **argv)
                booting_test_all(&success, &fail);
                _I("Total: %d, Success: %d, Fail: %d", success+fail, success, fail);
        } else if (0 == strcasecmp(argv[3], METHOD_GET_REBOOT_MODE)) {
-               get_reboot_mode();
+               get_boot_mode();
        } else {
                _E("Unknown test case!!!");
        }
index f50faf1..142310a 100644 (file)
@@ -146,18 +146,3 @@ bool capi_result(const char *method, int val)
 
        return ret;
 }
-
-bool capi_reboot_result(const char *method, int val)
-{
-       bool ret = FALSE;
-
-       if (val == NORMAL_BOOT || val == SILENT_BOOT) {
-               _I("success (%s): %d", method, val);
-               ret = TRUE;
-       } else {
-               _E("fail (%s): returned fail (%d)", method, val);
-               ret = FALSE;
-       }
-
-       return ret;
-}
index 0ba59c6..ef10f18 100644 (file)
@@ -26,7 +26,7 @@
 #include <libsyscommon/libgdbus.h>
 #include <libsyscommon/list.h>
 #include <device-error.h>
-#include <device/booting-internal.h>
+#include <device/board-internal.h>
 
 #include "shared/common.h"
 #include "core/udev.h"
@@ -107,6 +107,5 @@ const struct test_ops *find_test(const char *name);
 void _R(const char *format, ...);
 void __cb(GVariant *result, void *data, GError *err);
 bool capi_result(const char *method, int val);
-bool capi_reboot_result(const char *method, int val);
 int feature_supported(const char *feature);
 #endif