修改Fedora20的开机动画(解决开机无显示的问题)

出处:https://www.eefocus.com/marianna/blog/14-07/304759_cb453.html
调试Plymouth,经常会遇到关机可以正常显示动画,但是开机却总是保持charge球的情况;并且还会遇到hot-dog老是自动应用且删除不了的问题。

其实答案总是在最明显的地方,就看你能不能留意到,还是把它当作背景噪声忽略掉。

在前面的调试过程中,我学习到了基本的Plymouth应用步骤,主要是这么几步:
plymouthd
plymouth --show-splash
plymouth quit
plymouth-set-default-theme --list
plymouth-set-default-theme xxx

而update-alternatives命令,只在自己制作theme的时候用到,yum时是用不到的,所以答案就在上面的plymouth*五条命令中。之前采用kernel command line观察Plymouth的启动信息时,总是会发现这么一行:
find_system_default_splash:System default splash is configured to be 'charge'
就是说,虽然执行了plymouth-set-default-theme solar命令,但是默认的theme并没有改过来。

执行:
plymouth-set-default-theme --help
会出现下面的信息:
Plymouth theme chooser
usage: plymouth-set-default-theme { --list | --reset | <theme-name> [ --rebuild-initrd ] | --help }

-h, --help Show this help message
-l, --list Show available themes
-r. --reset Reset to default theme
-R, --rebuild-initrd Rebuild initrd (necessary after changing theme)
<theme-name> Name of new theme to use (see --list for available themes)

注意-R这个参数,它提示在改变theme之后需要重新编译initrd。所以,再执行:
plymouth-set-default-theme -R
会出现下面的信息:
/usr/share/plymouth/themes//.plymouth does not exist


****更正:这条命令实际上应该是这样的:
plymouth-set-default-theme -R solar
就可以顺利调用dracut命令了,但是还是要注意的是它生成的是:
initrd-3.15.6-200.fc20.i686.img
而不是:
initramfs-3.11.10-301.fc20.i686.img
问题是,我的Fedora20采用的是前者,这从/boot/grub2/grub.cfg里面也能看出来:
===========
linux /vmlinuz-3.11.10-301.fc20.i686 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=fedora/root rhgb quiet LANG=en_US.UTF-8
initrd /initramfs-3.11.10-301.fc20.i686.img
===========
因为此时以boot为根目录,所以vmlinuz和initramfs都放在了/boot下面。那initrd和initramfs的区别是什么呢?
https://www.linux.com/learn/linux-training/92607-the-kernel-newbie-corner-qinitrdq-and-qinitramfsq-whats-up-with-that
=============================
In a nutshell, when your bootloader (GRUB?) loads your Linux kernel, it is of course the kernel's job to finish the boot process. But to do so, it might require particular drivers to be able to work with, say, hardware RAID controllers, or a network, and so on. And developing on where those critically important drivers are, the kernel might not have the ability to load them, hence, the creation of a preliminary root file system that would contain just enough in the way of loadable modules to give the kernel access to the rest of the hardware.
很多人对initrd很熟悉,因为在GRUB bootloader里面经常看到它的身影,以前,initrd包含了压缩了的文件系统镜像,你需要root权限才能访问它。
而initramfs(initial RAM file system)是更早的potential root file system(?),它能够被编译进内核。so,mkinitrd的步骤还是要执行的!


============================
https://advancelinux.blogspot.com/2013/06/how-to-rebuild-initrd-or-initramfs-in.html
============================
The inital RAM disk (initrd) is an initial root file system that is mounted prior to when the real root file system is available. It is necessary to rebuild the Initrd images in following scenarios to include the proper kernel modules, files, and configuration directives

  1. If adding new hardware to a system that may be used very early in the boot process.
  2. If changing configuration files that may be used very early in the boot process.
  3. If changing the options on a kernel module.
    ============================

首先保存initrd的备份:
mv /boot/initrd-(uname -r).img /boot/initrd-(uname -r).img.bak
然后重新编译initrd:
mkinitrd -f -v /boot/initrd-(uname -r).img(uname -r)

-f参数意思是强制覆盖已存在的img,-v参数意思是打印所有的信息。当执行完这个命令之后reboot,就会发现开关机动画都漂亮的出现啦~~~

(对于RHEL 3,4,5来说是mkinitrd,对RHEL 6来说是新命令dracut,mkinitrd也是可以用的。Fedora20里面两个命令都有,但我只采用了mkinitrd,哪位有兴趣的童鞋可以试试dracut~~~)

补充:获取屏幕分辨率的命令,除了xdpyinfo之外,还有xrandr。

推荐阅读更多精彩内容