Ozan Şelte
Mühendis Adayı


LFS 4 - Yeni Sistemi Derleme
17 Ağustos 2015 - Linux

Bir upuzun derleme sürecinin daha başına geldik. En uzunu bu olacak gibi görünüyor. Geçen yazılardan pek farkı yok, hızlıca bash komutlarını verip geçeceğim. Bir önceki yazıdaki tekrar giriş yapılırsa uygulanması gerekenleri uygulayın yeni sistemin içine girin ve devam edelim.

Örnek çıktılar 32bit sistem için verilmiştir. Ufak farklılıklar olabilir. (lib > lib64)

Linux API Headers

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 662 MB

1
2
3
4
5
6
7
8
9
10
11
cd /sources  
tar xvf linux-3.19.tar.xz
cd linux-3.19

make mrproper
make INSTALL_HDR_PATH=dest headers_install
find dest/include \( -name .install -o -name ..install.cmd \) -delete
cp -rv dest/include/* /usr/include

cd /sources
rm -rf linux-3.19/

Man-pages

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 35 MB

1
2
3
4
5
6
7
8
cd /sources  
tar xvf man-pages-3.79.tar.xz
cd man-pages-3.79

make install

cd /sources
rm -rf man-pages-3.79/

Glibc

Derleme süresi: 16.3 SBU, Gerekli disk alanı: 1.1 GB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cd /sources  
tar xvf glibc-2.21.tar.xz
cd glibc-2.21
patch -Np1 -i ../glibc-2.21-fhs-1.patch

sed -e '/ia32/s/^/1:/' \
    -e '/SSE2/s/^1://' \
    -i  sysdeps/i386/i686/multiarch/mempcpy_chk.S
mkdir -v ../glibc-build
cd ../glibc-build

../glibc-2.21/configure    \
    --prefix=/usr          \
    --disable-profile      \
    --enable-kernel=2.6.32 \
    --enable-obsolete-rpc
make
touch /etc/l.so.conf
make install

cp -v ../glibc-2.21/nscd/nscd.conf /etc/nscd.conf
mkdir -pv /var/cache/nscd

# zaten ileride ayarlayacağımız için kitaptaki tüm örnek yerel dosyaları kuruyorum
mkdir -pv /usr/lib/locale
localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
localedef -i de_DE -f ISO-8859-1 de_DE
localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
localedef -i de_DE -f UTF-8 de_DE.UTF-8
localedef -i en_GB -f UTF-8 en_GB.UTF-8
localedef -i en_HK -f ISO-8859-1 en_HK
localedef -i en_PH -f ISO-8859-1 en_PH
localedef -i en_US -f ISO-8859-1 en_US
localedef -i en_US -f UTF-8 en_US.UTF-8
localedef -i es_MX -f ISO-8859-1 es_MX
localedef -i fa_IR -f UTF-8 fa_IR
localedef -i fr_FR -f ISO-8859-1 fr_FR
localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
localedef -i it_IT -f ISO-8859-1 it_IT
localedef -i it_IT -f UTF-8 it_IT.UTF-8
localedef -i ja_JP -f EUC-JP ja_JP
localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
localedef -i zh_CN -f GB18030 zh_CN.GB18030
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

tar xvf ../tzdata2015a.tar.gz

ZONEINFO=/usr/share/zoneinfo
mkdir -pv $ZONEINFO/{posix,right}

for tz in etcetera southamerica northamerica europe africa antarctica  \
          asia australasia backward pacificnew systemv; do
    zic -L /dev/null   -d $ZONEINFO       -y "sh yearistype.sh" ${tz}
    zic -L /dev/null   -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz}
    zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz}
done

cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
zic -d $ZONEINFO -p America/New_York
unset ZONEINFO

tzselect# 8 47 1 sayılarını girerek Europe/Istanbul'u seçip onaylıyoruz.
cp -v /usr/share/zoneinfo/Europe/Istanbul /etc/localtime

cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib

EOF

cat >> /etc/ld.so.conf << "EOF"
# Add an include directory
include /etc/ld.so.conf.d/*.conf

EOF
mkdir -pv /etc/ld.so.conf.d

cd /sources
rm -rf glibc-2.21/
rm -rf glibc-build/

Araçları ayarlanmak

Hızlıca derleyicimi test edecek ve ufak ayarlar yapacağız.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cd /sources
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 -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]

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("/usr/lib")
# > SEARCH_DIR("/lib");

grep "/lib.*/libc.so.6 " dummy.log
# > attempt to open /lib/libc.so.6 succeeded

