From: Youngjae Cho Date: Mon, 14 Mar 2022 05:32:36 +0000 (+0900) Subject: Support silent boot via cmdline bootmode X-Git-Tag: accepted/tizen/unified/20220318.132958^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=501f642b1f0517310744f24998fecf4416559db5;p=platform%2Fcore%2Fsystem%2Fdeviced.git Support silent boot via cmdline bootmode The /proc/cmdline has changed to have bootmode=silent parameter on silent booting. Change-Id: I15ebb44bdd86155fc1a65489e23ec527fd9cbf86 Signed-off-by: Youngjae Cho --- diff --git a/src/core/main.c b/src/core/main.c index fa1e4a1..ecbf942 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #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); diff --git a/tests/auto-test/boot.c b/tests/auto-test/boot.c index d589f8c..26f7193 100644 --- a/tests/auto-test/boot.c +++ b/tests/auto-test/boot.c @@ -16,17 +16,35 @@ * limitations under the License. */ #include "test.h" -#include +#include #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!!!"); } diff --git a/tests/auto-test/test.c b/tests/auto-test/test.c index f50faf1..142310a 100644 --- a/tests/auto-test/test.c +++ b/tests/auto-test/test.c @@ -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; -} diff --git a/tests/auto-test/test.h b/tests/auto-test/test.h index 0ba59c6..ef10f18 100644 --- a/tests/auto-test/test.h +++ b/tests/auto-test/test.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #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