bootlog doesn't block startup (#31061)

* bootlog doesn't block startup

* keep params

* fix

* cleanup
pull/31063/head
Adeeb Shihadeh 1 year ago committed by GitHub
parent 29536324c1
commit c4362bd958
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 19
      selfdrive/manager/helpers.py
  2. 6
      selfdrive/manager/manager.py
  3. 2
      system/hardware/hw.h

@ -3,7 +3,13 @@ import sys
import fcntl import fcntl
import errno import errno
import signal import signal
import shutil
import subprocess
import tempfile
import threading
from openpilot.common.basedir import BASEDIR
from openpilot.common.params import Params
def unblock_stdout() -> None: def unblock_stdout() -> None:
# get a non-blocking stdout # get a non-blocking stdout
@ -41,3 +47,16 @@ def unblock_stdout() -> None:
def write_onroad_params(started, params): def write_onroad_params(started, params):
params.put_bool("IsOnroad", started) params.put_bool("IsOnroad", started)
params.put_bool("IsOffroad", not started) params.put_bool("IsOffroad", not started)
def save_bootlog():
# copy current params
tmp = tempfile.mkdtemp()
shutil.copytree(Params().get_param_path() + "/..", tmp, dirs_exist_ok=True)
env = os.environ.copy()
env['PARAMS_ROOT'] = tmp
t = threading.Thread(target=subprocess.call, args=("./bootlog", ), kwargs={'cwd': os.path.join(BASEDIR, "system/loggerd"), 'env': env})
t.daemon = True
t.start()

@ -2,7 +2,6 @@
import datetime import datetime
import os import os
import signal import signal
import subprocess
import sys import sys
import traceback import traceback
from typing import List, Tuple, Union from typing import List, Tuple, Union
@ -10,12 +9,11 @@ from typing import List, Tuple, Union
from cereal import log from cereal import log
import cereal.messaging as messaging import cereal.messaging as messaging
import openpilot.selfdrive.sentry as sentry import openpilot.selfdrive.sentry as sentry
from openpilot.common.basedir import BASEDIR
from openpilot.common.params import Params, ParamKeyType from openpilot.common.params import Params, ParamKeyType
from openpilot.common.text_window import TextWindow from openpilot.common.text_window import TextWindow
from openpilot.selfdrive.boardd.set_time import set_time from openpilot.selfdrive.boardd.set_time import set_time
from openpilot.system.hardware import HARDWARE, PC from openpilot.system.hardware import HARDWARE, PC
from openpilot.selfdrive.manager.helpers import unblock_stdout, write_onroad_params from openpilot.selfdrive.manager.helpers import unblock_stdout, write_onroad_params, save_bootlog
from openpilot.selfdrive.manager.process import ensure_running from openpilot.selfdrive.manager.process import ensure_running
from openpilot.selfdrive.manager.process_config import managed_processes from openpilot.selfdrive.manager.process_config import managed_processes
from openpilot.selfdrive.athena.registration import register, UNREGISTERED_DONGLE_ID from openpilot.selfdrive.athena.registration import register, UNREGISTERED_DONGLE_ID
@ -31,7 +29,7 @@ def manager_init() -> None:
set_time(cloudlog) set_time(cloudlog)
# save boot log # save boot log
subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "system/loggerd")) save_bootlog()
params = Params() params = Params()
params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START) params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START)

@ -30,7 +30,7 @@ namespace Path {
} }
inline std::string params() { inline std::string params() {
return Hardware::PC() ? util::getenv("PARAMS_ROOT", Path::comma_home() + "/params") : "/data/params"; return util::getenv("PARAMS_ROOT", Hardware::PC ? (Path::comma_home() + "/params") : "/data/params");
} }
inline std::string rsa_file() { inline std::string rsa_file() {

Loading…
Cancel
Save