plymouth客制化主题方案

官方源自带的theme主题

设备上已知的主题位于/usr/share/plymouth/themes路径下

root@ning-QiTianM620-N000:/usr/share/plymouth/themes# ls
casco  charge  fade-in  rings  rings.origin  rings.sources  script  solar  spinfinity

对应的rpm文件名称为plymouth-theme-fade-in-xxx.rpm plymouth-theme-rings-xxx.rpm plymouth-theme-script-xxx.rpm  plymouth-theme-solar-xxx.rpm plymouth-theme-spinfinity-xxx.rpm

-rw-rw-r-- 1 ning ning    60656 11月 24 08:41 plymouth-theme-fade-in-0.8.3-29.el6.centos.noarch.rpm
-rw-rw-r-- 1 ning ning    33756 11月 24 08:41 plymouth-theme-rings-0.8.3-29.el6.centos.noarch.rpm
-rw-rw-r-- 1 ning ning    34644 11月 24 08:41 plymouth-theme-script-0.8.3-29.el6.centos.noarch.rpm
-rw-rw-r-- 1 ning ning   389804 11月 24 08:41 plymouth-theme-solar-0.8.3-29.el6.centos.noarch.rpm
-rw-rw-r-- 1 ning ning    48144 11月 24 10:19 plymouth-theme-spinfinity-0.8.3-29.el6.centos.noarch.rpm

参考fedora的客制化主题

fedora plymouth的开机主题,是基于plymouth-theme-charge开发的,个人理解的也就是在charge主题的基础上替换了progress-00.png progress-16/17/18.png 以及 throbess-00.png生成的。这几张png图片对应的就是客户提供的图片。需要注意的是,plymouth主题中使用的图片格式必须是png格式的,如jpg图片应用主题会失败。centos的官方源上没有找到charge对应的主题rpm包,可以参考ubuntu或debian的官方源的plymouth-theme-charge-xxx.deb文件。

root@ning-QiTianM620-N000:update-logo-fc27/fedora-new-logo# ls -ll
total 4092
-rw-r--r-- 1 root root    870 3月  28  2022 box.png
-rw-r--r-- 1 root root    131 3月  28  2022 bullet.png
-rw-r--r-- 1 root root    366 8月   4  2017 charge.plymouth
-rw-r--r-- 1 root root    367 3月  28  2022 entry.png
-rw-r--r-- 1 root root   1896 3月  28  2022 lock.png
-rwxr-xr-x 1 root root 756750 3月  29  2022 progress-00.png
-rwxr-xr-x 1 root root 810415 3月  29  2022 progress-16.png
-rwxr-xr-x 1 root root 830083 3月  29  2022 progress-17.png
-rwxr-xr-x 1 root root 881465 3月  29  2022 progress-18.png
-rwxr-xr-x 1 root root 881465 3月  29  2022 throbber-00.png

所有主题对应存在一个.plymouth文件,如果没有.plymouth文件,/usr/share/plymouth/themes/x/ 中的主题 x 通过plymouth-set-default-theme --list无法查询到。另外,box.png bullet.png entry.png以及lock.png在two-step.so中可以看到它的用途,在客制化的时候容易忽略掉这部分png。

设定主题

1、查看当前已知存在的主题有哪些?

plymouth-set-default-theme --list

2、查看当前生效的主题是哪一个?

plymouth-set-default-theme

3、设定已知的某个主题

plymouth-set-default-theme xxx

4、更新initrd

/usr/libexec/plymouth/plymouth-update-initrd

安装plymouth依赖的库文件

plymouth主题依赖的库文件位于/usr/lib64/plymouth/目录下,已知的库文件有two-step.so fade-throbber.so  script.so space-flares.so throbgress.so

对应的rpm包名称为:plymouth-plugin-fade-throbber-xxx.rpm  plymouth-plugin-two-step-xxx.rpm

plymouth-plugin-script-xxx.rpm   plymouth-plugin-throbgress-xxx.rpm

-rw-rw-r-- 1 ning ning    32560 11月 24 14:02 plymouth-plugin-label-0.8.3-29.el6.centos.x86_64.rpm
-rw-rw-r-- 1 ning ning    55004 11月 24 10:19 plymouth-plugin-script-0.8.3-29.el6.centos.x86_64.rpm
-rw-rw-r-- 1 ning ning    43240 11月 24 10:11 plymouth-plugin-space-flares-0.8.3-29.el6.centos.x86_64.rpm
-rw-rw-r-- 1 ning ning    35680 11月 24 10:22 plymouth-plugin-throbgress-0.8.3-29.el6.centos.x86_64.rpm
-rw-rw-r-- 1 ning ning    37700 11月 23 17:09 plymouth-plugin-two-step-0.8.3-29.el6.centos.x86_64.rpm

如何客制化theme主题

客制化主题的思路就是,找到可参考的主题,比如plymouth-theme-rings,查看ring.plymouth文件,已知rings主题使用的ModuleName为two-step,使用vi查看/usr/lib64/plymouth/two-step.so文件,grep查找.png文件,可以已知主题中使用的png图片的名称,然后使用客户的png图片进行替换即可。

可参考plymouth修改开机动画,该篇文章中有详细讲解,自己参考fedora的charge主题修改casco的开机动画时异常,通过阅读该篇链接有了新的思路,最后定位到的原因是缺少了animatation-00.png图片导致的异常。

比较官方的plymouth文件的解析,可参考该篇链接中的解释。

Red Hat 10.3. Plymouth 解释,客制化主题的文章可以参考。

设定主题开机生效

1、修改/boot/grub/grub.cfg,在cmdline中添加'rhgb'或'splash'参数;如果使用的是grub2引导,可在/etc/default/grub中修改GRUB_CMDLINE_LINUX参数,然后执行grub2-mkconfig生成grub.cfg文件;

2、设定主题xx,plymouth-set-default-theme xx

3、使用/usr/libexec/plymouth/plymouth-update-initrd更新initrd

4、reboot重启

调试手段

plymouthd

plymouth --show-splash

plymouth --quit

  • 16
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值