diff options
author | Jorge E. Moreira <jemoreira@google.com> | 2019-09-10 17:22:30 -0700 |
---|---|---|
committer | Jorge E. Moreira <jemoreira@google.com> | 2019-09-11 15:34:42 -0700 |
commit | 8b2cafbce99b7a3ad53e1721f161510f6b257a31 (patch) | |
tree | 66a5b21381875eae4b3cac38a41f9203f4baef8d | |
parent | 2f7d54a7ec143b3361023f41c6a338e189ddee1b (diff) | |
download | cuttlefish-8b2cafbce99b7a3ad53e1721f161510f6b257a31.tar.gz |
Send logcat ouput over serial ports instead of vsocket
- Delete logcat_receiver and vsock_logcat
Sending logcat over vsocket requires a couple of extra processes with
the only purpose of forwarding the logs around, using the serial port
is possible to make the logcat command write directly to a node file
in the guest, the device for which is connected to a file host side.
Bug: 132911257
Test: locally
Change-Id: Ieb7a26008b372c837ed05d602cd6b87c471bb35f
-rw-r--r-- | guest/commands/Android.bp | 1 | ||||
-rw-r--r-- | guest/commands/vsock_logcat/Android.bp | 36 | ||||
-rw-r--r-- | guest/commands/vsock_logcat/main.cpp | 140 | ||||
-rw-r--r-- | host/commands/launch/flags.cc | 23 | ||||
-rw-r--r-- | host/commands/launch/launch.cc | 22 | ||||
-rw-r--r-- | host/commands/launch/launch.h | 2 | ||||
-rw-r--r-- | host/commands/launch/main.cc | 2 | ||||
-rw-r--r-- | host/commands/logcat_receiver/Android.bp | 37 | ||||
-rw-r--r-- | host/commands/logcat_receiver/main.cpp | 73 | ||||
-rw-r--r-- | host/libs/config/cuttlefish_config.cpp | 25 | ||||
-rw-r--r-- | host/libs/config/cuttlefish_config.h | 10 | ||||
-rwxr-xr-x | host/libs/vm_manager/cf_qemu.sh | 10 | ||||
-rw-r--r-- | host/libs/vm_manager/crosvm_manager.cpp | 3 | ||||
-rw-r--r-- | host/libs/vm_manager/qemu_manager.cpp | 1 |
14 files changed, 20 insertions, 365 deletions
diff --git a/guest/commands/Android.bp b/guest/commands/Android.bp index df1506789..5026e33f4 100644 --- a/guest/commands/Android.bp +++ b/guest/commands/Android.bp @@ -14,7 +14,6 @@ // limitations under the License. subdirs = [ - "vsock_logcat", "ip_link_add", "usbforward", "vport_trigger", diff --git a/guest/commands/vsock_logcat/Android.bp b/guest/commands/vsock_logcat/Android.bp deleted file mode 100644 index 52575d7ec..000000000 --- a/guest/commands/vsock_logcat/Android.bp +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright (C) 2019 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -cc_binary { - name: "vsock_logcat", - srcs: [ - "main.cpp", - ], - shared_libs: [ - "libbase", - "libcutils", - "libcuttlefish_fs", - "libcuttlefish_utils", - "liblog", - ], - static_libs: [ - "libgflags", - ], - header_libs: [ - "cuttlefish_glog", - ], - defaults: ["cuttlefish_guest_only"] -} diff --git a/guest/commands/vsock_logcat/main.cpp b/guest/commands/vsock_logcat/main.cpp deleted file mode 100644 index 51d97e384..000000000 --- a/guest/commands/vsock_logcat/main.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "vsock_logcat" - -#include <string.h> - -#include <errno.h> -#include <sys/stat.h> -#include <sys/types.h> - -#include <fstream> -#include <sstream> -#include <string> - -#include <cutils/properties.h> -#include <gflags/gflags.h> -#include <glog/logging.h> - -#include "common/libs/fs/shared_fd.h" -#include "common/libs/utils/files.h" -#include "common/libs/utils/subprocess.h" - -DEFINE_uint32(port, property_get_int32("ro.boot.vsock_logcat_port", 0), - "VSOCK port to send logcat output to"); -DEFINE_uint32(cid, 2, "VSOCK CID to send logcat output to"); -DEFINE_string(pipe_name, "/dev/cf_logcat_pipe", - "The path for the named pipe logcat will write to"); - -namespace { - -constexpr char kLogcatExitMsg[] = "\nDetected exit of logcat process\n\n"; - -class ServiceStatus { - public: - static const char* kServiceStatusProperty; - static const char* kStatusStarted; - static const char* kStatusFailed; - - ServiceStatus() { - // This can fail if the property isn't set (the first time it runs), so - // ignore the result. - property_get(kServiceStatusProperty, status_, kStatusStarted); - } - - bool Set(const char* status) { - auto ret = property_set(kServiceStatusProperty, status); - - if (ret == 0) { - strcpy(status_, status); - return true; - } - return false; - } - - const char* Get() { return status_; } - - private: - char status_[PROP_VALUE_MAX]; -}; - -const char* ServiceStatus::kServiceStatusProperty = "vendor.vsock_logcat_status"; -const char* ServiceStatus::kStatusStarted = "started"; -const char* ServiceStatus::kStatusFailed = "failed"; - -void LogFailed(const std::string& msg, ServiceStatus* status) { - // Only log if status is not failed, ensuring it logs once per fail. - if (strcmp(status->Get(), ServiceStatus::kStatusFailed) != 0) { - LOG(ERROR) << msg; - std::ofstream kmsg; - kmsg.open("/dev/kmsg"); - kmsg << LOG_TAG << ": " << msg; - kmsg << ""; - kmsg.close(); - } - auto ret = status->Set(ServiceStatus::kStatusFailed); - if (!ret) { - LOG(ERROR) << "Unable to set value of property: " - << ServiceStatus::kServiceStatusProperty; - } -} -} // namespace - -int main(int argc, char** argv) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - - CHECK(FLAGS_port != 0) << "Port flag is required"; - - ServiceStatus status; - - auto log_fd = cvd::SharedFD::VsockClient(FLAGS_cid, FLAGS_port, SOCK_STREAM); - if (!log_fd->IsOpen()) { - std::ostringstream msg; - msg << "Unable to connect to vsock:" << FLAGS_cid << ":" << FLAGS_port - << ": " << log_fd->StrError(); - LogFailed(msg.str(), &status); - return 1; - } - auto ret = status.Set(ServiceStatus::kStatusStarted); - if (!ret) { - LOG(ERROR) << "Unable to set value of property: " - << ServiceStatus::kServiceStatusProperty; - } - - if (cvd::FileExists(FLAGS_pipe_name)) { - LOG(WARNING) << "The file " << FLAGS_pipe_name << " already exists. Deleting..."; - cvd::RemoveFile(FLAGS_pipe_name); - } - auto pipe = mkfifo(FLAGS_pipe_name.c_str(), 0600); - if (pipe != 0) { - LOG(FATAL) << "unable to create pipe: " << strerror(errno); - } - property_set("vendor.ser.cf-logcat", FLAGS_pipe_name.c_str()); - while (1) { - auto conn = cvd::SharedFD::Open(FLAGS_pipe_name.c_str(), O_RDONLY); - while (conn->IsOpen()) { - char buff[4096]; - auto read = conn->Read(buff, sizeof(buff)); - if (read) { - log_fd->Write(buff, read); - } else { - conn->Close(); - } - } - log_fd->Write(kLogcatExitMsg, sizeof(kLogcatExitMsg) - 1); - } -} diff --git a/host/commands/launch/flags.cc b/host/commands/launch/flags.cc index 3dc865c76..ff2441513 100644 --- a/host/commands/launch/flags.cc +++ b/host/commands/launch/flags.cc @@ -192,13 +192,8 @@ DEFINE_bool(run_e2e_test, true, "Run e2e test after device launches"); DEFINE_string(e2e_test_binary, vsoc::DefaultHostArtifactsPath("bin/host_region_e2e_test"), "Location of the region end to end test binary"); -DEFINE_string(logcat_receiver_binary, - vsoc::DefaultHostArtifactsPath("bin/logcat_receiver"), - "Binary for the logcat server"); -DEFINE_string(logcat_mode, "", "How to send android's log messages from " - "guest to host. One of [serial, vsock]"); -DEFINE_int32(logcat_vsock_port, vsoc::GetPerInstanceDefault(5620), - "The port for logcat over vsock"); +DEFINE_string(logcat_serial_port, "", + "The serial port for logcat. Used only with crosvm"); DEFINE_string(config_server_binary, vsoc::DefaultHostArtifactsPath("bin/config_server"), "Binary for the configuration server"); @@ -391,9 +386,9 @@ bool InitializeCuttlefishConfiguration( tmp_config_obj.add_kernel_cmdline( concat("androidboot.hardware=", FLAGS_hardware_name)); } - if (FLAGS_logcat_mode == cvd::kLogcatVsockMode) { - tmp_config_obj.add_kernel_cmdline(concat("androidboot.vsock_logcat_port=", - FLAGS_logcat_vsock_port)); + if (!FLAGS_logcat_serial_port.empty()) { + tmp_config_obj.add_kernel_cmdline(concat("androidboot.logcat_serial_port=/dev/", + FLAGS_logcat_serial_port)); } tmp_config_obj.add_kernel_cmdline(concat("androidboot.cuttlefish_config_server_port=", FLAGS_config_server_port)); @@ -466,7 +461,6 @@ bool InitializeCuttlefishConfiguration( tmp_config_obj.set_deprecated_boot_completed(FLAGS_deprecated_boot_completed); tmp_config_obj.set_console_path(tmp_config_obj.PerInstancePath("console")); tmp_config_obj.set_logcat_path(tmp_config_obj.PerInstancePath("logcat")); - tmp_config_obj.set_logcat_receiver_binary(FLAGS_logcat_receiver_binary); tmp_config_obj.set_config_server_binary(FLAGS_config_server_binary); tmp_config_obj.set_launcher_log_path(tmp_config_obj.PerInstancePath("launcher.log")); tmp_config_obj.set_launcher_monitor_socket_path( @@ -519,8 +513,7 @@ bool InitializeCuttlefishConfiguration( tmp_config_obj.disable_usb_adb(); } - tmp_config_obj.set_logcat_mode(FLAGS_logcat_mode); - tmp_config_obj.set_logcat_vsock_port(FLAGS_logcat_vsock_port); + tmp_config_obj.set_logcat_serial_port(FLAGS_logcat_serial_port); tmp_config_obj.set_config_server_port(FLAGS_config_server_port); tmp_config_obj.set_frames_vsock_port(FLAGS_frames_vsock_port); if (!tmp_config_obj.enable_ivserver() && tmp_config_obj.enable_vnc_server()) { @@ -580,7 +573,7 @@ void SetDefaultFlagsForQemu() { google::FlagSettingMode::SET_FLAGS_DEFAULT); SetCommandLineOptionWithMode("hardware_name", "cutf_ivsh", google::FlagSettingMode::SET_FLAGS_DEFAULT); - SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatSerialMode, + SetCommandLineOptionWithMode("logcat_serial_port", "", google::FlagSettingMode::SET_FLAGS_DEFAULT); } @@ -612,7 +605,7 @@ void SetDefaultFlagsForCrosvm() { google::FlagSettingMode::SET_FLAGS_DEFAULT); SetCommandLineOptionWithMode("run_e2e_test", "false", google::FlagSettingMode::SET_FLAGS_DEFAULT); - SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatVsockMode, + SetCommandLineOptionWithMode("logcat_serial_port", "ttyS2", google::FlagSettingMode::SET_FLAGS_DEFAULT); if (!FLAGS_composite_disk.empty()) { diff --git a/host/commands/launch/launch.cc b/host/commands/launch/launch.cc index 75387f072..b2c61e4bd 100644 --- a/host/commands/launch/launch.cc +++ b/host/commands/launch/launch.cc @@ -88,10 +88,6 @@ int GetHostPort() { return vsoc::GetPerInstanceDefault(kFirstHostPort); } -bool LogcatReceiverEnabled(const vsoc::CuttlefishConfig& config) { - return config.logcat_mode() == cvd::kLogcatVsockMode; -} - bool AdbUsbEnabled(const vsoc::CuttlefishConfig& config) { return AdbModeEnabled(config, vsoc::AdbMode::Usb); } @@ -174,24 +170,6 @@ std::vector<cvd::SharedFD> LaunchKernelLogMonitor( return ret; } -void LaunchLogcatReceiverIfEnabled(const vsoc::CuttlefishConfig& config, - cvd::ProcessMonitor* process_monitor) { - if (!LogcatReceiverEnabled(config)) { - return; - } - auto port = config.logcat_vsock_port(); - auto socket = cvd::SharedFD::VsockServer(port, SOCK_STREAM); - if (!socket->IsOpen()) { - LOG(ERROR) << "Unable to create logcat server socket: " - << socket->StrError(); - std::exit(LauncherExitCodes::kLogcatServerError); - } - cvd::Command cmd(config.logcat_receiver_binary()); - cmd.AddParameter("-server_fd=", socket); - process_monitor->StartSubprocess(std::move(cmd), - GetOnSubprocessExitCallback(config)); -} - void LaunchConfigServer(const vsoc::CuttlefishConfig& config, cvd::ProcessMonitor* process_monitor) { auto port = config.config_server_port(); diff --git a/host/commands/launch/launch.h b/host/commands/launch/launch.h index ec95c247a..1584605f3 100644 --- a/host/commands/launch/launch.h +++ b/host/commands/launch/launch.h @@ -15,8 +15,6 @@ std::vector <cvd::SharedFD> LaunchKernelLogMonitor( const vsoc::CuttlefishConfig& config, cvd::ProcessMonitor* process_monitor, unsigned int number_of_event_pipes); -void LaunchLogcatReceiverIfEnabled(const vsoc::CuttlefishConfig& config, - cvd::ProcessMonitor* process_monitor); void LaunchConfigServer(const vsoc::CuttlefishConfig& config, cvd::ProcessMonitor* process_monitor); void LaunchUsbServerIfEnabled(const vsoc::CuttlefishConfig& config, diff --git a/host/commands/launch/main.cc b/host/commands/launch/main.cc index d9029b10e..9aeb42e4e 100644 --- a/host/commands/launch/main.cc +++ b/host/commands/launch/main.cc @@ -400,8 +400,6 @@ int main(int argc, char** argv) { SetUpHandlingOfBootEvents(&process_monitor, boot_events_pipe, boot_state_machine); - LaunchLogcatReceiverIfEnabled(*config, &process_monitor); - LaunchConfigServer(*config, &process_monitor); LaunchTombstoneReceiverIfEnabled(*config, &process_monitor); diff --git a/host/commands/logcat_receiver/Android.bp b/host/commands/logcat_receiver/Android.bp deleted file mode 100644 index 16f3bf9dd..000000000 --- a/host/commands/logcat_receiver/Android.bp +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright (C) 2019 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -cc_binary_host { - name: "logcat_receiver", - srcs: [ - "main.cpp", - ], - header_libs: [ - "cuttlefish_glog", - ], - shared_libs: [ - "libbase", - "libcuttlefish_fs", - "liblog", - "libcuttlefish_utils", - "cuttlefish_auto_resources", - ], - static_libs: [ - "libcuttlefish_host_config", - "libgflags", - "libjsoncpp", - ], - defaults: ["cuttlefish_host_only"], -} diff --git a/host/commands/logcat_receiver/main.cpp b/host/commands/logcat_receiver/main.cpp deleted file mode 100644 index e9cbad2d0..000000000 --- a/host/commands/logcat_receiver/main.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gflags/gflags.h> -#include <glog/logging.h> - -#include "common/libs/fs/shared_fd.h" -#include "host/libs/config/cuttlefish_config.h" - -DEFINE_int32( - server_fd, -1, - "File descriptor to an already created vsock server. If negative a new " - "server will be created at the port specified on the config file"); - -int main(int argc, char** argv) { - ::android::base::InitLogging(argv, android::base::StderrLogger); - google::ParseCommandLineFlags(&argc, &argv, true); - - auto config = vsoc::CuttlefishConfig::Get(); - - auto path = config->logcat_path(); - auto logcat_file = - cvd::SharedFD::Open(path.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0666); - CHECK(logcat_file->IsOpen()) - << "Unable to open logcat file: " << logcat_file->StrError(); - - cvd::SharedFD server_fd; - if (FLAGS_server_fd < 0) { - unsigned int port = config->logcat_vsock_port(); - server_fd = cvd::SharedFD::VsockServer(port, SOCK_STREAM); - } else { - server_fd = cvd::SharedFD::Dup(FLAGS_server_fd); - close(FLAGS_server_fd); - } - - CHECK(server_fd->IsOpen()) << "Error creating or inheriting logcat server: " - << server_fd->StrError(); - - // Server loop - while (true) { - auto conn = cvd::SharedFD::Accept(*server_fd); - - while (true) { - char buff[1024]; - auto read = conn->Read(buff, sizeof(buff)); - if (read <= 0) { - // Close here to ensure the other side gets reset if it's still - // connected - conn->Close(); - LOG(WARNING) << "Detected close from the other side"; - break; - } - auto written = logcat_file->Write(buff, read); - CHECK(written == read) - << "Error writing to log file: " << logcat_file->StrError() - << ". This is unrecoverable."; - } - } - return 0; -}
\ No newline at end of file diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp index 540732c77..70360205b 100644 --- a/host/libs/config/cuttlefish_config.cpp +++ b/host/libs/config/cuttlefish_config.cpp @@ -153,11 +153,9 @@ const char* kDataPolicy = "data_policy"; const char* kBlankDataImageMb = "blank_data_image_mb"; const char* kBlankDataImageFmt = "blank_data_image_fmt"; -const char* kLogcatMode = "logcat_mode"; const char* kLogcatVsockPort = "logcat_vsock_port"; const char* kConfigServerPort = "config_server_port"; const char* kFramesVsockPort = "frames_vsock_port"; -const char* kLogcatReceiverBinary = "logcat_receiver_binary"; const char* kConfigServerBinary = "config_server_binary"; const char* kRunTombstoneReceiver = "enable_tombstone_logger"; @@ -819,21 +817,12 @@ void CuttlefishConfig::set_blank_data_image_fmt(const std::string& blank_data_im (*dictionary_)[kBlankDataImageFmt] = blank_data_image_fmt; } - -void CuttlefishConfig::set_logcat_mode(const std::string& mode) { - (*dictionary_)[kLogcatMode] = mode; -} - -std::string CuttlefishConfig::logcat_mode() const { - return (*dictionary_)[kLogcatMode].asString(); -} - -void CuttlefishConfig::set_logcat_vsock_port(int port) { +void CuttlefishConfig::set_logcat_serial_port(const std::string& port) { (*dictionary_)[kLogcatVsockPort] = port; } -int CuttlefishConfig::logcat_vsock_port() const { - return (*dictionary_)[kLogcatVsockPort].asInt(); +std::string CuttlefishConfig::logcat_serial_port() const { + return (*dictionary_)[kLogcatVsockPort].asString(); } void CuttlefishConfig::set_config_server_port(int port) { @@ -852,14 +841,6 @@ int CuttlefishConfig::frames_vsock_port() const { return (*dictionary_)[kFramesVsockPort].asInt(); } -void CuttlefishConfig::set_logcat_receiver_binary(const std::string& binary) { - SetPath(kLogcatReceiverBinary, binary); -} - -std::string CuttlefishConfig::logcat_receiver_binary() const { - return (*dictionary_)[kLogcatReceiverBinary].asString(); -} - void CuttlefishConfig::set_config_server_binary(const std::string& binary) { SetPath(kConfigServerBinary, binary); } diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h index defc4ef23..bc94c440b 100644 --- a/host/libs/config/cuttlefish_config.h +++ b/host/libs/config/cuttlefish_config.h @@ -184,9 +184,6 @@ class CuttlefishConfig { std::string logcat_path() const; void set_logcat_path(const std::string& logcat_path); - std::string logcat_receiver_binary() const; - void set_logcat_receiver_binary(const std::string& binary); - std::string config_server_binary() const; void set_config_server_binary(const std::string& binary); @@ -308,11 +305,8 @@ class CuttlefishConfig { void set_blank_data_image_fmt(const std::string& blank_data_image_fmt); std::string blank_data_image_fmt() const; - void set_logcat_mode(const std::string& mode); - std::string logcat_mode() const; - - void set_logcat_vsock_port(int port); - int logcat_vsock_port() const; + void set_logcat_serial_port(const std::string& port); + std::string logcat_serial_port() const; void set_config_server_port(int port); int config_server_port() const; diff --git a/host/libs/vm_manager/cf_qemu.sh b/host/libs/vm_manager/cf_qemu.sh index 66ad15b3b..0baa1c455 100755 --- a/host/libs/vm_manager/cf_qemu.sh +++ b/host/libs/vm_manager/cf_qemu.sh @@ -198,12 +198,10 @@ args+=( -device "ivshmem-doorbell,chardev=ivsocket,vectors=${ivshmem_vector_count}" ) -if [[ "${logcat_mode}" == "serial" ]]; then - args+=( - -chardev "file,id=charchannel0,path=${logcat_path:-${default_dir}/logcat},append=on" - -device "virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=cf-logcat" - ) -fi +args+=( + -chardev "file,id=charchannel0,path=${logcat_path:-${default_dir}/logcat},append=on" + -device "virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=cf-logcat" +) if [[ -n "${gdb_flag}" ]]; then args+=(-gdb "${gdb_flag}") diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp index 953b26058..a692710d3 100644 --- a/host/libs/vm_manager/crosvm_manager.cpp +++ b/host/libs/vm_manager/crosvm_manager.cpp @@ -149,6 +149,9 @@ std::vector<cvd::Command> CrosvmManager::StartCommands(bool with_frontend) { config_->kernel_log_pipe_name(),",console=true"); // Use stdio for the second serial port, it contains the serial console. crosvm_cmd.AddParameter("--serial=num=2,type=stdout,stdin=true"); + // Third serial port has logcat output, send it to the appropriate file. + crosvm_cmd.AddParameter("--serial=num=3,type=file,path=", + config_->logcat_path()); // Redirect standard input and output to a couple of pipes for the console // forwarder host process to handle. diff --git a/host/libs/vm_manager/qemu_manager.cpp b/host/libs/vm_manager/qemu_manager.cpp index 847e5e943..74da4798f 100644 --- a/host/libs/vm_manager/qemu_manager.cpp +++ b/host/libs/vm_manager/qemu_manager.cpp @@ -153,7 +153,6 @@ std::vector<cvd::Command> QemuManager::StartCommands(bool /*with_frontend*/) { std::to_string(config_->ivshmem_vector_count())); LogAndSetEnv("usb_v1_socket_name", config_->usb_v1_socket_name()); LogAndSetEnv("vsock_guest_cid", std::to_string(config_->vsock_guest_cid())); - LogAndSetEnv("logcat_mode", config_->logcat_mode()); cvd::Command qemu_cmd(vsoc::DefaultHostArtifactsPath("bin/cf_qemu.sh"), [](cvd::Subprocess* proc) { |