grep found dummy.log
# > found ld-linux.so.2 at /lib/ld-linux.so.2

rm -v dummy.c a.out dummy.log

Zlib

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 4.1 MB

1
2
3
4
5
6
7
8
9
10
11
12
cd /sources  
tar xvf zlib-1.2.8.tar.xz
cd zlib-1.2.8

./configure --prefix=/usr
make
make install
mv -v /usr/lib/libz.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so

cd /sources
rm -rf zlib-1.2.8/

File

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 16 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf file-5.22.tar.gz
cd file-5.22

./configure --prefix=/usr
make
make install

cd /sources
rm -rf file-5.22/

Binutils

Derleme süresi: 2.2 SBU, Gerekli disk alanı: 473 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cd /sources  
tar xvf binutils-2.25.tar.bz2
cd binutils-2.25

expect -c "spawn ls"
# > spawn ls
mkdir -v ../binutils-build
cd ../binutils-build

../binutils-2.25/configure --prefix=/usr   \
    --enable-shared \
    --disable-werror
make tooldir=/usr
make tooldir=/usr install

cd /sources
rm -rf binutils-2.25/
rm -rf binutils-binutils/

GMP

Derleme süresi: 1.3 SBU, Gerekli disk alanı: 65 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cd /sources
tar xvf gmp-6.0.0a.tar.xz
cd gmp-6.0.0

# 32bit
ABI=32 ./configure --prefix=/usr \
       --enable-cxx  \
       --docdir=/usr/share/doc/gmp-6.0.0a
# 64bit
./configure --prefix=/usr \
       --enable-cxx  \
       --docdir=/usr/share/doc/gmp-6.0.0a

make
make html
make install
make install-html

cd /sources
rm -rf gmp-6.0.0a/

MPFR

Derleme süresi: 0.7 SBU, Gerekli disk alanı: 30 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cd /sources  
tar xvf mpfr-3.1.2.tar.xz
cd mpfr-3.1.2
patch -Np1 -i ../mpfr-3.1.2-upstream_fixes-3.patch

./configure --prefix=/usr        \
            --enable-thread-safe \
            --docdir=/usr/share/doc/mpfr-3.1.2
make
make html
make install
make install-html

cd /sources
rm -rf mpfr-3.1.2/

MPC

Derleme süresi: 0.3 SBU, Gerekli disk alanı: 11.2 MB

1
2
3
4
5
6
7
8
9
10
11
12
cd /sources  
tar xvf mpc-1.0.2.tar.gz
cd mpc-1.0.2

./configure --prefix=/usr --docdir=/usr/share/doc/mpc-1.0.2
make
make html
make install
make install-html

cd /sources
rm -rf mpc-1.0.2/

GCC

Derleme süresi: 63 SBU(testler ile birlikte), Gerekli disk alanı: 2.9 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cd /sources  
tar xvf gcc-4.9.2.tar.bz2
cd gcc-4.9.2

mkdir -v ../gcc-build
cd ../gcc-build

SED=sed                       \
../gcc-4.9.2/configure        \
     --prefix=/usr            \
     --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
install -v -dm755 /usr/lib/bfd-plugins
ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/4.9.2/liblto_plugin.so /usr/lib/bfd-plugins/

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]
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
# > /usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crt1.o succeeded
# > /usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crti.o succeeded
# > /usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crtn.o succeeded
grep -B4 '^ /usr/include' dummy.log
# ># include <...> search starts here:
# > /usr/lib/gcc/i686-pc-linux-gnu/4.9.2/include
# > /usr/local/include
# > /usr/lib/gcc/i686-pc-linux-gnu/4.9.2/include-fixed
# > /usr/include
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
# > SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32")
# > SEARCH_DIR("/usr/local/lib32")
# > SEARCH_DIR("/lib32")
# > SEARCH_DIR("/usr/lib32")
# > 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
grep found dummy.log
# > found ld-linux.so.2 at /lib/ld-linux.so.2
rm -v dummy.c a.out dummy.log
mkdir -pv /usr/share/gdb/auto-load/usr/lib
mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib

