CSDN博客

img RobinsonNie

基于cdboot.note构建的可引导的linux之上,对根文件系统继续完善,使其支持X-System and Qt.

发表于2008/9/28 8:05:00  591人阅读

分类: 工作文档

+-----------------------------------------------------------------------------+
|                         第一部分 文档说明                                    |
+-----------------------------------------------------------------------------+
1 作用
##########
  基于cdboot.note构建的可引导的linux之上,对根文件系统继续
  完善,使其支持X-System and Qt.

2 版权
######
  版权: 聂大鹏(dozec)

3.2 作者
========
3.2.1 作者1
-----------
   姓名: 聂大鹏
   email: dozec@mail.csdn.net

4 产生时间
##########
  时间: 2007-2-9

5 版本
######
  版本: 0.1 版

6 修订过程
##########
6.1 第0.1版
===========


+-----------------------------------------------------------------------------+
|                         第二部分 文档正文                                    |
+-----------------------------------------------------------------------------+
1 实验环境
##########
工作站: RHEL4
        Linux version 2.6.14.7
        gcc version 3.4.6 20060404 (Red Hat 3.4.6-3))
        CPU: Pentium 1.7G
        Memory: 256MB
        装LFS根分区: /dev/hdd1 (hdd是一块4.3G硬盘)
           swap分区: /dev/hdd2
        /dev/hdd1               1         427     3429846   83  Linux
        /dev/hdd2             428         524      779152+  82  Linux swap

2 安装构建Xorg与QT所依赖的包
############################
2.0 设置根文件系统所在环境变量
==============================
# export $TROOTFS=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs


2.1 libpng
==========
[nie@hellokitty sysapp]$ tar -jxvf libpng-1.2.12.tar.bz2
[nie@hellokitty sysapp]$ cd libpng-1.2.12
/home/nie/dev_home/graduation_paper/cdboot
[nie@hellokitty libpng-1.2.12]$ ./configure --prefix=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/ && make
[nie@hellokitty libpng-1.2.12]$ make install
[nie@hellokitty libpng-1.2.12]$ install -v -m755 -d /home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/share/doc/libpng-1.2.12
[nie@hellokitty libpng-1.2.12]$ install -v -m644 README libpng.txt /home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/share/doc/libpng-1.2.12


2.2 freetype
============
[nie@hellokitty sysapp]$ tar jxvf freetype-2.1.10.tar.bz2
[nie@hellokitty sysapp]$ cd freetype-2.1.10
[nie@hellokitty freetype-2.1.10]$ sed -i -r 's:.*(#.*BYTE.*) .*:/1:' include/freetype/config/ftoption.h
[nie@hellokitty freetype-2.1.10]$ ./configure --prefix=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr && make
[nie@hellokitty freetype-2.1.10]$ make install


2.3 Expat
=========
[nie@hellokitty sysapp]$ tar -zxvf expat-2.0.0.tar.gz
[nie@hellokitty sysapp]$ cd expat-2.0.0
[nie@hellokitty expat-2.0.0]$ ./configure --prefix=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs && make && make install
[nie@hellokitty sysapp]$ tar zxvf fontconfig-2.3.2.tar.gz
[nie@hellokitty sysapp]$ cd fontconfig-2.3.2
[nie@hellokitty fontconfig-2.3.2]$ ./configure --prefix=$TROOTFS/usr --sysconfdir=$TROOTFS/etc --disable-docs --without-add-fonts --with-docdir=$TROOTFS/usr/share/doc/fontconfig-2.3.2 && make && make install

安装后会发现$TROOTFS/etc/mnt下多出一个font目录--配置文件目录.
默认字体位置是在/usr/share/font与~/.fonts--记录在fonts/fonts.conf


2.4 libjpeg
===========
[nie@hellokitty sysapp]$ tar -zxvf jpegsrc.v6b.tar.gz
[nie@hellokitty sysapp]$ cd jpeg-6b/
[nie@hellokitty jpeg-6b]$ ./configure --prefix=$TROOTFS/usr --enable-static --enable-shared && make && make install


