Show Table of Contents
10.4. Plymouth
“
Plymouth”是红帽企业版 Linux 7 的图形启动系统和记录器,它使用了基于内核的模式设置(KMS)和直接渲染管理器(DRM)。在启动时,“Plymouth”将对用户交互进行处理。
您可以在多个静态或动态图形主题中选择主题,从而自定义启动画面外观。新的主题可以在现有主题的基础上进行创建。
10.4.1. 在主题中置入徽标
“
Plymouth”的每一个主题都由一个主题数据文件和一个编译的“启动模块插件 ”组成。这个数据文件有一个安装于 /usr/share/plymouth/themes/ 目录下的 .plymouth 扩展文件。
配置数据以“键-值”(key-value)的格式指定于
[Plymouth Theme] 小节中。这个组的有效键值是 “Name(名称)”、“Description(描述)”,和“ModuleName(模块名称)”。其中,前两个键值是自我解释的,第三个键值则指定了“Plymouth”启动插件模块的名称。不同的插件提供了开机时不同的动画和不同主题底层的实现:
例 10.2. 实例 .plymouth 文件
[Plymouth Theme] Name=Charge Description=A theme that features the shadowy hull of my logo charge up and finally burst into full form. ModuleName=two-step
过程 10.5. 更改 Plymouth 主题
- 搜索现有的“
Plymouth”主题,选择一个您最满意的。运行以下命令:#yum search plymouth-theme或者运行plymouth-set-default-theme --list命令,来查看所安装的主题。您还可以在安装所有的 plymouth 软件包的同时,将所有的主题进行安装。但与此同时,您也会安装许多不必要的软件包。# yum install plymouth\*
- 使用
plymouth-set-default-theme theme_name命令,将新主题设置为默认主题。例 10.3. 将 “spinfinity” 设置为默认主题
您已经选择了 spinfinity 主题,接下来请运行:#plymouth-set-default-theme spinfinity - 编辑完成后,重新生成“
initrd”守护程序,否则您设置的主题将不会显示在启动画面上。您可以运行以下命令重新生成守护程序:#dracut -f
10.4.2. 创建一个新的 Plymouth 主题
如果您不想从给出的主题列表中选择主题,那么您可以创建属于您自己的主题。最简单的方法就是复制一个现有的主题并对它进行修改。
过程 10.6. 用一个现有的主题来创建您自己的主题
- 复制
plymouth/目录中的所有内容。 作为一个目录模板使用,例如,通过以下设置来使用“two-step”启动插件的红帽企业版 Linux 7 的默认主题,/usr/share/plymouth/themes/charge/charge.plymouth:[Plymouth Theme] Name=Charge Description=A theme that features the shadowy hull of my logo charge up and finally burst into full form. ModuleName=two-step [two-step] ImageDir=/usr/share/plymouth/themes/charge HorizontalAlignment=.5 VerticalAlignment=.5 Transition=none TransitionDuration=0.0 BackgroundStartColor=0x202020 BackgroundEndColor=0x202020
- 将
charge.plymouth文件重命名为以下格式,并保存在/usr/share/plymouth/themes/newtheme/目录下:newtheme.plymouth - 根据您的喜好、颜色改变、对齐,或者转换,来更新您的
/usr/share/plymouth/themes/newtheme/newtheme.plymouth文件。 - 运行以下命令,从而将您的 newtheme 设置成默认主题。
#plymouth-set-default-theme newtheme - 改变主题后运行以下命令,从而重建“
initrd”守护程序:#dracut -f
10.4.2.1. 使用品牌标商标
一些插件会将品牌商标作为启动动画的一部分显示。如果您想将您自己的徽标加到您的主题中,请遵循以下简短的步骤。
重要
记住,您的品牌徽标图案的格式必须为 .png 格式。
过程 10.7. 将您的徽标添加至主题
- 为您的徽标创建一个名为
logo.png的图形文件。 - 通过更新 ImageDir 键值来编辑
/usr/share/plymouth/themes/newtheme.plymouth文件,从而使之指向您在步骤一中创建的logo.png图形文件目录:ImageDir=/usr/share/plymouth/themes/newtheme
更多关于“
Plymouth”的信息,请参见plymouth(8)手册页。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.