cd /sources
rm -rf gcc-4.9.2/
rm -rf gcc-build/

Bzip

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 6.9 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cd /sources  
tar xvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
patch -Np1 -i ../bzip2-1.0.6-install_docs-1.patch

sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" 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 /sources
rm -rf bzip2-1.0.6/

Pkg-config

Derleme süresi: 0.3 SBU, Gerekli disk alanı: 30 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf pkg-config-0.28.tar.gz
cd pkg-config-0.28

./configure --prefix=/usr    \
       --with-internal-glib  \
       --disable-host-tool   \
       --docdir=/usr/share/doc/pkg-config-0.28
make
make install

cd /sources
rm -rf pkg-config-0.28/

Ncurses

Derleme süresi: 0.5 SBU, Gerekli disk alanı: 54 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cd /sources  
tar xvf ncurses-5.9.tar.gz
cd ncurses-5.9

./configure --prefix=/usr           \
            --mandir=/usr/share/man \
            --with-shared           \
            --without-debug         \
            --enable-pc-files       \
            --enable-widec
make
make install

mv -v /usr/lib/libncursesw.so.5* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /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
    ln -sfv ${lib}w.pc        /usr/lib/pkgconfig/${lib}.pc
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.9
cp -v -R doc/* /usr/share/doc/ncurses-5.9

cd /sources
rm -rf ncurses-5.9/

Attr

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 4.2 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cd /sources  
tar xvf attr-2.4.47.src.tar.gz
cd attr-2.4.47

sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in
./configure --prefix=/usr --bindir=/bin
make
make -j<çekirdekSayınız> test
make -j<çekirdekSayınız> root-tests
make install install-dev install-lib
chmod -v 755 /usr/lib/libattr.so

mv -v /usr/lib/libattr.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so

cd /sources
rm -rf attr-2.4.47/

Acl

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 7.7 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cd /sources  
tar xvf acl-2.2.52.src.tar.gz
cd acl-2.2.52

sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in
sed -i "s:| sed.*::g" test/{sbits-restore,cp,misc}.test
sed -i -e "/TABS-1;/a if (x > (TABS-1)) x = (TABS-1);" \
    libacl/__acl_to_any_text.c

./configure --prefix=/usr \
            --bindir=/bin \
            --libexecdir=/usr/lib
make
make install install-dev install-lib
chmod -v 755 /usr/lib/libacl.so

mv -v /usr/lib/libacl.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so

cd /sources
rm -rf acl-2.2.52/

Libcap

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 1.8 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf libcap-2.24.tar.xz
cd libcap-2.24

make
make RAISE_SETFCAP=no prefix=/usr install
chmod -v 755 /usr/lib/libcap.so

mv -v /usr/lib/libcap.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so

cd /sources
rm -rf libcap-2.24/

Sed

Derleme süresi: 0.2 SBU, Gerekli disk alanı: 12 MB

1
2
3
4
5
6
7
8
9
10
11
12
cd /sources  
tar xvf sed-4.2.2.tar.bz2
cd sed-4.2.2

./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed-4.2.2
make
make html
make install
make -C doc install-html

cd /sources
rm -rf sed-4.2.2/

Shadow

Derleme süresi: 0.2 SBU, Gerekli disk alanı: 52 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd /sources  
tar xvf shadow-4.2.1.tar.xz
cd shadow-4.2.1

sed -i 's/groups$(EXEEXT) //' src/Makefile.in
find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
       -e 's@/var/spool/mail@/var/mail@' etc/login.defs

sed -i 's/1000/999/' etc/useradd
./configure --sysconfdir=/etc --with-group-name-max-length=32
make
make install
mv -v /usr/bin/passwd /bin

Şimdi de kullanıcı yapılandırmalarımızı halledelim.

1
2
3
4
5
6
7
8
9
10
11
pwconv
grpconv

sed -i 's/yes/no/' /etc/default/useradd

# root şifresi belirleyelim
passwd root

# shadow ile işimiz bitti silebiliriz
cd /sources
rm -rf shadow-4.2.1/

Pcmisc

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 4.7 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf psmisc-22.21.tar.gz
cd psmisc-22.21

./configure --prefix=/usr
make
make install

mv -v /usr/bin/fuser   /bin
mv -v /usr/bin/killall /bin

cd /sources
rm -rf psmisc-22.21/

Procps-ng

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 17 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cd /sources  
tar xvf procps-ng-3.3.10.tar.xz
cd procps-ng-3.3.10

./configure --prefix=/usr                           \
            --exec-prefix=                          \
            --libdir=/usr/lib                       \
            --docdir=/usr/share/doc/procps-ng-3.3.10 \
            --disable-static                        \
            --disable-kill
make
make install

mv -v /usr/bin/pidof /bin
mv -v /usr/lib/libprocps.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so

cd /sources
rm -rf procps-ng-3.3.10/

E2fsprogs

Derleme süresi: 2.7 SBU, Gerekli disk alanı: 52 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cd /sources  
tar xvf e2fsprogs-1.42.12.tar.gz
cd e2fsprogs-1.42.12

sed -e '/int.*old_desc_blocks/s/int/blk64_t/' \
    -e '/if (old_desc_blocks/s/super->s_first_meta_bg/desc_blocks/' \
    -i lib/ext2fs/closefs.c
mkdir -v build
cd build

LIBS=-L/tools/lib                    \
CFLAGS=-I/tools/include              \
PKG_CONFIG_PATH=/tools/lib/pkgconfig \
../configure --prefix=/usr           \
             --bindir=/bin           \
             --with-root-prefix=""   \
             --enable-elf-shlibs     \
             --disable-libblkid      \
             --disable-libuuid       \
             --disable-uuidd         \
             --disable-fsck
make
make install
makw 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 /sources
rm -rf e2fsprogs-1.42.12/

Coreutils

Derleme süresi: 2.5 SBU, Gerekli disk alanı: 193 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cd /sources  
tar xvf coreutils-8.23.tar.xz
cd coreutils-8.23

# gurularımız eğer hata alırsak bu iki satırı iptal ederek baştan denememizi söylüyorlar.
patch -Np1 -i ../coreutils-8.23-i18n-1.patch 
touch Makefile.in

FORCE_UNSAFE_CONFIGURE=1 ./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 nobody -s /bin/bash \
          -c "PATH=$PATH 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/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8
mv -v /usr/bin/{head,sleep,nice,test,[} /bin

cd /sources
rm -rf coreutils-8.23/

Iana-Etc

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 3.0 MB

1
2
3
4
5
6
7
8
9
cd /sources  
tar xvf iana-etc-2.30.tar.bz2
cd iana-etc-2.30

make
make install

cd /sources
rm -rf iana-etc-2.30/

M4

Derleme süresi: 0.4 SBU, Gerekli disk alanı: 31 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf m4-1.4.17.tar.xz  
cd m4-1.4.17

./configure --prefix=/usr
make  
make install

cd /sources  
rm -rf m4-1.4.17/

Flex

Derleme süresi: 0.3 SBU, Gerekli disk alanı: 38 MB

1
2
3
4
5
6
7
8
9
10
11
12
cd /sources  
tar xvf flex-2.5.39.tar.bz2
cd flex-2.5.39

sed -i -e '/test-bison/d' tests/Makefile.in
./configure --prefix=/usr --docdir=/usr/share/doc/flex-2.5.39
make
make install
ln -sv flex /usr/bin/lex

cd /sources
rm -rf flex-2.5.39/

Bison

Derleme süresi: 2.3 SBU, Gerekli disk alanı: 40 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf bison-3.0.4.tar.xz
cd bison-3.0.4

./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.0.4
make
make install

cd /sources
rm -rf bison-3.0.4

Grep

Derleme süresi: 0.4 SBU, Gerekli disk alanı: 30 MB

1
2
3
4
5
6
7
8
9
10
11
cd /sources  
tar xvf grep-2.21.tar.xz
cd grep-2.21

sed -i -e '/tp++/a  if (ep <= tp) break;' src/kwset.c
./configure --prefix=/usr --bindir=/bin
make
make install

cd /sources
rm -rf grep-2.21/

Readline

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 24 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cd /sources  
tar xvf readline-6.3.tar.gz
cd readline-6.3

patch -Np1 -i ../readline-6.3-upstream_fixes-3.patch
sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install

./configure --prefix=/usr --docdir=/usr/share/doc/readline-6.3
make SHLIB_LIBS=-lncurses
make SHLIB_LIBS=-lncurses install

mv -v /usr/lib/lib{readline,history}.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so
ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so
install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-6.3

cd /sources
rm -rf readline-6.3/

Bash

Derleme süresi: 1.9 SBU, Gerekli disk alanı: 57 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cd /sources  
tar xvf bash-4.3.30.tar.gz
cd bash-4.3.30
patch -Np1 -i ../bash-4.3.30-upstream_fixes-1.patch

./configure --prefix=/usr                    \
            --bindir=/bin                    \
            --docdir=/usr/share/doc/bash-4.3.30 \
            --without-bash-malloc            \
            --with-installed-readline
make

chown -Rv noboy .
su nobody -s /bin/bash -c "PATH=$PATH make tests"

make install exec /bin/bash --login +h

cd /sources
rm -rf bash-4.3.30/

Bc

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 4 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd /sources  
tar xvf bc-1.06.95.tar.bz2
cd bc-1.06.95
patch -Np1 -i ../bc-1.06.95-memory_leak-1.patch

./configure --prefix=/usr           \
            --with-readline         \
            --mandir=/usr/share/man \
            --infodir=/usr/share/info
make
make install

cd /sources
rm -rf bc-1.06.95/

Libtool

Derleme süresi: 2 SBU, Gerekli disk alanı: 48 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf libtool-2.4.6.tar.xz
cd libtool-2.4.6

./configure --prefix=/usr
make
make install

cd /sources
rm -rf libtool-2.4.6/

GDBM

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 12.6 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf gdbm-1.11.tar.gz
cd gdbm-1.11

./configure --prefix=/usr --enable-libgdbm-compat
make
make install

cd /sources
rm -rf gdbm-1.11/

Expat

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 11 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf expat-2.1.0.tar.gz
cd expat-2.1.0

./configure --prefix=/usr
make
make install

install -v -dm755 /usr/share/doc/expat-2.1.0
install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.1.0

cd /sources
rm -rf expat-2.1.0/

Inetutils

Derleme süresi: 0.4 SBU, Gerekli disk alanı: 34 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cd /sources  
tar xvf inetutils-1.9.2.tar.gz
cd inetutils-1.9.2

echo '#define PATH_PROCNET_DEV "/proc/net/dev"' >> ifconfig/system/linux.h 
./configure --prefix=/usr  \
            --localstatedir=/var   \
            --disable-logger       \
            --disable-whois        \
            --disable-servers
make
make install

mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin
mv -v /usr/bin/ifconfig /sbin

cd /sources
rm -rf inetutils-1.9.2/

Perl

Derleme süresi: 6.5 SBU, Gerekli disk alanı: 301 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cd /sources  
tar xvf perl-5.20.2.tar.bz2
cd perl-5.20.2

echo "127.0.0.1 localhost $(hostname)" > /etc/hosts

export BUILD_ZLIB=False
export BUILD_BZIP2=0
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
unset BUILD_ZLIB BUILD_BZIP2

cd /sources
rm -rf perl-5.20.2/

XML::Parser

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 2.4 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf XML-Parser-2.44.tar.gz
cd XML-Parser-2.44

perl Makefile.PL
make
make install

cd /sources
rm -rf XML-Parser-2.44/

Autoconf

Derleme süresi: 3.6 SBU, Gerekli disk alanı: 20 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf autoconf-2.69.tar.xz
cd autoconf-2.69

./configure --prefix=/usr
make
make install

cd /sources
rm -rf autoconf-2.69/

Automake

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 109 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf automake-1.15.tar.xz
cd automake-1.15

./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.15
make
make install

cd /sources
rm -rf automake-1.15/

Diffutils

Derleme süresi: 0.4 SBU, Gerekli disk alanı: 30 MB

1
2
3
4
5
6
7
8
9
10
11
cd /sources  
tar xvf diffutils-3.3.tar.xz
cd diffutils-3.3

sed -i 's:= @mkdir_p@:= /bin/mkdir -p:' po/Makefile.in.in
./configure --prefix=/usr
make
make install

cd /sources
rm -rf diffutils-3.3/

Gawk

Derleme süresi: 0.3 SBU, Gerekli disk alanı: 39 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf gawk-4.1.1.tar.xz
cd gawk-4.1.1

./configure --prefix=/usr
make
make install

mkdir -v /usr/share/doc/gawk-4.1.1
cp    -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.1.1

cd /sources
rm -rf gawk-4.1.1/

Findutils

Derleme süresi: 0.4 SBU, Gerekli disk alanı: 32 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf findutils-4.4.2.tar.gz
cd findutils-4.4.2

./configure --prefix=/usr --localstatedir=/var/lib/locate
make
make install

mv -v /usr/bin/find /bin
sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb

cd /sources
rm -rf findutils-4.4.2/

Gettext

Derleme süresi: 4.9 SBU, Gerekli disk alanı: 229 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf gettext-0.19.4.tar.xz
cd gettext-0.19.4

./configure --prefix=/usr --docdir=/usr/share/doc/gettext-0.19.4
make
make install

cd /sources
rm -rf gettext-0.19.4/

Intltool

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 1.3 MB

1
2
3
4
5
6
7
8
9
10
11
cd /sources  
tar xvf intltool-0.50.2.tar.gz
cd intltool-0.50.2

./configure --prefix=/usr
make
make install
install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.50.2/I18N-HOWTO

cd /sources
rm -rf intltool-0.50.2/

Gperf

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 6 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf gperf-3.0.4.tar.gz
cd gperf-3.0.4

./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.0.4
make
make install

cd /sources
rm -rf gperf-3.0.4/

Groff

Derleme süresi: 0.5 SBU, Gerekli disk alanı: 111 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf groff-1.22.3.tar.gz
cd groff-1.22.3

PAGE=A4 ./configure --prefix=/usr
make
make install

cd /sources
rm -rf groff-1.22.3/

Xz

Derleme süresi: 0.4 SBU, Gerekli disk alanı: 22 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd /sources  
tar xvf xz-5.2.0.tar.xz
cd xz-5.2.0

./configure --prefix=/usr --docdir=/usr/share/doc/xz-5.2.0
make
make install

mv -v   /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin
mv -v /usr/lib/liblzma.so.* /lib
ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so

cd /sources
rm -rf xz-5.2.0/

GRUB

Derleme süresi: 0.8 SBU, Gerekli disk alanı: 170 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cd /sources  
tar xvf grub-2.02~beta2.tar.xz
cd grub-2.02~beta2

./configure --prefix=/usr          \
            --sbindir=/sbin        \
            --sysconfdir=/etc      \
            --disable-grub-emu-usb \
            --disable-efiemu       \
            --disable-werror
make
make install

cd /sources
rm -rf grub-2.02~beta2/

Less

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 4.1 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf less-458.tar.gz
cd less-458

./configure --prefix=/usr --sysconfdir=/etc
make
make install

cd /sources
rm -rf less-458/

Gzip

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 20 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf gzip-1.6.tar.xz
cd gzip-1.6

./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 /sources
rm -rf gzip-1.6/

IPRoute

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 10.6 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf iproute2-3.19.0.tar.xz
cd iproute2-3.19.0

sed -i '/^TARGETS/s@arpd@@g' misc/Makefile
sed -i /ARPD/d Makefile
sed -i 's/arpd.8//' man/man8/Makefile

make
make DOCDIR=/usr/share/doc/iproute2-3.19.0 install

cd /sources
rm -rf iproute2-3.19.0/

Kbd

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 34 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cd /sources  
tar xvf kbd-2.0.2.tar.gz
cd kbd-2.0.2

patch -Np1 -i ../kbd-2.0.2-backspace-1.patch
sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure
sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in

PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr --disable-vlock
make
make install

mkdir -v       /usr/share/doc/kbd-2.0.2
cp -R -v docs/doc/* /usr/share/doc/kbd-2.0.2

cd /sources
rm -rf kbd-2.0.2/

Kmod

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 37 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cd /sources  
tar xvf kmod-19.tar.xz
cd kmod-19

./configure --prefix=/usr          \
            --bindir=/bin          \
            --sysconfdir=/etc      \
            --with-rootlibdir=/lib \
            --with-xz              \
            --with-zlib
make
make install

for target in depmod insmod lsmod modinfo modprobe rmmod; do
  ln -sv ../bin/kmod /sbin/$target
done

ln -sv kmod /bin/lsmod

cd /sources
rm -rf kmod-19/

Libpipeline

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 8.2 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf libpipeline-1.4.0.tar.gz
cd libpipeline-1.4.0

PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr
make
make install

cd /sources
rm -rf libpipeline-1.4.0/

Make

Derleme süresi: 0.6 SBU, Gerekli disk alanı: 14.2 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf make-4.1.tar.bz2
cd make-4.1

./configure --prefix=/usr
make
make install

cd /sources
rm -rf make-4.1/

Patch

Derleme süresi: 0.2 SBU, Gerekli disk alanı: 11.6 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf patch-2.7.4.tar.xz
cd patch-2.7.4

./configure --prefix=/usr
make
make install

cd /sources
rm -rf patch-2.7.4/

Sysklogd

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 0.7 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cd /sources  
tar xvf sysklogd-1.5.1.tar.gz
cd sysklogd-1.5.1

sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c
make
make BINDIR=/sbin install

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 /sources
rm -rf sysklogd-1.5.1/

Sysvinit

Derleme süresi: 0.1 SBU, Gerekli disk alanı: 1.4 MB

1
2
3
4
5
6
7
8
9
10
cd /sources  
tar xvf sysvinit-2.88dsf.tar.bz2
cd sysvinit-2.88dsf

patch -Np1 -i ../sysvinit-2.88dsf-consolidated-1.patch
make -C src
make -C src install

cd /sources
rm -rf sysvinit-2.88dsf/

Tar

Derleme süresi: 2.3 SBU, Gerekli disk alanı: 46 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /sources  
tar xvf tar-1.28.tar.xz
cd tar-1.28

FORCE_UNSAFE_CONFIGURE=1  \
./configure --prefix=/usr \
            --bindir=/bin
make
make install
make -C doc install-html docdir=/usr/share/doc/tar-1.28

cd /sources
rm -rf tar-1.28/

Textinfo

Derleme süresi: 0.5 SBU, Gerekli disk alanı: 109 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cd /sources  
tar xvf texinfo-5.2.tar.xz
cd texinfo-5.2

./configure --prefix=/usr
make
make install
make TEXMF=/usr/share/texmf install-tex

pushd /usr/share/info
rm -v dir
for f in *
  do install-info $f dir 2>/dev/null
done
popd

cd /sources
rm -rf texinfo-5.2/

Eudev

Derleme süresi: 0.2 SBU, Gerekli disk alanı: 95 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cd /sources  
tar xvf eudev-2.1.1.tar.gz
cd eudev-2.1.1

sed -r -i 's|/usr(/bin/test)|\1|' test/udev-test.pl
BLKID_CFLAGS=-I/tools/include       \
BLKID_LIBS='-L/tools/lib -lblkid'   \
./configure --prefix=/usr           \
            --bindir=/sbin          \
            --sbindir=/sbin         \
            --libdir=/usr/lib       \
            --sysconfdir=/etc       \
            --libexecdir=/lib       \
            --with-rootprefix=      \
            --with-rootlibdir=/lib  \
            --enable-split-usr      \
            --enable-libkmod        \
            --enable-rule_generator \
            --enable-keymap         \
            --disable-introspection \
            --disable-gudev         \
            --disable-gtk-doc-html

make
mkdir -pv /lib/udev/rules.d
mkdir -pv /etc/udev/rules.d
make install
tar -xvf ../eudev-2.1.1-manpages.tar.bz2 -C /usr/share
tar -xvf ../udev-lfs-20140408.tar.bz2
make -f udev-lfs-20140408/Makefile.lfs install

udevadm hwdb --update

cd /sources
rm -rf eudev-2.1.1/

Util-linux

Derleme süresi: 1.3 SBU, Gerekli disk alanı: 137 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cd /sources  
tar xvf util-linux-2.26.tar.xz
cd util-linux-2.26

mkdir -pv /var/lib/hwclock
./configure ADJTIME_PATH=/var/lib/hwclock/adjtime     \
            --docdir=/usr/share/doc/util-linux-2.26 \
            --disable-chfn-chsh  \
            --disable-login      \
            --disable-nologin    \
            --disable-su         \
            --disable-setpriv    \
            --disable-runuser    \
            --disable-pylibmount \
            --without-python     \
            --without-systemd    \
            --without-systemdsystemunitdir
make

chown -Rv nobody .
su nobody -s /bin/bash -c "PATH=$PATH make -k check"
make install

cd /sources
rm -rf util-linux-2.26/

Man-DB

Derleme süresi: 0.4 SBU, Gerekli disk alanı: 33 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cd /sources  
tar xvf man-db-2.7.1.tar.xz
cd man-db-2.7.1

./configure --prefix=/usr                          \
            --docdir=/usr/share/doc/man-db-2.7.1   \
            --sysconfdir=/etc                      \
            --disable-setuid                       \
            --with-browser=/usr/bin/lynx           \
            --with-vgrind=/usr/bin/vgrind          \
            --with-grap=/usr/bin/grap
make
make install

cd /sources
rm -rf man-db-2.7.1/

Vim

Derleme süresi: 1 SBU, Gerekli disk alanı: 139 MB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
cd /sources  
tar xvf vim-7.4.tar.bz2
cd vim74

echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
./configure --prefix=/usr
make
make install

ln -sv vim /usr/bin/vi
for L in  /usr/share/man/{,*/}man1/vim.1; do
    ln -sv vim.1 $(dirname $L)/vi.1
