• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /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
26else
27  device_config_dir="/etc/cras/${device_config_dir}"
28fi
29
30if [ -n "${device_config_dir}" ]; then
31  DEVICE_CONFIG_DIR="--device_config_dir=${device_config_dir}"
32  DSP_CONFIG="--dsp_config=${device_config_dir}/dsp.ini"
33fi
34if [ -n "${internal_ucm_suffix}" ]; then
35  INTERNAL_UCM_SUFFIX="--internal_ucm_suffix=${internal_ucm_suffix}"
36fi
37
38# Leave cras in the init pid namespace as it uses its PID as an IPC identifier.
39exec minijail0 -u cras -g cras -G --uts -v -l \
40        -T static \
41        -P /mnt/empty \
42        -b /,/ \
43        -k 'tmpfs,/run,tmpfs,MS_NODEV|MS_NOEXEC|MS_NOSUID,mode=755,size=10M' \
44        -b /run/cras,/run/cras,1 \
45        -b /run/dbus,/run/dbus,1 \
46        -b /run/systemd/journal \
47        -b /run/udev,/run/udev \
48        -b /dev,/dev \
49        -b /dev/shm,/dev/shm,1 \
50        -k proc,/proc,proc \
51        -b /sys,/sys \
52        -k 'tmpfs,/var,tmpfs,MS_NODEV|MS_NOEXEC|MS_NOSUID,mode=755,size=10M' \
53        -b /var/lib/metrics/,/var/lib/metrics/,1 \
54        -- \
55        /sbin/minijail0 -n \
56        -S /usr/share/policy/cras-seccomp.policy \
57        -- \
58        /usr/bin/cras \
59        ${DSP_CONFIG} ${DEVICE_CONFIG_DIR} ${DISABLE_PROFILE} \
60        ${INTERNAL_UCM_SUFFIX}
61