22.-lfs

Click here to load reader

Post on 10-Nov-2014

14 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

#!/bin/bash #####PARTICIONADO DISCOS ##### read -p "Disco a particionar Ej:/dev/sdb:" disco dd if=$disco of=mbrcopia bs=512 count=1 echo "d 1 d 2 d 3 d 4 n p 1

953 n p 2

t 2 82 w"|fdisk $disco read -p "El disco elegido $disco es el correcto s/n:" resp

if [ "$resp" = "n" ] then dd if=mbrcopia of=$disco bs=512 count=1 exit fi

#####FIN PARTICIONADO##### #####PAQUETES ANFITRION (DEBIAN)#####

ifconfig eth0 192.168.0.58 255.255.255.0 route add default gw 192.168.0.1 echo "nameserver 8.8.8.8">/etc/resolv.conf echo "nameserver 8.8.4.4">>/etc/resolv.conf ##### FIN PAQUETES ANFITRION ##### apt-get update apt-get install autoconf apt-get install automake apt-get install bash apt-get install binutils apt-get install bison apt-get install bzip2 apt-get install coreutils apt-get install dejaGNU apt-get install diffutils apt-get install expect apt-get install e2fsprogs apt-get install file

apt-get install findutils apt-get install flex apt-get install gawk apt-get install gcc apt-get install libgdbm -dev apt-get install Gettext apt-get install glibc6 apt-get install libgmp3 -dev apt-get install grep apt-get install groff apt-get install grub apt-get install gzip apt-get install libi18n-charset-perl apt-get install inetutils-tools apt-get install iproute -dev apt-get install kbd apt-get install kmod apt-get install less apt-get install libtool apt-get install m4 apt-get install make apt-get install man-DB apt-get install libmpc -dev apt-get install libmpfr -dev apt-get install libncurses5 apt-get install patch apt-get install perl

apt-get install procps apt-get install psmisc apt-get install readline-common apt-get install sed apt-get install sysklogd apt-get install sysvinit apt-get install tar apt-get install tcl apt-get install texinfo apt-get install udev apt-get install util-linux apt-get install vim apt-get install xz-utils apt-get install libzzip -dev apt-get install zlib1g -dev apt-get install sysklogd

##### FORMATEO DISCOS ###### disco="/dev/sdb" particion1="$disco"1 particion2="$disco"2 echo $particion1 mkswap $particion2 #####FIN FORMATEO#####

####Montaje sobre anfitrion#### mkdir /mnt/lfs

export LFS=/mnt/lfs mount -t ext3 $disco $LFS /usr/sbin/swapon $particion2 #### Montaje ####

####Paquetes Fuentes#### mkdir $LFS/sources cd LFS/sources wget http://www.linuxfromscratch.org/lfs/downloads/7.1/wget-list wget -i wget-list -P $LFS/sources wget http://source-forge.net/projects/libpng/files/zlib-1.2.6.tar.bz2/download ####Fin paquetes fuentes#### #### Montaje LFS #### echo "/dev/$particion1 $LFS ext3 defaults 0 0">>/etc/fstab

#### Fin montaje LFS ####

####Agregr usuario alfs y permisos#### useradd alfs -s /bin/bash -g alfs -m -k /dev/null alfs passwd alfs groupadd alfs mkdir $LFS/tools ln -sv $LFS/tools chown alfs $LFS/tools chown -R alfs /$LFS/sources su - alfs ####Fin usuario permisos####

####Ajuste Bashrc y bash_profile#### cat > ~/bash.profile ~/bashrc $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 cd .. rm -rf glibc-build cd $LFS/sources #####glibc##### #####binutils##### tar -jxvf binutils-2.22.tar.bz2 cd binutils-2.22 mkdir -v ../binutils-build cd ../binutils-build CC="$LFS_TGT-gcc -B/tools/lib/" \ AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \ ../binutils-2.22/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

cd $LFS/sources #####Fin BINUTILS##### #####GCC##### tar -jxvf gcc-4.6.2.tar.bz2 cd gcc-4.6.2 patch -Np1 -i ../gcc-4.6.2-startfiles_fix-1.patch cp -v gcc/Makefile.in{,.orig} sed '[email protected]\./fixinc\[email protected] [email protected]' 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 '[email protected]/lib\(64\)\?\(32\)\?/[email protected]/tools&@g' \ -e '[email protected]/[email protected]/[email protected]' $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.1.0.tar.bz2 mv -v mpfr-3.1.0 mpfr tar -Jxf ../gmp-5.0.4.tar.xz mv -v gmp-5.0.4 gmp tar -zxf ../mpc-0.9.tar.gz mv -v mpc-0.9 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.6.2/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 \ --without-ppl --without-cloog \ --with-mpfr-include=$(pwd)/../gcc-4.6.2/mpfr/src \ --with-mpfr-lib=$(pwd)/mpfr/src/.libs make

