Chinaunix首页 | 论坛 | 博客
  • 博客访问: 66258
  • 博文数量: 7
  • 博客积分: 450
  • 博客等级: 下士
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-10 10:02
文章分类
文章存档

2010年(3)

2009年(1)

2008年(3)

我的朋友

分类: LINUX

2010-11-30 11:08:36

如果您需要转载,请写明出处!谢谢你的配合。
1. 安装Fedora14的Kernel Source:
 [安装Kernel Headers]
 1.1 在Fedora软件仓库和Update软件仓库中在线查找同时确保他们与你的系统相匹配,使用uname命令:
  #uname -rm
   2.6.35.6-45.fc14.i686 i686
 1.2 如果你已经升级过你的kernel(使用yum),那么建议你使用yum来安装这个软件包:
  #yum install kernel-PAE-devel
 [安装Kernel Source]
 1.3 在开始安装之前,必须安装两个必要的软件包
  #yum install yum-utils rpmdevtools
 1.4 设置Kernel Source下载和解压路径,下列命令在当前的用户目录下生成了rpmbuild目录:
  #rpmdev-setuptree
 1.5 下载内核源码
  #yumdownloader --source kernel      (source选项前是两个-)
 1.6 安装依赖性软件
  #yum-builddep kernel-2.6.35.6-48.fc14.src.rpm
 1.7 安装kernel-2.6.35.6-48.fc14.src.rpm包
  #rpm -ivh kernel-2.6.35.6-48.fc14.src.rpm
         1:kernel                  ########################################### [100%]
            在安装的过程中,如果出现如下错误:
  warning: user mockbuild does not exist – using root
     新建一个组和一个帐号就好了。
  #groupadd mockbuild
  #useradd mockbuild -g mockbuild
     然后再重新安装
 1.8 进入SPECS目录
     #cd ~/rpmbuild/SPECS
     #rpmbuild -bp --target=$(uname -m) kernel.spec      (target选项前是两个-)
 1.9 Kernel Source 目录说明:
     1.9.1 linux-2.6.32.i686/arch --- 此目录包含了Fedora 补丁和更新的标准kernel.org内核源码。系统架构与uname
-m的输出相匹配,一般来说是i686 ,如果你想,你可以让–target=选项使用noarch参数。
     1.9.2 vanilla-2.6.32 --- 这里只包含标准的kernel.org的kernel(没有补丁和更新)。
2. 编译Fedora14的Kernel Source:
 2.1 给Kernel Source打补丁:
     #yum install ncurses-devel
 2.2 下载bootsplash-3.1.6a-2.6.35.diff,并给Kernel Source打上补丁:
     #cd /root/rpmbuild/BUILD/kernel-2.6.35.fc14/linux-2.6.35.i686
     #patch -p1 <../bootsplash-3.1.6a-2.6.35.diff
 2.3 配置kernel参数:
     #make menuconfig
     参数配置如下:
==================================================================================================
            Device Drivers
  Graphics support
   <*> Support for frame buffer devices
     [*] VESA VGA graphics support
  Console display driver support
   <*> Framebuffer Console support
  Bootsplash configuration
    [*] Bootup splash screen
==================================================================================================
     #make && make modules_install && make install
3. 编译bootsplash-3.1.tar.bz2
 3.1 解压缩:
     #tar jxvf bootsplash-3.1.tar.bz2
     #cd bootsplash-3.1/Utilities
 3.2 安装其他库:
     #yum install freetype-devel libmng libmng-devel
 3.3 修改Makefile,下面的Makefil是我已经成功编译好的,仅供参考:
==================================================================================================
  # Makefile for bootsplash utilities.
  # written by Stefan Reinauer <> in 2003
  #
  CC       = gcc
  STRIP  = strip
  # Triggering lib64 path from spec file.
  PREFIX   ?= /usr
  LIB      ?= lib
  LIBDIR   = $(PREFIX)/$(LIB)
  PROGRAMS        = splash splashpbm fbresolution fbtruetype fbmngplay
  PROGRAMS_STATIC = fbtruetype.static fbmngplay.static
  OBJECTS_FT2  = fbtruetype.o fbtruetype-messages.o console.o ttf.o luxisri.o
  OBJECTS_MNG  = fbmngplay.o fbmngplay-messages.o mng.o console.o
  LDFLAGS  =  -L$(LIBDIR)
  LIBSS_FT2    = $(LIBDIR)/libfreetype.a $(LIBDIR)/libz.a -lm
  LIBSD_FT2    = -lfreetype -lm -lz
  LIBSS_MNG    = $(LIBDIR)/libmng-mini.a $(LIBDIR)/libz.a -lm
  LIBSD_MNG    = -lmng -lz -lm -ljpeg
  CFLAGS   = -Os -Wall -I/usr/include/freetype2
  LINKS    = $(CC) $(CFLAGS) $(LDFLAGS) -static -o $@
  LINKD    = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
  all: $(PROGRAMS) strip
  .SUFFIXES: .c .o
  mostlyclean:
   -rm -f *.o core *~
  clean: mostlyclean
   -rm -f $(PROGRAMS) $(PROGRAMS_STATIC)
  fbtruetype: $(OBJECTS_FT2)
   @rm -f fbtruetype
   $(LINKD) $(LDFLAGS) $(OBJECTS_FT2) $(LIBSD_FT2)
  fbtruetype.static: $(OBJECTS_FT2)
   @rm -f fbtruetype.static
   $(LINKS) $(LDFLAGS) $(OBJECTS_FT2) $(LIBSS_FT2)
  fbmngplay: $(OBJECTS_MNG)
   @rm -f fbmngplay
   $(LINKD) $(LDFLAGS) $(OBJECTS_MNG) $(LIBSD_MNG)
  fbmngplay.static: $(OBJECTS_MNG)
   @rm -f fbmngplay.static
   $(LINKS) $(LDFLAGS) $(OBJECTS_MNG) $(LIBSS_MNG)
  strip: $(PROGRAMS)
   $(STRIP) -s $(PROGRAMS)
  .PHONY: mostlyclean clean fbtruetype fbtruetype.static all strip
==================================================================================================
 3.4 修改mng.c,因为文件太长,我只将我修改过的地方给大家标注起来:
==================================================================================================
  原文: input = *((unsigned short *) background)++;
  改后: background = (unsigned short *)background + 1;
                        input = *background;
     --------------------------------------------------------------------------------------
  原文:  *((unsigned short *) dest)++ = output;
  改后:  dest = (unsigned short *)dest + 1; *dest = output;
==================================================================================================
 3.5 编译bootsplash:
  #make
  #cp fbresolution fbmngplay fbtruetype splash splashpbm /sbin
 3.6 生成主题数据文件:
  #mkdir -p /etc/bootsplash/themes
  #tar jxvf Theme-Linux.tar.bz2 -C /etc/bootsplash/themes/
  #splash -s –f /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg > /boot/bootsplash
  #cd ../Scripts/
  #cp * /etc/rc.d
 3.7 制作initrd:
  #mkdir test
  #cd test
  #cp /boot/initramfs-2.6.35.6.img ../initrd.gz
  #gzip -d ../initrd.gz
  #cpio -i <../initrd
  #cp /boot/bootsplash .
  #find . | cpio -c -o > ../initramfs-2.6.35.6-bootsplash.img
 3.8 修改grub.conf文件,我的grub.conf新增了下面内容:
==================================================================================================
  title Fedora (2.6.35.6)
         root (hd0,0)
         kernel /vmlinuz-2.6.35.6 ro root=/dev/mapper/vg_allding16gd-lv_root rd_LVM_LV=vg_allding16gd/lv_root
  rd_LVM_LV=vg_allding16gd/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb- 
 sun16 KEYTABLE=us rhgb quiet
         initrd /initramfs-2.6.35.6-bootsplash.img
==================================================================================================
 3.9 修改/etc/rc.d/splash.sh:
================================================================================================== 
  原文: THEME="No bootsplash theme selected" 
  改后:  THEME="Linux"
==================================================================================================
 3.10 修改/etc/rc.d/rc,我的rc文件:
==================================================================================================
#! /bin/bash
#
# rc            This file is responsible for starting/stopping
#               services when the runlevel changes.
#
# Original Author:      
#               Miquel van Smoorenburg, <>
#
set -m
# check a file to be a correct runlevel script
check_runlevel ()
{
 # Check if the file exists at all.
 [ -x "$1" ] || return 1
 is_ignored_file "$1" && return 1
 return 0
}
# added for bootsplash --- begin
export progress=0
export sscripts=0
export kscripts=0
# added for bootsplash --- end
for item in /etc/rc.d/rc3.d/S*;do
    sscripts=$(($sscripts + 1))