done
ln -sv ../vim/vim74/doc /usr/share/doc/vim-7.4

cat > /etc/vimrc << "EOF"
" Begin /etc/vimrc

set nocompatible
set backspace=2
syntax on
if (&term == "iterm") || (&term == "putty")
  set background=dark
endif

" End /etc/vimrc
EOF

# vim ayarları için:
vim -c ':options'
# çıkmayı bilmeyenler ":q" yazacaklar

cd /sources
rm -rf vim74/

Temizlik

Evet neredeyse tüm derleme işlerimizi bitirdik. Geriye sistem ayarlarını düzenlemek, boot ayarlarını yapmak ve çekirdek(kernel) derlemek kaldı. Geleceği çok düşünmeden temizliğimizi bitirelim.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
logout
# paralel linuxumuzdan çıktık

chroot $LFS /tools/bin/env -i            \
    HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin   \
    /tools/bin/bash --login
# yeniden girdik

/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
    -exec /tools/bin/strip --strip-debug '{}' ';'
# ilk temizliğimizi yaptık
# "File format not recognized" yazısı önemsizdir. Endişelenmeyin.
rm -rf /tmp/*
# ikinciyi de yaptık

Burada önemli bir şey var dikkat edin. Artık tekrar giriş yapacağımız zaman eski chroot komutlarını kullanmayacağız. Kitap yenisini veriyor. Bu sıkıcı bölümler başarıyla bittiğine göre kutlama yapabilirsiniz.

1
2
3
4
chroot "$LFS" /usr/bin/env -i              \
    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin     \
    /bin/bash --login