2.5 lcms
========
[nie@hellokitty sysapp]$ tar -zxvf lcms-1.15.tar.gz
[nie@hellokitty sysapp]$ cd lcms-1.15
[nie@hellokitty lcms-1.15]$ ./configure --prefix=$TROOTFS/usr && make && make install


2.6 libmns
==========
[nie@hellokitty sysapp]$ tar -zxvf libmng-1.0.9.tar.gz
[nie@hellokitty sysapp]$ cd libmng-1.0.9
[nie@hellokitty libmng-1.0.9]$ cp makefiles/makefile.linux Makefile
[nie@hellokitty libmng-1.0.9]$ vi Makefile
# 修改安装路径到根文件系统
prefix=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/local

# 指明Zlib库位置, 用工作站的就可以
ZLIBLIB=/usr/lib
ZLIBINC=/usr/include

# 指明libjpeg位置, 由于我们装了, 就用我们的就OK
JPEGLIB=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/lib
JPEGINC=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/include

# 指明lcms位置
LCMSLIB=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/lib
LCMSINC=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/include

[nie@hellokitty libmng-1.0.9]$ make
[nie@hellokitty libmng-1.0.9]$ make prefix=$TROOTFS/usr install



3 安装Xorg
##########
[nie@hellokitty sysapp]$ tar -jxvf X11R6.9.0-src.tar.bz2
[nie@hellokitty sysapp]$ cd xc
[nie@hellokitty xc]$ patch -Np1 -i ../xorg-6.9.0-luit_race-1.patch
[nie@hellokitty xc]$ patch -Np1 -i ../xorg-6.9.0-security-4.patch
[nie@hellokitty xc]$ sed -i 's@/usr/X11R6@/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr/X11R6@' programs/luit/parser.h
[nie@hellokitty xc]$ sed -i '/^SUBDIRS =/s/ etc$//' programs/Xserver/Xprint/Imakefile
# pushd config/util &&  make -f Makefile.ini lndir
# popd
# mkdir ../xcbuild && cd ../xcbuild && ../xc/config/util/lndir ../xc

# cat > config/cf/host.def << "EOF"
/* Begin Xorg host.def file */
/* System Related Information. If you read and configure only one
* section then it should be this one. The Intel architecture defaults
* are set for a i686 and higher. Axp is for the Alpha architecture
* and Ppc is for the Power PC. AMD64 is for the Opteron processor.
* Note that there have been reports that the Ppc optimization line
* causes segmentation faults during build. If that happens, try
* building without the DefaultGcc2PpcOpt line. ***********/
/* #define DefaultGcc2i386Opt -O2 -fno-strength-reduce /
-fno-strict-aliasing -march=i686 */
/* #define DefaultGcc2AMD64Opt -O2 -fno-strength-reduce /
-fno-strict-aliasing */
/* #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 */
/* #define DefaultGcc2PpcOpt -O2 -mcpu=750 */
#define HasFreetype2 YES
#define HasFontconfig YES
#define HasExpat YES
#define HasLibpng YES
#define HasZlib YES
/* Uncomment the following define if you'd like
* xdm to use Linux-PAM
#define HasPam YES
*/
/*
* Which drivers to build. When building a static server, each of
* these will be included in it. When building the loadable server
* each of these modules will be built.
*
#define XF86CardDrivers mga glint nv tga s3virge sis rendition /
neomagic i740 tdfx savage /
cirrus vmware tseng trident chips apm /
GlideDriver fbdev i128 /
ati DevelDrivers ark /
cyrix siliconmotion vesa vga /
XF86OSCardDrivers XF86ExtraCardDrivers
*/
/*
* Select the XInput devices you want by uncommenting this.
*
#define XInputDrivers mouse keyboard acecad calcomp citron /
digitaledge dmc dynapro elographics /
microtouch mutouch penmount spaceorb /
summa wacom void magictouch aiptek
*/
/* Most installs will only need this */
#define XInputDrivers mouse keyboard
/* Xterm is no longer built by default */
#define BuildXterm YES
/* Disable building Xprint server and clients until we get them figured
* out but build Xprint libraries to allow precompiled binaries such as
* Acrobat Reader to run.
*/
#define XprtServer NO
#define BuildXprintClients NO
/* Uncomment the following define if you would prefer to install X into
* /usr or change it to any other location that you prefer.
* The GL related defines disable compatibility symlinks (the links
* are not needed when X is installed in /usr).
#define ProjectRoot /usr
#define LinkGLToUsrInclude NO
#define LinkGLToUsrLib NO
*/
/* End Xorg host.def file */
EOF