make install ln -vs gcc /tools/bin/cc echo 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /tools' rm -v dummy.c a.out cd .. rm -rf gcc-build cd $LFS/sources #####FIN GCC#####

#####TCL##### tar -jzvf tcl-8.5.11-1.tar.bz2 cd tcl-8.5.11-1 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 $LFS/sources #####FIN TCL##### ##### Expect ##### tar -zxvf expect5.45.tar.gz cd expect5.45

cp -v configure{,.orig} sed 's:/usr/local/bin:/bin:' configure.orig > configure ./configure --prefix=/tools --with-tcl=/tools/lib \ --with-tclinclude=/tools/include make make test make SCRIPTS="" install cd $LFS/sources #####FIN Expect##### #####DejaGNU##### tar -zxvf dejagnu-1.5.tar.gz ./configure --prefix=/tools make install make check cd $LFS/sources #####FIM DejaGNU##### #####Check##### tar -zxvf check-0.9.8.tar.gz cd check-0.9.8 ./configure --prefix=/tools make make check make install cd $LFS/sources #####FIN Check##### #####Ncurses##### tar -zxvf Ncurses-5.9.tar.gz

cd Ncurses-5.9 ./configure --prefix=/tools --with-shared \ --without-debug --without-ada --enable-overwrite

make make install cd $LFS/sources #####FIN Ncurses##### #####Bash##### tar -zxvf bash-4.2.tar.gz cd bash-4.2

patch -Np1 -i ../bash-4.2-fixes-4.patch ./configure --prefix=/tools --without-bash-malloc make make test make install ln -vs bash /tools/bin/sh cd $LFS/sources #####FIN Bash##### #####Bzip##### tar -zxvf bzip-1.0.6.tar.gz cd bzip-1.0.6 make make PREFIX=/tools install cd $LFS/sources #####FIN Bzip#####

#####Coreutils##### tar -Jxvf coreutils-8.15.tar.xz cd coreutils-8.15 ./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 $LFS/sources #####Fin Coreutils##### #####Diffutils##### tar -zxvf diffutils-3.2.tar.gz cd diffutils-3.2 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin Coreutils##### #####file##### tar -zxvf tar-5.10.tar.gz cd tar-5.10 ./configure --prefix=/tools make make check make install cd $LFS/sources

#####fin file##### #####findutils##### tar -zxvf findutils-4.4.2.tar.gz cd findutils-4.4.2 ./configure --prefix=/tools make make check make install cd $LFS/sources #####fin findutils##### #####Gawk##### tar -zxvf gawk-4.0.0.tar.gz cd gawk-4.0.0 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin Gawk##### #####Gettext##### tar -zxvf 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 $LFS/sources #####Fin Gettext##### #####grep##### tar -Jxvf grep-2.10.tar.xz cd grep-2.10 ./configure --prefix=/tools \ --disable-perl-regexp make make check make install cd $LFS/sources #####fin grep##### #####Gzip##### tar -Jxvf gzip-1.4.tar.xz cd gzip-1.4 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin Gzip##### #####M4##### tar -jxvf m4-1.4.16.tar.bz2 cd m4-1.4.16 ./configure --prefix=/tools make make check

make install cd $LFS/sources #####fin m4##### #####make##### tar -jxvf make-3.82.tar.bz2 cd make-3.82 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin Make##### #####Patch-2.6.1##### tar -jxvf patch-2.6.1.tar.bz2 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin Patch##### #####Perl##### tar -zxvf perl-5.14.2.tar.gz cd perl-5.14.2 patch -Np1 -i ../perl-5.14.2-libc-1.patch sh Configure -des -Dprefix=/tools make cp -v perl cpan/podlators/pod2man /tools/bin

mkdir -pv /tools/lib/perl5/5.14.2 cp -Rv lib/* /tools/lib/perl5/5.14.2 cd $LFS/sources #####Fin Perl##### #####Sed##### tar -zxvf sed-4.2.1.tar.gz cd sed-4.2.1 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin Sed##### #####tar##### tar -zxvf tar-1.26.tar.gz cd tar-1.26 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin tar##### #####Texinfo##### tar -zxvf texinfo-4.13a.tar.gz cd texinfo-4.13a ./configure --prefix=/tools make

make check make install cd $LFS/sources #####Fin Textinfo##### #####Xz##### tar -jxvf xz-5.0.3.tar.bz2 cd xz-5.0.3 ./configure --prefix=/tools make make check make install cd $LFS/sources #####Fin xz##### #####Stripping##### strip --strip-debug /tools/lib/* strip --strip-unneeded /tools/{,s}bin/* rm -rf /tools/{,share}/{info,man,doc} chown -R root:root $LFS/tools #####fin stripping##### #####preparing Virtual kernel##### mkdir -v $LFS/{dev,proc,sys} mknod -m 600 $LFS