| # Copyright 2012 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Displays an animation while the system is booting" |
| author "chromium-os-dev@chromium.org" |
| |
| # UI should still be able to come up even if we fail. |
| oom score -100 |
| export fork |
| |
| # boot-splash depends on udev-trigger-early because frecon does need |
| # graphics device to be ready to display splash screen and tty (ptmx) |
| # device to create terminals, it also uses input devices (though they |
| # can also be hotplugged). |
| |
| start on stopped udev-trigger-early and started cros_configfs |
| |
| # If no assets are available to show, assume "embedded". |
| # If a specific embedded device needs different parameters, see: |
| # http://upstart.ubuntu.com/cookbook/#separating-variables-from-the-job |
| env ASSETLESS_ARGS="--enable-osc --enable-vts --pre-create-vts" |
| |
| # Script stanzas can only execute one program, |
| # and that program needs to be frecon. |
| pre-start script |
| # Do not change backlight if the display was already |
| # initialized in firmware (brightness is set in firmware). |
| if [ "$(cros_config /firmware has-splash-screen)" != "true" ] || |
| ! grep -qsF "active=1" /sys/kernel/debug/dri/0/state; then |
| # Set the backlight to 40% of its maximum level. |
| BACKLIGHT_DIR=/sys/class/backlight |
| if [ -d ${BACKLIGHT_DIR} ] && |
| [ -n "$(find ${BACKLIGHT_DIR} -maxdepth 0 ! -empty)" ]; then |
| backlight_tool --set_brightness_percent=40.0 || true |
| fi |
| fi |
| end script |
| |
| script |
| BACKGROUND=0xfffefefe |
| ARGS="" |
| BOOT_IMAGES="" |
| |
| if [ "$(cros_config /firmware has-splash-screen)" != "true" ] || |
| ! grep -qsF "active=1" /sys/kernel/debug/dri/0/state; then |
| ASSETS=/usr/share/chromeos-assets |
| ASSETS_200=${ASSETS}/images_200_percent |
| ASSETS_100=${ASSETS}/images_100_percent |
| |
| if [ "$(feature_check --feature_name=FeatureManagementOobeSimon)" -eq "1" ] |
| then |
| ASSETS_200=${ASSETS}/animated_splash_screen/splash_200_percent |
| ASSETS_100=${ASSETS}/animated_splash_screen/splash_100_percent |
| fi |
| |
| if [ -f "${ASSETS}/splash_background" ]; then |
| BACKGROUND=$(cat "${ASSETS}/splash_background") |
| fi |
| |
| # Use differently-sized images depending on the framebuffer width. |
| if [ -e "${ASSETS_200}/boot_splash_frame01.png" ]; then |
| ARGS="--frame-interval 25" |
| BOOT_IMAGES="" |
| |
| for image in "${ASSETS_200}"/boot_splash_frame*.png; do |
| BOOT_IMAGES="${BOOT_IMAGES} --image-hires ${image}" |
| done |
| for image in "${ASSETS_100}"/boot_splash_frame*.png; do |
| BOOT_IMAGES="${BOOT_IMAGES} --image ${image}" |
| done |
| elif [ -d "${ASSETS_100}" ]; then |
| ARGS="--frame-interval 25" |
| BOOT_IMAGES="${ASSETS_100}"/boot_splash_frame*.png |
| else |
| ARGS="${ASSETLESS_ARGS}" |
| fi |
| fi |
| |
| if is_developer_end_user; then |
| ARGS="${ARGS} --dev-mode --enable-osc --enable-vts --pre-create-vts" |
| fi |
| |
| # Run as 'frecon' group, to give created files/folders the correct ownership. |
| # TODO(b/193068531): Sandbox frecon and run as user:group frecon:frecon. |
| minijail0 -g frecon --no-fs-restrictions --no-default-runtime-environment -i \ |
| -- /sbin/frecon --daemon --clear "${BACKGROUND}" ${ARGS} ${BOOT_IMAGES} |
| end script |