blob: e456df1f5dde16e5f08f048f8293883c6e8cf6f0 [file] [log] [blame]
// Copyright 2022 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <unistd.h>
#include <base/files/file_path.h>
#include <base/files/file_util.h>
#include <base/logging.h>
#include <base/values.h>
#include <brillo/key_value_store.h>
#include <brillo/process/process.h>
#include <brillo/syslog_logging.h>
#include "init/crossystem.h"
#include "init/crossystem_impl.h"
#include "init/startup/chromeos_startup.h"
#include "init/startup/lib.h"
namespace {
constexpr char kLogFile[] = "/run/chromeos_startup.log";
constexpr char kLsbRelease[] = "/etc/lsb-release";
constexpr char kProcPath[] = "/proc";
constexpr char kStatefulPartition[] = "/mnt/stateful_partition";
} // namespace
int main(int argc, char* argv[]) {
// Set up logging to a file to record any unexpected but non-fatal
// behavior.
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_FILE;
settings.log_file_path = kLogFile;
settings.lock_log = logging::DONT_LOCK_LOG_FILE;
settings.delete_old = logging::DELETE_OLD_LOG_FILE;
logging::InitLogging(settings);
startup::Flags flags;
startup::ChromeosStartup::ParseFlags(&flags);
CrosSystemImpl* cros_system = new CrosSystemImpl();
auto startup = std::make_unique<startup::ChromeosStartup>(
std::unique_ptr<CrosSystemImpl>(cros_system), flags, base::FilePath("/"),
base::FilePath(kStatefulPartition), base::FilePath(kLsbRelease),
base::FilePath(kProcPath));
return startup->Run();
}