`
java-mans
  • 浏览: 11414992 次
文章分类
社区版块
存档分类
最新评论

为GRUB2添加背景图片

 
阅读更多

1.自己弄一张自己喜欢的,然后将它转化为xx.tga格式的.(只修改后缀名是没有用的,必须是要真正是tga格式的(建议使用tga),其他的我测试过会有问题,不知道是不是自己修改的问题还是其他问题,总之我的试过不行), 并且大小必须合乎你机子所支持的大小(可以在电脑启动时,进入grub命令行,输入:vebinfo查看自己的电脑所支持的分辨率.

2.将修改后的图片复制到/usr/share/images/grub/xx.tga, 最好顺便也复制一张到/boot/grub/目录下.

3.修改/etc/grub.d/05_debian_theme文件

#!/bin/bash -e

source /usr/lib/grub/grub-mkconfig_lib

# this allows desktop-base to override our settings
f=/usr/share/desktop-base/grub_background.sh
if test -e ${f} ; then
  source ${f}
else
  #WALLPAPER="/usr/share/images/desktop-base/moreblue-orbit-grub.png"
 WALLPAPER="/usr/share/images/grub/yangzhiyong.tga"
  COLOR_NORMAL="white/black"
  COLOR_HIGHLIGHT="green/brown"
fi

set_mono_theme()
{
  cat << EOF
set menu_color_normal=white/black
set menu_color_highlight=green/brown
EOF
}

# check for usable backgrounds
use_bg=false
if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then
  for i in /boot/grub/`basename ${WALLPAPER}` ${WALLPAPER} ; do
    if is_path_readable_by_grub $i ; then 
      bg=$i
      case ${bg} in
        *.png)		reader=png ;;
        *.tga)		reader=tga ;;
        *.jpg|*.jpeg)	reader=jpeg ;;
      esac
      if test -e /boot/grub/${reader}.mod ; then
        echo "Found background image: `basename ${bg}`" >&2
        use_bg=true
        break
      fi
    fi
  done
fi

# set the background if possible
if ${use_bg} ; then
  prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
  cat << EOF
insmod ${reader}
if background_image `make_system_path_relative_to_its_root ${bg}` ; then
  set color_normal=${COLOR_NORMAL}
  set color_highlight=${COLOR_HIGHLIGHT}
else
EOF
fi

# otherwise, set a monochromatic theme for Ubuntu
if ${use_bg} ; then
  set_mono_theme | sed -e "s/^/  /g"
  echo "fi"
else
  set_mono_theme
fi
将上面那个
WALLPAPER="/usr/share/images/grub/yangzhiyong.tga"中红色部分改为你刚才复制进入/usr/share/images/目录下的图片的文件名.

4.最好记得要update-grub..

OK

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics