Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1079055
  • 博文数量: 277
  • 博客积分: 8313
  • 博客等级: 中将
  • 技术积分: 2976
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-22 11:25
文章分类

全部博文(277)

文章存档

2013年(17)

2012年(66)

2011年(104)

2010年(90)

我的朋友

分类: LINUX

2010-09-21 18:58:13

2.2. Creating a New Partition
扩大vmware硬盘大小,在cmd里:
d:
"Program Files\VMware Workstation\vmware-vdiskmanager.exe" -x 56Gb lfs_ubuntu\Ubuntu.vmdk
在linux里创建分区
fdisk /dev/sda

 

2.3. Creating a File System on the Partition
mke2fs -jv /dev/sda3

 

2.4. Mounting the New Partition
export LFS=/mnt/lfs
mkdir -pv $LFS
mount -v -t ext3 /dev/sda3 $LFS

 

4.2. Creating the $LFS/tools Directory
mkdir -v $LFS/sources
mkdir -v $LFS/tools
ln -sv $LFS/tools /

 

4.3. Adding the LFS User
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

 

4.4. Setting Up the Environment
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

 

5.4. Binutils-2.20.1 - Pass 1
tar -jxf 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
case $(uname -m) in
  x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
esac
make install
cd ..
rm -rf binutils-2.20.1 binutils-build

 

5.5. GCC-4.5.1 - Pass 1
tar -jxf 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 gcc-build    
    


5.6. Linux-2.6.35.4 API Headers
tar -jxf 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 ..

 

5.7. Glibc-2.12.1
tar -jxf 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.16.1 --with-headers=/tools/include \
    libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes
make
make install;
cd ..
rm -rf glibc-2.12.1 glibc-build

 

5.8. Adjusting the Toolchain
SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs
$LFS_TGT-gcc -dumpspecs | sed \
  -e \
  -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'

rm -v dummy.c a.out

 

5.9. Binutils-2.20.1 - Pass 2
tar -jxf 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-2.20.1 binutils-build

 

5.10. GCC-4.5.1 - Pass 2
tar -jxf 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 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 \
  -e $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
case $(uname -m) in
  x86_64)
    for file in $(find gcc/config -name t-linux64) ; do \
      cp -v $file{,.orig}
      sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file
    done
  ;;
esac
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 \
    --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
    --without-ppl --without-cloog
make LD_LIBRARY_PATH=$(pwd)/$(../gcc-4.5.1/config.guess)/libgcc
make install
ln -vs gcc /tools/bin/cc
cd ..
rm -rf gcc-4.5.1 gcc-build

echo 'main(){}' > dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'
rm -v dummy.c a.out

 


5.11. Tcl-8.5.8
tar -xf tcl8.5.8-src.tar.gz
cd tcl8.5.8
cd unix
./configure --prefix=/tools
make
TZ=UTC make test
make install
chmod -v u+w /tools/lib/libtcl8.5.so
make install-private-headers
ln -sv tclsh8.5 /tools/bin/tclsh
cd ../..
rm -rf tcl8.5.8

 

5.12. Expect-5.44.1.15
tar -xf 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 test
make SCRIPTS="" install
cd ..
rm -rf expect-5.44.1.15

 

5.13. DejaGNU-1.4.4
tar -xf 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
make check
cd ..
rm -rf dejagnu-1.4.4

5.14. Ncurses-5.7
tar -xf 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
 
5.15. Bash-4.1
tar -xf 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 tests
make install
ln -sv bash /tools/bin/sh
cd ..
rm -rf bash-4.1
 
5.16. Bzip2-1.0.5
tar -xf bzip2-1.0.5.tar.gz
cd bzip2-1.0.5
make
make PREFIX=/tools install
cd ..
rm -rf bzip2-1.0.5
 

5.17. Coreutils-8.5
tar -xf coreutils-8.5.tar.gz
cd coreutils-8.5
./configure --prefix=/tools --enable-install-program=hostname
make
make RUN_EXPENSIVE_TESTS=yes check
make install
cp -v src/su /tools/bin/su-tools
cd ..
rm -rf coreutils-8.5
 

5.18. Diffutils-3.0
tar -xf diffutils-3.0.tar.gz
cd diffutils-3.0
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf diffutils-3.0
 
5.19. File-5.04
tar -xf file-5.04.tar.gz
cd file-5.04
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf file-5.04
 

5.20. Findutils-4.4.2
tar -xf findutils-4.4.2.tar.gz
cd findutils-4.4.2
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf findutils-4.4.2
 
5.21. Gawk-3.1.8
tar -xf gawk-3.1.8.tar.bz2
cd gawk-3.1.8
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf gawk-3.1.8
 
5.22. Gettext-0.18.1.1
tar -xf 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 ../..
rm -rf gettext-0.18.1.1
 
5.23. Grep-2.6.3
tar -xf grep-2.6.3.tar.gz
cd grep-2.6.3
./configure --prefix=/tools \
    --disable-perl-regexp
make
make check
make install
cd ..
rm -rf grep-2.6.3
 
 
5.24. Gzip-1.4
tar -xf gzip-1.4.tar.gz
cd gzip-1.4
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf gzip-1.4
 
5.25. M4-1.4.14
tar -xf m4-1.4.14.tar.bz2
cd m4-1.4.14
sed -i -e '/"m4.h"/a\
#include ' src/path.c
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf m4-1.4.14
 

5.26. Make-3.82
tar -xf make-3.82.tar.bz2
cd make-3.82
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf make-3.82
 
5.27. Patch-2.6.1
tar -xf patch-2.6.1.tar.bz2
cd patch-2.6.1
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf patch-2.6.1
 

5.28. Perl-5.12.1
tar -xf 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                 
 

5.29. Sed-4.2.1
tar -xf sed-4.2.1.tar.bz2
cd sed-4.2.1
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf sed-4.2.1
 

5.30. Tar-1.23
tar -xf tar-1.23.tar.bz2
cd tar-1.23
sed -i /SIGPIPE/d src/tar.c
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf tar-1.23
 
5.31. Texinfo-4.13a 
tar -xf texinfo-4.13a.tar.gz
cd texinfo-4.13
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf texinfo-4.13
 

5.32. Stripping
strip --strip-debug /tools/lib/*
strip --strip-unneeded /tools/{,s}bin/*
rm -rf /tools/{,share}/{info,man}
 
 
5.33. Changing Ownership
chown -R root:root $LFS/tools
阅读(876) | 评论(0) | 转发(0) |
0

上一篇:Linux汇编语言开发指南

下一篇:lfs_2

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