Projects - Rebuilding Kernel
The steps and notices of rebuilding kernel for the Slackware Linux on my computer (including bootsplash and UNICON).
It's different to rebuild 2.4.x and 2.6.x kernel, but they have the same prerequisite knowledge:
If you are familiar with them, you will feel easy on this section, but if not, you will learn more than here.
UNICON is a CJK (Chinese/Japanese/Korean) Linux console input and display system. It can support console virtual terminals, GPM mouse, keyboard, and almost all video devices using the kernel frame buffer. It supports multiple language fonts with a font manager so each virtual console can display a different font and input method. UNICON also can display IBM table characters mixed with double byte language encodings.
And I only use UNICON for Chinese display in the console of my Slackware Linux.
Bootsplash is the graphical boot process for the linux kernel although it is not yet a part of the official kernel. It is, however included in several major distributions.
I really enter into the graphical world of Linux using bootsplash.
Notice: the version of the UNICON and bootsplash must be correspond with that of the Linux kernel.
Actually the bootsplash and the UNICON are patch files for Linux kernel, so we must patch them into Linux official kernel before rebuilding it.
#cp /path/to/linux-2.6.15.tar.bz2 /usr/src/ #cd /usr/src/ #tar xvfj linux-2.6.15.tar.bz2 #rm linux #ln -sf linux-2.6.15 linux
#cp /path/to/bootsplash-3.1.6-2.6.15.diff /usr/src/ #cd /usr/src/linux/ #patch -p1 < ../bootsplash-3.1.6-2.6.15.diff patching file drivers/char/keyboard.c patching file drivers/char/n_tty.c patching file drivers/char/vt.c patching file drivers/video/Kconfig patching file drivers/video/Makefile patching file drivers/video/bootsplash/Kconfig patching file drivers/video/bootsplash/Makefile patching file drivers/video/bootsplash/bootsplash.c patching file drivers/video/bootsplash/bootsplash.h patching file drivers/video/bootsplash/decode-jpg.c patching file drivers/video/bootsplash/decode-jpg.h patching file drivers/video/bootsplash/render.c patching file drivers/video/console/bitblit.c patching file drivers/video/console/fbcon.c patching file drivers/video/console/fbcon.h patching file drivers/video/vesafb.c patching file include/linux/console_struct.h patching file include/linux/fb.h
#cp /path/to/vd_unicon-kernel-fonts-20040205.patch.bz2 /usr/src/ #cd /usr/src/ #bunzip2 vd_unicon-kernel-fonts-20040205.patch.bz2 #cd /usr/src/linux/ #patch -p1 < ../vd_unicon-kernel-fonts-20040205.patch patching file drivers/video/unicon/font_big5_16.h patching file drivers/video/unicon/font_eucjp16.h patching file drivers/video/unicon/font_gb16.h patching file drivers/video/unicon/font_gbk16.h patching file drivers/video/unicon/font_jis16.h patching file drivers/video/unicon/font_kscm16.h #cp /path/to/vd_unicon-kernel-20060103-2.6.15.patch /usr/src/ #cd /usr/src/linux/ #patch -p1 < ../vd_unicon-kernel-20060103-2.6.15.patch patching file drivers/char/consolemap.c patching file drivers/char/selection.c patching file drivers/char/vt.c Hunk #26 succeeded at 3484 (offset 25 lines). patching file drivers/video/Kconfig patching file drivers/video/Makefile Hunk #1 succeeded at 9 with fuzz 2 (offset 1 line). patching file drivers/video/console/bitblit.c Hunk #1 FAILED at 18. Hunk #2 succeeded at 228 (offset 24 lines). Hunk #3 succeeded at 453 (offset 7 lines). Hunk #4 succeeded at 487 (offset 24 lines). Hunk #5 succeeded at 634 (offset 15 lines). Hunk #6 succeeded at 665 (offset 24 lines). 1 out of 6 hunks FAILED -- saving rejects to file drivers/video/console/bitblit.c.rej patching file drivers/video/console/fbcon.c Hunk #1 FAILED at 106. Hunk #2 succeeded at 123 (offset 3 lines). Hunk #4 succeeded at 960 (offset 7 lines). Hunk #5 succeeded at 1240 (offset 10 lines). Hunk #6 succeeded at 1257 (offset 7 lines). Hunk #7 succeeded at 1524 (offset 10 lines). Hunk #8 succeeded at 1572 (offset 7 lines). Hunk #9 succeeded at 1595 (offset 10 lines). Hunk #10 succeeded at 1663 (offset 7 lines). Hunk #11 succeeded at 1677 (offset 10 lines). Hunk #12 succeeded at 1692 (offset 7 lines). Hunk #13 succeeded at 1711 (offset 10 lines). Hunk #14 succeeded at 1740 (offset 7 lines). Hunk #15 succeeded at 1868 (offset 14 lines). Hunk #16 succeeded at 1956 (offset 11 lines). Hunk #17 succeeded at 2645 (offset 41 lines). Hunk #18 succeeded at 2736 (offset 11 lines). Hunk #19 succeeded at 3171 (offset 41 lines). 1 out of 19 hunks FAILED -- saving rejects to file drivers/video/console/fbcon.c.rej patching file drivers/video/console/unicon.c patching file drivers/video/unicon/COPYING patching file drivers/video/unicon/CREDITS patching file drivers/video/unicon/ChangeLog.TL patching file drivers/video/unicon/Kconfig patching file drivers/video/unicon/Makefile patching file drivers/video/unicon/encode-big5.c patching file drivers/video/unicon/encode-eucjp.c patching file drivers/video/unicon/encode-gb.c patching file drivers/video/unicon/encode-gbk.c patching file drivers/video/unicon/encode-jis.c patching file drivers/video/unicon/encode-kscm.c patching file drivers/video/unicon/encode-sjis.c patching file drivers/video/unicon/unikey.h patching file drivers/video/unicon/xl_fm.c patching file drivers/video/unicon/xl_funckeys.h patching file drivers/video/unicon/xl_hzfb.c patching file drivers/video/unicon/xl_hzfb.h patching file drivers/video/unicon/xl_key.h patching file drivers/video/unicon/xl_keyhooks.c patching file drivers/video/unicon/xl_keyhooks.h patching file drivers/video/unicon/xl_keymasks.c patching file drivers/video/unicon/xl_unikey.c patching file include/linux/fb_doublebyte.hYou must notice that there are two errors here happens as says:
1 out of 6 hunks FAILED -- saving rejects to file drivers/video/console/bitblit.c.rej 1 out of 19 hunks FAILED -- saving rejects to file drivers/video/console/fbcon.c.rejThat's because we have patched bootsplash which also modified the two files:
drivers/video/console/bitblit.c drivers/video/console/fbcon.cSo we must modify these two files manually as follows (look through the xxx.c.rej file for reference):
18 #include <linux/console.h> 19 #include <asm/types.h> 20 #include "fbcon.h" 21 #ifdef CONFIG_BOOTSPLASH 22 #include "../bootsplash/bootsplash.h" 23 #endif 24 25 /* 26 * Accelerated handlers. 27 */
to
18 #include <linux/console.h> 19 #include <asm/types.h> 20 #include "fbcon.h" 21 #ifdef CONFIG_BOOTSPLASH 22 #include "../bootsplash/bootsplash.h" 23 #endif 24 #ifdef CONFIG_UNICON 25 #include "unicon.c" 26 extern struct display fb_display[MAX_NR_CONSOLES]; 27 #endif 28 29 /* 30 * Accelerated handlers. 31 */
110 FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */ 111 }; 112 113 static struct display fb_display[MAX_NR_CONSOLES]; 114 signed char con2fb_map[MAX_NR_CONSOLES]; 115 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
to
110 FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */ 111 }; 112 113 #ifdef CONFIG_UNICON 114 struct display fb_display[MAX_NR_CONSOLES]; 115 #else 116 static struct display fb_display[MAX_NR_CONSOLES]; 117 #endif 118 119 signed char con2fb_map[MAX_NR_CONSOLES]; 120 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
#cd /usr/src/linux/ #make menuconfig
The most configuration options is decided by your own computer hardware and system, but in order to use bootsplash and UNICON we introduced above, the following options must be chosen:
Code maturity level options --->[*] Prompt for development and/or incomplete code/drivers
Processor type and features --->[*] MTRR (Memory Type Range Register) support
Device Drivers --->
Block devices --->
<*> Loopback device support
<*> RAM disk support
(4096) Default RAM disk size
[*] Initial RAM disk (initrd) support
Graphics support --->[*] Support for frame buffer devices
[*] VESA VGA graphics support
Console display driver support --->[*] Video mode selection support
<*> Framebuffer Console support
Bootsplash configuration --->[*] Bootup splash screen
and
Device Drivers --->Graphics support --->
[*] UNICON console support (EXPERIMENTAL)
<M> UNICON GB Font support
<M> UNICON GBK Font support
<M> UNICON Big5 Font support
<M> UNICON EUC-JP Font support
<M> UNICON JIS Font support
<M> UNICON Shift-JIS Font support
<M> UNICON KSCM Font support
then
#make #make modules_install #cp /usr/src/linux/arch/i386/boot/bzImage /boot/kernel-2.6.15 #cp /usr/src/linux/System.map /boot/System.map-2.6.15 #cp /usr/src/linux/.config /boot/config-2.6.15
#installpkg /path/to/bootsplash-10.2-i486-2kta.tgz
#touch /etc/rc.d/rc.splash #! /bin/bash # # Author: Danilo Levantesi <vagninu@virgilio.it> # # This is the script to enable the console background image. # Put it in your /etc/rc.d/ and add in /etc/rc.d/rc.local: # if [ -x /etc/rc.d/rc.splash ]; then # . /etc/rc.d/rc.splash # fi # test -f /proc/splash || exit 5 test -x /sbin/splash || exit 5 # sleep 5 echo "verbose" > /proc/splash splashv=`cat /proc/splash` res="${splashv##*, }" test "$splashv" != "$res" || exit 5 res="${res%)*}" echo "Setting up splash screens ($res)" # splcfg=/etc/bootsplash/themes/current/config/bootsplash-$res.cfg spljpg=/etc/bootsplash/themes/current/images/bootsplash-$res.jpg # # start_console : first fb console to display bootsplash # console numeber is zero based! # start_console = 1 Ctrl+Alt+F2 start_console=1 # end_console : last fb console to display bootsplash # end_console = 5 Ctrl+Alt+F6 end_console=5 # for ((unit=$start_console;unit<=$end_console;unit++)); do /sbin/splash -s -u "$unit" -n "$splcfg" done
# bootsplash for slackware if [ -x /etc/rc.d/rc.splash ]; then . /etc/rc.d/rc.splash fi
#/sbin/splash -s -f /etc/bootsplash/themes/current/config/bootsplash-800x600.cfg > /boot/initrd-800x600
#tar xvfz /path/to/unicon-tools-0.0.0.20050707.tar.gz #cd unicon-tools-0.0.0.20050707 #./configure && make && make install
# /etc/rc.d/rc.unicon: unicon script. # # FlyZhy Sat Dec 17 08:49:17 CST 2005 # # Put any local setup commands in here: /sbin/modprobe unikey /sbin/modprobe encode-gbk # /usr/bin/setfont -C /dev/tty1 -u /usr/local/lib/unicon/direct.uni /usr/bin/setfont -C /dev/tty2 -u /usr/local/lib/unicon/direct.uni /usr/bin/setfont -C /dev/tty3 -u /usr/local/lib/unicon/direct.uni /usr/bin/setfont -C /dev/tty4 -u /usr/local/lib/unicon/direct.uni /usr/bin/setfont -C /dev/tty5 -u /usr/local/lib/unicon/direct.uni /usr/bin/setfont -C /dev/tty6 -u /usr/local/lib/unicon/direct.uni # if [ -x /usr/local/bin/uniconctrl ]; then echo -ne "Starting Unicon 3.0.4 ...\n" echo -ne "Command:\n" echo -ne "/usr/local/bin/uniconctrl --gbk\n" /usr/local/bin/uniconctrl --gbk >/dev/null 2>&1 fi
# unicon for gbk if [ -x /etc/rc.d/rc.unicon ]; then . /etc/rc.d/rc.unicon fi
mknod
#mknod /dev/unikey c 10 202 #chmod 640 /dev/unikey
#/usr/local/bin/unicontrol --gbk
#cp /path/to/lilo.bmp /boot/
# LILO configuration file # generated by 'liloconfig' # # Start LILO global section boot = /dev/hda #message = /boot/boot_message.txt prompt timeout = 60 # Override dangerous defaults that rewrite the partition table: change-rules reset # VESA framebuffer console @ 800x600x256 #vga = 771 # Normal VGA console # vga = normal # VESA framebuffer console @ 1024x768x64k # vga=791 # VESA framebuffer console @ 1024x768x32k # vga=790 # VESA framebuffer console @ 1024x768x256 # vga=773 # VESA framebuffer console @ 800x600x64k # vga=788 # VESA framebuffer console @ 800x600x32k # vga=787 # VESA framebuffer console @ 800x600x256 # vga=771 # VESA framebuffer console @ 640x480x64k # vga=785 # VESA framebuffer console @ 640x480x32k # vga=784 # VESA framebuffer console @ 640x480x256 # vga=769 bitmap = /boot/lilo.bmp bmp-colors = 15,,0,5,,15 bmp-table = 59,5,1,18 bmp-timer = 66,28,6,8,0 # End LILO global section # Linux bootable partition config begins image = /boot/kernel-2.6.15 initrd = /boot/initrd-800x600 append = "video=vesafb:ywrap,mtrr splash=verbose" # append = "splash=silent" # switch to verbose pressing F2 key vga = 788 root = /dev/hda3 label = SLK2615 read-only # image = /boot/vmlinuz vga = 771 root = /dev/hda3 label = Linux read-only # Linux bootable partition config ends # Windows bootable partition config begins other = /dev/hda1 label = Windows table = /dev/hda # Windows bootable partition config ends
# open harddisk and optical disk dma # for testing to use the following command: # #hdparm -Tt /dev/hda # ATA33 : -X66 # ATA66 : -X68 # ATA100: -X69 # ATA133: -X70 echo -ne "DMA setting ...\n" /usr/sbin/hdparm -d1 -X69 -c3 -m16 /dev/hda /usr/sbin/hdparm -d1 -X66 -a8 -u1 /dev/hdd
# Enable NumLock echo -ne "Turning NUMLOCK off ...\n" for tty in /dev/tty[1-6]; do setleds -D +num < $tty done
# setterm -blank 0 echo -ne "Killing black screen ...\n" setterm -blank 0
#chmod +x /etc/rc.d/rc.bootsplash #chmod +x /etc/rc.d/rc.splash #chmod +x /etc/rc.d/rc.unicon #chmod +x /etc/rc.d/rc.local
#lilo #reboot
The command lilo will make the modification of /etc/lilo.conf be effect.
After rebooting and log in the console, to enjoy the display system for Chinese in console, type
#/usr/local/bin/unicontrol --gbk
I have modified some configuration of above to make the bootsplash be different from each tty. To do this, download some bootsplash themes on this page. And put them into /etc/bootsplash/themes/ and modify the file /etc/rc.d/rc.splash to
#! /bin/bash # # Author: Danilo Levantesi <vagninu@virgilio.it> # # This is the script to enable the console background image. # Put it in your /etc/rc.d/ and add in /etc/rc.d/rc.local: # if [ -x /etc/rc.d/rc.splash ]; then # . /etc/rc.d/rc.splash # fi # test -f /proc/splash || exit 5 test -x /sbin/splash || exit 5 # sleep 5 echo "verbose" > /proc/splash splashv=`cat /proc/splash` res="${splashv##*, }" test "$splashv" != "$res" || exit 5 res="${res%)*}" echo "Setting up splash screens ($res)" # splcfg=/etc/bootsplash/themes/current/config/bootsplash-$res.cfg spljpg=etc/bootsplash/themes/current/images/bootsplash-$res.jpg # # start_console : first fb console to display bootsplash # console numeber is zero based! # start_console = 1 Ctrl+Alt+F2 #start_console=1 # end_console : last fb console to display bootsplash # end_console = 5 Ctrl+Alt+F6 #end_console=5 # #for ((unit=$start_console;unit<=$end_console;unit++)); do # /sbin/splash -s -u "$unit" -n "$splcfg" #done # # bootsplash for vga=791 1024x768 #/sbin/splash -s -u 1 -n /etc/bootsplash/themes/SwirlPool/config/bootsplash-1024x768.cfg #/sbin/splash -s -u 2 -n /etc/bootsplash/themes/73labAllstar/config/bootsplash-1024x768.cfg #/sbin/splash -s -u 3 -n /etc/bootsplash/themes/WarmAqua/config/bootsplash-1024x768.cfg #/sbin/splash -s -u 4 -n /etc/bootsplash/themes/Frugalware/config/bootsplash-1024x768.cfg #/sbin/splash -s -u 5 -n /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg # # bootsplash for vga=788 800x600 # /sbin/splash -s -u 0 -n /etc/bootsplash/themes/dragon/config/bootsplash-800x600.cfg /sbin/splash -s -u 1 -n /etc/bootsplash/themes/compact/config/bootsplash-800x600.cfg /sbin/splash -s -u 2 -n /etc/bootsplash/themes/gnu/config/bootsplash-800x600.cfg /sbin/splash -s -u 3 -n /etc/bootsplash/themes/frugalware/config/bootsplash-800x600.cfg /sbin/splash -s -u 4 -n /etc/bootsplash/themes/slackware/config/bootsplash-800x600.cfg /sbin/splash -s -u 5 -n /etc/bootsplash/themes/darkblue/config/bootsplash-800x600.cfg
1. The symbol "+" stands for adding the following lines into the file in front of "+".