grub2 背景图片设置

本帖转自──http://blogs.koolwal.net/2008/12/16/how-to-grub2-and-grub-pc-installing-splash-images/

Purpose: This post is a follow-up of my previous post which had explained how to install GRUB splash images with “grub” package (legacy one). Couple of people requested to show how to do this with the new version of GRUB i.e. GRUB2 or GRUB-PC . So in this article we will learn how to install GRUB splash images with GRUB2. Actually GRUB2 is just a transitional package, the real package name is GRUB-PC.

Assumptions: Before going ahead, I would like to state some assumptions that I have made. To get the best results it would be nice if you also have the exact same setup.

  • Debian Lenny installed
  • You were able to install the GRUB splash images for the previous (old) version of GRUB as explained in my last post.
  • GRUB – older version
  • GRUB2 and GRUB-PC – New version of GRUB

Step 1: Install GRUB2

We first need to install GRUB2 package giving the following command:

# apt-get update
# apt-get install grub2

During installation you will be given some warning, just say “Ok” and let the installation continue. Once the installation is complete go to Step 2.

Step 2: Install Splash Images for GRUB2 package

#apt-get update
#apt-get install grub2-splashimages

Step 3: Check out the new images installed

The new GRUB2 splash images are installed at:

# ls /usr/share/images/grub/

Output:

050817-N-3488C-028.tga                  Glasses_800_edit.tga
2006-02-15_Piping.tga                   Hortensia-1.tga
Aesculus_hippocastanum_fruit.tga        Lake_mapourika_NZ.tga
Apollo_17_The_Last_Moon_Shot_Edit1.tga  Moraine_Lake_17092005.tga
B-1B_over_the_pacific_ocean.tga         Plasma-lamp.tga
BonsaiTridentMaple.tga                  Sparkler.tga
Flower_jtca001.tga                      TulipStair_QueensHouse_Greenwich.tga
Fly-Angel.tga                           Windbuchencom.tga#

Step 4: Reboot and some installation notes

Now if you reboot your computer you should still get your old grub screen as follow:

 

Screen Showing GRUB2 Menu

Screen Showing GRUB2 Menu

As you can see that installing GRUB2 does not overwrite your current GRUB installation which is very good. This will allow you to test the GRUB2 before you can overwrite your older GRUB installation.

From the above image, the first line says “Chainload into GRUB 2″ which basically means that you can launch GRUB2 now and see if your system boots fine. At this point of time you can also boot into your system in the regular way by selecting the kernel listed as seen above. If you do that then you will be using your older GRUB installation.

Also once you are satisfied that GRUB2 works then you can select the second option, “upgrade-from-grub-legacy “, as show in the image above and you will be overwriting GRUB.

 

Step 5:  Select “Chainload into GRUB 2″

Once you select this, you should get the following screen:

GRUB2 Default Image

Congratulations! If you are able to see something like above, then your GRUB2 installation has been successful and also with this your default GRUB2 splash image is also installed.

Step 6: Change the GRUB2 splash image

Now we will see how we can change the default GRUB2 splash image. First select the image file that you want to install from the following locations:
/usr/share/images/desktop-base/
/usr/share/images/grub/

For this example, I have selected “Plasma-lamp.tga” from /usr/share/images/grub/.
Now edit the file following file:
# nano /etc/grub.d/05_debian_theme

and change the following line from:

for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga}
to
for i in {/boot/grub,/usr/share/images/desktop-base,/usr/share/images/grub}/Plasma-lamp.{png,tga} and save the file.

This basically tells GRUB2 to look for image name “Plasma-lamp” in the locations:
/boot/grub
/usr/share/images/desktop-base
/usr/share/images/grub

Now you need to regenerate the grub.cfg file by giving the following command:
# update-grub
Updating /boot/grub/grub.cfg ...
Found Debian background: Plasma-lamp.tga
Found linux image: /boot/vmlinuz-2.6.26-rt1-rt
Found initrd image: /boot/initrd.img-2.6.26-rt1-rt
Found linux image: /boot/vmlinuz-2.6.26-1-686
Found initrd image: /boot/initrd.img-2.6.26-1-686
Found linux image: /boot/vmlinuz-2.6.25-2-686
Found initrd image: /boot/initrd.img-2.6.25-2-686
done
#

Step 7: Reboot the system
After rebooting again select the option “Chainload into GRUB 2″, and now you should see your new GRUB2 splash image like this:
GRUB2 Plasma Splash Image
Enjoy your new shiny sparkling GRUB2 splash image.

Step 8:  Further customization
You can further customize the text color and all by editing the file:
/etc/grub.d/05_debian_theme

That’s it. We are done here.

Additional Notes:

  • The file /boot/grub/grub.cfg is equivalent of /boot/grub/menu.lst of the old GRUB. This file is self-generated by the command “update-grub” and upgrade-grub2″. Both these command do the same thing.
  • Do not select the option “upgrade-from-grub-legacy” before verifying that the GRUB2 loads your OS properly.
  • You can create your own customized GRUB2 splash screen by using the script “commons2tga.pl” located at usrsharedocgrub2-splashimages

As usual, please leave a comment/feedback , if you have any. Nothing encourages a blogger more than comments/feedback.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值