|
题目起得有点霸道,各位高手别人肉我。
文章分开两篇同时发表于自己的博客:
http://www.open2l.com/lfs67-quick-guide.html
http://www.open2l.com/install-xorg75-at-lfs67.html
作者是在真机里装了 virtualbox-3.2_3.2.12-68302 ,要在 virtualbox 里创建一个 LFS6.7 系统。
建立虚拟机,按默认来就行,其中“网络”选择“Bridged”
开启虚拟机,用 LiveCD 启动。LiveCD 可前往 http://www.linuxfromscratch.org/livecd/download.html 下载。
##########下面在虚拟机操作#############
开启SSH
设置root密码
##########下面的在真机的系统里操作#######
连接 SSH ,IP 地址要根据自己的情况来改。
连接上之后,就可以用真机的一个终端来对虚拟机进行操作。
分区、激活交换分区、创建“创作基地”、创建必要目录并设置属性、创建工具链目录
当然不一定用 cfdisk 命令,我个人是觉得好用而已。分两个区出来:/dev/sda1 作为 swap ,/dev/sda2 作为目标系统根目录。
- mkswap /dev/sda1
- mke2fs -jv /dev/sda2
- swapon /dev/sda1
- export LFS=/mnt/lfs
- mkdir -v $LFS
- mount -v -t ext3 /dev/sda2 $LFS
- mkdir -v $LFS/sources
- chmod -v a+wt $LFS/sources
- mkdir -v $LFS/tools
- ln -sv $LFS/tools /
复制代码
创建 lfs 用户、登录到 lfs 用户、建立 lfs 用户环境、下入编译目录
- groupadd lfs
- useradd -s /bin/bash -g lfs -m -k /dev/null lfs
- passwd lfs
- #直接回车就是空密码
- chown -v lfs $LFS/tools
- chown -v lfs $LFS/sources
- su - lfs
- cat > ~/.bash_profile << "EOF"
- exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
- EOF
- cat > ~/.bashrc << "EOF"
- set +h
- umask 022
- LFS=/mnt/lfs
- LC_ALL=POSIX
- LFS_TGT=$(uname -m)-lfs-linux-gnu
- PATH=/tools/bin:/bin:/usr/bin
- export LFS LC_ALL LFS_TGT PATH
- EOF
- source ~/.bash_profile
- cd $LFS/sources
- wget -c ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/lfs-packages-6.7.tar
复制代码
如果在真机里有,可以在真机通过 scp 命令拷贝进去:scp lfs-packages-6.7.tar root@192.168.1.101:/mnt/lfs/sources
- tar xvf lfs-packages-6.7.tar -C $LFS/
复制代码
注:其实如果不使用lfs用root也是能完成工具链的,不过需要对root的环境变量进行修改,还要防止因为输入错误而导致覆盖主系统下的文件,所以LFS手册中制作工具链部分就是为了解决这种意外的发生而用lfs用户来建立工具链
#############################################################
########下面开始就是手册里5. Constructing a Temporary System
########构建临时体系统的过程
##############################################################
Binutils-2.20.1 - Pass 1
- tar xvf binutils-2.20.1.tar.bz2
- cd binutils-2.20.1
- mkdir -v ../binutils-build
- cd ../binutils-build
- ../binutils-2.20.1/configure \
- --target=$LFS_TGT --prefix=/tools \
- --disable-nls --disable-werror
- make
- make install
- cd ..
- rm -rf binutils-build
- rm -rf binutils-2.20.1
复制代码
GCC-4.5.1 - Pass 1
- tar xvf gcc-4.5.1.tar.bz2
- cd gcc-4.5.1
- tar -jxf ../mpfr-3.0.0.tar.bz2
- mv -v mpfr-3.0.0 mpfr
- tar -jxf ../gmp-5.0.1.tar.bz2
- mv -v gmp-5.0.1 gmp
- tar -zxf ../mpc-0.8.2.tar.gz
- mv -v mpc-0.8.2 mpc
- mkdir -v ../gcc-build
- cd ../gcc-build
- ../gcc-4.5.1/configure \
- --target=$LFS_TGT --prefix=/tools \
- --disable-nls --disable-shared --disable-multilib \
- --disable-decimal-float --disable-threads \
- --disable-libmudflap --disable-libssp \
- --disable-libgomp --enable-languages=c \
- --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
- --without-ppl --without-cloog
- make
- make install
- ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
- sed 's/libgcc/&_eh/'`
- cd ..
- rm -rf gcc-4.5.1
- rm -rf gcc-build
复制代码
这里不要图个省事而不删除 gcc-4.5.1 ,否则可能会给后面的编译产生一些意外错误
Linux-2.6.35.4 API Headers
- tar xvf linux-2.6.35.4.tar.bz2
- cd linux-2.6.35.4
- make mrproper
- make headers_check
- make INSTALL_HDR_PATH=dest headers_install
- cp -rv dest/include/* /tools/include
- cd ..
- rm -rf linux-2.6.35.4
复制代码
Glibc-2.12.1
- tar xvf glibc-2.12.1.tar.bz2
- cd glibc-2.12.1
- patch -Np1 -i ../glibc-2.12.1-gcc_fix-1.patch
- patch -Np1 -i ../glibc-2.12.1-makefile_fix-1.patch
- mkdir -v ../glibc-build
- cd ../glibc-build
- case `uname -m` in
- i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;;
- esac
- ../glibc-2.12.1/configure --prefix=/tools \
- --host=$LFS_TGT --build=$(../glibc-2.12.1/scripts/config.guess) \
- --disable-profile --enable-add-ons \
- --enable-kernel=2.6.22.5 --with-headers=/tools/include \
- libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes
- make
- make install
- cd ..
- rm -rf glibc-2.12.1
- rm -rf glibc-build
复制代码
注:这里的参数—enable-kernel=2.6.22.5,指支持2.6.22.5 及其之后的内核版本,老版本不支持。
调节工具链
- SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs
- $LFS_TGT-gcc -dumpspecs | sed \
- -e 's@/lib\(64\)\?/ld@/tools&@g' \
- -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
- echo "New specs file is: $SPECS"
- unset SPECS
复制代码
测试一下工具链,可以不做的,但还是看看有没有出错
- echo 'main(){}' > dummy.c
- $LFS_TGT-gcc -B/tools/lib dummy.c
- readelf -l a.out | grep ': /tools'
复制代码
这里大致输出:
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
删除测试文件
Binutils-2.20.1 - Pass 2
- tar xvf binutils-2.20.1.tar.bz2
- cd binutils-2.20.1
- mkdir -v ../binutils-build
- cd ../binutils-build
- CC="$LFS_TGT-gcc -B/tools/lib/" \
- AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
- ../binutils-2.20.1/configure --prefix=/tools \
- --disable-nls --with-lib-path=/tools/lib
- make
- make install
- make -C ld clean
- make -C ld LIB_PATH=/usr/lib:/lib
- cp -v ld/ld-new /tools/bin
- cd ..
- rm -rf binutils-build
- rm -rf binutils-2.20.1
复制代码
GCC-4.5.1 - Pass 2
- tar xvf gcc-4.5.1.tar.bz2
- cd gcc-4.5.1
- patch -Np1 -i ../gcc-4.5.1-startfiles_fix-1.patch
- cp -v gcc/Makefile.in{,.orig}
- sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in
- cp -v gcc/Makefile.in{,.tmp}
- sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
- > gcc/Makefile.in
- for file in \
- $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
- do
- cp -uv $file{,.orig}
- sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
- -e 's@/usr@/tools@g' $file.orig > $file
- echo '
- #undef STANDARD_INCLUDE_DIR
- #define STANDARD_INCLUDE_DIR 0
- #define STANDARD_STARTFILE_PREFIX_1 ""
- #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
- touch $file.orig
- done
- tar -jxf ../mpfr-3.0.0.tar.bz2
- mv -v mpfr-3.0.0 mpfr
- tar -jxf ../gmp-5.0.1.tar.bz2
- mv -v gmp-5.0.1 gmp
- tar -zxf ../mpc-0.8.2.tar.gz
- mv -v mpc-0.8.2 mpc
- mkdir -v ../gcc-build
- cd ../gcc-build
- CC="$LFS_TGT-gcc -B/tools/lib/" \
- AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
- ../gcc-4.5.1/configure --prefix=/tools \
- --with-local-prefix=/tools --enable-clocale=gnu \
- --enable-shared --enable-threads=posix \
- --enable-__cxa_atexit --enable-languages=c,c++ \
- --disable-libstdcxx-pch --disable-multilib \
- --disable-bootstrap --disable-libgomp \
- --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
- --without-ppl --without-cloog
- make
- make install
- ln -vs gcc /tools/bin/cc
- cd ..
- rm -rf gcc-4.5.1
- rm -rf gcc-build
复制代码
再次测试工具链的调整,以确保刚刚编译的gcc正确工作
- echo 'main(){}' > dummy.c
- cc dummy.c
- readelf -l a.out | grep 'tools'
复制代码
如果输出大致如下
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
则表示调整成功,因为所有的库已经连接到了/tools/lib下。
删除测试文件
############################################################
###接下来这三个:Tcl-8.5.8、Expect-5.44.1.15、DejaGNU-1.4.4。#
###是用于手册第六章各种源码包编译后测试的工具。 #
###如果不打算做 make check 之类的事情,那么这三个包其可以不装。 #
############################################################
Tcl-8.5.8
- tar xvf tcl8.5.8-src.tar.gz
- cd tcl8.5.8
- cd unix
- ./configure --prefix=/tools
- make
- make install
- chmod -v u+w /tools/lib/libtcl8.5.so
- make install-private-headers
- ln -sv tclsh8.5 /tools/bin/tclsh
- cd ..
- cd ..
- rm -rf tcl8.5.8
复制代码
Expect-5.44.1.15
- tar xvf expect-5.44.1.15.tar.bz2
- cd expect-5.44.1.15
- patch -Np1 -i ../expect-5.44.1.15-no_tk-1.patch
- cp -v configure{,.orig}
- sed 's:/usr/local/bin:/bin:' configure.orig > configure
- ./configure --prefix=/tools --with-tcl=/tools/lib \
- --with-tclinclude=/tools/include --with-tk=no
- make
- make SCRIPTS="" install
- cd ..
- rm -rf expect-5.44.1.15
复制代码
DejaGNU-1.4.4
- tar xvf dejagnu-1.4.4.tar.gz
- cd dejagnu-1.4.4
- patch -Np1 -i ../dejagnu-1.4.4-consolidated-1.patch
- ./configure --prefix=/tools
- make install
- cd ..
- rm -rf dejagnu-1.4.4
复制代码
Ncurses-5.7
- tar xvf ncurses-5.7.tar.gz
- cd ncurses-5.7
- ./configure --prefix=/tools --with-shared \
- --without-debug --without-ada --enable-overwrite
- make
- make install
- cd ..
- rm -rf ncurses-5.7
复制代码
Bash-4.1
- tar xvf bash-4.1.tar.gz
- cd bash-4.1
- patch -Np1 -i ../bash-4.1-fixes-2.patch
- ./configure --prefix=/tools --without-bash-malloc
- make
- make install
- ln -vs bash /tools/bin/sh
- cd ..
- rm -rf bash-4.1
复制代码
Bzip2-1.0.5
- tar xvf bzip2-1.0.5.tar.gz
- cd bzip2-1.0.5
- make
- make PREFIX=/tools install
- cd ..
- rm -rf bzip2-1.0.5
复制代码
Coreutils-8.5
- tar xvf coreutils-8.5.tar.gz
- cd coreutils-8.5
- ./configure --prefix=/tools --enable-install-program=hostname
- make
- make install
- cp -v src/su /tools/bin/su-tools
- cd ..
- rm -rf coreutils-8.5
复制代码
Diffutils-3.0
- tar xvf diffutils-3.0.tar.gz
- cd diffutils-3.0
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf diffutils-3.0
复制代码
File-5.04
- tar xvf file-5.04.tar.gz
- cd file-5.04
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf file-5.04
复制代码
Findutils-4.4.2
- tar xvf findutils-4.4.2.tar.gz
- cd findutils-4.4.2
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf findutils-4.4.2
复制代码
Gawk-3.1.8
- tar xvf gawk-3.1.8.tar.bz2
- cd gawk-3.1.8
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf gawk-3.1.8
复制代码
Gettext-0.18.1.1
- tar xvf gettext-0.18.1.1.tar.gz
- cd gettext-0.18.1.1
- cd gettext-tools
- ./configure --prefix=/tools --disable-shared
- make -C gnulib-lib
- make -C src msgfmt
- cp -v src/msgfmt /tools/bin
- cd ..
- cd ..
- rm -rf gettext-0.18.1.1
复制代码
Grep-2.6.3
- tar xvf grep-2.6.3.tar.gz
- cd grep-2.6.3
- ./configure --prefix=/tools \
- --disable-perl-regexp
- make
- make install
- cd ..
- rm -rf grep-2.6.3
复制代码
Gzip-1.4
- tar xvf gzip-1.4.tar.gz
- cd gzip-1.4
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf gzip-1.4
复制代码
M4-1.4.14
- tar xvf m4-1.4.14.tar.bz2
- cd m4-1.4.14
- sed -i -e '/"m4.h"/a\
- #include <sys/stat.h>' src/path.c
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf m4-1.4.14
复制代码
Make-3.82
- tar xvf make-3.82.tar.bz2
- cd make-3.82
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf make-3.82
复制代码
Patch-2.6.1
- tar xvf patch-2.6.1.tar.bz2
- cd patch-2.6.1
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf patch-2.6.1
复制代码
Perl-5.12.1
- tar xvf perl-5.12.1.tar.bz2
- cd perl-5.12.1
- patch -Np1 -i ../perl-5.12.1-libc-1.patch
- sh Configure -des -Dprefix=/tools \
- -Dstatic_ext='Data/Dumper Fcntl IO'
- make perl utilities ext/Errno/pm_to_blib
- cp -v perl pod/pod2man /tools/bin
- mkdir -pv /tools/lib/perl5/5.12.1
- cp -Rv lib/* /tools/lib/perl5/5.12.1
- cd ..
- rm -rf perl-5.12.1
复制代码
Sed-4.2.1
- tar xvf sed-4.2.1.tar.bz2
- cd sed-4.2.1
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf sed-4.2.1
复制代码
Tar-1.23
- tar xvf tar-1.23.tar.bz2
- cd tar-1.23
- sed -i /SIGPIPE/d src/tar.c
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf tar-1.23
复制代码
Texinfo-4.13a
- tar xvf texinfo-4.13a.tar.gz
- cd texinfo-4.13
- ./configure --prefix=/tools
- make
- make install
- cd ..
- rm -rf texinfo-4.13
复制代码
Stripping
这步是可有可无的,如果你打算今后还要用/tools里面的东西,那么可以strip一下来减少占用的磁盘空间(70M),但如果做完目标系统后就删除了,不Strip也可以,反正最后也是要删掉的。
- strip --strip-debug /tools/lib/*
- strip --strip-unneeded /tools/{,s}bin/*
复制代码
info和man里面的内容在制作过程中没什么用处,所以删掉也没啥关系。空出 25M 的空间。
- rm -rf /tools/{,share}/{info,man}
复制代码
####################
###这一步千万不能少###
###退出 lfs 用户 ###
####################
现在你应该是处于root用户状态的,看看你的命令行提示符是不是回到了“#”。
从现在开始不在需要lfs用户来制作系统了。重新设置目录权限,便于后面的工作。
- chown -R root:root $LFS/tools
复制代码
#########接下来就是手册第六章的内容Installing Basic System Software######
创建三个重要目录
- mkdir -v $LFS/{dev,proc,sys}
复制代码
创建两个目标系统所必须的设备文件
- mknod -m 600 $LFS/dev/console c 5 1
- mknod -m 666 $LFS/dev/null c 1 3
复制代码
利用主系统加载几个重要的文件系统,请注意这个步骤对于后面的工作极其重要。
- mount -v --bind /dev $LFS/dev
- mount -vt devpts devpts $LFS/dev/pts
- mount -vt tmpfs shm $LFS/dev/shm
- mount -vt proc proc $LFS/proc
- mount -vt sysfs sysfs $LFS/sys
复制代码
Chroot到目标系统的目录下,以便不受主系统的影响来制作目标系统
- chroot "$LFS" /tools/bin/env -i \
- HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
- PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
- /tools/bin/bash --login +h
复制代码
注意:这个时候你的提示符会是“I have no name!”,没有关系继续我们的工作很快就可以正常了。
建立目标系统的目录结构
- mkdir -pv /{bin,boot,etc/opt,home,lib,mnt,opt}
- mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
- install -dv -m 0750 /root
- install -dv -m 1777 /tmp /var/tmp
- mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
- mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
- mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
- mkdir -pv /usr/{,local/}share/man/man{1..8}
- for dir in /usr /usr/local; do
- ln -sv share/{man,doc,info} $dir
- done
- case $(uname -m) in
- x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 ;;
- esac
- mkdir -v /var/{lock,log,mail,run,spool}
- mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
复制代码
创建几个必要的链接,因为在目标系统的编译过程中,部分编译程序会用绝对路径来寻找命令或文件。
- ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
- ln -sv /tools/bin/perl /usr/bin
- ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
- ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
- ln -sv bash /bin/sh
- touch /etc/mtab
复制代码
创建root及nobody用户和必要的组
- cat > /etc/passwd << "EOF"
- root:x:0:0:root:/root:/bin/bash
- bin:x:1:1:bin:/dev/null:/bin/false
- nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
- EOF
- cat > /etc/group << "EOF"
- root:x:0:
- bin:x:1:
- sys:x:2:
- kmem:x:3:
- tty:x:4:
- tape:x:5:
- daemon:x:6:
- floppy:x:7:
- disk:x:8:
- lp:x:9:
- dialout:x:10:
- audio:x:11:
- video:x:12:
- utmp:x:13:
- usb:x:14:
- cdrom:x:15:
- mail:x:34:
- nogroup:x:99:
- EOF
复制代码
重新加载bash,以使root用户起效,这样前面的提示符就不会是“I have no name!”
- exec /tools/bin/bash --login +h
复制代码
创建和设置几个临时文件和日志文件。
- touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
- chgrp -v utmp /var/run/utmp /var/log/lastlog
- chmod -v 664 /var/run/utmp /var/log/lastlog
复制代码
进入源码包所在目录来进行编译安装系统
Linux-2.6.35.4 API Headers
- tar xvf linux-2.6.35.4.tar.bz2
- cd linux-2.6.35.4
- make mrproper
- make headers_check
- make INSTALL_HDR_PATH=dest headers_install
- find dest/include \( -name .install -o -name ..install.cmd \) -delete
- cp -rv dest/include/* /usr/include
- cd ..
- rm -rf linux-2.6.35.4
复制代码
Man-pages-3.25
man-pages的版本可以使用更新的版本。当然只要你愿意。
- tar xvf man-pages-3.25.tar.bz2
- cd man-pages-3.25
- make install
- cd ..
- rm -rf man-pages-3.25
复制代码
Glibc-2.12.1
这一关是相当的长的,慢慢等。
注意:glibc的测试比较容易出现错误,比如机器慢就有可能出现超时的错误,还有一些能引起错误的LFS手册上有所提及,像超时这种错误有时候很难避免,就跳过去吧。
在进行之前请检查一下是否glibc-2.12.1和glibc-build这两个目录已经被删除,如果没有删除请删除后在继续。
- tar xvf glibc-2.12.1.tar.bz2
- cd glibc-2.12.1
- DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
- sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
- scripts/test-installation.pl
- unset DL
- sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
- patch -Np1 -i ../glibc-2.12.1-gcc_fix-1.patch
- patch -Np1 -i ../glibc-2.12.1-makefile_fix-1.patch
- mkdir -v ../glibc-build
- cd ../glibc-build
- case `uname -m` in
- i?86) echo "CFLAGS += -march=i486 -mtune=native -O3 -pipe" > configparms ;;
- esac
- ../glibc-2.12.1/configure --prefix=/usr \
- --disable-profile --enable-add-ons \
- --enable-kernel=2.6.22.5 --libexecdir=/usr/lib/glibc
- make
- cp -v ../glibc-2.12.1/iconvdata/gconv-modules iconvdata
- make -k check 2>&1 | tee glibc-check-log
- grep Error glibc-check-log
- touch /etc/ld.so.conf
- make install
- #安装locale
- mkdir -pv /usr/lib/locale
- localedef -i en_US -f UTF-8 en_US.UTF-8
- localedef -i zh_CN -f GB18030 zh_CN
- localedef -i zh_CN -f GBK zh_CN
- localedef -i zh_CN -f UTF-8 zh_CN
- localedef -i zh_CN -f GB2312 zh_CN
- localedef -i zh_HK -f UTF-8 zh_CN
- localedef -i zh_HK -f BIG5-HKSCS zh_CN
- localedef -i zh_TW -f EUC-TW zh_CN
- localedef -i zh_TW -f UTF-8 zh_CN
- localedef -i zh_TW -f BIG5 zh_CN
- #这里只安装了美语与中文,如果想安装全部则用 make localedata/install-locales 命令替代上面的命令。
- cat > /etc/nsswitch.conf << "EOF"
- # Begin /etc/nsswitch.conf
- passwd: files
- group: files
- shadow: files
- hosts: files dns
- networks: files
- protocols: files
- services: files
- ethers: files
- rpc: files
- # End /etc/nsswitch.conf
- EOF
- cp -v --remove-destination /usr/share/zoneinfo/Asia/Shanghai \
- /etc/localtime
- #这里使用“上海”时区,如果想用别的可以用命令 tzselect 查看相应的时区。
- cat > /etc/ld.so.conf << "EOF"
- # Begin /etc/ld.so.conf
- /usr/local/lib
- /opt/lib
- # End /etc/ld.so.conf
- EOF
- cd ..
- rm -rf glibc-2.12.1
- rm -rf glibc-build
复制代码
调整工具链
- mv -v /tools/bin/{ld,ld-old}
- mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
- mv -v /tools/bin/{ld-new,ld}
- ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
复制代码
调整specs文件
- gcc -dumpspecs | sed -e 's@/tools@@g' \
- -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
- -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
- `dirname $(gcc --print-libgcc-file-name)`/specs
复制代码
测试工具链是否被调整成功
- echo 'main(){}' > dummy.c
- cc dummy.c -v -Wl,--verbose &> dummy.log
- readelf -l a.out | grep ': /lib'
复制代码
如果显示[Requesting program interpreter: /lib/ld-linux.so.2]表示调整成功,动态库已经连接到了目标系统的/lib下。
- grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
复制代码
应该显示:
/usr/lib/crt1.o succeeded
/usr/lib/crti.o succeeded
/usr/lib/crtn.o succeeded
- grep -B1 '^ /usr/include' dummy.log
复制代码
应该显示:
#include <...> search starts here:
/usr/include
- grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
复制代码
应该显示:
SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib");
- grep "/lib.*/libc.so.6 " dummy.log
复制代码
应该显示:
attempt to open /lib/libc.so.6 succeeded
应该显示:
found ld-linux.so.2 at /lib/ld-linux.so.2
如果上面均显示正常,那么表明工具链调整成功,删除测试文件:
- rm -v dummy.c a.out dummy.log
复制代码
Zlib-1.2.5
这里我省掉了 make check ,手册建议这一章内容最好不要省掉 make check。
- tar xvf zlib-1.2.5.tar.bz2
- cd zlib-1.2.5
- sed -i 's/ifdef _LARGEFILE64_SOURCE/ifndef _LARGEFILE64_SOURCE/' zlib.h
- CFLAGS='-mstackrealign -fPIC -O3' ./configure --prefix=/usr
- make
- make install
- mv -v /usr/lib/libz.so.* /lib
- ln -sfv ../../lib/libz.so.1.2.5 /usr/lib/libz.so
- cd ..
- rm -rf zlib-1.2.5
复制代码
Binutils-2.20.1
make check 时这里测试统计可能会出现个别失败。这里我也给省掉了,手册说这个是相当重要!
- tar xvf binutils-2.20.1.tar.bz2
- cd binutils-2.20.1
- expect -c "spawn ls"
- rm -fv etc/standards.info
- sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
- mkdir -v ../binutils-build
- cd ../binutils-build
- ../binutils-2.20.1/configure --prefix=/usr \
- --enable-shared
- make tooldir=/usr
- make tooldir=/usr install
- cp -v ../binutils-2.20.1/include/libiberty.h /usr/include
- cd ..
- rm -rf binutils-2.20.1
- rm -rf binutils-build
复制代码
GMP-5.0.1
- tar xvf gmp-5.0.1.tar.bz2
- cd gmp-5.0.1
- ./configure --prefix=/usr --enable-cxx --enable-mpbsd
- make
- make check 2>&1 | tee gmp-check-log
- awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log
- #测试结果为 162 通过。
- make install
- #如果要安装文档则运行下面两行命令
- #mkdir -v /usr/share/doc/gmp-5.0.1
- #cp -v doc/{isa_abi_headache,configuration} doc/*.html \
- # /usr/share/doc/gmp-5.0.1
- cd ..
- rm -rf gmp-5.0.1
复制代码
MPFR-3.0.0
这里测试应全部通过
- tar xvf mpfr-3.0.0.tar.bz2
- cd mpfr-3.0.0
- ./configure --prefix=/usr --enable-thread-safe \
- --docdir=/usr/share/doc/mpfr-3.0.0
- make
- make install
- make html
- make install-html
- cd ..
- rm -rf mpfr-3.0.0
复制代码
MPC-0.8.2
- tar xvf mpc-0.8.2.tar.gz
- cd mpc-0.8.2
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf mpc-0.8.2
复制代码
GCC-4.5.1
这里我也不进行make check。其实这一步是相当重要的。这里check时间比较长,可能会有一些错误发生
- tar xvf gcc-4.5.1.tar.bz2
- cd gcc-4.5.1
- sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
- case `uname -m` in
- i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' \
- gcc/Makefile.in ;;
- esac
- sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
- mkdir -v ../gcc-build
- cd ../gcc-build
- ../gcc-4.5.1/configure --prefix=/usr \
- --libexecdir=/usr/lib --enable-shared \
- --enable-threads=posix --enable-__cxa_atexit \
- --enable-clocale=gnu --enable-languages=c,c++ \
- --disable-multilib --disable-bootstrap --with-system-zlib
- make
- make install
- ln -sv ../usr/bin/cpp /lib
- ln -sv gcc /usr/bin/cc
复制代码
重新测试工具链是否正确,确定GCC是否安装正确
- echo 'main(){}' > dummy.c
- cc dummy.c -v -Wl,--verbose &> dummy.log
- readelf -l a.out | grep ': /lib'
复制代码
如果显示[Requesting program interpreter: /lib/ld-linux.so.2]表示链接位置正确,动态库已经连接到了目标系统的/lib下。
- grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
复制代码
应该显示:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../crt1.o succeeded
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../crti.o succeeded
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../crtn.o succeeded
- grep -B4 '^ /usr/include' dummy.log
复制代码
应该显示:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/include
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/include-fixed
/usr/include
- grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
复制代码
应该显示:
SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");
- grep "/lib.*/libc.so.6 " dummy.log
复制代码
应该显示:
attempt to open /lib/libc.so.6 succeeded
应该显示:
found ld-linux.so.2 at /lib/ld-linux.so.2
如果上面均显示正常,那么表明工具链正常,可以删除测试文件了
- rm -v dummy.c a.out dummy.log
复制代码
- cd ..
- rm -rf gcc-4.5.1
- rm -rf gcc-build
复制代码
Sed-4.2.1
- tar xvf sed-4.2.1.tar.bz2
- cd sed-4.2.1
- ./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed-4.2.1
- make
- make html
- make install
- make -C doc install-html
- cd ..
- rm -rf sed-4.2.1
复制代码
Pkg-config-0.25
- tar xvf pkg-config-0.25.tar.gz
- cd pkg-config-0.25
- sed -i -e 's/XT])dnl/XT])[]dnl/' \
- -e 's/\.])dnl/\.])[]dnl/' pkg.m4
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf pkg-config-0.25
复制代码
Ncurses-5.7
- tar xvf ncurses-5.7.tar.gz
- cd ncurses-5.7
- ./configure --prefix=/usr --with-shared --without-debug --enable-widec
- make
- make install
- mv -v /usr/lib/libncursesw.so.5* /lib
- ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
- for lib in ncurses form panel menu ; do \
- rm -vf /usr/lib/lib${lib}.so ; \
- echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so ; \
- ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a ; \
- done
- ln -sfv libncurses++w.a /usr/lib/libncurses++.a
- rm -vf /usr/lib/libcursesw.so
- echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so
- ln -sfv libncurses.so /usr/lib/libcurses.so
- ln -sfv libncursesw.a /usr/lib/libcursesw.a
- ln -sfv libncurses.a /usr/lib/libcurses.a
- #如果要文档文件则安装之
- #mkdir -v /usr/share/doc/ncurses-5.7
- #cp -v -R doc/* /usr/share/doc/ncurses-5.7
- cd ..
- rm -rf ncurses-5.7
复制代码
Util-linux-ng-2.18
- tar xvf util-linux-ng-2.18.tar.bz2
- cd util-linux-ng-2.18
- sed -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
- -i $(grep -rl '/etc/adjtime' .)
- mkdir -pv /var/lib/hwclock
- ./configure --enable-arch --enable-partx --enable-write
- make
- make install
- cd ..
- rm -rf util-linux-ng-2.18
复制代码
E2fsprogs-1.41.12
- tar xvf e2fsprogs-1.41.12.tar.gz
- cd e2fsprogs-1.41.12
- mkdir -v build
- cd build
- ../configure --prefix=/usr --with-root-prefix="" \
- --enable-elf-shlibs --disable-libblkid --disable-libuuid \
- --disable-uuidd --disable-fsck
- make
- make install
- make install-libs
- chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
- gunzip -v /usr/share/info/libext2fs.info.gz
- install-info --dir-file=/usr/share/info/dir \
- /usr/share/info/libext2fs.info
- makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo
- install -v -m644 doc/com_err.info /usr/share/info
- install-info --dir-file=/usr/share/info/dir \
- /usr/share/info/com_err.info
- cd ..
- cd ..
- rm -rf e2fsprogs-1.41.12
复制代码
Coreutils-8.5
- tar xvf coreutils-8.5.tar.gz
- cd coreutils-8.5
- case `uname -m` in
- i?86 | x86_64) patch -Np1 -i ../coreutils-8.5-uname-2.patch ;;
- esac
- patch -Np1 -i ../coreutils-8.5-i18n-1.patch
- ./configure --prefix=/usr \
- --enable-no-install-program=kill,uptime
- make
- make NON_ROOT_USERNAME=nobody check-root
- echo "dummy:x:1000:nobody" >> /etc/group
- chown -Rv nobody .
- su-tools nobody -s /bin/bash -c "make RUN_EXPENSIVE_TESTS=yes check"
- sed -i '/dummy/d' /etc/group
- make install
- mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
- mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
- mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin
- mv -v /usr/bin/chroot /usr/sbin
- mv -v /usr/bin/{head,sleep,nice} /bin
- cd ..
- rm -rf coreutils-8.5
复制代码
Iana-Etc-2.30
- tar xvf iana-etc-2.30.tar.bz2
- cd iana-etc-2.30
- make
- make install
- cd ..
- rm -rf iana-etc-2.30
复制代码
M4-1.4.14
- tar xvf m4-1.4.14.tar.bz2
- cd m4-1.4.14
- sed -i -e '/"m4.h"/a\
- #include <sys/stat.h>' src/path.c
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf m4-1.4.14
复制代码
Bison-2.4.3
- tar xvf bison-2.4.3.tar.bz2
- cd bison-2.4.3
- ./configure --prefix=/usr
- echo '#define YYENABLE_NLS 1' >> lib/config.h
- make
- make install
- cd ..
- rm -rf bison-2.4.3
复制代码
Procps-3.2.8
- tar xvf procps-3.2.8.tar.gz
- cd procps-3.2.8
- patch -Np1 -i ../procps-3.2.8-watch_unicode-1.patch
- sed -i -e 's@\*/module.mk@proc/module.mk ps/module.mk@' Makefile
- make
- make install
- cd ..
- rm -rf procps-3.2.8
复制代码
Grep-2.6.3
- tar xvf grep-2.6.3.tar.gz
- cd grep-2.6.3
- ./configure --prefix=/usr \
- --bindir=/bin
- make
- make install
- cd ..
- rm -rf grep-2.6.3
复制代码
Readline-6.1
- tar xvf readline-6.1.tar.gz
- cd readline-6.1
- sed -i '/MV.*old/d' Makefile.in
- sed -i '/{OLDSUFF}/c:' support/shlib-install
- sed -i -e 's/0x0600/0x0601/' \
- -e 's/6\.0/6.1/' \
- -e 's/RL_VERSION_MINOR\t0/RL_VERSION_MINOR\t1/' readline.h
- ./configure --prefix=/usr --libdir=/lib
- make SHLIB_LIBS=-lncurses
- make install
- mv -v /lib/lib{readline,history}.a /usr/lib
- rm -v /lib/lib{readline,history}.so
- ln -sfv ../../lib/libreadline.so.6 /usr/lib/libreadline.so
- ln -sfv ../../lib/libhistory.so.6 /usr/lib/libhistory.so
- #要文档就安装之。
- #mkdir -v /usr/share/doc/readline-6.1
- #install -v -m644 doc/*.{ps,pdf,html,dvi} \
- # /usr/share/doc/readline-6.1
- cd ..
- rm -rf readline-6.1
复制代码
Bash-4.1
- tar xvf bash-4.1.tar.gz
- cd bash-4.1
- patch -Np1 -i ../bash-4.1-fixes-2.patch
- ./configure --prefix=/usr --bindir=/bin \
- --htmldir=/usr/share/doc/bash-4.1 --without-bash-malloc \
- --with-installed-readline
- make
- make install
- cd ..
- rm -rf bash-4.1
复制代码
应用刚编译好的/bin/bash。做脚本的朋友,这一步很容易出问题的哟。
- exec /bin/bash --login +h
复制代码
Libtool-2.2.10
- tar xvf libtool-2.2.10.tar.gz
- cd libtool-2.2.10
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf libtool-2.2.10
复制代码
GDBM-1.8.3
- tar xvf gdbm-1.8.3.tar.gz
- cd gdbm-1.8.3
- ./configure --prefix=/usr
- make
- make install
- make install-compat
- install-info --dir-file=/usr/info/dir /usr/info/gdbm.info
- cd ..
- rm -rf gdbm-1.8.3
复制代码
Inetutils-1.8
- tar xvf inetutils-1.8.tar.gz
- cd inetutils-1.8
- ./configure --prefix=/usr --libexecdir=/usr/sbin \
- --localstatedir=/var --disable-ifconfig \
- --disable-logger --disable-syslogd --disable-whois \
- --disable-servers
- make
- make install
- mv -v /usr/bin/{hostname,ping,ping6} /bin
- mv -v /usr/bin/traceroute /sbin
- cd ..
- rm -rf inetutils-1.8
复制代码
Perl-5.12.1
- tar xvf perl-5.12.1.tar.bz2
- cd perl-5.12.1
- echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
- sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|" \
- -e "s|INCLUDE\s*= ./zlib-src|INCLUDE = /usr/include|" \
- -e "s|LIB\s*= ./zlib-src|LIB = /usr/lib|" \
- cpan/Compress-Raw-Zlib/config.in
- sh Configure -des -Dprefix=/usr \
- -Dvendorprefix=/usr \
- -Dman1dir=/usr/share/man/man1 \
- -Dman3dir=/usr/share/man/man3 \
- -Dpager="/usr/bin/less -isR" \
- -Duseshrplib
- make
- make install
- cd ..
- rm -rf perl-5.12.1
复制代码
Autoconf-2.67
- tar xvf autoconf-2.67.tar.bz2
- cd autoconf-2.67
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf autoconf-2.67
复制代码
Automake-1.11.1
- tar xvf automake-1.11.1.tar.bz2
- cd automake-1.11.1
- ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.11.1
- make
- make install
- cd ..
- rm -rf automake-1.11.1
复制代码
Bzip2-1.0.5
- tar xvf bzip2-1.0.5.tar.gz
- cd bzip2-1.0.5
- patch -Np1 -i ../bzip2-1.0.5-install_docs-1.patch
- patch -Np1 -i ../bzip2-1.0.5-version_fixes-1.patch
- sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
- make -f Makefile-libbz2_so
- make clean
- make
- make PREFIX=/usr install
- cp -v bzip2-shared /bin/bzip2
- cp -av libbz2.so* /lib
- ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
- rm -v /usr/bin/{bunzip2,bzcat,bzip2}
- ln -sv bzip2 /bin/bunzip2
- ln -sv bzip2 /bin/bzcat
- cd ..
- rm -rf bzip2-1.0.5
复制代码
Diffutils-3.0
- tar xvf diffutils-3.0.tar.gz
- cd diffutils-3.0
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf diffutils-3.0
复制代码
Gawk-3.1.8
- tar xvf gawk-3.1.8.tar.bz2
- cd gawk-3.1.8
- ./configure --prefix=/usr --libexecdir=/usr/lib
- make
- make install
- #要文档就安装之。
- #mkdir -v /usr/share/doc/gawk-3.1.8
- #cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} \
- # /usr/share/doc/gawk-3.1.8
- cd ..
- rm -rf gawk-3.1.8
复制代码
File-5.04
- tar xvf file-5.04.tar.gz
- cd file-5.04
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf file-5.04
复制代码
Findutils-4.4.2
- tar xvf findutils-4.4.2.tar.gz
- cd findutils-4.4.2
- ./configure --prefix=/usr --libexecdir=/usr/lib/findutils \
- --localstatedir=/var/lib/locate
- make
- make install
- mv -v /usr/bin/find /bin
- sed -i 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb
- cd ..
- rm -rf findutils-4.4.2
复制代码
Flex-2.5.35
- tar xvf flex-2.5.35.tar.bz2
- cd flex-2.5.35
- patch -Np1 -i ../flex-2.5.35-gcc44-1.patch
- ./configure --prefix=/usr
- make
- make install
- ln -sv libfl.a /usr/lib/libl.a
- cat > /usr/bin/lex << "EOF"
- #!/bin/sh
- # Begin /usr/bin/lex
- exec /usr/bin/flex -l "$@"
- # End /usr/bin/lex
- EOF
- chmod -v 755 /usr/bin/lex
- #要flex.pdf的话就安装之
- #mkdir -v /usr/share/doc/flex-2.5.35
- #cp -v doc/flex.pdf \
- # /usr/share/doc/flex-2.5.35
- cd ..
- rm -rf flex-2.5.35
复制代码
Gettext-0.18.1.1
- tar xvf gettext-0.18.1.1.tar.gz
- cd gettext-0.18.1.1
- ./configure --prefix=/usr \
- --docdir=/usr/share/doc/gettext-0.18.1.1
- make
- make install
- cd ..
- rm -rf gettext-0.18.1.1
复制代码
Groff-1.20.1
PAGE=A4,A4 也可以换成 letter ,只要你喜欢。
- tar xvf groff-1.20.1.tar.gz
- cd groff-1.20.1
- PAGE=A4 ./configure --prefix=/usr
- make
- make docdir=/usr/share/doc/groff-1.20.1 install
- ln -sv eqn /usr/bin/geqn
- ln -sv tbl /usr/bin/gtbl
- cd ..
- rm -rf groff-1.20.1
复制代码
GRUB-1.98
- tar xvf grub-1.98.tar.gz
- cd grub-1.98
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --disable-grub-emu-usb \
- --disable-grub-fstest \
- --disable-efiemu
- make
- make install
- cd ..
- rm -rf grub-1.98
复制代码
Gzip-1.4
- tar xvf gzip-1.4.tar.gz
- cd gzip-1.4
- ./configure --prefix=/usr --bindir=/bin
- make
- make install
- mv -v /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin
- mv -v /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin
- cd ..
- rm -rf gzip-1.4
复制代码
IPRoute2-2.6.35
- tar xvf iproute2-2.6.35.tar.bz2
- cd iproute2-2.6.35
- sed -i '/^TARGETS/s@arpd@@g' misc/Makefile
- sed -i '1289i\\tfilter.cloned = 2;' ip/iproute.c
- make DESTDIR=
- make DESTDIR= SBINDIR=/sbin MANDIR=/usr/share/man \
- DOCDIR=/usr/share/doc/iproute2-2.6.35 install
- cd ..
- rm -rf iproute2-2.6.35
复制代码
Kbd-1.15.2
- tar xvf kbd-1.15.2.tar.gz
- cd kbd-1.15.2
- patch -Np1 -i ../kbd-1.15.2-backspace-1.patch
- ./configure --prefix=/usr --datadir=/lib/kbd
- make
- make install
- mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin
- #要文档就安装之。
- #mkdir -v /usr/share/doc/kbd-1.15.2
- #cp -R -v doc/* \
- # /usr/share/doc/kbd-1.15.2
- cd ..
- rm -rf kbd-1.15.2
复制代码
Less-436
- tar xvf less-436.tar.gz
- cd less-436
- ./configure --prefix=/usr --sysconfdir=/etc
- make
- make install
- cd ..
- rm -rf less-436
复制代码
Make-3.82
- tar xvf make-3.82.tar.bz2
- cd make-3.82
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf make-3.82
复制代码
Man-DB-2.5.7
- tar xvf man-db-2.5.7.tar.gz
- cd man-db-2.5.7
- patch -Np1 -i ../man-db-2.5.7-fix_man_assertion-1.patch
- ./configure --prefix=/usr --libexecdir=/usr/lib \
- --docdir=/usr/share/doc/man-db-2.5.7 --sysconfdir=/etc --disable-setuid \
- --with-browser=/usr/bin/lynx --with-vgrind=/usr/bin/vgrind \
- --with-grap=/usr/bin/grap
- make
- make install
- cd ..
- rm -rf man-db-2.5.7
复制代码
Module-Init-Tools-3.12
- tar xvf module-init-tools-3.12.tar.bz2
- cd module-init-tools-3.12
- echo '.so man5/modprobe.conf.5' > modprobe.d.5
- ./configure
- make check
- ./tests/runtests
- make clean
- ./configure --prefix=/ --enable-zlib-dynamic --mandir=/usr/share/man
- make
- make INSTALL=install install
- cd ..
- rm -rf module-init-tools-3.12
复制代码
Patch-2.6.1
- tar xvf patch-2.6.1.tar.bz2
- cd patch-2.6.1
- patch -Np1 -i ../patch-2.6.1-test_fix-1.patch
- ./configure --prefix=/usr
- make
- make install
- cd ..
- rm -rf patch-2.6.1
复制代码
Psmisc-22.12
- tar xvf psmisc-22.12.tar.gz
- cd psmisc-22.12
- sed -i 's@#include <sys\/user.h>@#include <bits\/types.h>\n&@' configure
- ./configure --prefix=/usr
- make
- make install
- mv -v /usr/bin/fuser /bin
- mv -v /usr/bin/killall /bin
- cd ..
- rm -rf psmisc-22.12
复制代码
Shadow-4.1.4.2
- tar xvf shadow-4.1.4.2.tar.bz2
- cd shadow-4.1.4.2
- sed -i 's/groups$(EXEEXT) //' src/Makefile.in
- find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
- sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in
- sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD MD5@' \
- -e 's@/var/spool/mail@/var/mail@' etc/login.defs
- ./configure --sysconfdir=/etc
- make
- make install
- mv -v /usr/bin/passwd /bin
- pwconv
- grpconv
- passwd root
- #一定要设置root的密码,否则重新启动后无法登陆。
- cd ..
- rm -rf shadow-4.1.4.2
复制代码
Sysklogd-1.5
- tar xvf sysklogd-1.5.tar.gz
- cd sysklogd-1.5
- make
- make BINDIR=/sbin install
- #设置syslog的配置文件
- cat > /etc/syslog.conf << "EOF"
- # Begin /etc/syslog.conf
- auth,authpriv.* -/var/log/auth.log
- *.*;auth,authpriv.none -/var/log/sys.log
- daemon.* -/var/log/daemon.log
- kern.* -/var/log/kern.log
- mail.* -/var/log/mail.log
- user.* -/var/log/user.log
- *.emerg *
- # End /etc/syslog.conf
- EOF
- cd ..
- rm -rf sysklogd-1.5
复制代码
Sysvinit-2.88dsf
- tar xvf sysvinit-2.88dsf.tar.bz2
- cd sysvinit-2.88dsf
- sed -i 's@Sending processes@& configured via /etc/inittab@g' \
- src/init.c
- sed -i -e 's/utmpdump wall/utmpdump/' \
- -e 's/mountpoint.1 wall.1/mountpoint.1/' src/Makefile
- make -C src
- make -C src install
- #设置启动配置文件/etc/inittab
- cat > /etc/inittab << "EOF"
- # Begin /etc/inittab
- id:3:initdefault:
- si::sysinit:/etc/rc.d/init.d/rc sysinit
- l0:0:wait:/etc/rc.d/init.d/rc 0
- l1:S1:wait:/etc/rc.d/init.d/rc 1
- l2:2:wait:/etc/rc.d/init.d/rc 2
- l3:3:wait:/etc/rc.d/init.d/rc 3
- l4:4:wait:/etc/rc.d/init.d/rc 4
- l5:5:wait:/etc/rc.d/init.d/rc 5
- l6:6:wait:/etc/rc.d/init.d/rc 6
- ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
- su:S016:once:/sbin/sulogin
- 1:2345:respawn:/sbin/agetty tty1 9600
- 2:2345:respawn:/sbin/agetty tty2 9600
- 3:2345:respawn:/sbin/agetty tty3 9600
- 4:2345:respawn:/sbin/agetty tty4 9600
- 5:2345:respawn:/sbin/agetty tty5 9600
- 6:2345:respawn:/sbin/agetty tty6 9600
- # End /etc/inittab
- EOF
- cd ..
- rm -rf sysvinit-2.88dsf
复制代码
Tar-1.23
- tar xvf tar-1.23.tar.bz2
- cd tar-1.23
- sed -i /SIGPIPE/d src/tar.c
- patch -Np1 -i ../tar-1.23-overflow_fix-1.patch
- ./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin
- make
- sed -i '35 i\
- AT_UNPRIVILEGED_PREREQ' tests/remfiles01.at
- make check
- make install
- cd ..
- rm -rf tar-1.23
复制代码
Texinfo-4.13a
- tar xvf texinfo-4.13a.tar.gz
- cd texinfo-4.13
- ./configure --prefix=/usr
- make
- make install
- make TEXMF=/usr/share/texmf install-tex
- cd /usr/share/info
- rm -v dir
- for f in *
- do install-info $f dir 2>/dev/null
- done
- cd /sources
- rm -rf texinfo-4.13
复制代码
Udev-161
- tar xvf udev-161.tar.bz2
- cd udev-161
- tar -xvf ../udev-config-20100128.tar.bz2
- tar -xvf ../udev-161-testfiles.tar.bz2 --strip-components=1
- install -dv /lib/{firmware,udev/devices/{pts,shm}}
- mknod -m0666 /lib/udev/devices/null c 1 3
- ./configure --prefix=/usr \
- --sysconfdir=/etc --sbindir=/sbin \
- --with-rootlibdir=/lib --libexecdir=/lib/udev \
- --disable-extras --disable-introspection
- make
- make install
- rmdir -v /usr/share/doc/udev
- cd udev-config-20100128
- make install
- make install-doc
- cd ..
- cd ..
- rm -rf udev-161
复制代码
下面几个包在 LFS 里是没有的,得先在真机里下载好,用 scp 等方法放进虚拟机里去。
Nano-2.1.10
本身是 vim 的,但我从来不用,就干脆不装,装 nano。下载地址:http://www.nano-editor.org/dist/v2.1/nano-2.1.10.tar.gz
在真机里 wget 回来,用 scp 命令放进来就行。当然,如果你有别的方法一样可以搞掂。
这其实也是 BLFS 的内容,没所谓啦,什么时候装都一样。
- tar xvf nano-2.1.10.tar.gz
- cd nano-2.1.10
- ./configure --prefix=/usr --sysconfdir=/etc/nano \
- --enable-color --enable-multibuffer --enable-nanorc &&
- make
- make install &&
- install -v -m644 -D doc/nanorc.sample /etc/nano/nanorc.sample &&
- install -v -m755 -d /usr/share/doc/nano-2.1.10 &&
- install -v -m644 doc/{,man/,texinfo/}*.html /usr/share/doc/nano-2.1.10
- cd ..
- rm -rf nano-2.1.10
复制代码
Wget-1.12
顺手把这个也装了,下载地址:http://ftp.gnu.org/gnu/wget/wget-1.12.tar.bz2
- tar xvf wget-1.12.tar.bz2
- cd wget-1.12
- ./configure --prefix=/usr --sysconfdir=/etc &&
- make
- make install
- cd ..
- rm -rf wget-1.12
复制代码
为了一会装完 LFS 重启进入LFS不想摸黑进行 BLFS 等工作
这里装上 openssh ,以便我们能继续用 ssh 在真机里对虚拟机里的 LFS 进行操作。
OpenSSL
真机里下载好源码包、补丁。
wget -c http://www.openssl.org/source/openssl-1.0.0c.tar.gz
wget -c http://svn.cross-lfs.org/svn/repos/patches/openssl/openssl-1.0.0c-fix_manpages-1.patch
wget -c http://svn.cross-lfs.org/svn/repos/patches/openssl/openssl-1.0.0c-mips_support-1.patch
用 scp 等方式放进虚拟机里去。
- tar xvf openssl-1.0.0c.tar.gz
- cd openssl-1.0.0c
- patch -Np1 -i ../openssl-1.0.0c-fix_manpages-1.patch &&
- patch -Np1 -i ../openssl-1.0.0c-mips_support-1.patch &&
- ./config --openssldir=/etc/ssl --prefix=/usr shared &&
- make MANDIR=/usr/share/man
- make MANDIR=/usr/share/man install &&
- ln -sv ../../etc/ssl /usr/share &&
- cp -v -r certs /etc/ssl
- #要文档就安装之。
- #install -v -d -m755 /usr/share/doc/openssl-1.0.0c &&
- #cp -v -r doc/{HOWTO,README,*.{txt,html,gif}} \
- # /usr/share/doc/openssl-1.0.0c
- cd ..
- rm -rf openssl-1.0.0c
复制代码
OpenSSH
真机里下载好源码包。
wget -c ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-5.6p1.tar.gz
用 scp 等方式放进虚拟机里去。
- tar xvf openssh-5.6p1.tar.gz
- cd openssh-5.6p1
- groupadd -g 48 sshd &&
- useradd -c 'sshd PrivSep' -d /var/lib/sshd -g sshd -s /bin/false -u 48 sshd &&
- install -v -m700 -d /var/lib/sshd &&
- chown -v root:sys /var/lib/sshd
- ./configure --prefix=/usr --sysconfdir=/etc/ssh \
- --libexecdir=/usr/sbin --with-md5-passwords \
- --with-privsep-path=/var/lib/sshd \
- --with-default-path="/bin:/usr/bin" \
- --with-superuser-path="/sbin:/bin:/usr/sbin:/usr/bin" &&
- make
- make install
- #要文档则安装之。
- #install -v -m755 -d /usr/share/doc/openssh-5.6p1 &&
- #install -v -m644 INSTALL LICENCE OVERVIEW README* WARNING.RNG \
- #/usr/share/doc/openssh-5.6p1
- cd ..
- rm -rf openssh-5.6p1
复制代码
退出chroot环境
为Strip而进入chroot环境
- chroot $LFS /tools/bin/env -i \
- HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
- PATH=/bin:/usr/bin:/sbin:/usr/sbin \
- /tools/bin/bash --login
- /tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
- -exec /tools/bin/strip --strip-debug '{}' ';'
复制代码
退出chroot环境
###########第六章完###########
为最后的设置进入chroot环境
- chroot "$LFS" /usr/bin/env -i \
- HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
- PATH=/bin:/usr/bin:/sbin:/usr/sbin \
- /bin/bash --login
- cd /sources
复制代码
LFS-Bootscripts-20100627
- tar xvf lfs-bootscripts-20100627.tar.bz2
- cd lfs-bootscripts-20100627
- make install
- cd ..
- rm -rf lfs-bootscripts-20100627
复制代码
时间设置(Configuring the setclock Script)
- cat > /etc/sysconfig/clock << "EOF"
- # Begin /etc/sysconfig/clock
- UTC=1
- # Set this to any options you might need to give to hwclock,
- # such as machine hardware clock type for Alphas.
- CLOCKPARAMS=
- # End /etc/sysconfig/clock
- EOF
复制代码
设置bash下的键盘功能键设置
- cat > /etc/inputrc << "EOF"
- # Begin /etc/inputrc
- # Modified by Chris Lynn <roryo@roryo.dynup.net>
- # Allow the command prompt to wrap to the next line
- set horizontal-scroll-mode Off
- # Enable 8bit input
- set meta-flag On
- set input-meta On
- # Turns off 8th bit stripping
- set convert-meta Off
- # Keep the 8th bit for display
- set output-meta On
- # none, visible or audible
- set bell-style none
- # All of the following map the escape sequence of the value
- # contained in the 1st argument to the readline specific functions
- "\eOd": backward-word
- "\eOc": forward-word
- # for linux console
- "\e[1~": beginning-of-line
- "\e[4~": end-of-line
- "\e[5~": beginning-of-history
- "\e[6~": end-of-history
- "\e[3~": delete-char
- "\e[2~": quoted-insert
- # for xterm
- "\eOH": beginning-of-line
- "\eOF": end-of-line
- # for Konsole
- "\e[H": beginning-of-line
- "\e[F": end-of-line
- # End /etc/inputrc
- EOF
复制代码
设置Bash Shell启动文件(The Bash Shell Startup Files)
这 LANG 一行可以是:export LANG=zh_CN.UTF-8 等。
- cat > /etc/profile << "EOF"
- # Begin /etc/profile
- export LANG=en_US.UTF-8
- export INPUTRC=/etc/inputrc
- alias ls="ls --color"
- export PS1='\u:\w\$ '
- # End /etc/profile
- EOF
复制代码
设置本地网络名
- echo "HOSTNAME=mylinux" > /etc/sysconfig/network
复制代码
设置本地网络名
- cat > /etc/hosts << "EOF"
- # Begin /etc/hosts (no network card version)
- 127.0.0.1 mylinux localhost
- # End /etc/hosts (no network card version)
- EOF
复制代码
设置网络的静态地址
注意:IP、GATEWAY、BROADCAST的地址根据自己的实际情况设置。
- cd /etc/sysconfig/network-devices &&
- mkdir -v ifconfig.eth0 &&
- cat > ifconfig.eth0/ipv4 << "EOF"
- ONBOOT=yes
- SERVICE=ipv4-static
- IP=192.168.1.101
- GATEWAY=192.168.1.1
- PREFIX=24
- BROADCAST=192.168.1.255
- EOF
- cd /sources
复制代码
设置DNS
根据实际情况
- cat > /etc/resolv.conf << "EOF"
- # Begin /etc/resolv.conf
- nameserver 211.162.61.235
- nameserver 211.162.62.1
- # End /etc/resolv.conf
- EOF
复制代码
建立fstab文件
- cat > /etc/fstab << "EOF"
- # Begin /etc/fstab
- # file system mount-point type options dump fsck
- # order
- /dev/sda2 / ext3 defaults 1 1
- /dev/sda1 swap swap pri=1 0 0
- proc /proc proc defaults 0 0
- sysfs /sys sysfs defaults 0 0
- devpts /dev/pts devpts gid=4,mode=620 0 0
- shm /dev/shm tmpfs defaults 0 0
- # End /etc/fstab
- EOF
复制代码
内核、GRUB
根据机器实际情况而配置,我这里将提供一份可能用于virtualbox-3.2_3.2.12-68302的.config
- tar xvf linux-2.6.35.4.tar.bz2
- cd linux-2.6.35.4
- make mrproper
- make menuconfig
- make
- make modules_install
- cp -v arch/x86/boot/bzImage /boot/vmlinux-2.6.35.4-lfs-6.7
- cp -v System.map /boot/System.map-2.6.35.4
- cp -v .config /boot/config-2.6.35.4
- cd ..
- install -v -m755 -d /etc/modprobe.d
- cat > /etc/modprobe.d/usb.conf << "EOF"
- # Begin /etc/modprobe.d/usb.conf
- install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
- install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
- # End /etc/modprobe.d/usb.conf
- EOF
- grub-install --grub-setup=/bin/true /dev/sda
- grub-mkconfig -o /boot/grub/grub.cfg
- grub-setup /dev/sda
复制代码
从这里开始就是《LFS 6.7 上安装 xorg 7.5》
在前面,我们讨论了如何快速在 VBOX 上构建一个 LFS 6.7 ,但一部电脑没有图形界面,那是怎样一种悲惨,当然,特殊用途的除外。
本文将是讨论如果在我们建立好的 LFS 上安装 xorg 7.5 。
进入 LFS 里启动ssh: /usr/sbin/sshd 。则可以在真机里用连接虚拟机里的 LFS ,在真机里进行操作。
又或者用LiveCD 进入 chroot 环境进行操作:
- chroot "$LFS" /usr/bin/env -i \
- HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
- PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R7/bin \
- /bin/bash --login
复制代码
chroot 进去进行操作,因为摸黑实在有点那个,你懂的。
又或者可以在创建好的 LFS 里摸黑进行。
如果我们在 LFS 里已经装过 wget ,可以用 wget 来下载源码包了。
在 LFS 里随便找个地方,建立个文件夹,进行以下工作,我选择 /sources/xc
下载包包。
- wget -c http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tar.bz2
- wget -c http://xorg.freedesktop.org/releases/individual/lib/libXau-1.0.6.tar.bz2
- wget -c http://xorg.freedesktop.org/releases/individual/lib/libXdmcp-1.0.3.tar.bz2
- wget -c http://ftp.gnu.org/pub/gnu/ed/ed-1.5.tar.gz
- wget -c http://downloads.sourceforge.net/expat/expat-2.0.1.tar.gz
- wget -c http://www.linuxfromscratch.org/patches/blfs/svn/expat-2.0.1-fixes-3.patch
- wget -c http://xmlsoft.org/sources/libxml2-2.7.7.tar.gz
- wget -c http://www.w3.org/XML/Test/xmlts20080827.tar.gz
- wget -c http://downloads.sourceforge.net/freetype/freetype-2.4.4.tar.bz2
- wget -c http://downloads.sourceforge.net/freetype/freetype-doc-2.4.4.tar.bz2
- wget -c http://fontconfig.org/release/fontconfig-2.8.0.tar.gz
- wget -c http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.bz2
- wget -c http://xmlsoft.org/sources/libxslt-1.1.26.tar.gz
- wget -c http://xcb.freedesktop.org/dist/xcb-proto-1.5.tar.bz2
- wget -c http://xcb.freedesktop.org/dist/libxcb-1.4.tar.bz2
- wget -c http://xorg.freedesktop.org/releases/individual/data/xbitmaps-1.1.0.tar.bz2
- wget -c http://downloads.sourceforge.net/libpng/libpng-1.2.44.tar.bz2
- wget -c http://www.linuxfromscratch.org/patches/blfs/svn/libpng-1.2.44-apng-1.patch
- wget -c http://xorg.freedesktop.org/releases/individual/data/xcursor-themes-1.0.2.tar.bz2
- wget -c http://www.cpan.org/authors/id/C/CH/CHORNY/XML-Parser-2.40.tar.gz
- wget -c http://launchpad.net/intltool/trunk/0.41.1/+download/intltool-0.41.1.tar.gz
- wget -c http://xlibs.freedesktop.org/xkbdesc/xkeyboard-c onfig-1.8.tar.bz2
- wget -c http://xorg.freedesktop.org/releases/individual/app/luit-1.0.5.tar.bz2
- wget -c http://cairographics.org/releases/pixman-0.21.2.tar.gz
- wget -c http://www.hpl.hp.com/research/linux/atomic_ops/download/libatomic_ops-1.2.tar.gz
- wget -c http://dri.freedesktop.org/libdrm/libdrm-2.4.21.tar.bz2
- wget -c ftp://ftp.freedesktop.org/pub/mesa/7.8.2/MesaLib-7.8.2.tar.bz2
- wget -c ftp://ftp.freedesktop.org/pub/mesa/7.8.2/MesaDemos-7.8.2.tar.bz2
- wget -c http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.8.2.tar.bz2
- #proto
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/proto-7.5-3.md5
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/proto-7.5-3.wget
- mkdir proto &&
- cd proto &&
- grep -v '^#' ../proto-7.5-3.wget | wget -i- -c \
- -B http://xorg.freedesktop.org/releases/individual/proto/ &&
- md5sum -c ../proto-7.5-3.md5
- cd ..
- #util
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/util-7.5-3.md5
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/util-7.5-3.wget
- mkdir util &&
- cd util &&
- grep -v '^#' ../util-7.5-3.wget | wget -i- -c \
- -B http://xorg.freedesktop.org/releases/individual/util/ &&
- md5sum -c ../util-7.5-3.md5
- cd ..
- #lib
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/lib-7.5-3.md5
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/lib-7.5-3.wget
- mkdir lib &&
- cd lib &&
- grep -v '^#' ../lib-7.5-3.wget | wget -i- -c \
- -B http://xorg.freedesktop.org/releases/individual/lib/ &&
- md5sum -c ../lib-7.5-3.md5
- cd ..
- #app
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/app-7.5-3.md5
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/app-7.5-3.wget
- mkdir app &&
- cd app &&
- grep -v '^#' ../app-7.5-3.wget | wget -i- -c \
- -B http://xorg.freedesktop.org/releases/individual/app/ &&
- md5sum -c ../app-7.5-3.md5
- cd ..
- #font
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/font-7.5-3.md5
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/font-7.5-3.wget
- mkdir font &&
- cd font &&
- grep -v '^#' ../font-7.5-3.wget | wget -i- -c \
- -B http://xorg.freedesktop.org/releases/individual/font/ &&
- md5sum -c ../font-7.5-3.md5
- cd ..
- #driver
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/driver-7.5-3.md5
- wget -c http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/driver-7.5-3.wget
- #编辑 driver-7.5-3.wget 留下你要的,不要的用“#”注释掉
- #我这里只是留下四个:
- #xf86-input-evdev-2.5.0.tar.bz2
- #xf86-input-keyboard-1.4.0.tar.bz2
- #xf86-input-mouse-1.6.0.tar.bz2
- #xf86-video-vesa-2.3.0.tar.bz2
- mkdir driver &&
- cd driver &&
- grep -v '^#' ../driver-7.5-3.wget | wget -i- -c \
- -B http://xorg.freedesktop.org/releases/individual/driver/ &&
- md5sum -c ../driver-7.5-3.md5
- cd ..
复制代码
准备工作
- export XORG_PREFIX="/usr/X11R7"
- export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc \
- --mandir=$XORG_PREFIX/share/man --localstatedir=/var"
复制代码
增加 "/usr/X11R7/lib" 到 "/etc/ld.so.conf" 文件
- cat >> /etc/ld.so.conf << EOF
- # Begin Xorg addition to /etc/ld.so.conf
- ${XORG_PREFIX}/lib
- # End Xorg addition to /etc/ld.so.conf
- EOF
复制代码
老一点版本的lfs是没有pkg-config的,不过6.7版本的我们在LFS过程已经装过,这里不用装。
这个环境变量很重要,要不在 lib 那一步卡死过不去就你爸是李钢都没有用。
- export PKG_CONFIG_PATH="/usr/X11R7/lib:/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11R7/lib/pkgconfig:/usr/X11R7/share/pkgconfig"
复制代码
下面这条变形用来过xcursor-themes-1.0.2的安装。如果是chroot,PATH一项最好也设成这样。
- export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R7/bin
复制代码
我先把python 给装上,这是我的习惯,也可以在需要时候才安装。
- tar xvf Python-2.7.1.tar.bz2
- cd Python-2.7.1
- sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" setup.py &&
- ./configure --prefix=/usr --enable-shared &&
- make
- make install
- cd ..
- rm -rf Python-2.7.1
复制代码
Xorg Protocol Headers
- bash -e #exit on all errors
- section=proto
- version=7.5-3
- cd $section
- # build packages
- for package in $(grep -v '^#' ../${section}-${version}.wget)
- do
- packagedir=$(echo $package | sed 's/.tar.bz2//')
- tar -xf $package
- cd $packagedir
- ./configure $XORG_CONFIG
- make install
- cd ..
- rm -rf $packagedir
- echo $packagedir ======is=====end=====here====
- done 2>&1 | tee -a ../xorg-${section}-${version}-compile.log #log the entire loop
- cd ..
复制代码
Xorg Utilities
- bash -e #exit on all errors
- section=util
- version=7.5-3
- cd $section
- # build packages
- for package in $(grep -v '^#' ../${section}-${version}.wget)
- do
- packagedir=$(echo $package | sed 's/.tar.bz2//')
- tar -xf $package
- cd $packagedir
- ./configure $XORG_CONFIG &&
- make
- make install
- cd ..
- rm -rf $packagedir
- echo $packagedir ======is=====end=====here====
- done 2>&1 | tee -a ../xorg-${section}-${version}-compile.log #log the entire loop
- cd ..
复制代码
libXau-1.0.6
- tar xvf libXau-1.0.6.tar.bz2
- cd libXau-1.0.6
- ./configure $XORG_CONFIG &&
- make
- make install
- cd ..
- rm -rf libXau-1.0.6
复制代码
libXdmcp-1.0.3
- tar xvf libXdmcp-1.0.3.tar.bz2
- cd libXdmcp-1.0.3
- ./configure $XORG_CONFIG &&
- make
- make install
- cd ..
- rm -rf libXdmcp-1.0.3
复制代码
Xorg Libraries之前先安装它的依赖条件
Ed-1.5
- tar xvf ed-1.5.tar.gz
- cd ed-1.5
- ./configure --prefix=/usr --bindir=/bin &&
- make
- make install
- cd ..
- rm -rf ed-1.5
复制代码
Expat-2.0.1
注意BLFS手册上有错,是expat-2.0.1-fixes-3.patch,而不是expat-2.0.1-fixes-2.patch
- tar xvf expat-2.0.1.tar.gz
- cd expat-2.0.1
- patch -Np1 -i ../expat-2.0.1-fixes-3.patch &&
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf expat-2.0.1
复制代码
libxml2-2.7.7
- tar xvf libxml2-2.7.7.tar.gz
- cd libxml2-2.7.7
- tar xf ../xmlts20080827.tar.gz
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf libxml2-2.7.7
复制代码
FreeType-2.4.4
- tar xvf freetype-2.4.4.tar.bz2
- cd freetype-2.4.4
- tar -xf ../freetype-doc-2.4.4.tar.bz2 \
- --strip-components=2 -C docs
- sed -i -r 's:.*(#.*SUBPIXEL.*) .*:\1:' \
- include/freetype/config/ftoption.h &&
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf freetype-2.4.4
复制代码
Fontconfig-2.8.0
- tar xvf fontconfig-2.8.0.tar.gz
- cd fontconfig-2.8.0
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --disable-docs \
- --without-add-fonts \
- --docdir=/usr/share/doc/fontconfig-2.8.0 &&
- make
- make install
- cd ..
- rm -rf fontconfig-2.8.0
复制代码
libpthread-stubs-0.1
- tar xvf libpthread-stubs-0.1.tar.bz2
- cd libpthread-stubs-0.1
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf libpthread-stubs-0.1
复制代码
libxslt-1.1.26
- tar xvf libxslt-1.1.26.tar.gz
- cd libxslt-1.1.26
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf libxslt-1.1.26
复制代码
xcb-proto-1.5
- tar xvf xcb-proto-1.5.tar.bz2
- cd xcb-proto-1.5
- ./configure $XORG_CONFIG
- make install
- cd ..
- rm -rf xcb-proto-1.5
复制代码
libxcb-1.4
- tar xvf libxcb-1.4.tar.bz2
- cd libxcb-1.4
- ./configure $XORG_CONFIG &&
- make
- make install
- cd ..
- rm -rf libxcb-1.4
复制代码
Xorg Libraries
前面我们解决这么多的依赖问题就是为了装这玩意。
发觉BLFS svn 版本上矛盾,libX11 加上这样的参数来编译--without-xcb。加上它是因为其要依赖libxcb,我们才刚装完,这个参数本身就可以去掉。而Mesa那里又有--enable-xcb 参数,从而导致 Mesa的configur 找不到libX11。我这里去掉了--without-xcb参数,加上--enable-loadable-i18n开启i18n。
- bash -e #exit on all errors
- section=lib
- version=7.5-3
- cd $section
- # build packages
- for package in $(grep -v '^#' ../${section}-${version}.wget)
- do
- packagedir=$(echo $package | sed 's/.tar.bz2//')
- tar -xf $package
- cd $packagedir
- case $(basename "$PWD") in
- libXfont-[0-9]* )
- ./configure $XORG_CONFIG --disable-devel-docs
- ;;
- libX11-[0-9]* )
- ./configure $XORG_CONFIG --enable-loadable-i18n
- ;;
- libXt-[0-9]* )
- ./configure $XORG_CONFIG \
- --with-appdefaultdir=/etc/X11/app-defaults
- ;;
- * )
- ./configure $XORG_CONFIG
- ;;
- esac &&
- make
- make install
- ldconfig
- cd ..
- rm -rf $packagedir
- echo $packagedir ======is=====end=====here====
- done 2>&1 | tee -a ../xorg-${section}-${version}-compile.log #log the entire loop
- cd ..
复制代码
如果是装在/usr 下面这三条玩意儿就不用,我这里是装在/usr/X11R7,所有要。我加多了一条,第三条。
- ln -sv $XORG_PREFIX/lib/X11 /usr/lib/X11 &&
- ln -sv $XORG_PREFIX/include/X11 /usr/include/X11 &&
- ln -sv ${XORG_PREFIX}/bin /usr/bin/X11 &&
- ln -sv $XORG_PREFIX /usr/X11R6
复制代码
Xbitmaps-1.1.0
- tar xvf xbitmaps-1.1.0.tar.bz2
- cd xbitmaps-1.1.0
- ./configure $XORG_CONFIG
- make install
- cd ..
- rm -rf xbitmaps-1.1.0
复制代码
MesaLib-7.8.2
- tar xvf libatomic_ops-1.2.tar.gz
- cd libatomic_ops-1.2
- sed -i \
- 's|datadir)/@PACKAGE@|datadir)/doc/@PACKAGE@/@PACKAGE_VERSION@|' \
- doc/Makefile.in &&
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf libatomic_ops-1.2
- tar xvf libdrm-2.4.21.tar.bz2
- cd libdrm-2.4.21
- ./configure --prefix=$XORG_PREFIX &&
- make
- make install
- cd ..
- rm -rf libdrm-2.4.21
- tar xvf MesaLib-7.8.2.tar.bz2
- tar xvf MesaDemos-7.8.2.tar.bz2
- cd Mesa-7.8.2
- sed 's@FLAGS="-g@FLAGS="@' -i configure
- ./configure $XORG_CONFIG --enable-xcb
- make
- make install
- install -v -m755 progs/xdemos/glx{info,gears} ${XORG_PREFIX}/bin
- ln -s -v ${XORG_PREFIX}/include/GL /usr/include
- cd ..
- rm -rf Mesa-7.8.2
复制代码
Xorg Applications
在这之前先要解决依赖关系
- libpng-1.2.44
- tar xvf libpng-1.2.44.tar.bz2
- cd libpng-1.2.44
- patch -Np1 -i ../libpng-1.2.44-apng-1.patch
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf libpng-1.2.44
复制代码
- bash -e #exit on all errors
- section=app
- version=7.5-3
- cd $section
- # build packages
- for package in $(grep -v '^#' ../${section}-${version}.wget)
- do
- packagedir=$(echo $package | sed 's/.tar.bz2//')
- tar -xf $package
- cd $packagedir
- case $(basename "$PWD") in
- twm-[0-9]* )
- sed -e '/^rcdir =/s,^\(rcdir = \).*,\1/etc/X11/app-defaults,' \
- -i src/Makefile.in &&
- ./configure $XORG_CONFIG
- ;;
- xinit-[0-9]* )
- ./configure $XORG_CONFIG --with-xinitdir=/etc/X11/app-defaults
- ;;
- * )
- ./configure $XORG_CONFIG
- ;;
- esac &&
- make
- make install
- cd ..
- rm -rf $packagedir
- echo $packagedir ======is=====end=====here====
- done 2>&1 | tee -a ../xorg-${section}-${version}-compile.log #log the entire loop
- cd ..
复制代码
xcursor-themes-1.0.2
- tar xvf xcursor-themes-1.0.2.tar.bz2
- cd xcursor-themes-1.0.2
- ./configure $XORG_CONFIG &&
- make
- make install
- cd ..
- rm -rf xcursor-themes-1.0.2
复制代码
Xorg Fonts
- bash -e #exit on all errors
- section=font
- version=7.5-3
- cd $section
- # build packages
- for package in $(grep -v '^#' ../${section}-${version}.wget)
- do
- packagedir=$(echo $package | sed 's/.tar.bz2//')
- tar -xf $package
- cd $packagedir
- ./configure $XORG_CONFIG
- make
- make install
- cd ..
- rm -rf $packagedir
- echo $packagedir ======is=====end=====here====
- done 2>&1 | tee -a ../xorg-${section}-${version}-compile.log #log the entire loop
- install -v -d -m755 /usr/share/fonts &&
- ln -svn $XORG_PREFIX/share/fonts/X11/fonts/OTF /usr/share/fonts/X11-OTF &&
- ln -svn $XORG_PREFIX/share/fonts/X11/fonts/TTF /usr/share/fonts/X11-TTF
- cd ..
复制代码
下面为 XKeyboardConfig-1.8 的安装解决依赖关系。
Perl Module XML:arser
- tar xvf XML-Parser-2.40.tar.gz
- cd XML-Parser-2.40
- perl Makefile.PL &&
- make &&
- make test
- make install
- cd ..
- rm -rf XML-Parser-2.40
复制代码
Intltool-0.41.1
- tar xvf intltool-0.41.1.tar.gz
- cd intltool-0.41.1
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf intltool-0.41.1
复制代码
XKeyboardConfig-1.8
上面已把依赖关系给搞掂了。
- tar xvf xkeyboard-config-1.8.tar.bz2
- cd xkeyboard-config-1.8
- ./configure $XORG_CONFIG --with-xkb-rules-symlink=xorg &&
- make
- make install
- cd ..
- rm -rf xkeyboard-config-1.8
复制代码
Luit-1.0.5
- tar xvf luit-1.0.5.tar.bz2
- cd luit-1.0.5
- ./configure $XORG_CONFIG &&
- make
- make install
- cd ..
- rm -rf luit-1.0.5
复制代码
解决Xorg-Server-1.8.2的依赖关系,openssl之前在LFS那里我已经安装了,这里省略
pixman-0.15.20
这里我换个最新版的,要不装GTK2时过不去。
- tar xvf pixman-0.21.2.tar.gz
- cd pixman-0.21.2
- ./configure --prefix=/usr &&
- make
- make install
- cd ..
- rm -rf pixman-0.21.2
复制代码
Xorg-Server-1.8.2
- tar xvf xorg-server-1.8.2.tar.bz2
- cd xorg-server-1.8.2
- ./configure $XORG_CONFIG \
- --with-module-dir=$XORG_PREFIX/lib/X11/modules \
- --with-xkb-output=/var/lib/xkb \
- --enable-install-setuid \
- --disable-config-hal &&
- make
- make install
- cd ..
- rm -rf xorg-server-1.8.2
复制代码
Xorg Drivers
编辑driver-7.5-3.wget,留下自己要的就行。
- bash -e #exit on all errors
- section=driver
- version=7.5-3
- cd $section
- # build packages
- for package in $(grep -v '^#' ../${section}-${version}.wget)
- do
- packagedir=$(echo $package | sed 's/.tar.bz2//')
- tar -xf $package
- cd $packagedir
- case $(basename "$PWD") in
- xf86-input-evdev-[0-9]* | xf86-video-ati-[0-9]* | \
- xf86-video-fbdev-[0-9]* | xf86-video-glint-[0-9]* | \
- xf86-video-newport-[0-9]* )
- sed -i -e "s/\xc3\xb8/\\\\[\/o]/" \
- -e "s/\xc3\xa4/\\\\[:a]/" \
- -e "s/\xc3\x9c/\\\\[:U]/" man/*.man
- ;;
- esac &&
- case $(basename "$PWD") in
- xf86-video-s3-[0-9]* | xf86-video-xgi-[0-9]* )
- for file in `grep -Rl "xf86Version.h" *`
- do
- sed 's@xf86Version.h@xorgVersion.h@g' -i "$file"
- done
- ;;
- esac &&
- ./configure $XORG_CONFIG \
- --with-xorg-module-dir=$XORG_PREFIX/lib/X11/modules &&
- make
- make install
- cd ..
- rm -rf $packagedir
- echo $packagedir ======is=====end=====here====
- done 2>&1 | tee -a ../xorg-${section}-${version}-compile.log #log the entire loop
- cd ..
复制代码
Configuring The X Window System
对edit xorg.conf.new进行编译,然后测试
- X -retro -config ~/xorg.conf.new
复制代码
如果没响应,请查看/var/log/Xorg.0.log
安装xorg.conf文件
- install -v -m644 ~/xorg.conf.new /etc/X11/xorg.conf
复制代码
到此,xorg 安装完毕,看个人喜欢用什么窗口管理器、桌面之类的,去装吧。 |
|