美文网首页
修改启动画面

修改启动画面

作者: 发条蛙 | 来源:发表于2017-10-23 14:52 被阅读0次

    ChromiumOS本质上还是Linux,因此对其启动画面Splash的修改还是Linux的那一套,以下分别对其进行描述:

    ChromeBook

    在ChromeBook上,Splash存在的路径为:

    /usr/share/chromeos-assets/images_100_percent
    

    如果只想修改本机的启动画面,最简单的方式就是修改该目录下的启动图片boot_splash_frame**.png即可。但如果想将新的Splash应用到系统编译中,则还需要更多的操作。

    ChromiumOS系统编译

    经过查找,可以知道ChromiumOS系统是将Splash放置在目录src/platform/chromiumos-assets/images_100_percent下,该目录下共有18个图片文件:

    boot_splash_frame01.png
    boot_splash_frame02.png
    boot_splash_frame03.png
    boot_splash_frame04.png
    boot_splash_frame05.png
    boot_splash_frame06.png
    boot_splash_frame07.png
    boot_splash_frame08.png
    boot_splash_frame09.png
    boot_splash_frame10.png
    boot_splash_frame11.png
    boot_splash_frame12.png
    boot_splash_frame13.png
    boot_splash_frame14.png
    boot_splash_frame15.png
    boot_splash_frame16.png
    boot_splash_frame17.png
    boot_splash_frame18.png
    

    但是由于ChromiumOS系统编译时,默认是从网络下载源码进行编译,因此如果只是修改这些文件,其实并不会改动到最终编译后的系统,这里还需要先查找该目录是属于哪个ebuild包:

    $ cros_workon --board=${BOARD} --all info | grep chromiumos-assets
    chromeos-base/chromiumos-assets chromiumos/platform/chromiumos-assets src/platform/chromiumos-assets
    

    可以看到,这里需要将chromeos-base/chromiumos-assets设置为使用本地代码编译才行。故在chroot环境中,还需要先执行如下代码再进行编译:

    cros_workon --board=${BOARD} start chromeos-base/chromiumos-assets
    

    则最终将这些Splash图片编译到目标目录chroot/build/quawks/usr/share/chromeos-assets/images_100_percent中,再打包到最后的ChromiumOS系统内。

    Splash的使用

    Splash图片在文件src/platform2/init/upstart/boot-splash.conf中被使用,该文件对应的git仓库为https://chromium.googlesource.com/chromiumos/platform2,该文件具体内容为:

    # Copyright (c) 2012 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    "Displays an animation while the system is booting"
    author         "chromium-os-dev@chromium.org"
    
    # 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
    
    script
      . /usr/share/cros/factory_utils.sh
    
      if ! is_factory_installer_mode; 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
    
        ASSETS=/usr/share/chromeos-assets
        ASSETS_200=$ASSETS/images_200_percent
        ASSETS_100=$ASSETS/images_100_percent
    
        # Use differently-sized images depending on the framebuffer width.
        if [ -e "$ASSETS_200/boot_splash_frame01.png" ]; then
          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
        else
          BOOT_IMAGES="$ASSETS_100"/boot_splash_frame*.png
        fi
    
        if is_factory_test_mode; then
          BOOT_IMAGES="${BOOT_IMAGES} /usr/local/factory/misc/boot_splash.png"
        fi
    
        DEV_END_USER=
        if is_developer_end_user; then
          DEV_END_USER=--dev-mode
        fi
    
        frecon --daemon --clear 0xfffefefe $DEV_END_USER --frame-interval 25 \
          $BOOT_IMAGES
      fi
    end script
    

    相关文章

      网友评论

          本文标题:修改启动画面

          本文链接:https://www.haomeiwen.com/subject/lvcauxtx.html