Contents
-
LinuxFromScratch
-
Build cross compiler system
- Logged in as lfs user
- binutils as lfs user
- gcc
- Linux-6.1.11 API Headers
- glibc
- Libstdc++
- m4
- ncurses
- bash
- coreutils
- diffutils
- file
- findutils
- gawk
- grep
- gzip
- make
- patch
- sed
- tar
- xz
- binutils pass 2
- gcc part 2
- As root user
- gettext
- bison
- perl
- python
- texinfo
- util-linux
- Cleaning
- Backup as root
- Restore as root if required
-
Build system based on the cross compiler
- Prepare Virtual Kernel File Systems
- Enter the chroot env
- man pages
- iana
- glibc
- zlib
- bzip2
- xz
- zstd
- file
- readline
- m4
- bc
- flex
- tcl
- expect
- dejagnu
- binutils
- gmp
- mpfr
- mpc
- attr
- acl
- libcap
- shadow
- gcc
- pkg-config
- ncurses
- sed
- psmisc
- gettext
- bison
- grep
- bash
- libtool
- gdbm
- gperf
- expat
- inetutils
- less
- perl
- XML-Parser
- intltool-0.51.0.tar.gz
- autoconf-2.71.tar.xz
- automake-1.16.5.tar.xz
- openssl-3.0.8.tar.gz
- kmod-30.tar.xz
- elfutils-0.188.tar.bz2
- libffi-3.4.4.tar.gz
- Python-3.11.2.tar.xz
- wheel-0.38.4.tar.gz
- ninja-1.11.1.tar.gz
- meson-1.0.0.tar.gz
- coreutils-9.1.tar.xz
- check-0.15.2.tar.gz
- diffutils-3.9.tar.xz
- gawk-5.2.1.tar.xz
- findutils-4.9.0.tar.xz
- groff-1.22.4.tar.gz
- grub-2.06.tar.xz
- gzip-1.12.tar.xz
- iproute2-6.1.0.tar.xz
- kbd-2.5.1.tar.xz
- libpipeline-1.5.7.tar.gz
- make-4.4.tar.gz
- patch-2.7.6.tar.xz
- tar-1.34.tar.xz
- texinfo-7.0.2.tar.xz
- vim-9.0.1273.tar.xz
- eudev-3.2.11.tar.gz
- man-db-2.11.2.tar.xz
- procps-ng-4.0.2.tar.xz
- util-linux-2.38.1.tar.xz
- e2fsprogs-1.47.0.tar.gz
- sysklogd-1.5.1.tar.gz
- sysvinit-3.06.tar.xz
- Stripping
- Cleaning Up
- lfs-bootscripts-20230101.tar.xz
- linux-6.1.11.tar.xz
- Add partition in VM to host LFS build
-
Build cross compiler system
- initramfs with static program
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
Logged in as lfs user
1 su - lfs
2
3 cat > ~/.bash_profile << "EOF"
4 exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
5 EOF
6
7 cat > ~/.bashrc << "EOF"
8 set +h
9 umask 022
10 LFS=/home/vagrant/lfs
11 LC_ALL=POSIX
12 LFS_TGT=$(uname -m)-lfs-linux-gnu
13 PATH=/usr/bin
14 if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
15 PATH=$LFS/tools/bin:$PATH
16 CONFIG_SITE=$LFS/usr/share/config.site
17 export LFS LC_ALL LFS_TGT PATH CONFIG_SITE
18 EOF
19
20 source ~/.bash_profile
21 source ~/.bashrc
22 echo $LFS
23
24 # Basic build steps
25 # cd /mnt/lfs/sources/
26 # untar package as lfs user
27 # go to package folder
28 # build
29 # go back to /mnt/lfs/sources/
30 # delete extracted package
31
binutils as lfs user
1 cd $LFS/sources/
2 tar xvif binutils*.xz
3 cd $(ls binutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4 mkdir -v build
5 cd build
6 ../configure --prefix=$LFS/tools \
7 --with-sysroot=$LFS \
8 --target=$LFS_TGT \
9 --disable-nls \
10 --enable-gprofng=no \
11 --disable-werror
12 make
13 make install
14 cd $LFS/sources/
15 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
Prepare Virtual Kernel File Systems
1 findmnt | grep $LFS
2 mkdir -pv $LFS/{dev,proc,sys,run}
3 mount -v --bind /dev $LFS/dev
4 mount -v --bind /dev/pts $LFS/dev/pts
5 mount -vt proc proc $LFS/proc
6 mount -vt sysfs sysfs $LFS/sys
7 mount -vt tmpfs tmpfs $LFS/run
8 if [ -h $LFS/dev/shm ]; then
9 mkdir -pv $LFS/$(readlink $LFS/dev/shm)
10 else
11 mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
12 fi
Enter the chroot env
man pages
iana
glibc
1 cd /sources/
2 APP=glibc
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 patch -Np1 -i ../glibc-2.37-fhs-1.patch
7 sed '/width -=/s/workend - string/number_length/' \
8 -i stdio-common/vfprintf-process-arg.c
9 mkdir -v build
10 cd build
11
12 echo "rootsbindir=/usr/sbin" > configparms
13 ../configure --prefix=/usr \
14 --disable-werror \
15 --enable-kernel=3.2 \
16 --enable-stack-protector=strong \
17 --with-headers=/usr/include \
18 libc_cv_slibdir=/usr/lib
19
20 make
21 make check
22 touch /etc/ld.so.conf
23
24 sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
25 make install
26 sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd
27 cp -v ../nscd/nscd.conf /etc/nscd.conf
28 mkdir -pv /var/cache/nscd
29
30 mkdir -pv /usr/lib/locale
31
32 localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
33
34 localedef -i en_US -f ISO-8859-1 en_US
35 localedef -i en_US -f UTF-8 en_US.UTF-8
36
37 localedef -i pt_PT -f ISO-8859-1 pt_PT
38 localedef -i pt_PT@euro -f ISO-8859-15 pt_PT@euro
39 localedef -i pt_PT -f UTF-8 pt_PT.UTF-8
40
41 make localedata/install-locales
42 localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
43 localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true
44
45 cat > /etc/nsswitch.conf << "EOF"
46 passwd: files
47 group: files
48 shadow: files
49
50 hosts: files dns
51 networks: files
52
53 protocols: files
54 services: files
55 ethers: files
56 rpc: files
57 EOF
58
59 tar -xf ../../tzdata2022g.tar.gz
60
61 ZONEINFO=/usr/share/zoneinfo
62 mkdir -pv $ZONEINFO/{posix,right}
63
64 for tz in etcetera southamerica northamerica europe africa antarctica \
65 asia australasia backward; do
66 zic -L /dev/null -d $ZONEINFO ${tz}
67 zic -L /dev/null -d $ZONEINFO/posix ${tz}
68 zic -L leapseconds -d $ZONEINFO/right ${tz}
69 done
70
71 cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
72 zic -d $ZONEINFO -p America/New_York
73 unset ZONEINFO
74
75 echo -e "7\n 37\n 1\n 1\n" | tzselect
76 # 7\n 37\n 1\n 1\n
77 # Europe Portugal Mainland yes
78 ln -sfv /usr/share/zoneinfo/Europe/Portugal /etc/localtime
79
80 cat > /etc/ld.so.conf << "EOF"
81 /usr/local/lib
82 /opt/lib
83 # Add an include directory
84 include /etc/ld.so.conf.d/*.conf
85 EOF
86
87 mkdir -pv /etc/ld.so.conf.d
88 cd /sources/
89 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
zlib
bzip2
1 cd /sources/
2 APP=bzip2
3 tar xvif $APP*.gz
4 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
5
6 patch -Np1 -i ../bzip2-1.0.8-install_docs-1.patch
7 sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
8 sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
9 make -f Makefile-libbz2_so
10 make clean
11 make
12 make PREFIX=/usr install
13 cp -av libbz2.so.* /usr/lib
14 ln -sv libbz2.so.1.0.8 /usr/lib/libbz2.so
15
16 cp -v bzip2-shared /usr/bin/bzip2
17 for i in /usr/bin/{bzcat,bunzip2}; do
18 ln -sfv bzip2 $i
19 done
20
21 rm -fv /usr/lib/libbz2.a
22
23 cd /sources/
24 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
xz
1 cd /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 --disable-static \
8 --docdir=/usr/share/doc/xz-5.4.1
9
10 make
11 make check
12 make install
13
14 cd /sources/
15 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
zstd
file
1 cd /sources/
2 APP=file
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
readline
1 cd /sources/
2 APP=readline
3 tar xvif $APP*.gz
4 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
5
6 sed -i '/MV.*old/d' Makefile.in
7 sed -i '/{OLDSUFF}/c:' support/shlib-install
8 patch -Np1 -i ../readline-8.2-upstream_fix-1.patch
9
10 ./configure --prefix=/usr \
11 --disable-static \
12 --with-curses \
13 --docdir=/usr/share/doc/readline-8.2
14
15 make SHLIB_LIBS="-lncursesw"
16 make SHLIB_LIBS="-lncursesw" install
17 install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.2
18
19 cd /sources/
20 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
m4
1 cd /sources/
2 APP=m4
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
bc
1 cd /sources/
2 APP=bc
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 CC=gcc ./configure --prefix=/usr -G -O3 -r
8 make
9 make test
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
flex
1 cd /sources/
2 APP=flex
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --docdir=/usr/share/doc/flex-2.6.4 \
9 --disable-static
10
11 make
12 make check
13 make install
14 ln -sv flex /usr/bin/lex
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
tcl
1 cd /sources/
2 APP=tcl8.6.13-src
3 EXTENSION=gz
4 FOLDER=tcl8.6.13
5 tar xvzf $APP*.$EXTENSION
6 cd $FOLDER
7
8 SRCDIR=$(pwd)
9 cd unix
10 ./configure --prefix=/usr \
11 --mandir=/usr/share/man
12
13 make
14 sed -e "s|$SRCDIR/unix|/usr/lib|" \
15 -e "s|$SRCDIR|/usr/include|" \
16 -i tclConfig.sh
17
18 sed -e "s|$SRCDIR/unix/pkgs/tdbc1.1.5|/usr/lib/tdbc1.1.5|" \
19 -e "s|$SRCDIR/pkgs/tdbc1.1.5/generic|/usr/include|" \
20 -e "s|$SRCDIR/pkgs/tdbc1.1.5/library|/usr/lib/tcl8.6|" \
21 -e "s|$SRCDIR/pkgs/tdbc1.1.5|/usr/include|" \
22 -i pkgs/tdbc1.1.5/tdbcConfig.sh
23
24 sed -e "s|$SRCDIR/unix/pkgs/itcl4.2.3|/usr/lib/itcl4.2.3|" \
25 -e "s|$SRCDIR/pkgs/itcl4.2.3/generic|/usr/include|" \
26 -e "s|$SRCDIR/pkgs/itcl4.2.3|/usr/include|" \
27 -i pkgs/itcl4.2.3/itclConfig.sh
28
29 unset SRCDIR
30
31 make test
32 make install
33
34 chmod -v u+w /usr/lib/libtcl8.6.so
35
36 make install-private-headers
37 ln -sfv tclsh8.6 /usr/bin/tclsh
38 mv /usr/share/man/man3/{Thread,Tcl_Thread}.3
39 cd ..
40 tar -xf ../tcl8.6.13-html.tar.gz --strip-components=1
41 mkdir -v -p /usr/share/doc/tcl-8.6.13
42 cp -v -r ./html/* /usr/share/doc/tcl-8.6.13
43
44 cd /sources/
45 rm -rf $FOLDER
expect
1 cd /sources/
2 APP=expect
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --with-tcl=/usr/lib \
9 --enable-shared \
10 --mandir=/usr/share/man \
11 --with-tclinclude=/usr/include
12
13 make
14 make test
15 make install
16 ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib
17
18 cd /sources/
19 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
dejagnu
1 cd /sources/
2 APP=dejagnu
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 mkdir -v build
8 cd build
9
10 ../configure --prefix=/usr
11 makeinfo --html --no-split -o doc/dejagnu.html ../doc/dejagnu.texi
12 makeinfo --plaintext -o doc/dejagnu.txt ../doc/dejagnu.texi
13
14 make install
15 install -v -dm755 /usr/share/doc/dejagnu-1.6.3
16 install -v -m644 doc/dejagnu.{html,txt} /usr/share/doc/dejagnu-1.6.3
17
18 make check
19
20 cd /sources/
21 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
binutils
1 cd /sources/
2 APP=binutils
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 expect -c "spawn ls"
8 mkdir -v build
9 cd build
10
11 ../configure --prefix=/usr \
12 --sysconfdir=/etc \
13 --enable-gold \
14 --enable-ld=default \
15 --enable-plugins \
16 --enable-shared \
17 --disable-werror \
18 --enable-64-bit-bfd \
19 --with-system-zlib
20 make tooldir=/usr
21
22 make -k check
23 grep '^FAIL:' $(find -name '*.log')
24 # expected to 12 tests fail
25 grep '^FAIL:' $(find -name '*.log') | wc -l
26
27 make tooldir=/usr install
28 rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a
29 rm -fv /usr/share/man/man1/{gprofng,gp-*}.1
30
31 cd /sources/
32 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
gmp
1 cd /sources/
2 APP=gmp
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 cp -v configfsf.guess config.guess
8 cp -v configfsf.sub config.sub
9
10 ./configure --prefix=/usr \
11 --enable-cxx \
12 --disable-static \
13 --docdir=/usr/share/doc/gmp-6.2.1
14 make
15 make html
16 make check 2>&1 | tee gmp-check-log
17 awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log
18 # check all 197 pass
19 make install
20 make install-html
21
22 cd /sources/
23 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
mpfr
1 cd /sources/
2 APP=mpfr
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -e 's/+01,234,567/+1,234,567 /' \
8 -e 's/13.10Pd/13Pd/' \
9 -i tests/tsprintf.c
10
11 ./configure --prefix=/usr \
12 --disable-static \
13 --enable-thread-safe \
14 --docdir=/usr/share/doc/mpfr-4.2.0
15 make
16 make html
17 make check
18 # ensure that all 197 tests passed
19 make install
20 make install-html
21
22 cd /sources/
23 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
mpc
1 cd /sources/
2 APP=mpc
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-static \
9 --docdir=/usr/share/doc/mpc-1.3.1
10
11 make
12 make html
13 make check
14 make install
15 make install-html
16
17 cd /sources/
18 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
attr
1 cd /sources/
2 APP=attr
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-static \
9 --sysconfdir=/etc \
10 --docdir=/usr/share/doc/attr-2.5.1
11
12 make
13 make check
14 make install
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
acl
1 cd /sources/
2 APP=acl
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-static \
9 --docdir=/usr/share/doc/acl-2.3.1
10
11 make
12 make install
13
14 cd /sources/
15 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
libcap
1 cd /sources/
2 APP=libcap
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i '/install -m.*STA/d' libcap/Makefile
8 make prefix=/usr lib=lib
9 make test
10 make prefix=/usr lib=lib install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
shadow
1 cd /sources/
2 APP=shadow
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i 's/groups$(EXEEXT) //' src/Makefile.in
8 find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
9 find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
10 find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
11
12 sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \
13 -e 's@#\(SHA_CRYPT_..._ROUNDS 5000\)@\100@' \
14 -e 's:/var/spool/mail:/var/mail:' \
15 -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
16 -i etc/login.defs
17
18 # no cracklib support
19
20 touch /usr/bin/passwd
21 ./configure --sysconfdir=/etc \
22 --disable-static \
23 --with-group-name-max-length=32
24
25 make
26 make exec_prefix=/usr install
27 make -C man install-man
28
29 pwconv
30 grpconv
31 mkdir -p /etc/default
32 useradd -D --gid 999
33
34 sed -i '/MAIL/s/yes/no/' /etc/default/useradd
35 # input root pwd
36 passwd root
37
38 cd /sources/
39 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
gcc
1 cd /sources/
2 APP=gcc
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 case $(uname -m) in
8 x86_64)
9 sed -e '/m64=/s/lib64/lib/' \
10 -i.orig gcc/config/i386/t-linux64
11 ;;
12 esac
13
14 mkdir -v build
15 cd build
16
17 ../configure --prefix=/usr \
18 LD=ld \
19 --enable-languages=c,c++ \
20 --enable-default-pie \
21 --enable-default-ssp \
22 --disable-multilib \
23 --disable-bootstrap \
24 --with-system-zlib
25
26 time make # 43 SBU # real 65m28.356s
27 ulimit -s 32768
28 chown -Rv tester .
29 su tester -c "PATH=$PATH make -k check" # started 16:14
30 ../contrib/test_summary
31
32 make install
33 chown -v -R root:root \
34 /usr/lib/gcc/$(gcc -dumpmachine)/12.2.0/include{,-fixed}
35 ln -svr /usr/bin/cpp /usr/lib
36 ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/12.2.0/liblto_plugin.so \
37 /usr/lib/bfd-plugins/
38
39 echo 'int main(){}' > dummy.c
40 cc dummy.c -v -Wl,--verbose &> dummy.log
41 readelf -l a.out | grep ': /lib'
42 # should show
43 # [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
44
45 grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log
46 grep -B4 '^ /usr/include' dummy.log
47 grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
48 grep "/lib.*/libc.so.6 " dummy.log
49 rm -v dummy.c a.out dummy.log
50
51 mkdir -pv /usr/share/gdb/auto-load/usr/lib
52 mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
53
54 cd /sources/
55 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
pkg-config
1 cd /sources/
2 APP=pkg-config
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --with-internal-glib \
9 --disable-host-tool \
10 --docdir=/usr/share/doc/pkg-config-0.29.2
11 make
12 make check
13 make install
14
15 cd /sources/
16 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
ncurses
1 cd /sources/
2 APP=ncurses
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --mandir=/usr/share/man \
9 --with-shared \
10 --without-debug \
11 --without-normal \
12 --with-cxx-shared \
13 --enable-pc-files \
14 --enable-widec \
15 --with-pkg-config-libdir=/usr/lib/pkgconfig
16
17 make
18 make DESTDIR=$PWD/dest install
19 install -vm755 dest/usr/lib/libncursesw.so.6.4 /usr/lib
20 rm -v dest/usr/lib/libncursesw.so.6.4
21 cp -av dest/* /
22
23 for lib in ncurses form panel menu ; do
24 rm -vf /usr/lib/lib${lib}.so
25 echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so
26 ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
27 done
28
29 rm -vf /usr/lib/libcursesw.so
30 echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so
31 ln -sfv libncurses.so /usr/lib/libcurses.so
32
33 mkdir -pv /usr/share/doc/ncurses-6.4
34 cp -v -R doc/* /usr/share/doc/ncurses-6.4
35
36 cd /sources/
37 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
sed
1 cd /sources/
2 APP=sed
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8
9 make
10 make html
11 chown -Rv tester .
12 su tester -c "PATH=$PATH make check"
13
14 make install
15 install -d -m755 /usr/share/doc/sed-4.9
16 install -m644 doc/sed.html /usr/share/doc/sed-4.9
17
18 cd /sources/
19 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
psmisc
gettext
1 cd /sources/
2 APP=gettext
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-static \
9 --docdir=/usr/share/doc/gettext-0.21.1
10
11 make
12 make check
13 make install
14 chmod -v 0755 /usr/lib/preloadable_libintl.so
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
bison
1 cd /sources/
2 APP=bison
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
grep
1 cd /sources/
2 APP=grep
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i "s/echo/#echo/" src/egrep.sh
8 ./configure --prefix=/usr
9 make
10 make check
11 make install
12
13 cd /sources/
14 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
bash
1 cd /sources/
2 APP=bash
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --without-bash-malloc \
9 --with-installed-readline \
10 --docdir=/usr/share/doc/bash-5.2.15
11
12 make
13 chown -Rv tester .
14 su -s /usr/bin/expect tester << EOF
15 set timeout -1
16 spawn make tests
17 expect eof
18 lassign [wait] _ _ _ value
19 exit $value
20 EOF
21
22 make install
23 exec /usr/bin/bash --login
24
25 cd /sources/
26 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
libtool
1 cd /sources/
2 APP=libtool
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make -k check
10 make install
11 rm -fv /usr/lib/libltdl.a
12
13 cd /sources/
14 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
gdbm
1 cd /sources/
2 APP=gdbm
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-static \
9 --enable-libgdbm-compat
10
11 make
12 make check
13 make install
14
15 cd /sources/
16 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
gperf
1 cd /sources/
2 APP=gperf
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1
8 make
9 make -j1 check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
expat
1 cd /sources/
2 APP=expat
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-static \
9 --docdir=/usr/share/doc/expat-2.5.0
10
11 make
12 make check
13 make install
14 install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.5.0
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
inetutils
1 cd /sources/
2 APP=inetutils
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --bindir=/usr/bin \
9 --localstatedir=/var \
10 --disable-logger \
11 --disable-whois \
12 --disable-rcp \
13 --disable-rexec \
14 --disable-rlogin \
15 --disable-rsh \
16 --disable-servers
17
18 make
19 make check
20 make install
21 mv -v /usr/{,s}bin/ifconfig
22 cd /sources/
23 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
less
1 cd /sources/
2 APP=less
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr --sysconfdir=/etc
8 make
9 make install
10
11 cd /sources/
12 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
perl
1 cd /sources/
2 APP=perl
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 export BUILD_ZLIB=False
8 export BUILD_BZIP2=0
9
10 sh Configure -des \
11 -Dprefix=/usr \
12 -Dvendorprefix=/usr \
13 -Dprivlib=/usr/lib/perl5/5.36/core_perl \
14 -Darchlib=/usr/lib/perl5/5.36/core_perl \
15 -Dsitelib=/usr/lib/perl5/5.36/site_perl \
16 -Dsitearch=/usr/lib/perl5/5.36/site_perl \
17 -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \
18 -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl \
19 -Dman1dir=/usr/share/man/man1 \
20 -Dman3dir=/usr/share/man/man3 \
21 -Dpager="/usr/bin/less -isR" \
22 -Duseshrplib \
23 -Dusethreads
24 make
25 make test
26 make install
27 unset BUILD_ZLIB BUILD_BZIP2
28
29 cd /sources/
30 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
XML-Parser
1 cd /sources/
2 APP=XML-Parser
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 perl Makefile.PL
8 make
9 make test
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
intltool-0.51.0.tar.gz
1 cd /sources/
2 APP=intltool
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i 's:\\\${:\\\$\\{:' intltool-update.in
8 ./configure --prefix=/usr
9 make
10 make check
11 make install
12 install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO
13
14 cd /sources/
15 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
autoconf-2.71.tar.xz
1 cd /sources/
2 APP=autoconf
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -e 's/SECONDS|/&SHLVL|/' \
8 -e '/BASH_ARGV=/a\ /^SHLVL=/ d' \
9 -i.orig tests/local.at
10
11 ./configure --prefix=/usr
12 make
13 make check
14 make install
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
automake-1.16.5.tar.xz
1 cd /sources/
2 APP=automake
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.5
8
9 make
10 make -j4 check
11 make install
12
13 cd /sources/
14 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
openssl-3.0.8.tar.gz
1 cd /sources/
2 APP=openssl
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./config --prefix=/usr \
8 --openssldir=/etc/ssl \
9 --libdir=lib \
10 shared \
11 zlib-dynamic
12
13 make
14 make test
15 sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile
16 make MANSUFFIX=ssl install
17 mv -v /usr/share/doc/openssl /usr/share/doc/openssl-3.0.8
18 cp -vfr doc/* /usr/share/doc/openssl-3.0.8
19
20 cd /sources/
21 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
kmod-30.tar.xz
1 cd /sources/
2 APP=kmod
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --sysconfdir=/etc \
9 --with-openssl \
10 --with-xz \
11 --with-zstd \
12 --with-zlib
13
14 make
15 make install
16
17 for target in depmod insmod modinfo modprobe rmmod; do
18 ln -sfv ../bin/kmod /usr/sbin/$target
19 done
20
21 ln -sfv kmod /usr/bin/lsmod
22
23 cd /sources/
24 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
elfutils-0.188.tar.bz2
1 cd /sources/
2 APP=elfutils
3 EXTENSION=bz2
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-debuginfod \
9 --enable-libdebuginfod=dummy
10
11 make
12 make check
13 make -C libelf install
14 install -vm644 config/libelf.pc /usr/lib/pkgconfig
15 rm /usr/lib/libelf.a
16
17 cd /sources/
18 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
libffi-3.4.4.tar.gz
1 cd /sources/
2 APP=libffi
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --disable-static \
9 --with-gcc-arch=native
10
11 make
12 make check
13 make install
14
15 cd /sources/
16 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
Python-3.11.2.tar.xz
1 cd /sources/
2 APP=Python-3
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --enable-shared \
9 --with-system-expat \
10 --with-system-ffi \
11 --enable-optimizations
12
13 make
14 make install
15
16 cat > /etc/pip.conf << "EOF"
17 [global]
18 root-user-action = ignore
19 disable-pip-version-check = true
20 EOF
21
22 install -v -dm755 /usr/share/doc/python-3.11.2/html
23
24 tar --strip-components=1 \
25 --no-same-owner \
26 --no-same-permissions \
27 -C /usr/share/doc/python-3.11.2/html \
28 -xvf ../python-3.11.2-docs-html.tar.bz2
29
30 cd /sources/
31 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
wheel-0.38.4.tar.gz
1 cd /sources/
2 APP=wheel
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 PYTHONPATH=src pip3 wheel -w dist --no-build-isolation --no-deps $PWD
8 pip3 install --no-index --find-links=dist wheel
9
10 cd /sources/
11 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
ninja-1.11.1.tar.gz
1 cd /sources/
2 APP=ninja
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 export NINJAJOBS=4
8
9 sed -i '/int Guess/a \
10 int j = 0;\
11 char* jobs = getenv( "NINJAJOBS" );\
12 if ( jobs != NULL ) j = atoi( jobs );\
13 if ( j > 0 ) return j;\
14 ' src/ninja.cc
15
16 python3 configure.py --bootstrap
17
18 ./ninja ninja_test
19 ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots
20
21 install -vm755 ninja /usr/bin/
22 install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja
23 install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja
24
25 cd /sources/
26 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
meson-1.0.0.tar.gz
1 cd /sources/
2 APP=meson
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 pip3 wheel -w dist --no-build-isolation --no-deps $PWD
8 pip3 install --no-index --find-links dist meson
9 install -vDm644 data/shell-completions/bash/meson /usr/share/bash-completion/completions/meson
10 install -vDm644 data/shell-completions/zsh/_meson /usr/share/zsh/site-functions/_meson
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
coreutils-9.1.tar.xz
1 cd /sources/
2 APP=coreutils
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 patch -Np1 -i ../coreutils-9.1-i18n-1.patch
8
9 autoreconf -fiv
10 FORCE_UNSAFE_CONFIGURE=1 ./configure \
11 --prefix=/usr \
12 --enable-no-install-program=kill,uptime
13
14 make
15 make NON_ROOT_USERNAME=tester check-root
16
17 echo "dummy:x:102:tester" >> /etc/group
18
19 chown -Rv tester .
20 su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"
21 sed -i '/dummy/d' /etc/group
22
23 make install
24
25 mv -v /usr/bin/chroot /usr/sbin
26 mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
27 sed -i 's/"1"/"8"/' /usr/share/man/man8/chroot.8
28
29 cd /sources/
30 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
check-0.15.2.tar.gz
1 cd /sources/
2 APP=check
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr --disable-static
8
9 make
10 make check
11 make docdir=/usr/share/doc/check-0.15.2 install
12
13 cd /sources/
14 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
diffutils-3.9.tar.xz
1 cd /sources/
2 APP=diffutils
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
gawk-5.2.1.tar.xz
1 cd /sources/
2 APP=gawk
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i 's/extras//' Makefile.in
8 ./configure --prefix=/usr
9 make
10 make check
11 make LN='ln -f' install
12 mkdir -pv /usr/share/doc/gawk-5.2.1
13 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-5.2.1
14
15 cd /sources/
16 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
findutils-4.9.0.tar.xz
1 cd /sources/
2 APP=findutils
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 case $(uname -m) in
8 i?86) TIME_T_32_BIT_OK=yes ./configure --prefix=/usr --localstatedir=/var/lib/locate ;;
9 x86_64) ./configure --prefix=/usr --localstatedir=/var/lib/locate ;;
10 esac
11
12 make
13 chown -Rv tester .
14 su tester -c "PATH=$PATH make check"
15 make install
16
17 cd /sources/
18 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
groff-1.22.4.tar.gz
1 cd /sources/
2 APP=groff
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 PAGE=A4 ./configure --prefix=/usr
8
9 make
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
grub-2.06.tar.xz
1 cd /sources/
2 APP=grub
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 unset {C,CPP,CXX,LD}FLAGS
8 patch -Np1 -i ../grub-2.06-upstream_fixes-1.patch
9
10 ./configure --prefix=/usr \
11 --sysconfdir=/etc \
12 --disable-efiemu \
13 --disable-werror
14
15 make
16 make install
17 mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions
18
19 cd /sources/
20 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
gzip-1.12.tar.xz
1 cd /sources/
2 APP=gzip
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
iproute2-6.1.0.tar.xz
1 cd /sources/
2 APP=iproute2
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i /ARPD/d Makefile
8 rm -fv man/man8/arpd.8
9
10 make NETNS_RUN_DIR=/run/netns
11 make SBINDIR=/usr/sbin install
12 mkdir -pv /usr/share/doc/iproute2-6.1.0
13 cp -v COPYING README* /usr/share/doc/iproute2-6.1.0
14
15 cd /sources/
16 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
kbd-2.5.1.tar.xz
1 cd /sources/
2 APP=kbd
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 patch -Np1 -i ../kbd-2.5.1-backspace-1.patch
8
9 sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure
10 sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in
11
12 ./configure --prefix=/usr --disable-vlock
13
14 make
15 make check
16 make install
17
18 mkdir -pv /usr/share/doc/kbd-2.5.1
19 cp -R -v docs/doc/* /usr/share/doc/kbd-2.5.1
20
21 cd /sources/
22 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
libpipeline-1.5.7.tar.gz
1 cd /sources/
2 APP=libpipeline
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
make-4.4.tar.gz
1 cd /sources/
2 APP=make
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -e '/ifdef SIGPIPE/,+2 d' \
8 -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \
9 -i src/main.c
10
11 ./configure --prefix=/usr
12 make
13 make check
14 make install
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
patch-2.7.6.tar.xz
1 cd /sources/
2 APP=patch
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
tar-1.34.tar.xz
1 cd /sources/
2 APP=tar
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 FORCE_UNSAFE_CONFIGURE=1 \
8 ./configure --prefix=/usr
9
10 make
11 make check
12 make install
13 make -C doc install-html docdir=/usr/share/doc/tar-1.34
14
15 cd /sources/
16 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
texinfo-7.0.2.tar.xz
1 cd /sources/
2 APP=texinfo
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11 make TEXMF=/usr/share/texmf install-tex
12
13 cd /sources/
14 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
vim-9.0.1273.tar.xz
1 cd /sources/
2 APP=vim
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
8 ./configure --prefix=/usr
9 make
10 chown -Rv tester .
11 su tester -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log
12 make install
13
14 ln -sv vim /usr/bin/vi
15 for L in /usr/share/man/{,*/}man1/vim.1; do
16 ln -sv vim.1 $(dirname $L)/vi.1
17 done
18
19 ln -sv ../vim/vim90/doc /usr/share/doc/vim-9.0.1273
20
21 cat > /etc/vimrc << "EOF"
22 source $VIMRUNTIME/defaults.vim
23 let skip_defaults_vim=1
24
25 set nocompatible
26 set backspace=2
27 set mouse=
28 syntax on
29 if (&term == "xterm") || (&term == "putty")
30 set background=dark
31 endif
32
33 EOF
34
35 cd /sources/
36 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
eudev-3.2.11.tar.gz
1 cd /sources/
2 APP=eudev
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i '/udevdir/a udev_dir=${udevdir}' src/udev/udev.pc.in
8 ./configure --prefix=/usr \
9 --bindir=/usr/sbin \
10 --sysconfdir=/etc \
11 --enable-manpages \
12 --disable-static
13
14 make
15 mkdir -pv /usr/lib/udev/rules.d
16 mkdir -pv /etc/udev/rules.d
17
18 make check
19 make install
20
21 tar -xvf ../udev-lfs-20171102.tar.xz
22 make -f udev-lfs-20171102/Makefile.lfs install
23
24 udevadm hwdb --update
25
26 cd /sources/
27 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
man-db-2.11.2.tar.xz
1 cd /sources/
2 APP=man-db
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --docdir=/usr/share/doc/man-db-2.11.2 \
9 --sysconfdir=/etc \
10 --disable-setuid \
11 --enable-cache-owner=bin \
12 --with-browser=/usr/bin/lynx \
13 --with-vgrind=/usr/bin/vgrind \
14 --with-grap=/usr/bin/grap \
15 --with-systemdtmpfilesdir= \
16 --with-systemdsystemunitdir=
17 make
18 make check
19 make install
20
21 cd /sources/
22 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
procps-ng-4.0.2.tar.xz
1 cd /sources/
2 APP=procps
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --docdir=/usr/share/doc/procps-ng-4.0.2 \
9 --disable-static \
10 --disable-kill
11
12 make
13 make check
14 make install
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
util-linux-2.38.1.tar.xz
1 cd /sources/
2 APP=util-linux
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
8 --bindir=/usr/bin \
9 --libdir=/usr/lib \
10 --sbindir=/usr/sbin \
11 --disable-chfn-chsh \
12 --disable-login \
13 --disable-nologin \
14 --disable-su \
15 --disable-setpriv \
16 --disable-runuser \
17 --disable-pylibmount \
18 --disable-static \
19 --without-python \
20 --without-systemd \
21 --without-systemdsystemunitdir \
22 --docdir=/usr/share/doc/util-linux-2.38.1
23
24 make
25 chown -Rv tester .
26 su tester -c "make -k check"
27 make install
28
29 cd /sources/
30 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
e2fsprogs-1.47.0.tar.gz
1 cd /sources/
2 APP=e2fsprogs
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 mkdir -v build
8 cd build
9
10 ../configure --prefix=/usr \
11 --sysconfdir=/etc \
12 --enable-elf-shlibs \
13 --disable-libblkid \
14 --disable-libuuid \
15 --disable-uuidd \
16 --disable-fsck
17
18 make
19 make check
20 make install
21 rm -fv /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
22 gunzip -v /usr/share/info/libext2fs.info.gz
23 install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info
24 makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo
25 install -v -m644 doc/com_err.info /usr/share/info
26 install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info
27 sed 's/metadata_csum_seed,//' -i /etc/mke2fs.conf
28
29 cd /sources/
30 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
sysklogd-1.5.1.tar.gz
1 cd /sources/
2 APP=sysklogd
3 EXTENSION=gz
4 tar xvzf $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c
8 sed -i 's/union wait/int/' syslogd.c
9
10 make
11 make BINDIR=/sbin install
12
13 cat > /etc/syslog.conf << "EOF"
14 auth,authpriv.* -/var/log/auth.log
15 *.*;auth,authpriv.none -/var/log/sys.log
16 daemon.* -/var/log/daemon.log
17 kern.* -/var/log/kern.log
18 mail.* -/var/log/mail.log
19 user.* -/var/log/user.log
20 *.emerg *
21 EOF
22
23 cd /sources/
24 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
sysvinit-3.06.tar.xz
1 cd /sources/
2 APP=sysvinit
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 patch -Np1 -i ../sysvinit-3.06-consolidated-1.patch
8 make
9 make install
10
11 cd /sources/
12 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
Stripping
1 save_usrlib="$(cd /usr/lib; ls ld-linux*[^g])
2 libc.so.6
3 libthread_db.so.1
4 libquadmath.so.0.0.0
5 libstdc++.so.6.0.30
6 libitm.so.1.0.0
7 libatomic.so.1.2.0"
8
9 cd /usr/lib
10
11 for LIB in $save_usrlib; do
12 objcopy --only-keep-debug $LIB $LIB.dbg
13 cp $LIB /tmp/$LIB
14 strip --strip-unneeded /tmp/$LIB
15 objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB
16 install -vm755 /tmp/$LIB /usr/lib
17 rm /tmp/$LIB
18 done
19
20 online_usrbin="bash find strip"
21 online_usrlib="libbfd-2.40.so
22 libsframe.so.0.0.0
23 libhistory.so.8.2
24 libncursesw.so.6.4
25 libm.so.6
26 libreadline.so.8.2
27 libz.so.1.2.13
28 $(cd /usr/lib; find libnss*.so* -type f)"
29
30 for BIN in $online_usrbin; do
31 cp /usr/bin/$BIN /tmp/$BIN
32 strip --strip-unneeded /tmp/$BIN
33 install -vm755 /tmp/$BIN /usr/bin
34 rm /tmp/$BIN
35 done
36
37 for LIB in $online_usrlib; do
38 cp /usr/lib/$LIB /tmp/$LIB
39 strip --strip-unneeded /tmp/$LIB
40 install -vm755 /tmp/$LIB /usr/lib
41 rm /tmp/$LIB
42 done
43
44 for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \
45 $(find /usr/lib -type f -name \*.a) \
46 $(find /usr/{bin,sbin,libexec} -type f); do
47 case "$online_usrbin $online_usrlib $save_usrlib" in
48 *$(basename $i)* )
49 ;;
50 * ) strip --strip-unneeded $i
51 ;;
52 esac
53 done
54
55 unset BIN LIB save_usrlib online_usrbin online_usrlib
Cleaning Up
lfs-bootscripts-20230101.tar.xz
1 cd /sources/
2 APP=lfs-bootscripts
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 make install
8
9 cd /sources/
10 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
11
12 bash /usr/lib/udev/init-net-rules.sh
13 cat /etc/udev/rules.d/70-persistent-net.rules
14
15 cat > /etc/sysconfig/ifconfig.eth0 << "EOF"
16 ONBOOT=yes
17 IFACE=eth0
18 SERVICE=ipv4-static
19 IP=192.168.1.2
20 GATEWAY=192.168.1.1
21 PREFIX=24
22 BROADCAST=192.168.1.255
23 EOF
24
25 cat > /etc/resolv.conf << "EOF"
26 domain <Your Domain Name>
27 nameserver <IP address of your primary nameserver>
28 nameserver <IP address of your secondary nameserver>
29 EOF
30
31 echo "vitux" > /etc/hostname
32
33 cat > /etc/hosts << "EOF"
34 127.0.0.1 localhost.localdomain localhost
35 127.0.1.1 vitux.bitarus.mooo.com
36 ::1 localhost ip6-localhost ip6-loopback
37 ff02::1 ip6-allnodes
38 ff02::2 ip6-allrouters
39 EOF
40
41 cat > /etc/inittab << "EOF"
42 id:3:initdefault:
43 si::sysinit:/etc/rc.d/init.d/rc S
44 l0:0:wait:/etc/rc.d/init.d/rc 0
45 l1:S1:wait:/etc/rc.d/init.d/rc 1
46 l2:2:wait:/etc/rc.d/init.d/rc 2
47 l3:3:wait:/etc/rc.d/init.d/rc 3
48 l4:4:wait:/etc/rc.d/init.d/rc 4
49 l5:5:wait:/etc/rc.d/init.d/rc 5
50 l6:6:wait:/etc/rc.d/init.d/rc 6
51 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
52 su:S06:once:/sbin/sulogin
53 s1:1:respawn:/sbin/sulogin
54 1:2345:respawn:/sbin/agetty --noclear tty1 9600
55 2:2345:respawn:/sbin/agetty tty2 9600
56 3:2345:respawn:/sbin/agetty tty3 9600
57 4:2345:respawn:/sbin/agetty tty4 9600
58 5:2345:respawn:/sbin/agetty tty5 9600
59 6:2345:respawn:/sbin/agetty tty6 9600
60 EOF
61
62 cat > /etc/sysconfig/clock << "EOF"
63 UTC=1
64 # Set this to any options you might need to give to hwclock,
65 # such as machine hardware clock type for Alphas.
66 CLOCKPARAMS=
67 EOF
68
69 cat > /etc/sysconfig/console << "EOF"
70 KEYMAP="pt-latin1"
71 FONT="lat1-16 -m 8859-1"
72 UNICODE="1"
73 EOF
74
75 locale -a
76 locale -a | grep -i pt
77 kk_KZ.pt154
78 pt_BR
79 pt_BR.iso88591
80 pt_BR.utf8
81 pt_PT
82 pt_PT.iso88591
83 pt_PT.iso885915@euro
84 pt_PT.utf8
85 pt_PT@euro
86
87 cat > /etc/profile << "EOF"
88 export LANG=pt_PT.utf8
89 EOF
90
91 cat > /etc/inputrc << "EOF"
92 # Modified by Chris Lynn <roryo@roryo.dynup.net>
93 # Allow the command prompt to wrap to the next line
94 set horizontal-scroll-mode Off
95 # Enable 8-bit input
96 set meta-flag On
97 set input-meta On
98 # Turns off 8th bit stripping
99 set convert-meta Off
100 # Keep the 8th bit for display
101 set output-meta On
102 # none, visible or audible
103 set bell-style none
104 # All of the following map the escape sequence of the value
105 # contained in the 1st argument to the readline specific functions
106 "\eOd": backward-word
107 "\eOc": forward-word
108 # for linux console
109 "\e[1~": beginning-of-line
110 "\e[4~": end-of-line
111 "\e[5~": beginning-of-history
112 "\e[6~": end-of-history
113 "\e[3~": delete-char
114 "\e[2~": quoted-insert
115 # for xterm
116 "\eOH": beginning-of-line
117 "\eOF": end-of-line
118 # for Konsole
119 "\e[H": beginning-of-line
120 "\e[F": end-of-line
121 EOF
122
123 cat > /etc/shells << "EOF"
124 /bin/sh
125 /bin/bash
126 EOF
127
128 cat > /etc/fstab << "EOF"
129 # file-system mount-point type options dump fsck
130 # order
131
132 #/dev/<xxx> / <fff> defaults 1 1
133 #/dev/<yyy> swap swap pri=1 0 0
134 proc /proc proc nosuid,noexec,nodev 0 0
135 sysfs /sys sysfs nosuid,noexec,nodev 0 0
136 devpts /dev/pts devpts gid=5,mode=620 0 0
137 tmpfs /run tmpfs defaults 0 0
138 devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
139 tmpfs /dev/shm tmpfs nosuid,nodev 0 0
140 EOF
linux-6.1.11.tar.xz
1 cd /sources/
2 APP=linux
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 make mrproper
8 make menuconfig
9
10 # Processor type and features --->
11 # [*] Build a relocatable kernel [CONFIG_RELOCATABLE]
12 # [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE]
13 # General setup --->
14 # [ ] Compile the kernel with warnings as errors [CONFIG_WERROR]
15 # < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS]
16 # General architecture-dependent options --->
17 # [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR]
18 # [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG]
19 # Device Drivers --->
20 # Graphics support --->
21 # Frame buffer Devices --->
22 # <*> Support for frame buffer devices --->
23 # Console display driver support --->
24 # [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE]
25 # Generic Driver Options --->
26 # [ ] Support for uevent helper [CONFIG_UEVENT_HELPER]
27 # [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS]
28 # [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [CONFIG_DEVTMPFS_MOUNT]
29 # Processor type and features --->
30 # [*] Support x2apic [CONFIG_X86_X2APIC]
31 # Device Drivers --->
32 # [*] PCI Support ---> [CONFIG_PCI]
33 # [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI]
34 # [*] IOMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT]
35 # [*] Support for Interrupt Remapping [CONFIG_IRQ_REMAP]
36
37 /sources/linux-6.1.11# find . -name .config
38 ./.config
39
40 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 \
41 -e CONFIG_DEVTMPFS_MOUNT -e CONFIG_DEVTMPFS=y -e CONFIG_UEVENT_HELPER -e CONFIG_FRAMEBUFFER_CONSOLE=y \
42 -e CONFIG_STACKPROTECTOR=y -e CONFIG_STACKPROTECTOR_STRONG=y -e CONFIG_RELOCATABLE=y -e CONFIG_RANDOMIZE_BASE=y \
43 -e CONFIG_WERROR -e CONFIG_IKHEADERS
44
45 # # CONFIG_WERROR is not set
46 # # CONFIG_IKHEADERS is not set
47 # CONFIG_RELOCATABLE=y
48 # CONFIG_RANDOMIZE_BASE=y
49 # CONFIG_STACKPROTECTOR=y
50 # CONFIG_STACKPROTECTOR_STRONG=y
51 # CONFIG_PCI=y
52 # CONFIG_PCI_MSI=y
53 # # CONFIG_UEVENT_HELPER is not set
54 # CONFIG_DEVTMPFS=y
55 # CONFIG_DEVTMPFS_MOUNT=y
56 # CONFIG_FRAMEBUFFER_CONSOLE=y
57 # CONFIG_IOMMU_SUPPORT=y
58 # CONFIG_IRQ_REMAP=y
59
60 # https://www.linuxfromscratch.org/hints/downloads/files/kernel-configuration.txt
61
62 make help
63 make
64 make modules_install
65
66 cp -iv arch/x86/boot/bzImage /boot/vmlinuz-6.1.11-lfs-11.3
67 cp -iv System.map /boot/System.map-6.1.11
68 cp -iv .config /boot/config-6.1.11
69 install -d /usr/share/doc/linux-6.1.11
70 cp -r Documentation/* /usr/share/doc/linux-6.1.11
71
72 install -v -m755 -d /etc/modprobe.d
73
74 cat > /etc/modprobe.d/usb.conf << "EOF"
75 install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
76 install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
77 EOF
78
79 cd $LFS/sources/
80 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
81
82 echo 11.3 > /etc/lfs-release
83
84 cat > /etc/lsb-release << "EOF"
85 DISTRIB_ID="Linux From Scratch"
86 DISTRIB_RELEASE="11.3"
87 DISTRIB_CODENAME="Vitux"
88 DISTRIB_DESCRIPTION="Linux From Scratch"
89 EOF
90
91 cat > /etc/os-release << "EOF"
92 NAME="Linux From Scratch"
93 VERSION="11.3"
94 ID=lfs
95 PRETTY_NAME="Linux From Scratch 11.3"
96 VERSION_CODENAME="Vitux"
97 EOF
98
99 cd / # as chroot
100 du . -hs
101 # 2.0G
102 du sources/ -hs
103 # 603M sources/
104 sh version-check.sh
105
106 # To make a backup, leave the chroot environment:
107 exit
108 mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm
109 umount $LFS/dev/pts
110 umount $LFS/{sys,proc,run,dev}
111 LFS=/home/vagrant/lfs
112 echo $LFS
113 cd $LFS
114 time tar -cJpf /root/lfs-build-11.3.tar.xz .
115 # real 17m18.550s
116 tar tvaf /root/lfs-build-11.3.tar.xz
117 # -p, --preserve-permissions
118 # -f, --file=ARCHIVE
119 # -J, --xz Filter the archive through xz
120
121 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