Size: 80977
Comment:
|
Size: 81449
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 543: | Line 543: |
# patch |
}}} === patch === {{{#!highlight sh |
Line 550: | Line 552: |
Line 559: | Line 560: |
# sed |
}}} === sed === {{{#!highlight sh |
Line 573: | Line 576: |
# tar |
}}} === tar === {{{#!highlight sh |
Line 588: | Line 593: |
# xz |
}}} === xz === {{{#!highlight sh |
Line 606: | Line 613: |
# binutils pass 2 |
}}} === binutils pass 2 === {{{#!highlight sh |
Line 633: | Line 642: |
# gcc part 2 |
}}} === gcc part 2 === {{{#!highlight sh |
Line 683: | Line 694: |
# As root user |
}}} === As root user === {{{#!highlight sh |
Line 787: | Line 800: |
# gettext |
}}} === gettext === {{{#!highlight sh |
Line 800: | Line 815: |
# bison |
}}} === bison === {{{#!highlight sh |
Line 813: | Line 830: |
# perl |
}}} === perl === {{{#!highlight sh |
Line 834: | Line 853: |
# python |
}}} === python === {{{#!highlight sh |
Line 848: | Line 869: |
# texinfo |
}}} === texinfo === {{{#!highlight sh |
Line 861: | Line 884: |
# util-linux |
}}} === util-linux === {{{#!highlight sh |
Line 887: | Line 912: |
# Cleaning |
}}} === Cleaning === {{{#!highlight sh |
Line 892: | Line 919: |
# Backup as root |
}}} === Backup as root === {{{#!highlight sh |
Line 901: | Line 930: |
# Restore as root if required |
}}} === Restore as root if required === {{{#!highlight sh |
Contents
LinuxFromScratch
Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own custom Linux system, entirely from source code.
https://www.linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-11.3-NOCHUNKS.html
https://www.linuxfromscratch.org/hints/downloads/files/boot-cd_easy.txt
List of the required downloads for LFS 11.3
1 # https://www.linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-11.3-NOCHUNKS.html
2 uname -a
3 # Linux debian 5.10.0-22-amd64 #1 SMP Debian 5.10.178-3 (2023-04-22) x86_64 GNU/Linux
4 cd ~
5 mkdir lfs
6 cd lfs
7 wget https://www.linuxfromscratch.org/lfs/downloads/stable/wget-list
8 xargs -l wget < wget-list
9
10 # wget --input-file=wget-list --continue --directory-prefix=$LFS/sources
11 mkdir sources
12 mv *patch *xz *gz *bz2 sources/
13
14 # As root
15 sudo bash
16 cd sources
17 chmod 666 . -R
18
19 export LFS=/home/vagrant/lfs
20 echo $LFS
21 mkdir -pv $LFS
22
23 cd $LFS
24 mkdir sources
25 wget https://www.linuxfromscratch.org/lfs/downloads/stable/wget-list
26 xargs -l wget < wget-list
27 cd ..
28
29 cat > version-check.sh << "EOF"
30 #!/bin/bash
31 # Simple script to list version numbers of critical development tools
32 export LC_ALL=C
33 bash --version | head -n1 | cut -d" " -f2-4
34 MYSH=$(readlink -f /bin/sh)
35 echo "/bin/sh -> $MYSH"
36 echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
37 unset MYSH
38
39 echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
40 bison --version | head -n1
41
42 if [ -h /usr/bin/yacc ]; then
43 echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
44 elif [ -x /usr/bin/yacc ]; then
45 echo yacc is `/usr/bin/yacc --version | head -n1`
46 else
47 echo "yacc not found"
48 fi
49
50 echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
51 diff --version | head -n1
52 find --version | head -n1
53 gawk --version | head -n1
54
55 if [ -h /usr/bin/awk ]; then
56 echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
57 elif [ -x /usr/bin/awk ]; then
58 echo awk is `/usr/bin/awk --version | head -n1`
59 else
60 echo "awk not found"
61 fi
62
63 gcc --version | head -n1
64 g++ --version | head -n1
65 grep --version | head -n1
66 gzip --version | head -n1
67 cat /proc/version
68 m4 --version | head -n1
69 make --version | head -n1
70 patch --version | head -n1
71 echo Perl `perl -V:version`
72 python3 --version
73 sed --version | head -n1
74 tar --version | head -n1
75 makeinfo --version | head -n1 # texinfo version
76 xz --version | head -n1
77
78 echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
79 if [ -x dummy ]
80 then echo "g++ compilation OK";
81 else echo "g++ compilation failed"; fi
82 rm -f dummy.c dummy
83 EOF
84
85 sudo rm /bin/sh
86 sudo ln -s /bin/bash /bin/sh
87 sudo apt install bison texinfo gawk
88
89 bash version-check.sh
90
91 # As root user
92 sudo bash
93 export LFS=/home/vagrant/lfs
94 mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin}
95
96 for i in bin lib sbin; do
97 ln -sv usr/$i $LFS/$i
98 done
99
100 case $(uname -m) in
101 x86_64) mkdir -pv $LFS/lib64 ;;
102 esac
103
104 mkdir -pv $LFS/tools
105 groupadd lfs
106 useradd -s /bin/bash -g lfs -m -k /dev/null lfs
107 echo -e "lfs\nlfs\n" | passwd lfs
108
109 chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools,sources}
110 chgrp -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools,sources}
111 chmod 755 sources/
112
113 case $(uname -m) in
114 x86_64) chown -v lfs $LFS/lib64 ;;
115 esac
Build cross compiler system
1 # Logged in as lfs user
2 su - lfs
3
4 cat > ~/.bash_profile << "EOF"
5 exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
6 EOF
7
8 cat > ~/.bashrc << "EOF"
9 set +h
10 umask 022
11 LFS=/home/vagrant/lfs
12 LC_ALL=POSIX
13 LFS_TGT=$(uname -m)-lfs-linux-gnu
14 PATH=/usr/bin
15 if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
16 PATH=$LFS/tools/bin:$PATH
17 CONFIG_SITE=$LFS/usr/share/config.site
18 export LFS LC_ALL LFS_TGT PATH CONFIG_SITE
19 EOF
20
21 source ~/.bash_profile
22 source ~/.bashrc
23 echo $LFS
24
25 # Basic build steps
26 # cd /mnt/lfs/sources/
27 # untar package as lfs user
28 # go to package folder
29 # build
30 # go back to /mnt/lfs/sources/
31 # delete extracted package
32
33 # binutils as lfs user
34 cd $LFS/sources/
35 tar xvif binutils*.xz
36 cd $(ls binutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
37 mkdir -v build
38 cd build
39 ../configure --prefix=$LFS/tools \
40 --with-sysroot=$LFS \
41 --target=$LFS_TGT \
42 --disable-nls \
43 --enable-gprofng=no \
44 --disable-werror
45 make
46 make install
47 cd $LFS/sources/
48 rm -rf $(ls binutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
gcc
1 cd $LFS/sources/
2 tar xvif gcc*.xz
3 cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 tar -xf ../mpfr-4.2.0.tar.xz
6 mv -v mpfr-4.2.0 mpfr
7 tar -xf ../gmp-6.2.1.tar.xz
8 mv -v gmp-6.2.1 gmp
9 tar -xf ../mpc-1.3.1.tar.gz
10 mv -v mpc-1.3.1 mpc
11
12 case $(uname -m) in
13 x86_64)
14 sed -e '/m64=/s/lib64/lib/' \
15 -i.orig gcc/config/i386/t-linux64
16 ;;
17 esac
18
19 mkdir -v build
20 cd build
21
22 ../configure \
23 --target=$LFS_TGT \
24 --prefix=$LFS/tools \
25 --with-glibc-version=2.37 \
26 --with-sysroot=$LFS \
27 --with-newlib \
28 --without-headers \
29 --enable-default-pie \
30 --enable-default-ssp \
31 --disable-nls \
32 --disable-shared \
33 --disable-multilib \
34 --disable-threads \
35 --disable-libatomic \
36 --disable-libgomp \
37 --disable-libquadmath \
38 --disable-libssp \
39 --disable-libvtv \
40 --disable-libstdcxx \
41 --enable-languages=c,c++
42 make
43 make install
44
45 cd $LFS/sources/
46 rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
Linux-6.1.11 API Headers
=== glibc ===
1 cd $LFS/sources/
2 tar xvif glibc*.xz
3 cd $(ls glibc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4 case $(uname -m) in
5 i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
6 ;;
7 x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
8 ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
9 ;;
10 esac
11
12 patch -Np1 -i ../glibc-2.37-fhs-1.patch
13 mkdir -v build
14 cd build
15 echo "rootsbindir=/usr/sbin" > configparms
16 ../configure \
17 --prefix=/usr \
18 --host=$LFS_TGT \
19 --build=$(../scripts/config.guess) \
20 --enable-kernel=3.2 \
21 --with-headers=$LFS/usr/include \
22 libc_cv_slibdir=/usr/lib
23 make
24
25 make DESTDIR=$LFS install
26
27 sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd
28 echo 'int main(){}' | $LFS_TGT-gcc -xc -
29 readelf -l a.out | grep ld-linux
30 rm -v a.out
31
32 $LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders
33 cd $LFS/sources/
34 rm -rf $(ls glibc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
Libstdc++
1 cd $LFS/sources/
2 tar xvif gcc*.xz
3 cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 mkdir -v build
6 cd build
7
8 ../libstdc++-v3/configure \
9 --host=$LFS_TGT \
10 --build=$(../config.guess) \
11 --prefix=/usr \
12 --disable-multilib \
13 --disable-nls \
14 --disable-libstdcxx-pch \
15 --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/12.2.0
16 make
17
18 make DESTDIR=$LFS install
19 rm -v $LFS/usr/lib/lib{stdc++,stdc++fs,supc++}.la
20 cd $LFS/sources/
21 rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
m4
1 cd $LFS/sources/
2 tar xvif m4*.xz
3 cd $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 ./configure --prefix=/usr \
6 --host=$LFS_TGT \
7 --build=$(build-aux/config.guess)
8 make
9 make[1]: Leaving directory '/home/vagrant/lfs/sources/m4-1.4.19'
10 make: *** [Makefile:1974: all] Error 2
11
12 cd $LFS/sources/
13 tar xvif gcc*.xz
14 cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
15 cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
16 `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h
17 $LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders
18 cd $LFS/sources/
19 cd $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
20 make
21 make DESTDIR=$LFS install
22 cd $LFS/sources/
23 rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
24 rm -rf $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
ncurses
1 cd $LFS/sources/
2 tar xvzf ncurses*.gz
3 cd $(ls ncurses*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
4
5 sed -i s/mawk// configure
6
7 mkdir build
8 pushd build
9 ../configure
10 make -C include
11 make -C progs tic
12 popd
13
14 ./configure --prefix=/usr \
15 --host=$LFS_TGT \
16 --build=$(./config.guess) \
17 --mandir=/usr/share/man \
18 --with-manpage-format=normal \
19 --with-shared \
20 --without-normal \
21 --with-cxx-shared \
22 --without-debug \
23 --without-ada \
24 --disable-stripping \
25 --enable-widec
26 time make
27
28 make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
29 echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so
30
31 cd $LFS/sources/
32 rm -rf $(ls ncurses*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
=== bash ===
1 cd $LFS/sources/
2 tar xvzf bash*.gz
3 cd $(ls bash*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
4
5 ./configure --prefix=/usr \
6 --build=$(sh support/config.guess) \
7 --host=$LFS_TGT \
8 --without-bash-malloc
9
10 time make
11 make DESTDIR=$LFS install
12 ln -sv bash $LFS/bin/sh
13
14 cd $LFS/sources/
15 rm -rf $(ls bash*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
coreutils
1 cd $LFS/sources/
2 tar xvif coreutils*.xz
3 cd $(ls coreutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 ./configure --prefix=/usr \
6 --host=$LFS_TGT \
7 --build=$(build-aux/config.guess) \
8 --enable-install-program=hostname \
9 --enable-no-install-program=kill,uptime
10
11
12 time make
13 make DESTDIR=$LFS install
14
15 mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
16 mkdir -pv $LFS/usr/share/man/man8
17 mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
18 sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8
19
20 cd $LFS/sources/
21 rm -rf $(ls coreutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
diffutils
file
1 cd $LFS/sources/
2 tar xvzf file*.gz
3 cd $(ls file*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
4
5 mkdir build
6 pushd build
7 ../configure --disable-bzlib \
8 --disable-libseccomp \
9 --disable-xzlib \
10 --disable-zlib
11 make
12 popd
13
14 ./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess)
15 time make FILE_COMPILE=$(pwd)/build/src/file
16 make DESTDIR=$LFS install
17 rm -v $LFS/usr/lib/libmagic.la
18
19 cd $LFS/sources/
20 rm -rf $(ls file*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
findutils
1 cd $LFS/sources/
2 tar xvif findutils*.xz
3 cd $(ls findutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 ./configure --prefix=/usr \
6 --localstatedir=/var/lib/locate \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess)
9 make
10 make DESTDIR=$LFS install
11
12 cd $LFS/sources/
13 rm -rf $(ls findutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
gawk
1 cd $LFS/sources/
2 APP=gawk
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 sed -i 's/extras//' Makefile.in
7 ./configure --prefix=/usr \
8 --host=$LFS_TGT \
9 --build=$(build-aux/config.guess)
10 make
11 make DESTDIR=$LFS install
12
13 cd $LFS/sources/
14 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
grep
gzip
make
1 cd $LFS/sources/
2 APP=make
3 tar xvif $APP*.gz
4 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
5
6 sed -e '/ifdef SIGPIPE/,+2 d' \
7 -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \
8 -i src/main.c
9
10 ./configure --prefix=/usr \
11 --without-guile \
12 --host=$LFS_TGT \
13 --build=$(build-aux/config.guess)
14 make
15 make DESTDIR=$LFS install
16
17 cd $LFS/sources/
18 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
patch
1 cd $LFS/sources/
2 APP=patch
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 ./configure --prefix=/usr \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess)
9 make
10 make DESTDIR=$LFS install
11
12 cd $LFS/sources/
13 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
sed
tar
1 cd $LFS/sources/
2 APP=tar
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 ./configure --prefix=/usr \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess)
9 make
10 make DESTDIR=$LFS install
11
12 cd $LFS/sources/
13 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
xz
1 cd $LFS/sources/
2 APP=xz
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 ./configure --prefix=/usr \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess) \
9 --disable-static \
10 --docdir=/usr/share/doc/xz-5.4.1
11 make
12 make DESTDIR=$LFS install
13 rm -v $LFS/usr/lib/liblzma.la
14
15 cd $LFS/sources/
16 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
binutils pass 2
1 cd $LFS/sources/
2 APP=binutils
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 sed '6009s/$add_dir//' -i ltmain.sh
7 mkdir -v build
8 cd build
9
10 ../configure \
11 --prefix=/usr \
12 --build=$(../config.guess) \
13 --host=$LFS_TGT \
14 --disable-nls \
15 --enable-shared \
16 --enable-gprofng=no \
17 --disable-werror \
18 --enable-64-bit-bfd
19
20 make
21 make DESTDIR=$LFS install
22 rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la}
23
24 cd $LFS/sources/
25 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
gcc part 2
1 cd $LFS/sources/
2 APP=gcc
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 tar -xf ../mpfr-4.2.0.tar.xz
7 mv -v mpfr-4.2.0 mpfr
8 tar -xf ../gmp-6.2.1.tar.xz
9 mv -v gmp-6.2.1 gmp
10 tar -xf ../mpc-1.3.1.tar.gz
11 mv -v mpc-1.3.1 mpc
12
13 case $(uname -m) in
14 x86_64)
15 sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
16 ;;
17 esac
18
19 sed '/thread_header =/s/@.*@/gthr-posix.h/' \
20 -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
21
22 mkdir -v build
23 cd build
24
25 ../configure \
26 --build=$(../config.guess) \
27 --host=$LFS_TGT \
28 --target=$LFS_TGT \
29 LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \
30 --prefix=/usr \
31 --with-build-sysroot=$LFS \
32 --enable-default-pie \
33 --enable-default-ssp \
34 --disable-nls \
35 --disable-multilib \
36 --disable-libatomic \
37 --disable-libgomp \
38 --disable-libquadmath \
39 --disable-libssp \
40 --disable-libvtv \
41 --enable-languages=c,c++
42
43 make
44 make DESTDIR=$LFS install
45 ln -sv gcc $LFS/usr/bin/cc
46
47 cd $LFS/sources/
48 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
As root user
1 sudo bash
2 export LFS=/home/vagrant/lfs
3 echo $LFS
4 /home/vagrant/lfs
5 cd $LFS
6 chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools}
7 case $(uname -m) in
8 x86_64) chown -R root:root $LFS/lib64 ;;
9 esac
10 mkdir -pv $LFS/{dev,proc,sys,run}
11 mount -v --bind /dev $LFS/dev
12
13 mount -v --bind /dev/pts $LFS/dev/pts
14 mount -vt proc proc $LFS/proc
15 mount -vt sysfs sysfs $LFS/sys
16 mount -vt tmpfs tmpfs $LFS/run
17
18 if [ -h $LFS/dev/shm ]; then
19 mkdir -pv $LFS/$(readlink $LFS/dev/shm)
20 else
21 mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
22 fi
23
24 chroot "$LFS" /usr/bin/env -i \
25 HOME=/root \
26 TERM="$TERM" \
27 PS1='(lfs chroot) \u:\w\$ ' \
28 PATH=/usr/bin:/usr/sbin \
29 /bin/bash --login
30 # in chroot state the bash prompt will say "I have no name!"
31 mkdir -pv /{boot,home,mnt,opt,srv}
32 mkdir -pv /etc/{opt,sysconfig}
33 mkdir -pv /lib/firmware
34 mkdir -pv /media/{floppy,cdrom}
35 mkdir -pv /usr/{,local/}{include,src}
36 mkdir -pv /usr/local/{bin,lib,sbin}
37 mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
38 mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
39 mkdir -pv /usr/{,local/}share/man/man{1..8}
40 mkdir -pv /var/{cache,local,log,mail,opt,spool}
41 mkdir -pv /var/lib/{color,misc,locate}
42
43 ln -sfv /run /var/run
44 ln -sfv /run/lock /var/lock
45
46 install -dv -m 0750 /root
47 install -dv -m 1777 /tmp /var/tmp
48
49 ln -sv /proc/self/mounts /etc/mtab
50
51 cat > /etc/hosts << "EOF"
52 127.0.0.1 localhost $(hostname)
53 ::1 localhost
54 EOF
55
56 cat > /etc/passwd << "EOF"
57 root:x:0:0:root:/root:/bin/bash
58 bin:x:1:1:bin:/dev/null:/usr/bin/false
59 daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false
60 messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false
61 uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
62 nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false
63 EOF
64
65 cat > /etc/group << "EOF"
66 root:x:0:
67 bin:x:1:daemon
68 sys:x:2:
69 kmem:x:3:
70 tape:x:4:
71 tty:x:5:
72 daemon:x:6:
73 floppy:x:7:
74 disk:x:8:
75 lp:x:9:
76 dialout:x:10:
77 audio:x:11:
78 video:x:12:
79 utmp:x:13:
80 usb:x:14:
81 cdrom:x:15:
82 adm:x:16:
83 messagebus:x:18:
84 input:x:24:
85 mail:x:34:
86 kvm:x:61:
87 uuidd:x:80:
88 wheel:x:97:
89 users:x:999:
90 nogroup:x:65534:
91 EOF
92
93 echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd
94 echo "tester:x:101:" >> /etc/group
95 install -o tester -d /home/tester
96
97 exec /usr/bin/bash --login
98
99 touch /var/log/{btmp,lastlog,faillog,wtmp}
100 chgrp -v utmp /var/log/lastlog
101 chmod -v 664 /var/log/lastlog
102 chmod -v 600 /var/log/btmp
gettext
bison
perl
1 cd /sources/
2 APP=perl
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 sh Configure -des \
7 -Dprefix=/usr \
8 -Dvendorprefix=/usr \
9 -Dprivlib=/usr/lib/perl5/5.36/core_perl \
10 -Darchlib=/usr/lib/perl5/5.36/core_perl \
11 -Dsitelib=/usr/lib/perl5/5.36/site_perl \
12 -Dsitearch=/usr/lib/perl5/5.36/site_perl \
13 -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \
14 -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl
15 make
16 make install
17
18 cd /sources/
19 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
python
texinfo
util-linux
1 cd /sources/
2 APP=util-linux
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 mkdir -pv /var/lib/hwclock
7 ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
8 --libdir=/usr/lib \
9 --docdir=/usr/share/doc/util-linux-2.38.1 \
10 --disable-chfn-chsh \
11 --disable-login \
12 --disable-nologin \
13 --disable-su \
14 --disable-setpriv \
15 --disable-runuser \
16 --disable-pylibmount \
17 --disable-static \
18 --without-python \
19 runstatedir=/run
20 make
21 make install
22
23 cd /sources/
24 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
Cleaning
Backup as root
Restore as root if required
Build system based on the cross compiler
1 # Prepare Virtual Kernel File Systems
2 findmnt | grep $LFS
3 mkdir -pv $LFS/{dev,proc,sys,run}
4 mount -v --bind /dev $LFS/dev
5 mount -v --bind /dev/pts $LFS/dev/pts
6 mount -vt proc proc $LFS/proc
7 mount -vt sysfs sysfs $LFS/sys
8 mount -vt tmpfs tmpfs $LFS/run
9 if [ -h $LFS/dev/shm ]; then
10 mkdir -pv $LFS/$(readlink $LFS/dev/shm)
11 else
12 mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
13 fi
14
15 # Enter the chroot env
16 chroot "$LFS" /usr/bin/env -i \
17 HOME=/root \
18 TERM="$TERM" \
19 PS1='(lfs chroot) \u:\w\$ ' \
20 PATH=/usr/bin:/usr/sbin \
21 /bin/bash --login
22
23 # man pages
24 cd /sources/
25 APP=man-pages
26 tar xvif $APP*.xz
27 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
28 make prefix=/usr install
29 cd /sources/
30 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
31
32 # iana
33 cd /sources/
34 APP=iana
35 tar xvif $APP*.gz
36 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
37
38 cp services protocols /etc
39
40 cd /sources/
41 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
42
43 # glibc
44 cd /sources/
45 APP=glibc
46 tar xvif $APP*.xz
47 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
48
49 patch -Np1 -i ../glibc-2.37-fhs-1.patch
50 sed '/width -=/s/workend - string/number_length/' \
51 -i stdio-common/vfprintf-process-arg.c
52 mkdir -v build
53 cd build
54
55 echo "rootsbindir=/usr/sbin" > configparms
56 ../configure --prefix=/usr \
57 --disable-werror \
58 --enable-kernel=3.2 \
59 --enable-stack-protector=strong \
60 --with-headers=/usr/include \
61 libc_cv_slibdir=/usr/lib
62
63 make
64 make check
65 touch /etc/ld.so.conf
66
67 sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
68 make install
69 sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd
70 cp -v ../nscd/nscd.conf /etc/nscd.conf
71 mkdir -pv /var/cache/nscd
72
73 mkdir -pv /usr/lib/locale
74
75 localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
76
77 localedef -i en_US -f ISO-8859-1 en_US
78 localedef -i en_US -f UTF-8 en_US.UTF-8
79
80 localedef -i pt_PT -f ISO-8859-1 pt_PT
81 localedef -i pt_PT@euro -f ISO-8859-15 pt_PT@euro
82 localedef -i pt_PT -f UTF-8 pt_PT.UTF-8
83
84 make localedata/install-locales
85 localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
86 localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true
87
88 cat > /etc/nsswitch.conf << "EOF"
89 passwd: files
90 group: files
91 shadow: files
92
93 hosts: files dns
94 networks: files
95
96 protocols: files
97 services: files
98 ethers: files
99 rpc: files
100 EOF
101
102 tar -xf ../../tzdata2022g.tar.gz
103
104 ZONEINFO=/usr/share/zoneinfo
105 mkdir -pv $ZONEINFO/{posix,right}
106
107 for tz in etcetera southamerica northamerica europe africa antarctica \
108 asia australasia backward; do
109 zic -L /dev/null -d $ZONEINFO ${tz}
110 zic -L /dev/null -d $ZONEINFO/posix ${tz}
111 zic -L leapseconds -d $ZONEINFO/right ${tz}
112 done
113
114 cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
115 zic -d $ZONEINFO -p America/New_York
116 unset ZONEINFO
117
118 echo -e "7\n 37\n 1\n 1\n" | tzselect
119 # 7\n 37\n 1\n 1\n
120 # Europe Portugal Mainland yes
121 ln -sfv /usr/share/zoneinfo/Europe/Portugal /etc/localtime
122
123 cat > /etc/ld.so.conf << "EOF"
124 /usr/local/lib
125 /opt/lib
126 # Add an include directory
127 include /etc/ld.so.conf.d/*.conf
128 EOF
129
130 mkdir -pv /etc/ld.so.conf.d
131 cd /sources/
132 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
133
134 # zlib
135 cd /sources/
136 APP=zlib
137 tar xvif $APP*.xz
138 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
139
140 ./configure --prefix=/usr
141 make
142 make check
143 make install
144 rm -fv /usr/lib/libz.a
145
146 cd /sources/
147 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
148
149 # bzip2
150 cd /sources/
151 APP=bzip2
152 tar xvif $APP*.gz
153 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
154
155 patch -Np1 -i ../bzip2-1.0.8-install_docs-1.patch
156 sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
157 sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
158 make -f Makefile-libbz2_so
159 make clean
160 make
161 make PREFIX=/usr install
162 cp -av libbz2.so.* /usr/lib
163 ln -sv libbz2.so.1.0.8 /usr/lib/libbz2.so
164
165 cp -v bzip2-shared /usr/bin/bzip2
166 for i in /usr/bin/{bzcat,bunzip2}; do
167 ln -sfv bzip2 $i
168 done
169
170 rm -fv /usr/lib/libbz2.a
171
172 cd /sources/
173 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
174
175 # xz
176 cd /sources/
177 APP=xz
178 tar xvif $APP*.xz
179 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
180
181 ./configure --prefix=/usr \
182 --disable-static \
183 --docdir=/usr/share/doc/xz-5.4.1
184
185 make
186 make check
187 make install
188
189 cd /sources/
190 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
191
192 # zstd
193 cd /sources/
194 APP=zstd
195 tar xvif $APP*.gz
196 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
197
198 make prefix=/usr
199 make check
200 make prefix=/usr install
201 rm -v /usr/lib/libzstd.a
202
203 cd /sources/
204 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
205
206 # file
207 cd /sources/
208 APP=file
209 EXTENSION=gz
210 tar xvif $APP*.$EXTENSION
211 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
212
213 ./configure --prefix=/usr
214 make
215 make check
216 make install
217
218 cd /sources/
219 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
220
221 # readline
222 cd /sources/
223 APP=readline
224 tar xvif $APP*.gz
225 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
226
227 sed -i '/MV.*old/d' Makefile.in
228 sed -i '/{OLDSUFF}/c:' support/shlib-install
229 patch -Np1 -i ../readline-8.2-upstream_fix-1.patch
230
231 ./configure --prefix=/usr \
232 --disable-static \
233 --with-curses \
234 --docdir=/usr/share/doc/readline-8.2
235
236 make SHLIB_LIBS="-lncursesw"
237 make SHLIB_LIBS="-lncursesw" install
238 install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.2
239
240 cd /sources/
241 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
242
243 # m4
244 cd /sources/
245 APP=m4
246 EXTENSION=xz
247 tar xvif $APP*.$EXTENSION
248 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
249
250 ./configure --prefix=/usr
251 make
252 make check
253 make install
254
255 cd /sources/
256 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
257
258 # bc
259 cd /sources/
260 APP=bc
261 EXTENSION=xz
262 tar xvif $APP*.$EXTENSION
263 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
264
265 CC=gcc ./configure --prefix=/usr -G -O3 -r
266 make
267 make test
268 make install
269
270 cd /sources/
271 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
272
273 # flex
274 cd /sources/
275 APP=flex
276 EXTENSION=gz
277 tar xvif $APP*.$EXTENSION
278 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
279
280 ./configure --prefix=/usr \
281 --docdir=/usr/share/doc/flex-2.6.4 \
282 --disable-static
283
284 make
285 make check
286 make install
287 ln -sv flex /usr/bin/lex
288
289 cd /sources/
290 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
291
292 # tcl
293 cd /sources/
294 APP=tcl8.6.13-src
295 EXTENSION=gz
296 FOLDER=tcl8.6.13
297 tar xvzf $APP*.$EXTENSION
298 cd $FOLDER
299
300 SRCDIR=$(pwd)
301 cd unix
302 ./configure --prefix=/usr \
303 --mandir=/usr/share/man
304
305 make
306 sed -e "s|$SRCDIR/unix|/usr/lib|" \
307 -e "s|$SRCDIR|/usr/include|" \
308 -i tclConfig.sh
309
310 sed -e "s|$SRCDIR/unix/pkgs/tdbc1.1.5|/usr/lib/tdbc1.1.5|" \
311 -e "s|$SRCDIR/pkgs/tdbc1.1.5/generic|/usr/include|" \
312 -e "s|$SRCDIR/pkgs/tdbc1.1.5/library|/usr/lib/tcl8.6|" \
313 -e "s|$SRCDIR/pkgs/tdbc1.1.5|/usr/include|" \
314 -i pkgs/tdbc1.1.5/tdbcConfig.sh
315
316 sed -e "s|$SRCDIR/unix/pkgs/itcl4.2.3|/usr/lib/itcl4.2.3|" \
317 -e "s|$SRCDIR/pkgs/itcl4.2.3/generic|/usr/include|" \
318 -e "s|$SRCDIR/pkgs/itcl4.2.3|/usr/include|" \
319 -i pkgs/itcl4.2.3/itclConfig.sh
320
321 unset SRCDIR
322
323 make test
324 make install
325
326 chmod -v u+w /usr/lib/libtcl8.6.so
327
328 make install-private-headers
329 ln -sfv tclsh8.6 /usr/bin/tclsh
330 mv /usr/share/man/man3/{Thread,Tcl_Thread}.3
331 cd ..
332 tar -xf ../tcl8.6.13-html.tar.gz --strip-components=1
333 mkdir -v -p /usr/share/doc/tcl-8.6.13
334 cp -v -r ./html/* /usr/share/doc/tcl-8.6.13
335
336 cd /sources/
337 rm -rf $FOLDER
338
339 # expect
340 cd /sources/
341 APP=expect
342 EXTENSION=gz
343 tar xvif $APP*.$EXTENSION
344 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
345
346 ./configure --prefix=/usr \
347 --with-tcl=/usr/lib \
348 --enable-shared \
349 --mandir=/usr/share/man \
350 --with-tclinclude=/usr/include
351
352 make
353 make test
354 make install
355 ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib
356
357 cd /sources/
358 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
359
360
361 # dejagnu
362 cd /sources/
363 APP=dejagnu
364 EXTENSION=gz
365 tar xvif $APP*.$EXTENSION
366 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
367
368 mkdir -v build
369 cd build
370
371 ../configure --prefix=/usr
372 makeinfo --html --no-split -o doc/dejagnu.html ../doc/dejagnu.texi
373 makeinfo --plaintext -o doc/dejagnu.txt ../doc/dejagnu.texi
374
375 make install
376 install -v -dm755 /usr/share/doc/dejagnu-1.6.3
377 install -v -m644 doc/dejagnu.{html,txt} /usr/share/doc/dejagnu-1.6.3
378
379 make check
380
381 cd /sources/
382 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
383
384
385 # binutils
386 cd /sources/
387 APP=binutils
388 EXTENSION=xz
389 tar xvif $APP*.$EXTENSION
390 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
391
392 expect -c "spawn ls"
393 mkdir -v build
394 cd build
395
396 ../configure --prefix=/usr \
397 --sysconfdir=/etc \
398 --enable-gold \
399 --enable-ld=default \
400 --enable-plugins \
401 --enable-shared \
402 --disable-werror \
403 --enable-64-bit-bfd \
404 --with-system-zlib
405 make tooldir=/usr
406
407 make -k check
408 grep '^FAIL:' $(find -name '*.log')
409 # expected to 12 tests fail
410 grep '^FAIL:' $(find -name '*.log') | wc -l
411
412 make tooldir=/usr install
413 rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a
414 rm -fv /usr/share/man/man1/{gprofng,gp-*}.1
415
416 cd /sources/
417 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
418
419 # gmp
420 cd /sources/
421 APP=gmp
422 EXTENSION=xz
423 tar xvif $APP*.$EXTENSION
424 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
425
426 cp -v configfsf.guess config.guess
427 cp -v configfsf.sub config.sub
428
429 ./configure --prefix=/usr \
430 --enable-cxx \
431 --disable-static \
432 --docdir=/usr/share/doc/gmp-6.2.1
433 make
434 make html
435 make check 2>&1 | tee gmp-check-log
436 awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log
437 # check all 197 pass
438 make install
439 make install-html
440
441 cd /sources/
442 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
443
444
445 # mpfr
446 cd /sources/
447 APP=mpfr
448 EXTENSION=xz
449 tar xvif $APP*.$EXTENSION
450 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
451
452 sed -e 's/+01,234,567/+1,234,567 /' \
453 -e 's/13.10Pd/13Pd/' \
454 -i tests/tsprintf.c
455
456 ./configure --prefix=/usr \
457 --disable-static \
458 --enable-thread-safe \
459 --docdir=/usr/share/doc/mpfr-4.2.0
460 make
461 make html
462 make check
463 # ensure that all 197 tests passed
464 make install
465 make install-html
466
467 cd /sources/
468 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
469
470 # mpc
471 cd /sources/
472 APP=mpc
473 EXTENSION=gz
474 tar xvif $APP*.$EXTENSION
475 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
476
477
478 ./configure --prefix=/usr \
479 --disable-static \
480 --docdir=/usr/share/doc/mpc-1.3.1
481
482 make
483 make html
484 make check
485 make install
486 make install-html
487
488 cd /sources/
489 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
490
491 # attr
492 cd /sources/
493 APP=attr
494 EXTENSION=gz
495 tar xvif $APP*.$EXTENSION
496 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
497
498 ./configure --prefix=/usr \
499 --disable-static \
500 --sysconfdir=/etc \
501 --docdir=/usr/share/doc/attr-2.5.1
502
503 make
504 make check
505 make install
506
507 cd /sources/
508 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
509
510 # acl
511 cd /sources/
512 APP=acl
513 EXTENSION=xz
514 tar xvif $APP*.$EXTENSION
515 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
516
517 ./configure --prefix=/usr \
518 --disable-static \
519 --docdir=/usr/share/doc/acl-2.3.1
520
521 make
522 make install
523
524 cd /sources/
525 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
526
527 # libcap
528 cd /sources/
529 APP=libcap
530 EXTENSION=xz
531 tar xvif $APP*.$EXTENSION
532 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
533
534 sed -i '/install -m.*STA/d' libcap/Makefile
535 make prefix=/usr lib=lib
536 make test
537 make prefix=/usr lib=lib install
538
539 cd /sources/
540 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
541
542 # shadow
543 cd /sources/
544 APP=shadow
545 EXTENSION=xz
546 tar xvif $APP*.$EXTENSION
547 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
548
549 sed -i 's/groups$(EXEEXT) //' src/Makefile.in
550 find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
551 find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
552 find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
553
554 sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \
555 -e 's@#\(SHA_CRYPT_..._ROUNDS 5000\)@\100@' \
556 -e 's:/var/spool/mail:/var/mail:' \
557 -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
558 -i etc/login.defs
559
560 # no cracklib support
561
562 touch /usr/bin/passwd
563 ./configure --sysconfdir=/etc \
564 --disable-static \
565 --with-group-name-max-length=32
566
567 make
568 make exec_prefix=/usr install
569 make -C man install-man
570
571 pwconv
572 grpconv
573 mkdir -p /etc/default
574 useradd -D --gid 999
575
576 sed -i '/MAIL/s/yes/no/' /etc/default/useradd
577 # input root pwd
578 passwd root
579
580 cd /sources/
581 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
582
583 # gcc
584 cd /sources/
585 APP=gcc
586 EXTENSION=xz
587 tar xvif $APP*.$EXTENSION
588 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
589
590 case $(uname -m) in
591 x86_64)
592 sed -e '/m64=/s/lib64/lib/' \
593 -i.orig gcc/config/i386/t-linux64
594 ;;
595 esac
596
597 mkdir -v build
598 cd build
599
600 ../configure --prefix=/usr \
601 LD=ld \
602 --enable-languages=c,c++ \
603 --enable-default-pie \
604 --enable-default-ssp \
605 --disable-multilib \
606 --disable-bootstrap \
607 --with-system-zlib
608
609 time make # 43 SBU # real 65m28.356s
610 ulimit -s 32768
611 chown -Rv tester .
612 su tester -c "PATH=$PATH make -k check" # started 16:14
613 ../contrib/test_summary
614
615 make install
616 chown -v -R root:root \
617 /usr/lib/gcc/$(gcc -dumpmachine)/12.2.0/include{,-fixed}
618 ln -svr /usr/bin/cpp /usr/lib
619 ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/12.2.0/liblto_plugin.so \
620 /usr/lib/bfd-plugins/
621
622 echo 'int main(){}' > dummy.c
623 cc dummy.c -v -Wl,--verbose &> dummy.log
624 readelf -l a.out | grep ': /lib'
625 # should show
626 # [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
627
628 grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log
629 grep -B4 '^ /usr/include' dummy.log
630 grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
631 grep "/lib.*/libc.so.6 " dummy.log
632 rm -v dummy.c a.out dummy.log
633
634 mkdir -pv /usr/share/gdb/auto-load/usr/lib
635 mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
636
637 cd /sources/
638 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
639
640 # pkg-config
641 cd /sources/
642 APP=pkg-config
643 EXTENSION=gz
644 tar xvif $APP*.$EXTENSION
645 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
646
647 ./configure --prefix=/usr \
648 --with-internal-glib \
649 --disable-host-tool \
650 --docdir=/usr/share/doc/pkg-config-0.29.2
651 make
652 make check
653 make install
654
655 cd /sources/
656 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
657
658 # ncurses
659 cd /sources/
660 APP=ncurses
661 EXTENSION=gz
662 tar xvif $APP*.$EXTENSION
663 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
664
665 ./configure --prefix=/usr \
666 --mandir=/usr/share/man \
667 --with-shared \
668 --without-debug \
669 --without-normal \
670 --with-cxx-shared \
671 --enable-pc-files \
672 --enable-widec \
673 --with-pkg-config-libdir=/usr/lib/pkgconfig
674
675 make
676 make DESTDIR=$PWD/dest install
677 install -vm755 dest/usr/lib/libncursesw.so.6.4 /usr/lib
678 rm -v dest/usr/lib/libncursesw.so.6.4
679 cp -av dest/* /
680
681 for lib in ncurses form panel menu ; do
682 rm -vf /usr/lib/lib${lib}.so
683 echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so
684 ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
685 done
686
687 rm -vf /usr/lib/libcursesw.so
688 echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so
689 ln -sfv libncurses.so /usr/lib/libcurses.so
690
691 mkdir -pv /usr/share/doc/ncurses-6.4
692 cp -v -R doc/* /usr/share/doc/ncurses-6.4
693
694 cd /sources/
695 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
696
697 # sed
698 cd /sources/
699 APP=sed
700 EXTENSION=xz
701 tar xvif $APP*.$EXTENSION
702 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
703
704 ./configure --prefix=/usr
705
706 make
707 make html
708 chown -Rv tester .
709 su tester -c "PATH=$PATH make check"
710
711 make install
712 install -d -m755 /usr/share/doc/sed-4.9
713 install -m644 doc/sed.html /usr/share/doc/sed-4.9
714
715 cd /sources/
716 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
717
718 # psmisc
719 cd /sources/
720 APP=psmisc
721 EXTENSION=xz
722 tar xvif $APP*.$EXTENSION
723 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
724
725 ./configure --prefix=/usr
726 make
727 make install
728
729 cd /sources/
730 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
731
732 # gettext
733 cd /sources/
734 APP=gettext
735 EXTENSION=xz
736 tar xvif $APP*.$EXTENSION
737 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
738
739 ./configure --prefix=/usr \
740 --disable-static \
741 --docdir=/usr/share/doc/gettext-0.21.1
742
743 make
744 make check
745 make install
746 chmod -v 0755 /usr/lib/preloadable_libintl.so
747
748 cd /sources/
749 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
750
751 # bison
752 cd /sources/
753 APP=bison
754 EXTENSION=xz
755 tar xvif $APP*.$EXTENSION
756 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
757
758 ./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2
759 make
760 make check
761 make install
762
763 cd /sources/
764 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
765
766 # grep
767 cd /sources/
768 APP=grep
769 EXTENSION=xz
770 tar xvif $APP*.$EXTENSION
771 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
772
773 sed -i "s/echo/#echo/" src/egrep.sh
774 ./configure --prefix=/usr
775 make
776 make check
777 make install
778
779 cd /sources/
780 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
781
782 # bash
783 cd /sources/
784 APP=bash
785 EXTENSION=gz
786 tar xvif $APP*.$EXTENSION
787 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
788
789 ./configure --prefix=/usr \
790 --without-bash-malloc \
791 --with-installed-readline \
792 --docdir=/usr/share/doc/bash-5.2.15
793
794 make
795 chown -Rv tester .
796 su -s /usr/bin/expect tester << EOF
797 set timeout -1
798 spawn make tests
799 expect eof
800 lassign [wait] _ _ _ value
801 exit $value
802 EOF
803
804 make install
805 exec /usr/bin/bash --login
806
807 cd /sources/
808 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
809
810 # libtool
811 cd /sources/
812 APP=libtool
813 EXTENSION=xz
814 tar xvif $APP*.$EXTENSION
815 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
816
817 ./configure --prefix=/usr
818 make
819 make -k check
820 make install
821 rm -fv /usr/lib/libltdl.a
822
823 cd /sources/
824 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
825
826 # gdbm
827 cd /sources/
828 APP=gdbm
829 EXTENSION=gz
830 tar xvif $APP*.$EXTENSION
831 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
832
833 ./configure --prefix=/usr \
834 --disable-static \
835 --enable-libgdbm-compat
836
837 make
838 make check
839 make install
840
841 cd /sources/
842 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
843
844 # gperf
845 cd /sources/
846 APP=gperf
847 EXTENSION=gz
848 tar xvif $APP*.$EXTENSION
849 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
850
851 ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1
852 make
853 make -j1 check
854 make install
855
856 cd /sources/
857 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
858
859 # expat
860 cd /sources/
861 APP=expat
862 EXTENSION=xz
863 tar xvif $APP*.$EXTENSION
864 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
865
866 ./configure --prefix=/usr \
867 --disable-static \
868 --docdir=/usr/share/doc/expat-2.5.0
869
870 make
871 make check
872 make install
873 install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.5.0
874
875 cd /sources/
876 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
877
878 # inetutils
879 cd /sources/
880 APP=inetutils
881 EXTENSION=xz
882 tar xvif $APP*.$EXTENSION
883 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
884
885 ./configure --prefix=/usr \
886 --bindir=/usr/bin \
887 --localstatedir=/var \
888 --disable-logger \
889 --disable-whois \
890 --disable-rcp \
891 --disable-rexec \
892 --disable-rlogin \
893 --disable-rsh \
894 --disable-servers
895
896 make
897 make check
898 make install
899 mv -v /usr/{,s}bin/ifconfig
900 cd /sources/
901 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
902
903 # less
904 cd /sources/
905 APP=less
906 EXTENSION=gz
907 tar xvif $APP*.$EXTENSION
908 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
909
910 ./configure --prefix=/usr --sysconfdir=/etc
911 make
912 make install
913
914 cd /sources/
915 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
916
917 # perl
918 cd /sources/
919 APP=perl
920 EXTENSION=xz
921 tar xvif $APP*.$EXTENSION
922 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
923
924 export BUILD_ZLIB=False
925 export BUILD_BZIP2=0
926
927 sh Configure -des \
928 -Dprefix=/usr \
929 -Dvendorprefix=/usr \
930 -Dprivlib=/usr/lib/perl5/5.36/core_perl \
931 -Darchlib=/usr/lib/perl5/5.36/core_perl \
932 -Dsitelib=/usr/lib/perl5/5.36/site_perl \
933 -Dsitearch=/usr/lib/perl5/5.36/site_perl \
934 -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \
935 -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl \
936 -Dman1dir=/usr/share/man/man1 \
937 -Dman3dir=/usr/share/man/man3 \
938 -Dpager="/usr/bin/less -isR" \
939 -Duseshrplib \
940 -Dusethreads
941 make
942 make test
943 make install
944 unset BUILD_ZLIB BUILD_BZIP2
945
946 cd /sources/
947 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
948
949 # XML-Parser
950 cd /sources/
951 APP=XML-Parser
952 EXTENSION=gz
953 tar xvif $APP*.$EXTENSION
954 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
955
956 perl Makefile.PL
957 make
958 make test
959 make install
960
961 cd /sources/
962 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
963
964 # intltool-0.51.0.tar.gz
965 cd /sources/
966 APP=intltool
967 EXTENSION=gz
968 tar xvif $APP*.$EXTENSION
969 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
970
971 sed -i 's:\\\${:\\\$\\{:' intltool-update.in
972 ./configure --prefix=/usr
973 make
974 make check
975 make install
976 install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO
977
978 cd /sources/
979 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
980
981 # autoconf-2.71.tar.xz
982 cd /sources/
983 APP=autoconf
984 EXTENSION=xz
985 tar xvif $APP*.$EXTENSION
986 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
987
988 sed -e 's/SECONDS|/&SHLVL|/' \
989 -e '/BASH_ARGV=/a\ /^SHLVL=/ d' \
990 -i.orig tests/local.at
991
992 ./configure --prefix=/usr
993 make
994 make check
995 make install
996
997 cd /sources/
998 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
999
1000 # automake-1.16.5.tar.xz
1001 cd /sources/
1002 APP=automake
1003 EXTENSION=xz
1004 tar xvif $APP*.$EXTENSION
1005 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1006
1007 ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.5
1008
1009 make
1010 make -j4 check
1011 make install
1012
1013 cd /sources/
1014 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1015
1016 # openssl-3.0.8.tar.gz
1017 cd /sources/
1018 APP=openssl
1019 EXTENSION=gz
1020 tar xvif $APP*.$EXTENSION
1021 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1022
1023 ./config --prefix=/usr \
1024 --openssldir=/etc/ssl \
1025 --libdir=lib \
1026 shared \
1027 zlib-dynamic
1028
1029 make
1030 make test
1031 sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile
1032 make MANSUFFIX=ssl install
1033 mv -v /usr/share/doc/openssl /usr/share/doc/openssl-3.0.8
1034 cp -vfr doc/* /usr/share/doc/openssl-3.0.8
1035
1036 cd /sources/
1037 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1038
1039 # kmod-30.tar.xz
1040 cd /sources/
1041 APP=kmod
1042 EXTENSION=xz
1043 tar xvif $APP*.$EXTENSION
1044 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1045
1046 ./configure --prefix=/usr \
1047 --sysconfdir=/etc \
1048 --with-openssl \
1049 --with-xz \
1050 --with-zstd \
1051 --with-zlib
1052
1053 make
1054 make install
1055
1056 for target in depmod insmod modinfo modprobe rmmod; do
1057 ln -sfv ../bin/kmod /usr/sbin/$target
1058 done
1059
1060 ln -sfv kmod /usr/bin/lsmod
1061
1062 cd /sources/
1063 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1064
1065 # elfutils-0.188.tar.bz2
1066 cd /sources/
1067 APP=elfutils
1068 EXTENSION=bz2
1069 tar xvif $APP*.$EXTENSION
1070 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1071
1072 ./configure --prefix=/usr \
1073 --disable-debuginfod \
1074 --enable-libdebuginfod=dummy
1075
1076 make
1077 make check
1078 make -C libelf install
1079 install -vm644 config/libelf.pc /usr/lib/pkgconfig
1080 rm /usr/lib/libelf.a
1081
1082 cd /sources/
1083 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1084
1085 # libffi-3.4.4.tar.gz
1086 cd /sources/
1087 APP=libffi
1088 EXTENSION=gz
1089 tar xvzf $APP*.$EXTENSION
1090 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1091
1092 ./configure --prefix=/usr \
1093 --disable-static \
1094 --with-gcc-arch=native
1095
1096 make
1097 make check
1098 make install
1099
1100 cd /sources/
1101 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1102
1103 # Python-3.11.2.tar.xz
1104 cd /sources/
1105 APP=Python-3
1106 EXTENSION=xz
1107 tar xvif $APP*.$EXTENSION
1108 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1109
1110 ./configure --prefix=/usr \
1111 --enable-shared \
1112 --with-system-expat \
1113 --with-system-ffi \
1114 --enable-optimizations
1115
1116 make
1117 make install
1118
1119 cat > /etc/pip.conf << "EOF"
1120 [global]
1121 root-user-action = ignore
1122 disable-pip-version-check = true
1123 EOF
1124
1125 install -v -dm755 /usr/share/doc/python-3.11.2/html
1126
1127 tar --strip-components=1 \
1128 --no-same-owner \
1129 --no-same-permissions \
1130 -C /usr/share/doc/python-3.11.2/html \
1131 -xvf ../python-3.11.2-docs-html.tar.bz2
1132
1133 cd /sources/
1134 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1135
1136 # wheel-0.38.4.tar.gz
1137 cd /sources/
1138 APP=wheel
1139 EXTENSION=gz
1140 tar xvzf $APP*.$EXTENSION
1141 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1142
1143 PYTHONPATH=src pip3 wheel -w dist --no-build-isolation --no-deps $PWD
1144 pip3 install --no-index --find-links=dist wheel
1145
1146 cd /sources/
1147 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1148
1149 # ninja-1.11.1.tar.gz
1150 cd /sources/
1151 APP=ninja
1152 EXTENSION=gz
1153 tar xvzf $APP*.$EXTENSION
1154 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1155
1156 export NINJAJOBS=4
1157
1158 sed -i '/int Guess/a \
1159 int j = 0;\
1160 char* jobs = getenv( "NINJAJOBS" );\
1161 if ( jobs != NULL ) j = atoi( jobs );\
1162 if ( j > 0 ) return j;\
1163 ' src/ninja.cc
1164
1165 python3 configure.py --bootstrap
1166
1167 ./ninja ninja_test
1168 ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots
1169
1170 install -vm755 ninja /usr/bin/
1171 install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja
1172 install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja
1173
1174 cd /sources/
1175 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1176
1177 # meson-1.0.0.tar.gz
1178 cd /sources/
1179 APP=meson
1180 EXTENSION=gz
1181 tar xvzf $APP*.$EXTENSION
1182 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1183
1184 pip3 wheel -w dist --no-build-isolation --no-deps $PWD
1185 pip3 install --no-index --find-links dist meson
1186 install -vDm644 data/shell-completions/bash/meson /usr/share/bash-completion/completions/meson
1187 install -vDm644 data/shell-completions/zsh/_meson /usr/share/zsh/site-functions/_meson
1188
1189 cd /sources/
1190 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1191
1192 # coreutils-9.1.tar.xz
1193 cd /sources/
1194 APP=coreutils
1195 EXTENSION=xz
1196 tar xvif $APP*.$EXTENSION
1197 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1198
1199 patch -Np1 -i ../coreutils-9.1-i18n-1.patch
1200
1201 autoreconf -fiv
1202 FORCE_UNSAFE_CONFIGURE=1 ./configure \
1203 --prefix=/usr \
1204 --enable-no-install-program=kill,uptime
1205
1206 make
1207 make NON_ROOT_USERNAME=tester check-root
1208
1209 echo "dummy:x:102:tester" >> /etc/group
1210
1211 chown -Rv tester .
1212 su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"
1213 sed -i '/dummy/d' /etc/group
1214
1215 make install
1216
1217 mv -v /usr/bin/chroot /usr/sbin
1218 mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
1219 sed -i 's/"1"/"8"/' /usr/share/man/man8/chroot.8
1220
1221 cd /sources/
1222 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1223
1224 # check-0.15.2.tar.gz
1225 cd /sources/
1226 APP=check
1227 EXTENSION=gz
1228 tar xvzf $APP*.$EXTENSION
1229 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1230
1231
1232 ./configure --prefix=/usr --disable-static
1233
1234 make
1235 make check
1236 make docdir=/usr/share/doc/check-0.15.2 install
1237
1238 cd /sources/
1239 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1240
1241 # diffutils-3.9.tar.xz
1242 cd /sources/
1243 APP=diffutils
1244 EXTENSION=xz
1245 tar xvif $APP*.$EXTENSION
1246 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1247
1248 ./configure --prefix=/usr
1249 make
1250 make check
1251 make install
1252
1253 cd /sources/
1254 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1255
1256 # gawk-5.2.1.tar.xz
1257 cd /sources/
1258 APP=gawk
1259 EXTENSION=xz
1260 tar xvif $APP*.$EXTENSION
1261 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1262
1263 sed -i 's/extras//' Makefile.in
1264 ./configure --prefix=/usr
1265 make
1266 make check
1267 make LN='ln -f' install
1268 mkdir -pv /usr/share/doc/gawk-5.2.1
1269 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-5.2.1
1270
1271 cd /sources/
1272 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1273
1274 # findutils-4.9.0.tar.xz
1275 cd /sources/
1276 APP=findutils
1277 EXTENSION=xz
1278 tar xvif $APP*.$EXTENSION
1279 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1280
1281 case $(uname -m) in
1282 i?86) TIME_T_32_BIT_OK=yes ./configure --prefix=/usr --localstatedir=/var/lib/locate ;;
1283 x86_64) ./configure --prefix=/usr --localstatedir=/var/lib/locate ;;
1284 esac
1285
1286 make
1287 chown -Rv tester .
1288 su tester -c "PATH=$PATH make check"
1289 make install
1290
1291 cd /sources/
1292 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1293
1294 # groff-1.22.4.tar.gz
1295 cd /sources/
1296 APP=groff
1297 EXTENSION=gz
1298 tar xvzf $APP*.$EXTENSION
1299 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1300
1301 PAGE=A4 ./configure --prefix=/usr
1302
1303 make
1304 make install
1305
1306 cd /sources/
1307 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1308
1309 # grub-2.06.tar.xz
1310 cd /sources/
1311 APP=grub
1312 EXTENSION=xz
1313 tar xvif $APP*.$EXTENSION
1314 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1315
1316 unset {C,CPP,CXX,LD}FLAGS
1317 patch -Np1 -i ../grub-2.06-upstream_fixes-1.patch
1318
1319 ./configure --prefix=/usr \
1320 --sysconfdir=/etc \
1321 --disable-efiemu \
1322 --disable-werror
1323
1324 make
1325 make install
1326 mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions
1327
1328 cd /sources/
1329 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1330
1331 # gzip-1.12.tar.xz
1332 cd /sources/
1333 APP=gzip
1334 EXTENSION=xz
1335 tar xvif $APP*.$EXTENSION
1336 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1337
1338 ./configure --prefix=/usr
1339 make
1340 make check
1341 make install
1342
1343 cd /sources/
1344 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1345
1346 # iproute2-6.1.0.tar.xz
1347 cd /sources/
1348 APP=iproute2
1349 EXTENSION=xz
1350 tar xvif $APP*.$EXTENSION
1351 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1352
1353 sed -i /ARPD/d Makefile
1354 rm -fv man/man8/arpd.8
1355
1356 make NETNS_RUN_DIR=/run/netns
1357 make SBINDIR=/usr/sbin install
1358 mkdir -pv /usr/share/doc/iproute2-6.1.0
1359 cp -v COPYING README* /usr/share/doc/iproute2-6.1.0
1360
1361 cd /sources/
1362 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1363
1364 # kbd-2.5.1.tar.xz
1365 cd /sources/
1366 APP=kbd
1367 EXTENSION=xz
1368 tar xvif $APP*.$EXTENSION
1369 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1370
1371 patch -Np1 -i ../kbd-2.5.1-backspace-1.patch
1372
1373 sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure
1374 sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in
1375
1376 ./configure --prefix=/usr --disable-vlock
1377
1378 make
1379 make check
1380 make install
1381
1382 mkdir -pv /usr/share/doc/kbd-2.5.1
1383 cp -R -v docs/doc/* /usr/share/doc/kbd-2.5.1
1384
1385 cd /sources/
1386 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1387
1388 # libpipeline-1.5.7.tar.gz
1389 cd /sources/
1390 APP=libpipeline
1391 EXTENSION=gz
1392 tar xvzf $APP*.$EXTENSION
1393 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1394
1395 ./configure --prefix=/usr
1396 make
1397 make check
1398 make install
1399
1400 cd /sources/
1401 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1402
1403 # make-4.4.tar.gz
1404 cd /sources/
1405 APP=make
1406 EXTENSION=gz
1407 tar xvzf $APP*.$EXTENSION
1408 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1409
1410 sed -e '/ifdef SIGPIPE/,+2 d' \
1411 -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \
1412 -i src/main.c
1413
1414 ./configure --prefix=/usr
1415 make
1416 make check
1417 make install
1418
1419 cd /sources/
1420 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1421
1422 # patch-2.7.6.tar.xz
1423 cd /sources/
1424 APP=patch
1425 EXTENSION=xz
1426 tar xvif $APP*.$EXTENSION
1427 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1428
1429 ./configure --prefix=/usr
1430 make
1431 make check
1432 make install
1433
1434 cd /sources/
1435 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1436
1437 # tar-1.34.tar.xz
1438 cd /sources/
1439 APP=tar
1440 EXTENSION=xz
1441 tar xvif $APP*.$EXTENSION
1442 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1443
1444 FORCE_UNSAFE_CONFIGURE=1 \
1445 ./configure --prefix=/usr
1446
1447 make
1448 make check
1449 make install
1450 make -C doc install-html docdir=/usr/share/doc/tar-1.34
1451
1452 cd /sources/
1453 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1454
1455 # texinfo-7.0.2.tar.xz
1456 cd /sources/
1457 APP=texinfo
1458 EXTENSION=xz
1459 tar xvif $APP*.$EXTENSION
1460 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1461
1462 ./configure --prefix=/usr
1463 make
1464 make check
1465 make install
1466 make TEXMF=/usr/share/texmf install-tex
1467
1468 cd /sources/
1469 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1470
1471 # vim-9.0.1273.tar.xz
1472 cd /sources/
1473 APP=vim
1474 EXTENSION=xz
1475 tar xvif $APP*.$EXTENSION
1476 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1477
1478 echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
1479 ./configure --prefix=/usr
1480 make
1481 chown -Rv tester .
1482 su tester -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log
1483 make install
1484
1485 ln -sv vim /usr/bin/vi
1486 for L in /usr/share/man/{,*/}man1/vim.1; do
1487 ln -sv vim.1 $(dirname $L)/vi.1
1488 done
1489
1490 ln -sv ../vim/vim90/doc /usr/share/doc/vim-9.0.1273
1491
1492 cat > /etc/vimrc << "EOF"
1493 source $VIMRUNTIME/defaults.vim
1494 let skip_defaults_vim=1
1495
1496 set nocompatible
1497 set backspace=2
1498 set mouse=
1499 syntax on
1500 if (&term == "xterm") || (&term == "putty")
1501 set background=dark
1502 endif
1503
1504 EOF
1505
1506 cd /sources/
1507 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1 # eudev-3.2.11.tar.gz
2 cd /sources/
3 APP=eudev
4 EXTENSION=gz
5 tar xvzf $APP*.$EXTENSION
6 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
7
8 sed -i '/udevdir/a udev_dir=${udevdir}' src/udev/udev.pc.in
9 ./configure --prefix=/usr \
10 --bindir=/usr/sbin \
11 --sysconfdir=/etc \
12 --enable-manpages \
13 --disable-static
14
15 make
16 mkdir -pv /usr/lib/udev/rules.d
17 mkdir -pv /etc/udev/rules.d
18
19 make check
20 make install
21
22 tar -xvf ../udev-lfs-20171102.tar.xz
23 make -f udev-lfs-20171102/Makefile.lfs install
24
25 udevadm hwdb --update
26
27 cd /sources/
28 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
29
30 # man-db-2.11.2.tar.xz
31 cd /sources/
32 APP=man-db
33 EXTENSION=xz
34 tar xvif $APP*.$EXTENSION
35 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
36
37 ./configure --prefix=/usr \
38 --docdir=/usr/share/doc/man-db-2.11.2 \
39 --sysconfdir=/etc \
40 --disable-setuid \
41 --enable-cache-owner=bin \
42 --with-browser=/usr/bin/lynx \
43 --with-vgrind=/usr/bin/vgrind \
44 --with-grap=/usr/bin/grap \
45 --with-systemdtmpfilesdir= \
46 --with-systemdsystemunitdir=
47 make
48 make check
49 make install
50
51 cd /sources/
52 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
53
54 # procps-ng-4.0.2.tar.xz
55 cd /sources/
56 APP=procps
57 EXTENSION=xz
58 tar xvif $APP*.$EXTENSION
59 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
60
61 ./configure --prefix=/usr \
62 --docdir=/usr/share/doc/procps-ng-4.0.2 \
63 --disable-static \
64 --disable-kill
65
66 make
67 make check
68 make install
69
70 cd /sources/
71 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
72
73 # util-linux-2.38.1.tar.xz
74 cd /sources/
75 APP=util-linux
76 EXTENSION=xz
77 tar xvif $APP*.$EXTENSION
78 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
79
80 ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
81 --bindir=/usr/bin \
82 --libdir=/usr/lib \
83 --sbindir=/usr/sbin \
84 --disable-chfn-chsh \
85 --disable-login \
86 --disable-nologin \
87 --disable-su \
88 --disable-setpriv \
89 --disable-runuser \
90 --disable-pylibmount \
91 --disable-static \
92 --without-python \
93 --without-systemd \
94 --without-systemdsystemunitdir \
95 --docdir=/usr/share/doc/util-linux-2.38.1
96
97 make
98 chown -Rv tester .
99 su tester -c "make -k check"
100 make install
101
102 cd /sources/
103 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
104
105 # e2fsprogs-1.47.0.tar.gz
106 cd /sources/
107 APP=e2fsprogs
108 EXTENSION=gz
109 tar xvzf $APP*.$EXTENSION
110 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
111
112 mkdir -v build
113 cd build
114
115 ../configure --prefix=/usr \
116 --sysconfdir=/etc \
117 --enable-elf-shlibs \
118 --disable-libblkid \
119 --disable-libuuid \
120 --disable-uuidd \
121 --disable-fsck
122
123 make
124 make check
125 make install
126 rm -fv /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
127 gunzip -v /usr/share/info/libext2fs.info.gz
128 install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info
129 makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo
130 install -v -m644 doc/com_err.info /usr/share/info
131 install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info
132 sed 's/metadata_csum_seed,//' -i /etc/mke2fs.conf
133
134 cd /sources/
135 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
136
137 # sysklogd-1.5.1.tar.gz
138 cd /sources/
139 APP=sysklogd
140 EXTENSION=gz
141 tar xvzf $APP*.$EXTENSION
142 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
143
144 sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c
145 sed -i 's/union wait/int/' syslogd.c
146
147 make
148 make BINDIR=/sbin install
149
150 cat > /etc/syslog.conf << "EOF"
151 auth,authpriv.* -/var/log/auth.log
152 *.*;auth,authpriv.none -/var/log/sys.log
153 daemon.* -/var/log/daemon.log
154 kern.* -/var/log/kern.log
155 mail.* -/var/log/mail.log
156 user.* -/var/log/user.log
157 *.emerg *
158 EOF
159
160 cd /sources/
161 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
162
163 # sysvinit-3.06.tar.xz
164 cd /sources/
165 APP=sysvinit
166 EXTENSION=xz
167 tar xvif $APP*.$EXTENSION
168 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
169
170 patch -Np1 -i ../sysvinit-3.06-consolidated-1.patch
171 make
172 make install
173
174 cd /sources/
175 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
176
177 # Stripping
178 save_usrlib="$(cd /usr/lib; ls ld-linux*[^g])
179 libc.so.6
180 libthread_db.so.1
181 libquadmath.so.0.0.0
182 libstdc++.so.6.0.30
183 libitm.so.1.0.0
184 libatomic.so.1.2.0"
185
186 cd /usr/lib
187
188 for LIB in $save_usrlib; do
189 objcopy --only-keep-debug $LIB $LIB.dbg
190 cp $LIB /tmp/$LIB
191 strip --strip-unneeded /tmp/$LIB
192 objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB
193 install -vm755 /tmp/$LIB /usr/lib
194 rm /tmp/$LIB
195 done
196
197 online_usrbin="bash find strip"
198 online_usrlib="libbfd-2.40.so
199 libsframe.so.0.0.0
200 libhistory.so.8.2
201 libncursesw.so.6.4
202 libm.so.6
203 libreadline.so.8.2
204 libz.so.1.2.13
205 $(cd /usr/lib; find libnss*.so* -type f)"
206
207 for BIN in $online_usrbin; do
208 cp /usr/bin/$BIN /tmp/$BIN
209 strip --strip-unneeded /tmp/$BIN
210 install -vm755 /tmp/$BIN /usr/bin
211 rm /tmp/$BIN
212 done
213
214 for LIB in $online_usrlib; do
215 cp /usr/lib/$LIB /tmp/$LIB
216 strip --strip-unneeded /tmp/$LIB
217 install -vm755 /tmp/$LIB /usr/lib
218 rm /tmp/$LIB
219 done
220
221 for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \
222 $(find /usr/lib -type f -name \*.a) \
223 $(find /usr/{bin,sbin,libexec} -type f); do
224 case "$online_usrbin $online_usrlib $save_usrlib" in
225 *$(basename $i)* )
226 ;;
227 * ) strip --strip-unneeded $i
228 ;;
229 esac
230 done
231
232 unset BIN LIB save_usrlib online_usrbin online_usrlib
233
234 # Cleaning Up
235 rm -rf /tmp/*
236 find /usr/lib /usr/libexec -name \*.la -delete
237 find /usr -depth -name $(uname -m)-lfs-linux-gnu\* | xargs rm -rf
238 userdel -r tester
239
240 # lfs-bootscripts-20230101.tar.xz
241 cd /sources/
242 APP=lfs-bootscripts
243 EXTENSION=xz
244 tar xvif $APP*.$EXTENSION
245 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
246
247 make install
248
249 cd /sources/
250 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
251
252 bash /usr/lib/udev/init-net-rules.sh
253 cat /etc/udev/rules.d/70-persistent-net.rules
254
255 cat > /etc/sysconfig/ifconfig.eth0 << "EOF"
256 ONBOOT=yes
257 IFACE=eth0
258 SERVICE=ipv4-static
259 IP=192.168.1.2
260 GATEWAY=192.168.1.1
261 PREFIX=24
262 BROADCAST=192.168.1.255
263 EOF
264
265 cat > /etc/resolv.conf << "EOF"
266 domain <Your Domain Name>
267 nameserver <IP address of your primary nameserver>
268 nameserver <IP address of your secondary nameserver>
269 EOF
270
271 echo "vitux" > /etc/hostname
272
273 cat > /etc/hosts << "EOF"
274 127.0.0.1 localhost.localdomain localhost
275 127.0.1.1 vitux.bitarus.mooo.com
276 ::1 localhost ip6-localhost ip6-loopback
277 ff02::1 ip6-allnodes
278 ff02::2 ip6-allrouters
279 EOF
280
281 cat > /etc/inittab << "EOF"
282 id:3:initdefault:
283 si::sysinit:/etc/rc.d/init.d/rc S
284 l0:0:wait:/etc/rc.d/init.d/rc 0
285 l1:S1:wait:/etc/rc.d/init.d/rc 1
286 l2:2:wait:/etc/rc.d/init.d/rc 2
287 l3:3:wait:/etc/rc.d/init.d/rc 3
288 l4:4:wait:/etc/rc.d/init.d/rc 4
289 l5:5:wait:/etc/rc.d/init.d/rc 5
290 l6:6:wait:/etc/rc.d/init.d/rc 6
291 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
292 su:S06:once:/sbin/sulogin
293 s1:1:respawn:/sbin/sulogin
294 1:2345:respawn:/sbin/agetty --noclear tty1 9600
295 2:2345:respawn:/sbin/agetty tty2 9600
296 3:2345:respawn:/sbin/agetty tty3 9600
297 4:2345:respawn:/sbin/agetty tty4 9600
298 5:2345:respawn:/sbin/agetty tty5 9600
299 6:2345:respawn:/sbin/agetty tty6 9600
300 EOF
301
302 cat > /etc/sysconfig/clock << "EOF"
303 UTC=1
304 # Set this to any options you might need to give to hwclock,
305 # such as machine hardware clock type for Alphas.
306 CLOCKPARAMS=
307 EOF
308
309 cat > /etc/sysconfig/console << "EOF"
310 KEYMAP="pt-latin1"
311 FONT="lat1-16 -m 8859-1"
312 UNICODE="1"
313 EOF
314
315 locale -a
316 locale -a | grep -i pt
317 kk_KZ.pt154
318 pt_BR
319 pt_BR.iso88591
320 pt_BR.utf8
321 pt_PT
322 pt_PT.iso88591
323 pt_PT.iso885915@euro
324 pt_PT.utf8
325 pt_PT@euro
326
327 cat > /etc/profile << "EOF"
328 export LANG=pt_PT.utf8
329 EOF
330
331 cat > /etc/inputrc << "EOF"
332 # Modified by Chris Lynn <roryo@roryo.dynup.net>
333 # Allow the command prompt to wrap to the next line
334 set horizontal-scroll-mode Off
335 # Enable 8-bit input
336 set meta-flag On
337 set input-meta On
338 # Turns off 8th bit stripping
339 set convert-meta Off
340 # Keep the 8th bit for display
341 set output-meta On
342 # none, visible or audible
343 set bell-style none
344 # All of the following map the escape sequence of the value
345 # contained in the 1st argument to the readline specific functions
346 "\eOd": backward-word
347 "\eOc": forward-word
348 # for linux console
349 "\e[1~": beginning-of-line
350 "\e[4~": end-of-line
351 "\e[5~": beginning-of-history
352 "\e[6~": end-of-history
353 "\e[3~": delete-char
354 "\e[2~": quoted-insert
355 # for xterm
356 "\eOH": beginning-of-line
357 "\eOF": end-of-line
358 # for Konsole
359 "\e[H": beginning-of-line
360 "\e[F": end-of-line
361 EOF
362
363 cat > /etc/shells << "EOF"
364 /bin/sh
365 /bin/bash
366 EOF
367
368 cat > /etc/fstab << "EOF"
369 # file-system mount-point type options dump fsck
370 # order
371
372 #/dev/<xxx> / <fff> defaults 1 1
373 #/dev/<yyy> swap swap pri=1 0 0
374 proc /proc proc nosuid,noexec,nodev 0 0
375 sysfs /sys sysfs nosuid,noexec,nodev 0 0
376 devpts /dev/pts devpts gid=5,mode=620 0 0
377 tmpfs /run tmpfs defaults 0 0
378 devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
379 tmpfs /dev/shm tmpfs nosuid,nodev 0 0
380 EOF
381
382 # linux-6.1.11.tar.xz
383 cd /sources/
384 APP=linux
385 EXTENSION=xz
386 tar xvif $APP*.$EXTENSION
387 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
388
389 make mrproper
390 make menuconfig
391
392 # Processor type and features --->
393 # [*] Build a relocatable kernel [CONFIG_RELOCATABLE]
394 # [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE]
395 # General setup --->
396 # [ ] Compile the kernel with warnings as errors [CONFIG_WERROR]
397 # < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS]
398 # General architecture-dependent options --->
399 # [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR]
400 # [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG]
401 # Device Drivers --->
402 # Graphics support --->
403 # Frame buffer Devices --->
404 # <*> Support for frame buffer devices --->
405 # Console display driver support --->
406 # [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE]
407 # Generic Driver Options --->
408 # [ ] Support for uevent helper [CONFIG_UEVENT_HELPER]
409 # [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS]
410 # [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [CONFIG_DEVTMPFS_MOUNT]
411 # Processor type and features --->
412 # [*] Support x2apic [CONFIG_X86_X2APIC]
413 # Device Drivers --->
414 # [*] PCI Support ---> [CONFIG_PCI]
415 # [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI]
416 # [*] IOMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT]
417 # [*] Support for Interrupt Remapping [CONFIG_IRQ_REMAP]
418
419 /sources/linux-6.1.11# find . -name .config
420 ./.config
421
422 cat .config | grep -e CONFIG_IRQ_REMAP -e CONFIG_IOMMU_SUPPORT=y -e CONFIG_PCI_MSI=y -e CONFIG_PCI=y -e CONFIG_X86_X2APIC=y \
423 -e CONFIG_DEVTMPFS_MOUNT -e CONFIG_DEVTMPFS=y -e CONFIG_UEVENT_HELPER -e CONFIG_FRAMEBUFFER_CONSOLE=y \
424 -e CONFIG_STACKPROTECTOR=y -e CONFIG_STACKPROTECTOR_STRONG=y -e CONFIG_RELOCATABLE=y -e CONFIG_RANDOMIZE_BASE=y \
425 -e CONFIG_WERROR -e CONFIG_IKHEADERS
426
427 # # CONFIG_WERROR is not set
428 # # CONFIG_IKHEADERS is not set
429 # CONFIG_RELOCATABLE=y
430 # CONFIG_RANDOMIZE_BASE=y
431 # CONFIG_STACKPROTECTOR=y
432 # CONFIG_STACKPROTECTOR_STRONG=y
433 # CONFIG_PCI=y
434 # CONFIG_PCI_MSI=y
435 # # CONFIG_UEVENT_HELPER is not set
436 # CONFIG_DEVTMPFS=y
437 # CONFIG_DEVTMPFS_MOUNT=y
438 # CONFIG_FRAMEBUFFER_CONSOLE=y
439 # CONFIG_IOMMU_SUPPORT=y
440 # CONFIG_IRQ_REMAP=y
441
442 # https://www.linuxfromscratch.org/hints/downloads/files/kernel-configuration.txt
443
444 make help
445 make
446 make modules_install
447
448 cp -iv arch/x86/boot/bzImage /boot/vmlinuz-6.1.11-lfs-11.3
449 cp -iv System.map /boot/System.map-6.1.11
450 cp -iv .config /boot/config-6.1.11
451 install -d /usr/share/doc/linux-6.1.11
452 cp -r Documentation/* /usr/share/doc/linux-6.1.11
453
454 install -v -m755 -d /etc/modprobe.d
455
456 cat > /etc/modprobe.d/usb.conf << "EOF"
457 install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
458 install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
459 EOF
460
461 cd $LFS/sources/
462 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
463
464 echo 11.3 > /etc/lfs-release
465
466 cat > /etc/lsb-release << "EOF"
467 DISTRIB_ID="Linux From Scratch"
468 DISTRIB_RELEASE="11.3"
469 DISTRIB_CODENAME="Vitux"
470 DISTRIB_DESCRIPTION="Linux From Scratch"
471 EOF
472
473 cat > /etc/os-release << "EOF"
474 NAME="Linux From Scratch"
475 VERSION="11.3"
476 ID=lfs
477 PRETTY_NAME="Linux From Scratch 11.3"
478 VERSION_CODENAME="Vitux"
479 EOF
480
481 cd / # as chroot
482 du . -hs
483 # 2.0G
484 du sources/ -hs
485 # 603M sources/
486 sh version-check.sh
487
488 # To make a backup, leave the chroot environment:
489 exit
490 mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm
491 umount $LFS/dev/pts
492 umount $LFS/{sys,proc,run,dev}
493 LFS=/home/vagrant/lfs
494 echo $LFS
495 cd $LFS
496 time tar -cJpf /root/lfs-build-11.3.tar.xz .
497 # real 17m18.550s
498 tar tvaf /root/lfs-build-11.3.tar.xz
499 # -p, --preserve-permissions
500 # -f, --file=ARCHIVE
501 # -J, --xz Filter the archive through xz
502
503 scp lfs*xz xyz@xyz.com:/media/LFS/
Add partition in VM to host LFS build
1 # Add dymamic disk 8 GB to debian built with vagrant ....
2 vagrant halt
3 # VirtualBox, debian VM, settings storage sata add hard disk
4 # Create VDI dynamically allocated with 8 GB
5 vagrant up
6 # sd 2:0:0:0: [sdb] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB)
7 sudo cfdisk /dev/sdb
8 # label type gpt
9 # new 8GB linux fs
10 # write yes quit
11 sudo mkfs -v -t ext4 /dev/sdb1
12 export LFS=/mnt/lfs
13 sudo mkdir -pv $LFS
14 sudo mount -v -t ext4 /dev/sdb1 $LFS
15 sudo bash
16
17 # change fstab in debian host
18 cat >>/etc/fstab << "EOF"
19 /dev/sdb1 /mnt/lfs ext4 defaults 1 1
20 EOF
21
22 exit
23 sudo bash
24 export LFS=/mnt/lfs
25 cd ~
26 cp lfs-build-11.3.tar.xz $LFS
27
28 cd $LFS
29 rm -rf ./*
30 tar -xpf /root/lfs-build-11.3.tar.xz
31 ls
32 chown root:root $LFS/*
33 cat $LFS/etc/inittab
34 cat $LFS/etc/fstab
35
36 # Update LFS fstab
37 cat >>$LFS/etc/fstab << "EOF"
38 /dev/sdb1 / ext4 defaults 1 1
39 EOF
40
41 # Update debian grub to have an entry to LFS
42 cat >>/etc/grub.d/40_custom << "EOF"
43 menuentry "GNU/Linux, Linux 6.1.11-lfs-11.3" {
44 linux /boot/vmlinuz-6.1.11-lfs-11.3 root=/dev/sdb1 ro
45 }
46 EOF
47
48 update-grub
49
50 vagrant reload
51 # select grun entry for lfs
52 # login with root:root
53 df -h # uses 2.7G
54 rm lfs-build-11.3.tar.xz
55 rm -rf sources/*
56 df -h # uses 1.4 GB
57
initramfs with static program
https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html#contents-of-initramfs
A good first step is to get initramfs to run a statically linked "hello world" program as init
1 sudo apt install qemu-system genisoimage
2
3 cd /tmp
4 wget https://saimei.ftp.acc.umu.se/debian-cd/current/amd64/iso-cd/debian-12.1.0-amd64-netinst.iso
5 sudo mount -o loop /vagrant/debian-12.1.0-amd64-netinst.iso /mnt/iso
6
7 # reuse isolinux from debian iso
8 mkdir /tmp/debiancd
9 mkdir /tmp/debiancd/isolinux
10 mkdir /tmp/debiancd/install.amd
11 cd /mnt/iso
12 cp isolinux/isolinux.cfg isolinux/*c32 isolinux/menu.cfg isolinux/txt.cfg /tmp/debiancd/isolinux
13 cp install.amd/initrd.gz install.amd/vmlinuz /tmp/debiancd/install.amd/
14 cp /mnt/iso/isolinux/isolinux.bin /tmp/debiancd/isolinux/
15
16 # isolinux.cfg
17 cat > debiancd/isolinux/isolinux.cfg << EOF
18 default bootcd
19 prompt 1
20 timeout 40
21
22 label bootcd
23 kernel /install.amd/vmlinuz
24 append initrd=/install.amd/test.cpio.gz vga=788
25 EOF
26
27 # hello.c
28 cat > hello.c << EOF
29 #include <stdio.h>
30 #include <unistd.h>
31
32 int main(int argc, char *argv[])
33 {
34 printf("Hello world!\n");
35 sleep(999999999);
36 }
37 EOF
38 gcc -static hello.c -o init
39
40 # build cpio initramfs
41 echo init | cpio -o -H newc | gzip > test.cpio.gz
42 cp test.cpio.gz debiancd/install.amd/test.cpio.gz
43
44 cd /tmp/
45 mkisofs -o /tmp/output.iso -R -l -L -D -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "LFS_$(date +%Y%m%d)" /tmp/debiancd/
46 rm /vagrant/output.iso
47 cp output.iso /vagrant
48
49 # the output.iso can be launched in VirtualBox booting the iso in a VM Other Linux, Linux 64 bit
50
51 # test with qemu
52 qemu-system-x86_64 -kernel debiancd/install.amd/vmlinuz -initrd test.cpio.gz /dev/zero
53 # test with qemu with kernel in debian system
54 qemu-system-x86_64 -kernel /boot/vmlinuz-5.10.0-22-amd64 -initrd test.cpio.gz /dev/zero
55 # test with qemu with kernel from lfs
56 qemu-system-x86_64 -kernel /home/vagrant/lfs/boot/lfskernel -initrd test.cpio.gz /dev/zero
57 # test with qemu with kernel from lfs
58 qemu-system-x86_64 -kernel /home/vagrant/lfs/boot/vmlinuz-6.1.11-lfs-11.3 -initrd test.cpio.gz /dev/zero
Hello world USB boot
Build install-mbr
create-usb-boot-hello-world.sh
Create a FAT16 partition using cfdisk /dev/sdX. We can find the right device using dmesg or lsblk commands.
1 lsblk
2 read -p "Target device: " DEVICE
3 echo "Install MBR on device $DEVICE"
4 read -p "Enter to continue"
5 install-mbr $DEVICE --force
6
7 PARTITION=${DEVICE}1
8 echo "Format $PARTITION"
9 read -p "Enter to continue"
10 # create an MS-DOS FAT filesystem
11 mkdosfs $PARTITION
12 echo "Install syslinux"
13 read -p "Enter to continue"
14 # install the SYSLINUX bootloader on a FAT filesystem
15 syslinux $PARTITION
16
17 echo "Build ramfs"
18 rm -rf ramfs/
19 mkdir ramfs
20 cd ramfs
21
22 cat > hello.c << EOF
23 #include <dirent.h>
24 #include <stdio.h>
25 #include <unistd.h>
26 #include <string.h>
27
28 int main(void) {
29 char data[256];
30 DIR *d;
31 struct dirent *dir;
32 printf("Hello world!\n");
33
34 d = opendir("/dev");
35 if (d) {
36 while ((dir = readdir(d)) != NULL) {
37 printf("%s\n", dir->d_name);
38 }
39 closedir(d);
40 }
41 int loop=1;
42 while(loop == 1){
43 printf("> ");
44 scanf("%s",data);
45 printf("<%s>\n", data);
46 if( strcmp("exit",data) == 0) loop=0;
47 }
48 // sleep(3600);
49 return(0);
50 }
51 EOF
52 # compile static code
53 gcc -static hello.c -o init
54 # build cpio gz
55 find . | cpio -H newc -o | gzip > ../ramfs.gz
56 # copy data to initramfs
57 mount $PARTITION /mnt
58 cd /mnt
59 cat > syslinux.cfg << EOF
60 default vmlinuz
61 append initrd=initrd.gz init=/init
62 EOF
63
64 cp /boot/vmlinuz vmlinuz # slackware kernel
65 #cp /root/vmlinuz-6.1.11-lfs-11.3 vmlinuz
66 cp /root/ramfs.gz initrd.gz
67 ls .
68 cd ~
69 umount /mnt/
70 sync