From c4793572f37fbf883baade162c7bf51eff314b27 Mon Sep 17 00:00:00 2001 From: Will McVicker Date: Mon, 6 Apr 2020 10:29:36 -0700 Subject: [PATCH] first_stage_init: increase serial console tries to 50 tl,dr; Increase the attempts to 50 to reduce the chances of failing to load the serial console. This will only happen if the cmdline parameter "androidboot.first_stage_console=1" is enabled. Details: 10 attempts only amounts to about 1 second of trying to open the serial console. I tested booting an ACK GKI image 5x with 20 vendor modules and found the serial console loaded on attempt 17 for all five boot tests. Bug: 153354917 Test: boot ACK image 5x and verify serial console comes up Change-Id: I161a4176b2c6cf7b0bc1eefe072ff38b894add5d Merged-In: I161a4176b2c6cf7b0bc1eefe072ff38b894add5d --- init/first_stage_init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp index ef8ffbee8..ad546bf07 100644 --- a/init/first_stage_init.cpp +++ b/init/first_stage_init.cpp @@ -107,7 +107,7 @@ void StartConsole() { return; } int fd = -1; - int tries = 10; + int tries = 50; // should timeout after 5s // The device driver for console may not be ready yet so retry for a while in case of failure. while (tries--) { fd = open("/dev/console", O_RDWR);