blob: d1b333acb034ff8341cf632a6e01f819497877d4 [file] [log] [blame] [edit]
# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Start camera GPU algorithm service"
author "chromium-os-dev@chromium.org"
start on started system-services
stop on stopping system-services
# Make the camera jobs killable, because if it has a leak it's better to restart
# it than to OOM-panic.
oom score 0
expect fork
respawn
respawn limit 10 5
env SECCOMP_POLICY_FILE=/usr/share/policy/cros-camera-gpu-algo-seccomp.policy
env CAMERA_LIBFS_PATH=/usr/share/cros-camera/libfs
script
# Start constructing minijail0 args...
set --
# Enter a new mount, network, PID, IPC and cgroup namespace.
set -- "$@" --config /usr/share/minijail/cros-camera-gpu-algo.conf
# This service uses either /dev/mali0 (arm) or /dev/dri/* (amd64) for
# GPU access.
if [ -c "/dev/mali0" ]; then
set -- "$@" -b /dev/mali0,,1
fi
if [ -d "/dev/dri" ]; then
set -- "$@" -b /dev/dri,,1
fi
# Bind mount camera libraries.
set -- "$@" -b "${CAMERA_LIBFS_PATH}"
# Set seccomp filter.
set -- "$@" -S "${SECCOMP_POLICY_FILE}"
set -- "$@" -- /usr/bin/cros_camera_algo --type=gpu
exec minijail0 "$@"
end script