done
for item in /etc/rc.d/rc3.d/K*;do
    kscripts=$(($sscripts + 1))
done
# added for bootsplash --- end

# Now find out what the current and what the previous runlevel are.
argv1="$1"
set $(/sbin/runlevel)
runlevel=$2
previous=$1
export runlevel previous
. /etc/init.d/functions
export CONSOLETYPE
do_confirm="no"
if [ -f /var/run/confirm ]; then
 do_confirm="yes"
fi
UPSTART=
[ -x /sbin/initctl ] && UPSTART=yes
# See if we want to be in user confirmation mode
if [ "$previous" = "N" ]; then
 if [ "$do_confirm" = "yes" ]; then
  echo $"Entering interactive startup"
 else
  echo $"Entering non-interactive startup"
 fi
fi
# Get first argument. Set new runlevel to this argument.
[ -n "$argv1" ] && runlevel="$argv1"
# Is there an rc directory for this new runlevel?
[ -d /etc/rc$runlevel.d ] || exit 0
# Set language, vc settings once to avoid doing it for every init script
# through functions
if [ -z "${NOLOCALE:-}" ] && [ -f /etc/sysconfig/i18n ] ; then
  . /etc/profile.d/lang.sh 2>/dev/null
  export LANGSH_SOURCED=1
fi
# First, run the KILL scripts.
for i in /etc/rc$runlevel.d/K* ; do
 # Check if the subsystem is already up.
 subsys=${i#/etc/rc$runlevel.d/K??}
 [ -f /var/lock/subsys/$subsys ] || [ -f /var/lock/subsys/$subsys.init ] || continue
 check_runlevel "$i" || continue
 # Bring the subsystem down.
 [ -n "$UPSTART" ] && initctl emit --quiet stopping JOB=$subsys
 $i stop
 [ -n "$UPSTART" ] && initctl emit --quiet stopped JOB=$subsys
# added for bootsplash --- begin
progress=$(($progress+ 1))
/etc/rc.d/splash.sh 2>/dev/nul
# added for bootsplash --- end
done
# Now run the START scripts.
for i in /etc/rc$runlevel.d/S* ; do
# added for bootsplash --- begin
progress=$(($progress+ 1))
/etc/rc.d/splash.sh 2>/dev/nul
# added for bootsplash --- end
 # Check if the subsystem is already up.
 subsys=${i#/etc/rc$runlevel.d/S??}
 [ -f /var/lock/subsys/$subsys ] && continue
 [ -f /var/lock/subsys/$subsys.init ] && continue
 check_runlevel "$i" || continue
     
 # If we're in confirmation mode, get user confirmation
 if [ "$do_confirm" = "yes" ]; then
  confirm $subsys
  rc=$?
  if [ "$rc" = "1" ]; then
   continue
  elif [ "$rc" = "2" ]; then
   do_confirm="no"
  fi
 fi
  1.  update_boot_stage "$subsys"
     # Bring the subsystem up.
     [ -n "$UPSTART" ] && initctl emit --quiet starting JOB=$subsys
     if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then
      export LC_ALL=C
      exec $i start
     fi
     $i start
     [ -n "$UPSTART" ] && initctl emit --quiet started JOB=$subsys
    done
    [ "$do_confirm" = "yes" ] && rm -f /var/run/confirm
    exit 0
    ==================================================================================================
     3.10 重启系统:
          #reboot
    注意事项:
    1. 如果需要更换更换底图,请将你的新图片用windows自带的“画图”工具打开,然后拷贝复制,然后再用同样的方式打开你需要替换的bootsplash1024_768.jpg这张图片,然后粘贴过去。因为用PS做的图片,在jpg格式上,与主题中的图片有差异。所以,这点请大家注意了!
    2. 对于bootsplash制作原理,概括起来就是:先编译一个可以在framebuffer上打开bootsplash的内核,然后,制作一个ramdisk,这个ramdisk是系统用来引导用的。
    3. 在用splash制作/boot/bootsplash文件时,请用vim打开确认一下,因为有时可能splash生成的是一个空文件。
阅读(3052) | 评论(1) | 转发(0) |
0

上一篇:日记 [2010年10月31日]

下一篇:没有了

给主人留下些什么吧!~~

chinaunix网友2010-12-01 14:59:26

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com