« 2006/06, Vol. 125 PChome Magazine | 首頁 | 利用 GRUB4DOS 安裝 Linux »

2006年06月16日

用 bootsplash 妝點 Linux Console

調整 Linux Console 解析度

GRUB:

vi /boot/grub/menu.lst

在 kernel ... 這行最後加入 vga=791
(791 表示解析度為1024x768, 詳後述)

LILO:

vi /etc/lilo.conf

在設定項目中加入 vga=791 即可

16 進位表示:

pixel 640x480 800x600 1024x768 1280x1024
text 80x30 100x37 128x48 160x64
256 0x301 0x303 0x305 0x307
32k 0x310 0x313 0x316 0x319
64k 0x311 0x314 0x317 0x31A
16M 0x312 0x315 0x318 0x31B

10 進位表示:

pixel 640x480 800x600 1024x768 1280x1024
text 80x30 100x37 128x48 160x64
256 769 771 773 775
32k 784 787 790 793
64k 785 788 791 794
16M 786 789 792 795

References:

在 Linux Console 加入底圖

需求套件: bootsplash (http://www.bootsplash.de/http://www.bootsplash.org/)

判斷 kernel 是否已內建 bootsplash:

ls -l /proc/splash → 若 /proc/splash 存在, 表示 kernel 已內建 bootsplash, 可直接在 console 加入底圖. (若無 splash 程式, 需先安裝 bootsplash 工具組)

準備材料:

  1. Linux Kernel Source
  2. 適用 kernel 版本的 bootsplash patch 檔 (.diff)
  3. bootsplash 工具組 (Utilities) *註
  4. bootsplash 佈景主題 (Theme Packages)

*註: bootsplash-utils 分有各種版本, 可從 bootsplash patch 檔名辨別適用的版本. 如: bootsplash-3.1.6-2.6.15.diff 為 kernel 2.6.15 適用的 patch file, 應搭配的 bootsplash-utils 版本為 3.1 版

以 FC3 安裝 kernel 2.6.15 為例:

更新 Linux kernel

cd /usr/src
wget http://www.bootsplash.de/files/bootsplash-3.1.6-2.6.15.diff
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.15.tar.bz2
tar jxf linux-2.6.15.tar.bz2
ln -s linux-2.6.15 linux
cd linux
patch -p 1 < ../bootsplash-3.1.6-2.6.15.diff
make oldconfig
make menuconfig

[*] Code maturity / Prompt
[*] Device drivers / Block devices / Loopback device support
[*] Device drivers / Block devices / RAM disk support
[*] Device drivers / Block devices / (4096) Default RAM disk size
[*] Device drivers / Block devices / Initial RAM disk (initrd) support
[*] Device drivers / Graphics / VESA VGA graphics support
[*] Device drivers / Graphics / Console / Framebuffer Console support
[  ] Device drivers / Graphics / Logo / Bootup logo
[*] Device drivers / Graphics / Bootsplash / Bootup splash screen

make
make modules_install
make install

安裝 bootsplash 工具組 (以下僅安裝 splash 程式)

cd /usr/local/src
wget http://www.bootsplash.de/files/splashutils/bootsplash-3.1.tar.bz2
tar -jxf bootsplash-3.1.tar.bz2
cd bootsplash-3.1/Utilities
make splash
chmod +x splash
cp splash /sbin

安裝 bootsplash 佈景主題內容

cd /usr/local/src
wget ftp://ftp.openbios.org/pub/bootsplash/themes/Theme-Linux.tar.bz2
tar -jxf Theme-Linux.tar.bz2
mkdir -p /etc/bootsplash/themes
cp -a Linux /etc/bootsplash/themes

修改 GRUB / LILO 設定 terminal console 為 1024x768

vi /boot/grub/menu.lst

kernel /boot/vmlinuz-2.6.15 root=/dev/hda1 ro vga=791

vi /etc/lilo.conf

image=/boot/vmlinuz
    label="linux"
    ...
    vga=791

讓每個 TTY 都有背景圖

vi /etc/rc.d/rc.local

if [ -e /proc/splash ]; then
    /sbin/splash -s -u 0 /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg
    /sbin/splash -s -u 1 /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg
    /sbin/splash -s -u 2 /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg
    /sbin/splash -s -u 3 /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg
    /sbin/splash -s -u 4 /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg
    /sbin/splash -s -u 5 /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg
fi

ps. -u 0 為 tty1, -u 1 為 tty2, 餘類推. console 操作途中想停用背景圖者, 指令不含 config 路徑即可: splash -s -u 0 (tty1 停用背景圖)

自訂開機畫面

Fedora Core 3 & 5 (失敗)

方法一、
mkinitrd -f /boot/initrd.gz 2.6.15
gunzip /boot/initrd.gz
splash -s -f /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg >> /boot/initrd
(若不解壓縮 initrd 會出現 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block 的錯誤)

方法二、
dd if=/dev/zero of=/boot/initrd bs=1M count=4

mke2fs -F -m 0 -b 1024 /boot/initrd
splash -s -f /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg >> /boot/initrd
mkdir /initrd

vi /boot/grub/menu.lst

kernel /boot/vmlinuz-2.6.15.6 root=/dev/hda1 ro vga=791 splash=silent
initrd /boot/initrd

ps. 以上開機程序都停在執行 init 之前 (init 無法被帶起)

Mandrake 10.0 (成功) - 原本就內建 bootsplash, 只需另外安裝 bootsplash themes 即可

mkinitrd -f /boot/initrd.splash `uname -r`
splash -s -f /etc/bootsplash/themes/current/config/bootsplash-1024x768.cfg >> /boot/initrd.splash

vi /etc/lilo.conf

image=/boot/vmlinuz
    label="linux"
    ...
    initrd=/boot/initrd.splash
    append="splash=silent"
    vga=791

ps. 製作新的 initrd 後, 就算沒有更動 lilo.conf 也要再執行一次 lilo 才能套用變更

SuSE 10.0 (完美) - bootsplash 原本就是 SuSE 的產物, 當然是完美的結合

vi /etc/sysconfig/bootsplash

THEME="theme_name" #/etc/bootsplash/themes/theme_name
SPLASH="yes"

mkinitrd

Ubuntu Linux

Nicky's blog » 修改ubuntu的3个画面

一个新手的blog :: 美化动力120% 对breezy再美化


參考資料:

Posted by Jamyy at 2006年06月16日 10:32

Trackback Pings

TrackBack URL for this entry:
http://cha.homeip.net/cgi-bin/mt/mt-tb.cgi/206