[nie@hellokitty xcbuild]$ cd ../xc
[nie@hellokitty xc]$  sed -i -e "s@^#include <linux/config.h>@/* & */@" `grep -lr linux/config.h *`
[nie@hellokitty xc]$  cd ../xcbuild
[nie@hellokitty xcbuild]$ ( make World 2>&1 | tee xorg-compile.log && exit $PIPESTATUS )
[nie@hellokitty xcbuild]$ make install DESTDIR=$TROOTFS

[nie@hellokitty xcbuild]$ ln -v -s ../X11R6/bin $TROOTFS/usr/bin/X11
[nie@hellokitty xcbuild]$ ln -v -s ../X11R6/lib/X11 $TROOTFS/usr/lib/X11
[nie@hellokitty xcbuild]$ ln -v -s ../X11R6/include/X11 $TROOTFS/usr/include/X11

指明fonts路径, Expat默认的字体搜索路径为/usr/share/fonts
[nie@hellokitty xcbuild]$ install -v -d -m755 $TROOTFS/usr/share/fonts
[nie@hellokitty xcbuild]$ ln -svn /usr/X11R6/lib/X11/fonts/TTF $TROOTFS/usr/share/fonts/X11-TTF





4 根文件系统库处理及减肥
########################
4.1
====
现在虽然把许多软件包安装到了根文件系统下, 但这些软件包缺乏必要的库做支持.
解决方法就是copy工作站当中的库文件到我们的根文件系统当中.

如下命令copy以前做过的LFS系统当中的库文件至根文件系统的lib目录当中.
[root@hellokitty my_rootfs]# cp -rf /mnt/lfs/lib/* $TROOTFS/lib


4.2
===
使用strip command/lib对所有命令及库去除符号.


5 Xorg配置
##########
5.1 Create a basic xorg config file
===================================
[root@ /]# export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib:/usr/lib/nALFS:/usr/X11R6/lib/modules:/usr/X11R6/lib/modules/drivers
[root@ /]# export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
[root@ /]# export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/X11R6/lib/pkgconfig
# cd ~
# Xorg -configure
生成xorg.conf.new

# mknod /dev/mice c 13 63
设备文件与xorg.conf.new当中的inputdevice要一致

# X -config ~/xorg.conf.new
进行测试: 出现灰色背景界面, 且有鼠标就成功.

# install -v -m755 -D ~/xorg.conf.new /etc/X11/xorg.conf

# cat > ~/.xinitrc << "EOF"
# Begin .xinitrc file
/var/bin/current/current
twm
EOF
 

5.2 启动x
=========
# mount /dev/cdrom /mnt/cdrom
# chroot /mnt/cdrom /bin/bash -l
# mount -t porc none /proc
# mount -t tmpfs noen /tmp
# mount -t tmpfs none /var/log

# xfs -port 7100 &
port number is idetital to /etc/X11/xorg.conf(unix:7100)
否则出错:
Fatal Server error:
could not open default font 'fixed'

# startx


6 安装窗口管理器(fluxbox)
=========================
[root@hellokitty fluxbox-0.9.15.1]# ./configure --prefix=/home/nie/dev_home/graduation_paper/cdboot/rootfs/my_rootfs/usr
# make
# make install

# vi root/.xinitrc
add to following line:
startfluxbox

用户家目录当中的.fluxbox目录并不存在. 看样子是第一次运行时由fluxbox
自行创建的, 在CDBOOT当中可以把在工作站做实验的根文件系统当中.fluxbox
copy过来, 再进行修改.
1. # vi root/.fluxbox/startup
2. # vi root/.fluxbox/init
fix path problem about root path.

# vi root/.fluxbox/init    [to change style]
session.styleFile:      /usr/share/fluxbox/styles/BlueNight


7 参考文档
##########

0 0

相关博文

我的热门文章

img
取 消
img