• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


コミットメタ情報

リビジョン915b23670650d75b5d7f5e0355807adab81f910c (tree)
日時2016-09-14 07:21:06
作者Linux Build Service Account <lnxbuild@loca...>
コミッターGerrit - the friendly Code Review server

ログメッセージ

Merge "init: Add support for slow devices"

変更サマリ

差分

--- a/init/Android.mk
+++ b/init/Android.mk
@@ -12,6 +12,14 @@ endif
1212
1313 init_options += -DLOG_UEVENTS=0
1414
15+ifneq ($(TARGET_INIT_COLDBOOT_TIMEOUT),)
16+init_options += -DCOLDBOOT_TIMEOUT_OVERRIDE=$(TARGET_INIT_COLDBOOT_TIMEOUT)
17+endif
18+
19+ifneq ($(TARGET_INIT_CONSOLE_TIMEOUT),)
20+init_options += -DCONSOLE_TIMEOUT_SEC=$(TARGET_INIT_CONSOLE_TIMEOUT)
21+endif
22+
1523 init_cflags += \
1624 $(init_options) \
1725 -Wall -Wextra \
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -160,15 +160,19 @@ void handle_control_message(const std::string& msg, const std::string& name) {
160160
161161 static int wait_for_coldboot_done_action(const std::vector<std::string>& args) {
162162 Timer t;
163-
163+ int timeout = 0;
164+#ifdef COLDBOOT_TIMEOUT_OVERRIDE
165+ timeout = COLDBOOT_TIMEOUT_OVERRIDE;
166+#else
167+ timeout = 5;
168+#endif
164169 NOTICE("Waiting for %s...\n", COLDBOOT_DONE);
165170 // Any longer than 1s is an unreasonable length of time to delay booting.
166171 // If you're hitting this timeout, check that you didn't make your
167172 // sepolicy regular expressions too expensive (http://b/19899875).
168- if (wait_for_file(COLDBOOT_DONE, 5)) {
173+ if (wait_for_file(COLDBOOT_DONE, timeout)) {
169174 ERROR("Timed out waiting for %s\n", COLDBOOT_DONE);
170175 }
171-
172176 NOTICE("Waiting for %s took %.2fs.\n", COLDBOOT_DONE, t.duration());
173177 return 0;
174178 }
@@ -258,15 +262,31 @@ static int keychord_init_action(const std::vector<std::string>& args)
258262
259263 static int console_init_action(const std::vector<std::string>& args)
260264 {
265+ int fd = -1;
261266 std::string console = property_get("ro.boot.console");
262267 if (!console.empty()) {
263268 console_name = "/dev/" + console;
264269 }
265-
266- int fd = open(console_name.c_str(), O_RDWR | O_CLOEXEC);
270+ fd = open(console_name.c_str(), O_RDWR | O_CLOEXEC);
271+#ifdef CONSOLE_TIMEOUT_SEC
272+ int num_console_retries = 0;
273+ while ((fd < 0) && num_console_retries++ < CONSOLE_TIMEOUT_SEC) {
274+ ERROR("Failed to open console device %s(%s)..Retrying\n",
275+ console_name.c_str(), strerror(errno));
276+ sleep(1);
277+ fd = open(console_name.c_str(), O_RDWR | O_CLOEXEC);
278+ }
267279 if (fd >= 0)
280+ INFO("Console device located");
281+#endif
282+ if (fd >= 0) {
268283 have_console = 1;
269- close(fd);
284+ close(fd);
285+ } else {
286+ ERROR("console init failed. Open on Console device %s failed(%s)\n",
287+ console.c_str(), strerror(errno));
288+ return 0;
289+ }
270290
271291 fd = open("/dev/tty0", O_WRONLY | O_CLOEXEC);
272292 if (fd >= 0) {