*************************************************************** *************************************************************** # # # build tool-chain mit GNU LibC 2.3.6 # # # 2012-10-08 # svn://gcc.gnu.org/svn/gcc/branches/gcc-4_2-branch # ergibt dann einen 4.2.5 # 'gcc (GCC) 4.2.5 20090330 (prerelease)' # angefangen mit gcc-4.1.3 exit 1 # http://www.linuxfromscratch.org/lfs/view/6.6/index.html # http://www.linuxfromscratch.org/lfs/view/7.1/ # http://www.linuxfromscratch.org/patches/downloads/ # http://oss.erdfunkstelle.de/lfs-de/6.4/online/chapter05/gcc-pass1.html Basis LFS 6.5 als User holbru zum Hostsystem hinzugefuegt su - holbru gmp-5.0.5 tar xf gmp-5.0.5.tar.xz && mkdir build-1 && cd build-1 2. Konsole export CFLAGS='-O2 -march=i486' export CXXFLAGS="${CFLAGS}" ../gmp-5.0.5/configure \ --prefix=/usr \ --enable-cxx \ --enable-mpbsd \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make check su - root make install mpfr-3.1.1 tar xf mpfr-3.1.1.tar.xz && mkdir build-1 && cd build-1 ../mpfr-3.1.1/configure \ --prefix=/usr \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu #--enable-thread-safe make make check su - root make install ------------------------------- weiter mit User lfs su - lfs # binutils 2.19.1 tar xf binutils-2.19.1.tar.bz2 && mkdir -v binutils-build && cd binutils-build CC="gcc -B/usr/bin/" ../binutils-2.19.1/configure \ --prefix=/tools \ --disable-nls \ --disable-werror \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install make -C ld clean make -C ld LIB_PATH=/tools/lib cp -v ld/ld-new /tools/bin # gcc-4_2-branch -> 4.2.5 # Es ist besser c++ mit zubauen, dadurch lassen sich # gmp und mpfr ausserhalb vom gcc im 2. Durchgang bauen, # c++ dafuer erforderlich ist. Dauert wesentlich laenger. tar xf gcc-4_2-branch.tar.bz2 && mkdir -v gcc-build && cd gcc-build CC="gcc -B/usr/bin/" ../gcc-4_2-branch/configure \ --prefix=/tools \ --with-local-prefix=/tools \ --disable-nls \ --disable-shared \ --disable-libssp \ --enable-languages=c,c++ \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install ln -vs libgcc.a `gcc -print-libgcc-file-name | \ sed 's/libgcc/&_eh/'` ln -vs gcc /tools/bin/cc # Installation von Linux-API-Header 2.6.32-eisfair-1 su - holbru make mrproper make headers_check make INSTALL_HDR_PATH=dest headers_install su - lfs cp -rv dest/include/* /tools/include # glibc-2.10.1 tar xf glibc-2.10.1.tar.bz2 && cd glibc-2.10.1 tar xf ../glibc-libidn-2.10.1.tar.gz && mv glibc-libidn-2.10.1 libidn #Fix an error in the constants that get passed to the futex system call in some cases, causing certain pthread_mutex operations to fail: cp -v nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S{,.orig} sed -e 's/FUTEX_WAIT\( | FUTEX_CLOCK_REALTIME, reg\)/FUTEX_WAIT_BITSET\1/' \ nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S mkdir -v ../glibc-build && cd ../glibc-build echo "CFLAGS += -march=i486 -mtune=native" > configparms ../glibc-2.10.1/configure \ --prefix=/tools \ --disable-profile \ --enable-add-ons \ --enable-kernel=2.6.0 \ --with-binutils=/tools/bin \ --with-headers=/tools/include \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu configure: running configure fragment for add-on libidn configure: running configure fragment for add-on nptl make make[2]: Leaving directory `/data/source/glibc-2.10.1/wctype' make subdir=manual -C manual ..=../ subdir_lib make[2]: Entering directory `/data/source/glibc-2.10.1/manual' Makefile:235: *** mixed implicit and normal rules. Stop. make[2]: Leaving directory `/data/source/glibc-2.10.1/manual' make[1]: *** [manual/subdir_lib] Error 2 make[1]: Leaving directory `/data/source/glibc-2.10.1' siehe: http://www.linuxquestions.org/questions/linux-from-scratch-13/glibc-not-compiling-in-chapter-6-9-a-824573/ sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile mkdir -v /tools/etc touch /tools/etc/ld.so.conf make install # Anpasssen der toolchain 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 gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' \ > `dirname $(gcc -print-libgcc-file-name)`/specs GCC_FIXED=`dirname $(gcc -print-libgcc-file-name)`/include-fixed && find ${GCC_FIXED}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \; && rm -vf `grep -l "DO NOT EDIT THIS FILE" ${GCC_FIXED}/*` && unset GCC_FIXED echo 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /tools' [Requesting program interpreter: /tools/lib/ld-linux.so.2] rm -v dummy.c a.out #################### # 2. Durchlauf # Binutils 2.19.1 mkdir -v binutils-build && cd binutils-build ../binutils-2.19.1/configure \ --prefix=/tools \ --disable-nls \ --with-lib-path=/tools/lib \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install make -C ld clean make -C ld LIB_PATH=/usr/lib:/lib cp -v ld/ld-new /tools/bin # Tcl 8.5.12 cd unix ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install chmod -v u+w /tools/lib/libtcl8.5.so make install-private-headers ln -sv tclsh8.5 /tools/bin/tclsh # Expect 5.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 \ --with-x=no \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make SCRIPTS="" install # Dejagnu 1.5 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # gcc 4_2-branch 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/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \ > gcc/Makefile.in for file in $(find gcc/config -name linux64.h -o -name linux.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" >> $file touch $file.orig done tar -xf ../mpfr-3.1.1.tar.xz && mv mpfr-3.1.1 mpfr tar -xf ../gmp-5.0.5.tar.xz && mv gmp-5.0.5 gmp mkdir -v gcc-build && cd gcc-build ../gcc-4_2-branch/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-bootstrap \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install echo 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /tools' [Requesting program interpreter: /tools/lib/ld-linux.so.2] rm -v dummy.c a.out # Ncurses 5.9 ./configure \ --prefix=/tools \ --with-shared \ --without-debug \ --without-ada \ --enable-overwrite \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Bash 4.0.2 patch -Np1 -i ../bash-4.2-fixes-9.patch ./configure \ --prefix=/tools \ --without-bash-malloc \ ac_cv_func_working_mktime=yes \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install ln -vs bash /tools/bin/sh # Bzip 1.0.6 make make PREFIX=/tools install # Coreutils 8.5 ./configure \ --prefix=/tools \ --enable-install-program=hostname \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install cp -v src/su /tools/bin/su-tools # Diffutils 2.9 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # xz-utils 5.0.4 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # e2fsprogs 1.42.5 mkdir -v build && cd build ../configure \ --prefix=/tools \ --disable-defrag \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install make install-libs chmod -v u+w /tools/lib/{libblkid,libcom_err,libe2p,libext2fs,libss,libuuid}.a # Findutils 4.4.2 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Gawk 4.0.1 ./configure \ --prefix=/tools \ ac_cv_func_working_mktime=yes \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Gettext 0.18.1.1 cd gettext-tools ./configure \ --prefix=/tools \ --disable-shared \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make -C gnulib-lib make -C src msgfmt cp -v src/msgfmt /tools/bin # grep 2.14 ./configure \ --prefix=/tools \ --disable-perl-regexp \ --without-included-regex \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Gzip 1.5 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # M4 1.4.16 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Make 3.82 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Patch 2.6.1 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Perl 5.16.2 patch -Np1 -i ../perl-5.16.2-libc-1.patch sh Configure -des -Dprefix=/tools \ -Dstatic_ext='Data/Dumper Fcntl IO POSIX' make perl utilities ext/Errno/pm_to_blib cp -v perl cpan/podlators/pod2man /tools/bin mkdir -pv /tools/lib/perl5/5.16.2 cp -Rv lib/* /tools/lib/perl5/5.16.2 # Sed 4.2.1 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Tar 1.26 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Texinfo 4.13a ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make make install # Util-linux 2.19.1 ./configure \ --prefix=/tools \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make BLKID_LIBS="-lblkid -luuid" -C mount mount umount make -C text-utils more cp -v mount/{,u}mount text-utils/more /tools/bin # Basissystem aufbauen mkdir -pv $LFS/{dev,proc,sys} mknod -m 600 $LFS/dev/console c 5 1 mknod -m 666 $LFS/dev/null c 1 3 # Platten einhaengen 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 # Chrooten 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 # Ordnerstruktur erstellen 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 mkdir -v /var/{lock,log,mail,run,spool} mkdir -pv /var/{opt,cache,lib/{misc,locate},local} # Dateien erstellen ln -sv /tools/bin/{bash,cat,echo,grep,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 cat > /etc/passwd << "EOF" root:x:0:0:root:/root:/bin/bash 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: uucp:x:10: audio:x:11: video:x:12: utmp:x:13: usb:x:14: cdrom:x:15: mail:x:34: nogroup:x:99: EOF 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 # loss gehts ;-) # Linux Header 2.6.32 # eiskernel: 2.0.28 (2.6.32-eisfair-1-SMP) su - holbru make mrproper make headers_check make INSTALL_HDR_PATH=dest headers_install find /tools/include \( -name .install -o -name ..install.cmd \) -delete # chroot cp -rv /source/dest/include/* /usr/include # Man-pages 3.42 # weill es in lfs steht ;-) tar xf man-pages-3.42.tar.xz make install # glibc 2.10.1 tar xf ../glibc-libidn-2.10.1.tar.bz2 && mv glibc-libidn-2.10.1 libidn # When running make install, a script called test-installation.pl # performs a small sanity test on our newly installed Glibc. However, # because our toolchain still points to the /tools directory, the # sanity test would be carried out against the wrong Glibc. We can # force the script to check the Glibc we have just installed with # the following: 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 sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile # Fix an error in one of the make check routines. sed -i s/utf8/UTF-8/ libio/tst-fgetwc.c sed -i '/tst-fgetws-ENV/ a\ tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata' libio/Makefile #Fix an error in the constants that get passed to the futex system call #in some cases, causing certain pthread_mutex operations to fail: sed -i \ -e 's/FUTEX_WAIT\( | FUTEX_CLOCK_REALTIME, reg\)/FUTEX_WAIT_BITSET\1/' \ nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S mkdir -v ../glibc-build && cd ../glibc-build echo "CFLAGS += -march=i486 -mtune=native" > configparms ../glibc-2.10.1/configure \ --prefix=/usr \ --disable-profile \ --enable-add-ons \ --enable-kernel=2.6.0 \ --libexecdir=/usr/lib/glibc \ --build=i486-pc-linux-gnu \ --host=i486-pc-linux-gnu make cp -v ../glibc-2.10.1/iconvdata/gconv-modules iconvdata make -k check 2>&1 | tee glibc-check-log grep Error glibc-check-log root:/source/glibc-build# grep Error glibc-check-log make[2]: *** [/source/glibc-build/math/test-double.out] Error 1 make[1]: *** [math/tests] Error 2 make[2]: [/source/glibc-build/posix/annexc.out] Error 1 (ignored) make[2]: *** [/source/glibc-build/rt/tst-cpuclock2.out] Error 1 make[1]: *** [rt/tests] Error 2 make: *** [check] Error 2 root:/source/glibc-build# touch /etc/ld.so.conf make install # localedata/SUPPORTED bereinigt make localedata/install-locales ###################### # libc extrahieren make install_root=/public/glibc-2.10.1-stripped install make install_root=/public/glibc-2.10.1-stripped localedata/install-locales # kernel header hinzufuegen cp -rv /source/dest/include/* /public/glibc-2.10.1-stripped/usr/include for filename in `find /public/glibc-2.10.1-stripped -type f` do echo "stripping $filename with -S" strip -S "$filename" done ###################### 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 tzselect cp -v --remove-destination /usr/share/zoneinfo/Europe/Berlin \ /etc/localtime cat > /etc/ld.so.conf << "EOF" # Begin /etc/ld.so.conf /usr/local/lib /opt/lib # End /etc/ld.so.conf EOF