[Translated] 20170215 How to change the Linux Boot Splash screen.md

This commit is contained in:
Fuliang.Li 2017-03-14 00:09:55 +08:00 committed by GitHub
parent 452068f444
commit b5d0d82887
2 changed files with 161 additions and 152 deletions

View File

@ -1,152 +0,0 @@
GHLandy Translating
How to change the Linux Boot Splash screen
============================================================
### On this page
1. [What we need to proceed.][1]
2. [Change the Grub splash screen by using the GUI][2]
3. [Change the Grub splash screen on the command line][3]
**What is a Splash screen?**
A splash screen is nothing but the picture that's gets displayed in the background while booting the Linux operating system. You might be knowing that Grub (**GR**and **U**nified **B**ootloader) is the commonly used famous bootloader among major Linux distributions. If you take Redhat as an example, it displays a blank or black background during the booting of the system.
The splash screen definitions are defined in the grub.conf file and the splash screen image file resides in the /boot partition. If you are bored of the default blank screen and want to change it to whatever you like, then just perform the steps below to change it.
### What we need to proceed.
1\. ImageMagick (Only required For command Line Method): or GIMP (For GUI Method)
2\. A sample image.
###
Change the Grub splash screen by using the GUI
Let's proceed with the GUI method in which we will use GIMP as image editor.
**Step 1**. Open the image using GIMP (follow the path; Applications --> Graphics --> GNU Image Manipulation Program )
**Step 2**. Now we need to scale the image size to 640 x 480 for proper implementation. For this, go to option Image--> Scale Image. Keep in mind below specs for this. Change Width to 640 and Height to 480\. Do not change rest of the things.
[
![Scale image](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/scale.JPG)
][4]
Click on the **Scale** button.
**Step 3:** Then we need to index our image so that only 14 colors are used. To do this, go to option Image --> Mode --> Indexed. Tick the "generate optimum palette" option and enter 14 as the maximum number of colors (as shown below).
[
![Limit color palette to 14 colors](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/index.JPG)
][5] 
Click on the convert Button.
**Step 4:** Save the file. I'll use the name "UxTechno.xpm" below:
[
![Save the image file.](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/save.JPG)
][6]
**Step 5: **Zip the file. To do this, go to the location of the file --> Right click on it and select the "Compress" Option. Then select "gzip" as compression method:
[
![](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/compress.JPG)
][7]
**Step 6:** Now copy or move "UxTechno.xpm.gz" file to the location /boot/grub/UxTechno.xpm.gz 
**Step 7:** Now edit the line splashimage parameter in the  /boot/grub/grub.conf File as shown below and save the file. The final content shall look like this:
```
# grub.conf
generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means
that # all kernel and initrd paths are relative to /boot/, eg. # root
(hd0,0) # kernel /vmlinuz-version ro root=/dev/sda2 # initrd
/initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5
splashimage=(hd0,0)/grub/UxTechno.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=1d8c5075-1a5b-4fdc-ba15-0458b65c6012 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb
crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM initrd
/initramfs-2.6.32-220.el6.x86_64.img
```
When you reboot the server, you will see your customized boot splash image as below:
[
![](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/Uxtecho_splash.JPG)
][8]
### Change the Grub splash screen on the command line
If you are a big fan of the command line, then follow this method.
**Step 1:**
Before proceeding, we need to change the image pixel resolution. For this purpose, we should have the ImageMagick software installed on the Linux system. Cross check this using below command on CentOS / RHEL.
rpm -qa|grep -i ImageMagick
IWhen the command returns no (blank) output, then this means you don't have ImageMagick installed on your system. You have to install it using the below command.
yum install ImageMagick
When you recheck, you will get similar output as below:
rpm -qa|grep -i ImageMagick
ImageMagick-6.5.4.7-5.el6.x86_64
So let's proceed with the configuration. I have taken the UxTechno Logo as splash screen image.
**Step 2: **Covert the pixel depth using below command:
convert -depth 8 -colors 14 -resize 640x480 uxtechno_logo.jpg uxtechno_logo.xpm
Definition of above option is as follows:
1. It has to be max 14 colors.
2. It has got to be 640x480 resolution.
3. It should be in xpm format.
**Step 3: **Thengzip the file.
gzip uxtechno_logo.xpm
**Step 4: **Copy the file to the /boot partition.
cp uxtechno_logo.xpm.gz /boot/grub/
**Step 5: **Change the splashimage parameter in the /boot/grub/grub.conf file as below & save the file.
```
splashimage=(hd0,0)/grub/uxtechno_logo.xpm
```
**Step 6:** Finally reboot the server using the reboot command. The boot screen will display the splash image as shown in step 7 of the GUI install procedure.
--------------------------------------------------------------------------------
via: https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/
作者:[MANMOHAN MIRKAR][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/
[1]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/#what-we-need-to-proceed
[2]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/#change-the-grub-splash-screen-by-using-the-gui
[3]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/#change-the-grub-splash-screennbspon-the-command-line
[4]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/scale.JPG
[5]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/index.JPG
[6]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/save.JPG
[7]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/compress.JPG
[8]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/Uxtecho_splash.JPG

View File

@ -0,0 +1,161 @@
如何修改 Linux 启动 Splash 背景
====================
### 本文导航
1. [开始前需要哪些准备工作][1]
2. [使用 GUI 修改 Grub 的 Splash 背景][2]
3. [使用命令行修改 Grub 的 Splash 背景][3]
**何为 Splash 背景?**
Splash 只不过是一张图像,在 Linux 系统启动的时候显示为背景。你可能知道 Grub (**GR**and **U**nified **B**ootloader 的简写) 是主流 Linux 发行版中广泛使用的启动装载程序 (bootloader)。以 RedHat 为例,你会发现它在系统启动之时显示为空白或者是一个黑色背景。
Splash 背景的相关定义在 grub.conf 文件中,并且 splash 背景图像应该存储在 /boot 分区中。如果说你觉得默认的空白屏相当无趣,同时又想按照自己的意愿来修改它,那么赶紧阅读下方的每个步骤吧。
### 开始前需要哪些准备工作
1. ImageMagick (仅在命令行中使用) 或者 GIMP (GUI 中使用)
2. 一样样例图像
### 使用 GUI 修改 Grub 的 Splash 背景
首先然我们来使用 GUI 来进行操作吧,这里我们使用 GIMP 来作为图像编辑器。
**步骤 1**. 使用 GIMP 打开图像 (路径为_应用 (Applications)_ --> _图像 (Graphics)_ --> _GIMP 程序 (GNU Image Manipulation Program)_)
**步骤 2**. 现在我们需要按实际情况将图像缩放到 640x480 大小。为此,需要点击 _图像 (Image)_ --> _缩放图像 (Scale Image)_。记住,要如下图参数进行设置。修改宽度为 640高度为 480。其他保持不变。
[![缩放 image](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/scale.JPG)][4]
点击 **缩放 (Scale)** 按钮
**步骤 3**. 然后,我们需要索引图像,让它仅使用 14 色。为此,点击 _图像 (Image)_ --> 模式 (Mode) --> 索引 (Indexed)。点选 "生成最优调色板 (generate optimum palette)" 选项,并设置颜色最大值 (maximum number of colors) 为 14 (如下)。
[![最优调色板限制为 14 色](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/index.JPG)][5] 
点击 _转换 (convert)_ 按钮
**步骤 4** 保存文件。这里以文件名为 "UxTechno.xpm" 来保存。
[![保存图像文件](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/save.JPG)][6]
**步骤 5**. 以 Zip 压缩文件。为此,转到文件的保存位置 --> 右击并选择 "压缩 (Compress)" 选项,选择 "gzip" 方法来压缩。
[![](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/compress.JPG)][7]
**步骤 6**. 现在复制或移动 "UxTechno.xpm.gz" 到 /boot/grub/UxTechno.xpm.gz。
**步骤 7**. 这一步,打开 /boot/grub/grub.conf 文件编辑 splashimage 参数如下,并保存文件。
最后,文件的内容应该是像这样的:
```
# grub.conf
generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means
that # all kernel and initrd paths are relative to /boot/, eg. # root
(hd0,0) # kernel /vmlinuz-version ro root=/dev/sda2 # initrd
/initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5
splashimage=(hd0,0)/grub/UxTechno.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=1d8c5075-1a5b-4fdc-ba15-0458b65c6012 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb
crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM initrd
/initramfs-2.6.32-220.el6.x86_64.img
```
当你重启服务器之后,你讲看到如下效果的 splash 背景图像:
[![](https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/Uxtecho_splash.JPG)][8]
### 使用命令行修改 Grub 的 Splash 背景
如果说你是命令行的超级粉丝,那就使用如下方法吧。
**步骤 1**
开始之前,我们需要修改图像的像素分辨率。为此,我们还需要在 Linux 系统上安装好 ImageMagick。在 CentOS / RHEL 上使用如下命令来进行交叉检查。
```
# rpm -qa|grep -i ImageMagick
```
如果命令没有返回输出 (即空白),这意味这你的系统上还没有安装 ImageMagick。你必须运行下面的命令来安装它。
```
# yum install ImageMagick
```
安装好了重新复核,你会得到类似如下的输出:
```
# rpm -qa|grep -i ImageMagick
ImageMagick-6.5.4.7-5.el6.x86_64
```
然后,继续接下来的配置。这里我使用 UxTechno 的 logo 来做 splash 背景图像。
**步骤 2** 使用如下命令来转换像素深度
```
# convert -depth 8 -colors 14 -resize 640x480 uxtechno_logo.jpg uxtechno_logo.xpm
```
上述选项的意义如下:
1. 最大使用 14 色
2. 分辨率为 640x480
3. 使用 xpm 格式
**步骤 3** 以 Zip 压缩文件
```
# gzip uxtechno_logo.xpm
```
**步骤 4** 复制文件到 /boot 分区
```
# cp uxtechno_logo.xpm.gz /boot/grub/
```
**步骤 5** 在 /boot/grub/grub.conf 文件中修改 splashimage 参数如下,并保存文件。
```
splashimage=(hd0,0)/grub/uxtechno_logo.xpm
```
**步骤 6** 最后,使用 reboot 命令重启服务器。启动界面将显示使用 GUI 方式第 7 步中的图像。
-------------------------------
译者简介:
[GHLandy](http://GHLandy.com) —— 生活中所有欢乐与苦闷都应藏在心中,有些事儿注定无人知晓,自己也无从说起。
-------------------------------
via: https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/
作者:[MANMOHAN MIRKAR][a]
译者:[GHLandy](https://github.com/GHLandy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/
[1]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/#what-we-need-to-proceed
[2]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/#change-the-grub-splash-screen-by-using-the-gui
[3]:https://www.howtoforge.com/tutorial/how-to-change-the-linux-splash-screen/#change-the-grub-splash-screennbspon-the-command-line
[4]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/scale.JPG
[5]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/index.JPG
[6]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/save.JPG
[7]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/compress.JPG
[8]:https://www.howtoforge.com/images/how_to_change_the_linux_splash_screen/big/Uxtecho_splash.JPG