1# Copyright 2016 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# Unified build config. 6device_config_dir="$(cros_config --abspath /audio/main cras-config-dir)" 7internal_ucm_suffix="$(cros_config /audio/main ucm-suffix)" 8 9# Handle legacy config. 10if [ -z "${device_config_dir}" ]; then 11 # Disable HSP/HFP on Google WiFi (Gale) with UART-HCI Bluetooth 12 # which is incapable of handling SCO audio. 13 platform_name="$(mosys platform name)" 14 if [ "$platform_name" = "Gale" ]; then 15 DISABLE_PROFILE="--disable_profile=hfp,hsp" 16 fi 17 # For boards that need a different device config, check which config 18 # directory to use. Use that directory for both volume curves 19 # and DSP config. 20 if [ -f /etc/cras/get_device_config_dir ]; then 21 device_config_dir="$(sh /etc/cras/get_device_config_dir)" 22 fi 23 if [ -f /etc/cras/get_internal_ucm_suffix ]; then 24 internal_ucm_suffix="$(sh /etc/cras/get_internal_ucm_suffix)" 25 fi 26fi 27 28if [ -n "${device_config_dir}" ]; then 29 DEVICE_CONFIG_DIR="--device_config_dir=${device_config_dir}" 30 DSP_CONFIG="--dsp_config=${device_config_dir}/dsp.ini" 31fi 32if [ -n "${internal_ucm_suffix}" ]; then 33 INTERNAL_UCM_SUFFIX="--internal_ucm_suffix=${internal_ucm_suffix}" 34fi 35 36# Leave cras in the init pid namespace as it uses its PID as an IPC identifier. 37exec minijail0 -u cras -g cras -G -n --uts -v -l \ 38 -P /var/empty \ 39 -b /,/ \ 40 -k 'tmpfs,/run,tmpfs,MS_NODEV|MS_NOEXEC|MS_NOSUID,mode=755,size=10M' \ 41 -b /run/cras,/run/cras,1 \ 42 -b /run/dbus,/run/dbus,1 \ 43 -b /run/udev,/run/udev \ 44 -b /dev,/dev \ 45 -b /dev/shm,/dev/shm,1 \ 46 -k proc,/proc,proc \ 47 -b /sys,/sys \ 48 -k 'tmpfs,/var,tmpfs,MS_NODEV|MS_NOEXEC|MS_NOSUID,mode=755,size=10M' \ 49 -b /var/lib/metrics/,/var/lib/metrics/,1 \ 50 -S /usr/share/policy/cras-seccomp.policy \ 51 -- \ 52 /usr/bin/cras \ 53 ${DSP_CONFIG} ${DEVICE_CONFIG_DIR} ${DISABLE_PROFILE} \ 54 ${INTERNAL_UCM_SUFFIX} 55