blob: dce2189b7f7b5e4ecb854d01fb289762c87cae71 [file] [log] [blame]
# Copyright 2021 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.
description "Start Chrome OS HPS service"
author "chromium-os-dev@chromium.org"
# Environment variables for daemon configuration.
# They are empty here and should be overridden in hpsd.override
env HPS_HW_FLAGS=
env FW_APPL_PATH=
env FW_SPI_PATH=
env FW_VERSION=0
#
# Development options for prototyping
env UART_DEV=
# Start when mems_setup has set proper group and ownership.
start on started boot-services
stop on stopping boot-services
expect fork
respawn
respawn limit 5 30
# Make hpsd killable, because if it has a leak it's better to
# restart it than to OOM-panic.
oom score -100
# Need writable access to /sys/devices and /dev for I2C access.
# Need access to /run/dbus for DBus communications.
# Set RLIMIT_NICE(=13) to 40,40
exec minijail0 -i -u hpsd -g hpsd \
-N --uts -e -p -P /mnt/empty -b / -b /sys \
-k 'tmpfs,/run,tmpfs,MS_NOSUID|MS_NODEV|MS_NOEXEC' \
-n -b /sys/bus -b /sys/devices,,1 -b /dev,,1 \
-b /sys/class -b /run/dbus \
-R 13,40,40 \
-- /usr/sbin/hpsd --skipboot --test --version="${FW_VERSION}" \
--mcu_path="${FW_APPL_PATH}" --spi_path="${FW_SPI_PATH}" ${HPS_HW_FLAGS}