sudo apt update sudo apt install -y binutils bison gawk gcc g++ m4 make patch texinfo bash sudo rm /bin/sh sudo ln -s /bin/bash /bin/sh cat > version-check.sh << "EOF" #!/bin/bash # A script to list version numbers of critical development tools # If you have tools installed in other directories, adjust PATH here AND # in ~lfs/.bashrc (section 4.4) as well. LC_ALL=C PATH=/usr/bin:/bin bail() { echo "FATAL: $1"; exit 1; } grep --version > /dev/null 2> /dev/null || bail "grep does not work" sed '' /dev/null || bail "sed does not work" sort /dev/null || bail "sort does not work" ver_check() { if ! type -p $2 &>/dev/null then echo "ERROR: Cannot find $2 ($1)"; return 1; fi v=$($2 --version 2>&1 | grep -E -o '[0-9]+\.[0-9\.]+[a-z]*' | head -n1) if printf '%s\n' $3 $v | sort --version-sort --check &>/dev/null then printf "OK: %-9s %-6s >= $3\n" "$1" "$v"; return 0; else printf "ERROR: %-9s is TOO OLD ($3 or later required)\n" "$1"; return 1; fi } ver_kernel() { kver=$(uname -r | grep -E -o '^[0-9\.]+') if printf '%s\n' $1 $kver | sort --version-sort --check &>/dev/null then printf "OK: Linux Kernel $kver >= $1\n"; return 0; else printf "ERROR: Linux Kernel ($kver) is TOO OLD ($1 or later required)\n" "$kver"; return 1; fi } # Coreutils first because --version-sort needs Coreutils >= 7.0 ver_check Coreutils sort 8.1 || bail "Coreutils too old, stop" ver_check Bash bash 3.2 ver_check Binutils ld 2.13.1 ver_check Bison bison 2.7 ver_check Diffutils diff 2.8.1 ver_check Findutils find 4.2.31 ver_check Gawk gawk 4.0.1 ver_check GCC gcc 5.2 ver_check "GCC (C++)" g++ 5.2 ver_check Grep grep 2.5.1a ver_check Gzip gzip 1.3.12 ver_check M4 m4 1.4.10 ver_check Make make 4.0 ver_check Patch patch 2.5.4 ver_check Perl perl 5.8.8 ver_check Python python3 3.4 ver_check Sed sed 4.1.5 ver_check Tar tar 1.22 ver_check Texinfo texi2any 5.0 ver_check Xz xz 5.0.0 ver_kernel 4.19 if mount | grep -q 'devpts on /dev/pts' && [ -e /dev/ptmx ] then echo "OK: Linux Kernel supports UNIX 98 PTY"; else echo "ERROR: Linux Kernel does NOT support UNIX 98 PTY"; fi alias_check() { if $1 --version 2>&1 | grep -qi $2 then printf "OK: %-4s is $2\n" "$1"; else printf "ERROR: %-4s is NOT $2\n" "$1"; fi } echo "Aliases:" alias_check awk GNU alias_check yacc Bison alias_check sh Bash echo "Compiler check:" if printf "int main(){}" | g++ -x c++ - then echo "OK: g++ works"; else echo "ERROR: g++ does NOT work"; fi rm -f a.out if [ "$(nproc)" = "" ]; then echo "ERROR: nproc is not available or it produces empty output" else echo "OK: nproc reports $(nproc) logical cores are available" fi EOF bash version-check.sh add new hdd in vmware reboot install gparted new hdd is /dev/sdb create gpt partition table for it in gparted create new ext4 partition is called /dev/sdb1 in this case be root from here on unless specified else export LFS=/mnt/lfs mkdir -pv $LFS mount -v -t ext4 /dev/sdb1 $LFS mkdir -v $LFS/sources chmod -v a+wt $LFS/sources cd $LFS/sources wget https://lfs.gnlug.org/pub/lfs/lfs-packages/lfs-packages-12.2.tar untar and cd into chown root:root $LFS/sources/* mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin} for i in bin lib sbin; do ln -sv usr/$i $LFS/$i done case $(uname -m) in x86_64) mkdir -pv $LFS/lib64 ;; esac mkdir -pv $LFS/tools export PATH=$PATH:/usr/sbin groupadd lfs useradd -s /bin/bash -g lfs -m -k /dev/null lfs chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools} case $(uname -m) in x86_64) chown -v lfs $LFS/lib64 ;; esac su - lfs cat > ~/.bash_profile << "EOF" exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash EOF cat > ~/.bashrc << "EOF" set +h umask 022 LFS=/mnt/lfs LC_ALL=POSIX LFS_TGT=$(uname -m)-lfs-linux-gnu PATH=/usr/bin if [ ! -L /bin ]; then PATH=/bin:$PATH; fi PATH=$LFS/tools/bin:$PATH CONFIG_SITE=$LFS/usr/share/config.site export LFS LC_ALL LFS_TGT PATH CONFIG_SITE EOF export MAKEFLAGS=-j$(nproc) source ~/.bash_profile cd /mnt/lfs/sources/12.2 tar -xJvf binutils-2.43.1.tar.xz cd binutils-2.43.1 mkdir -v build cd build ../configure --prefix=$LFS/tools \ --with-sysroot=$LFS \ --target=$LFS_TGT \ --disable-nls \ --enable-gprofng=no \ --disable-werror \ --enable-new-dtags \ --enable-default-hash-style=gnu make make install cd ../../ rm -rf binutils-2.43.1 tar -xJvf gcc-14.2.0.tar.xz cd gcc-14.2.0 tar -xf ../mpfr-4.2.1.tar.xz mv -v mpfr-4.2.1 mpfr tar -xf ../gmp-6.3.0.tar.xz mv -v gmp-6.3.0 gmp tar -xf ../mpc-1.3.1.tar.gz mv -v mpc-1.3.1 mpc case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac mkdir -v build cd build ../configure \ --target=$LFS_TGT \ --prefix=$LFS/tools \ --with-glibc-version=2.40 \ --with-sysroot=$LFS \ --with-newlib \ --without-headers \ --enable-default-pie \ --enable-default-ssp \ --disable-nls \ --disable-shared \ --disable-multilib \ --disable-threads \ --disable-libatomic \ --disable-libgomp \ --disable-libquadmath \ --disable-libssp \ --disable-libvtv \ --disable-libstdcxx \ --enable-languages=c,c++ make make install cd .. cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include/limits.h cd ../ rm -rf gcc-14.2.0 tar -xJvf linux-6.10.5.tar.xz cd linux-6.10.5 make mrproper make headers find usr/include -type f ! -name '*.h' -delete cp -rv usr/include $LFS/usr cd ../ rm -rf linux-6.10.5 tar -xJvf glibc-2.40.tar.xz cd glibc-2.40 case $(uname -m) in i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3 ;; x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3 ;; esac patch -Np1 -i ../glibc-2.40-fhs-1.patch make build dir mkdir -v build cd build echo "rootsbindir=/usr/sbin" > configparms ../configure \ --prefix=/usr \ --host=$LFS_TGT \ --build=$(../scripts/config.guess) \ --enable-kernel=4.19 \ --with-headers=$LFS/usr/include \ --disable-nscd \ libc_cv_slibdir=/usr/lib make make DESTDIR=$LFS install sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd echo 'int main(){}' | $LFS_TGT-gcc -xc - readelf -l a.out | grep ld-linux rm -v a.out cd ../../ rm -rf glibc-2.40 tar -xJvf gcc-14.2.0.tar.xz cd gcc-14.2.0 mkdir -v build cd build ../libstdc++-v3/configure \ --host=$LFS_TGT \ --build=$(../config.guess) \ --prefix=/usr \ --disable-multilib \ --disable-nls \ --disable-libstdcxx-pch \ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/14.2.0 make make DESTDIR=$LFS install rm -v $LFS/usr/lib/lib{stdc++{,exp,fs},supc++}.la cd ../../ rm -rf gcc-14.2.0 tar -xJvf m4-1.4.19.tar.xz cd m4-1.4.19 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf m4-1.4.19 tar -xf ncurses-6.5.tar.gz cd ncurses-6.5 sed -i s/mawk// configure mkdir build pushd build ../configure make -C include make -C progs tic popd ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(./config.guess) \ --mandir=/usr/share/man \ --with-manpage-format=normal \ --with-shared \ --without-normal \ --with-cxx-shared \ --without-debug \ --without-ada \ --disable-stripping make make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install ln -sv libncursesw.so $LFS/usr/lib/libncurses.so sed -e 's/^#if.*XOPEN.*$/#if 1/' \ -i $LFS/usr/include/curses.h cd ../ rm -rf ncurses-6.5 tar -xf bash-5.2.32.tar.gz cd bash-5.2.32 ./configure --prefix=/usr \ --build=$(sh support/config.guess) \ --host=$LFS_TGT \ --without-bash-malloc \ bash_cv_strtold_broken=no make make DESTDIR=$LFS install ln -sv bash $LFS/bin/sh cd ../ rm -rf bash-5.2.32 tar -xJvf coreutils-9.5.tar.xz cd coreutils-9.5 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) \ --enable-install-program=hostname \ --enable-no-install-program=kill,uptime make make DESTDIR=$LFS install mv -v $LFS/usr/bin/chroot $LFS/usr/sbin mkdir -pv $LFS/usr/share/man/man8 mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8 sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8 cd ../ rm -rf coreutils-9.5 tar -xJvf diffutils-3.10.tar.xz cd diffutils-3.10 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(./build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf diffutils-3.10 tar -xf file-5.45.tar.gz cd file-5.45 mkdir build pushd build ../configure --disable-bzlib \ --disable-libseccomp \ --disable-xzlib \ --disable-zlib make popd ./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess) make FILE_COMPILE=$(pwd)/build/src/file make DESTDIR=$LFS install rm -v $LFS/usr/lib/libmagic.la cd ../ rm -rf file-5.45 tar -xJvf findutils-4.10.0.tar.xz cd findutils-4.10.0 ./configure --prefix=/usr \ --localstatedir=/var/lib/locate \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf findutils-4.10.0 tar -xJvf gawk-5.3.0.tar.xz cd gawk-5.3.0 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf gawk-5.3.0 tar -xJvf grep-3.11.tar.xz cd grep-3.11 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(./build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf grep-3.11 tar -xJvf gzip-1.13.tar.xz cd gzip-1.13 ./configure --prefix=/usr --host=$LFS_TGT make make DESTDIR=$LFS install cd ../ rm -rf gzip-1.13 tar -xf make-4.4.1.tar.gz cd make-4.4.1 ./configure --prefix=/usr \ --without-guile \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf make-4.4.1 tar -xJvf patch-2.7.6.tar.xz cd patch-2.7.6 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf patch-2.7.6 tar -xJvf sed-4.9.tar.xz cd sed-4.9 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(./build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf sed-4.9 tar -xJvf tar-1.35.tar.xz cd tar-1.35 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd ../ rm -rf tar-1.35 tar -xJvf xz-5.6.2.tar.xz cd xz-5.6.2 ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) \ --disable-static \ --docdir=/usr/share/doc/xz-5.6.2 make make DESTDIR=$LFS install rm -v $LFS/usr/lib/liblzma.la cd ../ rm -rf xz-5.6.2 tar -xJvf binutils-2.43.1.tar.xz cd binutils-2.43.1 sed '6009s/$add_dir//' -i ltmain.sh mkdir -v build cd build ../configure \ --prefix=/usr \ --build=$(../config.guess) \ --host=$LFS_TGT \ --disable-nls \ --enable-shared \ --enable-gprofng=no \ --disable-werror \ --enable-64-bit-bfd \ --enable-new-dtags \ --enable-default-hash-style=gnu make make DESTDIR=$LFS install rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la} cd ../../ rm -rf binutils-2.43.1 tar -xJvf gcc-14.2.0.tar.xz cd gcc-14.2.0 tar -xf ../mpfr-4.2.1.tar.xz mv -v mpfr-4.2.1 mpfr tar -xf ../gmp-6.3.0.tar.xz mv -v gmp-6.3.0 gmp tar -xf ../mpc-1.3.1.tar.gz mv -v mpc-1.3.1 mpc case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac sed '/thread_header =/s/@.*@/gthr-posix.h/' \ -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in mkdir -v build cd build ../configure \ --build=$(../config.guess) \ --host=$LFS_TGT \ --target=$LFS_TGT \ LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \ --prefix=/usr \ --with-build-sysroot=$LFS \ --enable-default-pie \ --enable-default-ssp \ --disable-nls \ --disable-multilib \ --disable-libatomic \ --disable-libgomp \ --disable-libquadmath \ --disable-libsanitizer \ --disable-libssp \ --disable-libvtv \ --enable-languages=c,c++ make make DESTDIR=$LFS install ln -sv gcc $LFS/usr/bin/cc cd ../.. rm -rf gcc-14.2.0 FROM HERE ON OUT THINGS ARE BEING RUN AS ROOT WITH THE LFS VARIABLE SET export LFS=/mnt/lfs chown --from lfs -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools} case $(uname -m) in x86_64) chown --from lfs -R root:root $LFS/lib64 ;; esac mkdir -pv $LFS/{dev,proc,sys,run} mount -v --bind /dev $LFS/dev mount -vt devpts devpts -o gid=5,mode=0620 $LFS/dev/pts mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys mount -vt tmpfs tmpfs $LFS/run /usr/sbin/chroot "$LFS" /usr/bin/env -i \ HOME=/root \ TERM="$TERM" \ PS1='(lfs chroot) \u:\w\$ ' \ PATH=/usr/bin:/usr/sbin \ MAKEFLAGS="-j$(nproc)" \ TESTSUITEFLAGS="-j$(nproc)" \ /bin/bash --login you are now dropped into (the barebones of) lfs! (lfs chroot) I have no name!:/# From this point on, there is no need to use the LFS variable any more because all work will be restricted to the LFS file system; the chroot command runs the Bash shell with the root (/) directory set to $LFS. mkdir -pv /{boot,home,mnt,opt,srv} mkdir -pv /etc/{opt,sysconfig} mkdir -pv /lib/firmware mkdir -pv /media/{floppy,cdrom} mkdir -pv /usr/{,local/}{include,src} mkdir -pv /usr/lib/locale mkdir -pv /usr/local/{bin,lib,sbin} mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man} mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -pv /usr/{,local/}share/man/man{1..8} mkdir -pv /var/{cache,local,log,mail,opt,spool} mkdir -pv /var/lib/{color,misc,locate} ln -sfv /run /var/run ln -sfv /run/lock /var/lock install -dv -m 0750 /root install -dv -m 1777 /tmp /var/tmp ln -sv /proc/self/mounts /etc/mtab cat > /etc/hosts << EOF 127.0.0.1 localhost $(hostname) ::1 localhost EOF cat > /etc/passwd << "EOF" root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/dev/null:/usr/bin/false daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false EOF cat > /etc/group << "EOF" root:x:0: bin:x:1:daemon sys:x:2: kmem:x:3: tape:x:4: tty:x:5: daemon:x:6: floppy:x:7: disk:x:8: lp:x:9: dialout:x:10: audio:x:11: video:x:12: utmp:x:13: cdrom:x:15: adm:x:16: messagebus:x:18: input:x:24: mail:x:34: kvm:x:61: uuidd:x:80: wheel:x:97: users:x:999: nogroup:x:65534: EOF localedef -i C -f UTF-8 C.UTF-8 echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd echo "tester:x:101:" >> /etc/group install -o tester -d /home/tester restart the shell to remove the i have no name exec /usr/bin/bash --login touch /var/log/{btmp,lastlog,faillog,wtmp} chgrp -v utmp /var/log/lastlog chmod -v 664 /var/log/lastlog chmod -v 600 /var/log/btmp cd /sources/12.2 tar -xJvf gettext-0.22.5.tar.xz cd gettext-0.22.5 ./configure --disable-shared make cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin cd ../ rm -rf gettext-0.22.5 tar -xJvf bison-3.8.2.tar.xz cd bison-3.8.2 ./configure --prefix=/usr \ --docdir=/usr/share/doc/bison-3.8.2 make make install cd ../ rm -rf bison-3.8.2 tar -xJvf perl-5.40.0.tar.xz cd perl-5.40.0 sh Configure -des \ -D prefix=/usr \ -D vendorprefix=/usr \ -D useshrplib \ -D privlib=/usr/lib/perl5/5.40/core_perl \ -D archlib=/usr/lib/perl5/5.40/core_perl \ -D sitelib=/usr/lib/perl5/5.40/site_perl \ -D sitearch=/usr/lib/perl5/5.40/site_perl \ -D vendorlib=/usr/lib/perl5/5.40/vendor_perl \ -D vendorarch=/usr/lib/perl5/5.40/vendor_perl make make install cd ../ rm -rf perl-5.40.0 tar -xJvf Python-3.12.5.tar.xz cd Python-3.12.5 ./configure --prefix=/usr \ --enable-shared \ --without-ensurepip make make install cd ../ rm -rf Python-3.12.5 tar -xJvf texinfo-7.1.tar.xz cd texinfo-7.1 ./configure --prefix=/usr make make install cd ../ rm -rf texinfo-7.1 tar -xJvf util-linux-2.40.2.tar.xz cd util-linux-2.40.2 mkdir -pv /var/lib/hwclock ./configure --libdir=/usr/lib \ --runstatedir=/run \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ --disable-su \ --disable-setpriv \ --disable-runuser \ --disable-pylibmount \ --disable-static \ --disable-liblastlog2 \ --without-python \ ADJTIME_PATH=/var/lib/hwclock/adjtime \ --docdir=/usr/share/doc/util-linux-2.40.2 make make install cd ../ rm -rf util-linux-2.40.2 rm -rf /usr/share/{info,man,doc}/* find /usr/{lib,libexec} -name \*.la -delete rm -rf /tools tar -xJvf man-pages-6.9.1.tar.xz cd man-pages-6.9.1 rm -v man3/crypt* make prefix=/usr install cd ../ rm -rf man-pages-6.9.1 tar -xf iana-etc-20240806.tar.gz cd iana-etc-20240806 cp services protocols /etc cd ../ rm -rf iana-etc-20240806 tar -xJvf glibc-2.40.tar.xz cd glibc-2.40 patch -Np1 -i ../glibc-2.40-fhs-1.patch mkdir -v build cd build echo "rootsbindir=/usr/sbin" > configparms ../configure --prefix=/usr \ --disable-werror \ --enable-kernel=4.19 \ --enable-stack-protector=strong \ --disable-nscd \ libc_cv_slibdir=/usr/lib make make check touch /etc/ld.so.conf sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile make install sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd localedef -i C -f UTF-8 C.UTF-8 localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8 localedef -i de_DE -f ISO-8859-1 de_DE localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro localedef -i de_DE -f UTF-8 de_DE.UTF-8 localedef -i el_GR -f ISO-8859-7 el_GR localedef -i en_GB -f ISO-8859-1 en_GB localedef -i en_GB -f UTF-8 en_GB.UTF-8 localedef -i en_HK -f ISO-8859-1 en_HK localedef -i en_PH -f ISO-8859-1 en_PH localedef -i en_US -f ISO-8859-1 en_US localedef -i en_US -f UTF-8 en_US.UTF-8 localedef -i es_ES -f ISO-8859-15 es_ES@euro localedef -i es_MX -f ISO-8859-1 es_MX localedef -i fa_IR -f UTF-8 fa_IR localedef -i fr_FR -f ISO-8859-1 fr_FR localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro localedef -i fr_FR -f UTF-8 fr_FR.UTF-8 localedef -i is_IS -f ISO-8859-1 is_IS localedef -i is_IS -f UTF-8 is_IS.UTF-8 localedef -i it_IT -f ISO-8859-1 it_IT localedef -i it_IT -f ISO-8859-15 it_IT@euro localedef -i it_IT -f UTF-8 it_IT.UTF-8 localedef -i ja_JP -f EUC-JP ja_JP localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true localedef -i ja_JP -f UTF-8 ja_JP.UTF-8 localedef -i nl_NL@euro -f ISO-8859-15 nl_NL@euro localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R localedef -i ru_RU -f UTF-8 ru_RU.UTF-8 localedef -i se_NO -f UTF-8 se_NO.UTF-8 localedef -i ta_IN -f UTF-8 ta_IN.UTF-8 localedef -i tr_TR -f UTF-8 tr_TR.UTF-8 localedef -i zh_CN -f GB18030 zh_CN.GB18030 localedef -i zh_HK -f BIG5-HKSCS zh_HK.BIG5-HKSCS localedef -i zh_TW -f UTF-8 zh_TW.UTF-8 make localedata/install-locales localedef -i C -f UTF-8 C.UTF-8 localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true cat > /etc/nsswitch.conf << "EOF" # Begin /etc/nsswitch.conf passwd: files group: files shadow: files hosts: files dns networks: files protocols: files services: files ethers: files rpc: files # End /etc/nsswitch.conf EOF tar -xf ../../tzdata2024a.tar.gz ZONEINFO=/usr/share/zoneinfo mkdir -pv $ZONEINFO/{posix,right} for tz in etcetera southamerica northamerica europe africa antarctica \ asia australasia backward; do zic -L /dev/null -d $ZONEINFO ${tz} zic -L /dev/null -d $ZONEINFO/posix ${tz} zic -L leapseconds -d $ZONEINFO/right ${tz} done cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO zic -d $ZONEINFO -p America/New_York unset ZONEINFO ln -sfv /usr/share/zoneinfo/Australia/Darwin /etc/localtime cat > /etc/ld.so.conf << "EOF" # Begin /etc/ld.so.conf /usr/local/lib /opt/lib EOF cat >> /etc/ld.so.conf << "EOF" # Add an include directory include /etc/ld.so.conf.d/*.conf EOF mkdir -pv /etc/ld.so.conf.d cd ../../ rm -rf glibc-2.40 tar -xf zlib-1.3.1.tar.gz cd zlib-1.3.1 ./configure --prefix=/usr make make install rm -fv /usr/lib/libz.a cd ../ rm -rf zlib-1.3.1 tar -xf bzip2-1.0.8.tar.gz cd bzip2-1.0.8 patch -Np1 -i ../bzip2-1.0.8-install_docs-1.patch sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile make -f Makefile-libbz2_so make clean make make PREFIX=/usr install cp -av libbz2.so.* /usr/lib ln -sv libbz2.so.1.0.8 /usr/lib/libbz2.so cp -v bzip2-shared /usr/bin/bzip2 for i in /usr/bin/{bzcat,bunzip2}; do ln -sfv bzip2 $i done rm -fv /usr/lib/libbz2.a cd ../ rm -rf bzip2-1.0.8 tar -xJvf xz-5.6.2.tar.xz cd xz-5.6.2 ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/xz-5.6.2 make make install cd ../ rm -rf xz-5.6.2 tar -xf lz4-1.10.0.tar.gz cd lz4-1.10.0 make BUILD_STATIC=no PREFIX=/usr make BUILD_STATIC=no PREFIX=/usr install cd ../ rm -rf lz4-1.10.0 tar -xf zstd-1.5.6.tar.gz cd zstd-1.5.6 make prefix=/usr make prefix=/usr install rm -v /usr/lib/libzstd.a cd ../ rm -rf zstd-1.5.6 tar -xf file-5.45.tar.gz cd file-5.45 ./configure --prefix=/usr make make install cd ../ rm -rf file-5.45 tar -xf readline-8.2.13.tar.gz cd readline-8.2.13 sed -i '/MV.*old/d' Makefile.in sed -i '/{OLDSUFF}/c:' support/shlib-install sed -i 's/-Wl,-rpath,[^ ]*//' support/shobj-conf ./configure --prefix=/usr \ --disable-static \ --with-curses \ --docdir=/usr/share/doc/readline-8.2.13 make SHLIB_LIBS="-lncursesw" make SHLIB_LIBS="-lncursesw" install install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.2.13 cd ../ rm -rf readline-8.2.13 tar -xJvf m4-1.4.19.tar.xz cd m4-1.4.19 ./configure --prefix=/usr make make install cd ../ rm -rf m4-1.4.19 tar -xJvf bc-6.7.6.tar.xz cd bc-6.7.6 CC=gcc ./configure --prefix=/usr -G -O3 -r make make install cd ../ rm -rf bc-6.7.6 tar -xf flex-2.6.4.tar.gz cd flex-2.6.4 ./configure --prefix=/usr \ --docdir=/usr/share/doc/flex-2.6.4 \ --disable-static make make install ln -sv flex /usr/bin/lex ln -sv flex.1 /usr/share/man/man1/lex.1 cd ../ rm -rf flex-2.6.4 tar -xf tcl8.6.14-src.tar.gz cd tcl8.6.14 SRCDIR=$(pwd) cd unix ./configure --prefix=/usr \ --mandir=/usr/share/man \ --disable-rpath make sed -e "s|$SRCDIR/unix|/usr/lib|" \ -e "s|$SRCDIR|/usr/include|" \ -i tclConfig.sh sed -e "s|$SRCDIR/unix/pkgs/tdbc1.1.7|/usr/lib/tdbc1.1.7|" \ -e "s|$SRCDIR/pkgs/tdbc1.1.7/generic|/usr/include|" \ -e "s|$SRCDIR/pkgs/tdbc1.1.7/library|/usr/lib/tcl8.6|" \ -e "s|$SRCDIR/pkgs/tdbc1.1.7|/usr/include|" \ -i pkgs/tdbc1.1.7/tdbcConfig.sh sed -e "s|$SRCDIR/unix/pkgs/itcl4.2.4|/usr/lib/itcl4.2.4|" \ -e "s|$SRCDIR/pkgs/itcl4.2.4/generic|/usr/include|" \ -e "s|$SRCDIR/pkgs/itcl4.2.4|/usr/include|" \ -i pkgs/itcl4.2.4/itclConfig.sh unset SRCDIR make install chmod -v u+w /usr/lib/libtcl8.6.so make install-private-headers ln -sfv tclsh8.6 /usr/bin/tclsh mv /usr/share/man/man3/{Thread,Tcl_Thread}.3 cd .. tar -xf ../tcl8.6.14-html.tar.gz --strip-components=1 mkdir -v -p /usr/share/doc/tcl-8.6.14 cp -v -r ./html/* /usr/share/doc/tcl-8.6.14 cd ../ rm -rf tcl8.6.14 we need to do a sanity check that tty works! python3 -c 'from pty import spawn; spawn(["echo", "ok"])' continuining! tar -xf expect5.45.4.tar.gz cd expect5.45.4 patch -Np1 -i ../expect-5.45.4-gcc14-1.patch ./configure --prefix=/usr \ --with-tcl=/usr/lib \ --enable-shared \ --disable-rpath \ --mandir=/usr/share/man \ --with-tclinclude=/usr/include make make install ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib cd ../ rm -rf expect5.45.4 tar -xf dejagnu-1.6.3.tar.gz cd dejagnu-1.6.3 mkdir -v build cd build ../configure --prefix=/usr makeinfo --html --no-split -o doc/dejagnu.html ../doc/dejagnu.texi makeinfo --plaintext -o doc/dejagnu.txt ../doc/dejagnu.texi make install install -v -dm755 /usr/share/doc/dejagnu-1.6.3 install -v -m644 doc/dejagnu.{html,txt} /usr/share/doc/dejagnu-1.6.3 cd ../.. rm -rf dejagnu-1.6.3 tar -xJvf pkgconf-2.3.0.tar.xz cd pkgconf-2.3.0 ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/pkgconf-2.3.0 make make install ln -sv pkgconf /usr/bin/pkg-config ln -sv pkgconf.1 /usr/share/man/man1/pkg-config.1 cd ../ rm -rf pkgconf-2.3.0 tar -xJvf binutils-2.43.1.tar.xz cd binutils-2.43.1 mkdir -v build cd build ../configure --prefix=/usr \ --sysconfdir=/etc \ --enable-gold \ --enable-ld=default \ --enable-plugins \ --enable-shared \ --disable-werror \ --enable-64-bit-bfd \ --enable-new-dtags \ --with-system-zlib \ --enable-default-hash-style=gnu make tooldir=/usr make -k check sanity check time! grep '^FAIL:' $(find -name '*.log') 12 failed tests == everything ok! make tooldir=/usr install rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,gprofng,opcodes,sframe}.a cd ../.. rm -rf binutils-2.43.1 tar -xJvf gmp-6.3.0.tar.xz cd gmp-6.3.0 ./configure --prefix=/usr \ --enable-cxx \ --disable-static \ --docdir=/usr/share/doc/gmp-6.3.0 make make html make check 2>&1 | tee gmp-check-log SANITY CHECK: ensure at least 199 tests pass awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log make install make install-html cd ../ rm -rf gmp-6.3.0 tar -xJvf mpfr-4.2.1.tar.xz cd mpfr-4.2.1 ./configure --prefix=/usr \ --disable-static \ --enable-thread-safe \ --docdir=/usr/share/doc/mpfr-4.2.1 make make html make check make install make install-html cd ../ rm -rf mpfr-4.2.1 tar -xf mpc-1.3.1.tar.gz cd mpc-1.3.1 ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/mpc-1.3.1 make make html make install make install-html cd ../ rm -rf mpc-1.3.1 tar -xf attr-2.5.2.tar.gz cd attr-2.5.2 ./configure --prefix=/usr \ --disable-static \ --sysconfdir=/etc \ --docdir=/usr/share/doc/attr-2.5.2 make make install cd ../ rm -rf attr-2.5.2 tar -xJvf acl-2.3.2.tar.xz cd acl-2.3.2 ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/acl-2.3.2 make make install cd ../ rm -rf acl-2.3.2 tar -xJvf libcap-2.70.tar.xz cd libcap-2.70 sed -i '/install -m.*STA/d' libcap/Makefile make prefix=/usr lib=lib make prefix=/usr lib=lib install cd ../ rm -rf libcap-2.70 tar -xJvf libxcrypt-4.4.36.tar.xz cd libxcrypt-4.4.36 ./configure --prefix=/usr \ --enable-hashes=strong,glibc \ --enable-obsolete-api=no \ --disable-static \ --disable-failure-tokens make make install cd ../ rm -rf libxcrypt-4.4.36 tar -xJvf shadow-4.16.0.tar.xz cd shadow-4.16.0 sed -i 's/groups$(EXEEXT) //' src/Makefile.in find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD YESCRYPT:' \ -e 's:/var/spool/mail:/var/mail:' \ -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \ -i etc/login.defs touch /usr/bin/passwd ./configure --sysconfdir=/etc \ --disable-static \ --with-{b,yes}crypt \ --without-libbsd \ --with-group-name-max-length=32 make make exec_prefix=/usr install make -C man install-man pwconv grpconv mkdir -p /etc/default useradd -D --gid 999 time to set the root password! passwd root cd ../ rm -rf shadow-4.16.0 tar -xJvf gcc-14.2.0.tar.xz cd gcc-14.2.0 case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac mkdir -v build cd build ../configure --prefix=/usr \ LD=ld \ --enable-languages=c,c++ \ --enable-default-pie \ --enable-default-ssp \ --enable-host-pie \ --disable-multilib \ --disable-bootstrap \ --disable-fixincludes \ --with-system-zlib make ulimit -s -H unlimited sed -e '/cpython/d' -i ../gcc/testsuite/gcc.dg/plugin/plugin.exp sed -e 's/no-pic /&-no-pie /' -i ../gcc/testsuite/gcc.target/i386/pr113689-1.c sed -e 's/300000/(1|300000)/' -i ../libgomp/testsuite/libgomp.c-c++-common/pr109062.c sed -e 's/{ target nonpic } //' \ -e '/GOTPCREL/d' -i ../gcc/testsuite/gcc.target/i386/fentryname3.c make install chown -v -R root:root \ /usr/lib/gcc/$(gcc -dumpmachine)/14.2.0/include{,-fixed} ln -svr /usr/bin/cpp /usr/lib ln -sv gcc.1 /usr/share/man/man1/cc.1 ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/14.2.0/liblto_plugin.so \ /usr/lib/bfd-plugins/ SANITY CHECKS echo 'int main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib' There should be no errors, and the output of the last command will be (allowing for platform-specific differences in the dynamic linker name): [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log The output of the last command should be: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../lib/Scrt1.o succeeded /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../lib/crti.o succeeded /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../lib/crtn.o succeeded grep -B4 '^ /usr/include' dummy.log This command should return the following output: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/include-fixed /usr/include grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' References to paths that have components with '-linux-gnu' should be ignored, but otherwise the output of the last command should be: SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64") SEARCH_DIR("/usr/local/lib64") SEARCH_DIR("/lib64") SEARCH_DIR("/usr/lib64") SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib") SEARCH_DIR("/usr/local/lib") SEARCH_DIR("/lib") SEARCH_DIR("/usr/lib"); grep "/lib.*/libc.so.6 " dummy.log The output of the last command should be: attempt to open /usr/lib/libc.so.6 succeeded grep found dummy.log The output of the last command should be (allowing for platform-specific differences in dynamic linker name): found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2 rm -v dummy.c a.out dummy.log mkdir -pv /usr/share/gdb/auto-load/usr/lib mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib cd ../../ rm -rf gcc-14.2.0 tar -xf ncurses-6.5.tar.gz cd ncurses-6.5 ./configure --prefix=/usr \ --mandir=/usr/share/man \ --with-shared \ --without-debug \ --without-normal \ --with-cxx-shared \ --enable-pc-files \ --with-pkg-config-libdir=/usr/lib/pkgconfig make make DESTDIR=$PWD/dest install install -vm755 dest/usr/lib/libncursesw.so.6.5 /usr/lib rm -v dest/usr/lib/libncursesw.so.6.5 sed -e 's/^#if.*XOPEN.*$/#if 1/' \ -i dest/usr/include/curses.h cp -av dest/* / for lib in ncurses form panel menu ; do ln -sfv lib${lib}w.so /usr/lib/lib${lib}.so ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc done ln -sfv libncursesw.so /usr/lib/libcurses.so cp -v -R doc -T /usr/share/doc/ncurses-6.5 cd ../ rm -rf ncurses-6.5 tar -xJvf sed-4.9.tar.xz cd sed-4.9 ./configure --prefix=/usr make make html make install install -d -m755 /usr/share/doc/sed-4.9 install -m644 doc/sed.html /usr/share/doc/sed-4.9 cd ../ rm -rf sed-4.9 tar -xJvf psmisc-23.7.tar.xz cd psmisc-23.7 ./configure --prefix=/usr make make install cd ../ rm -rf psmisc-23.7 tar -xJvf gettext-0.22.5.tar.xz cd gettext-0.22.5 ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/gettext-0.22.5 make make install chmod -v 0755 /usr/lib/preloadable_libintl.so cd ../ rm -rf gettext-0.22.5 tar -xJvf bison-3.8.2.tar.xz cd bison-3.8.2 ./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2 make make install cd ../ rm -rf bison-3.8.2 tar -xJvf grep-3.11.tar.xz cd grep-3.11 sed -i "s/echo/#echo/" src/egrep.sh ./configure --prefix=/usr make make install cd ../ rm -rf grep-3.11 tar -xf bash-5.2.32.tar.gz cd bash-5.2.32 ./configure --prefix=/usr \ --without-bash-malloc \ --with-installed-readline \ bash_cv_strtold_broken=no \ --docdir=/usr/share/doc/bash-5.2.32 make install exec /usr/bin/bash --login cd ../ rm -rf bash-5.2.32 tar -xJvf libtool-2.4.7.tar.xz cd libtool-2.4.7 ./configure --prefix=/usr make make install rm -fv /usr/lib/libltdl.a cd ../ rm -rf libtool-2.4.7 tar -xf gdbm-1.24.tar.gz cd gdbm-1.24 ./configure --prefix=/usr \ --disable-static \ --enable-libgdbm-compat make make install cd ../ rm -rf libtool-2.4.7 tar -xf gperf-3.1.tar.gz cd gperf-3.1 ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1 make make install cd ../ rm -rf gperf-3.1 tar -xJvf expat-2.6.2.tar.xz cd expat-2.6.2 ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/expat-2.6.2 make make install install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.6.2 cd ../ rm -rf expat-2.6.2 tar -xJvf inetutils-2.5.tar.xz cd inetutils-2.5 sed -i 's/def HAVE_TERMCAP_TGETENT/ 1/' telnet/telnet.c ./configure --prefix=/usr \ --bindir=/usr/bin \ --localstatedir=/var \ --disable-logger \ --disable-whois \ --disable-rcp \ --disable-rexec \ --disable-rlogin \ --disable-rsh \ --disable-servers make make install mv -v /usr/{,s}bin/ifconfig cd ../ rm -rf inetutils-2.5 tar -xf less-661.tar.gz cd less-661 ./configure --prefix=/usr --sysconfdir=/etc make make install cd ../ rm -rf less-661 tar -xJvf perl-5.40.0.tar.xz cd perl-5.40.0 export BUILD_ZLIB=False export BUILD_BZIP2=0 sh Configure -des \ -D prefix=/usr \ -D vendorprefix=/usr \ -D privlib=/usr/lib/perl5/5.40/core_perl \ -D archlib=/usr/lib/perl5/5.40/core_perl \ -D sitelib=/usr/lib/perl5/5.40/site_perl \ -D sitearch=/usr/lib/perl5/5.40/site_perl \ -D vendorlib=/usr/lib/perl5/5.40/vendor_perl \ -D vendorarch=/usr/lib/perl5/5.40/vendor_perl \ -D man1dir=/usr/share/man/man1 \ -D man3dir=/usr/share/man/man3 \ -D pager="/usr/bin/less -isR" \ -D useshrplib \ -D usethreads make make install unset BUILD_ZLIB BUILD_BZIP2 cd ../ rm -rf perl-5.40.0 tar -xf XML-Parser-2.47.tar.gz cd XML-Parser-2.47 perl Makefile.PL make make install cd ../ rm -rf XML-Parser-2.47 tar -xf intltool-0.51.0.tar.gz cd intltool-0.51.0 sed -i 's:\\\${:\\\$\\{:' intltool-update.in ./configure --prefix=/usr make make install install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO cd ../ rm -rf intltool-0.51.0 tar -xJvf autoconf-2.72.tar.xz cd autoconf-2.72 ./configure --prefix=/usr make make install cd ../ rm -rf autoconf-2.72 tar -xJvf automake-1.17.tar.xz cd automake-1.17 ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.17 make make install cd ../ rm -rf automake-1.17 tar -xf openssl-3.3.1.tar.gz cd openssl-3.3.1 ./config --prefix=/usr \ --openssldir=/etc/ssl \ --libdir=lib \ shared \ zlib-dynamic make sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile make MANSUFFIX=ssl install mv -v /usr/share/doc/openssl /usr/share/doc/openssl-3.3.1 cp -vfr doc/* /usr/share/doc/openssl-3.3.1 cd ../ rm -rf openssl-3.3.1 tar -xJvf kmod-33.tar.xz cd kmod-33 ./configure --prefix=/usr \ --sysconfdir=/etc \ --with-openssl \ --with-xz \ --with-zstd \ --with-zlib \ --disable-manpages make make install for target in depmod insmod modinfo modprobe rmmod; do ln -sfv ../bin/kmod /usr/sbin/$target rm -fv /usr/bin/$target done cd ../ rm -rf kmod-33 tar -xjvf elfutils-0.191.tar.bz2 cd elfutils-0.191 ./configure --prefix=/usr \ --disable-debuginfod \ --enable-libdebuginfod=dummy make make -C libelf install install -vm644 config/libelf.pc /usr/lib/pkgconfig rm /usr/lib/libelf.a cd ../ rm -rf elfutils-0.191 tar -xf libffi-3.4.6.tar.gz cd libffi-3.4.6 ./configure --prefix=/usr \ --disable-static \ --with-gcc-arch=native make make install cd ../ rm -rf libffi-3.4.6 tar -xJvf Python-3.12.5.tar.xz cd Python-3.12.5 ./configure --prefix=/usr \ --enable-shared \ --with-system-expat \ --enable-optimizations make make install cat > /etc/pip.conf << EOF [global] root-user-action = ignore disable-pip-version-check = true EOF install -v -dm755 /usr/share/doc/python-3.12.5/html tar --no-same-owner \ -xvf ../python-3.12.5-docs-html.tar.bz2 cp -R --no-preserve=mode python-3.12.5-docs-html/* \ /usr/share/doc/python-3.12.5/html cd ../ rm -rf Python-3.12.5 tar -xf flit_core-3.9.0.tar.gz cd flit_core-3.9.0 pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD pip3 install --no-index --no-user --find-links dist flit_core cd ../ rm -rf flit_core-3.9.0 tar -xf wheel-0.44.0.tar.gz cd wheel-0.44.0 pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD pip3 install --no-index --find-links=dist wheel cd ../ rm -rf wheel-0.44.0 tar -xf setuptools-72.2.0.tar.gz cd setuptools-72.2.0 pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD pip3 install --no-index --find-links dist setuptools cd ../ rm -rf setuptools-72.2.0 tar -xf ninja-1.12.1.tar.gz cd ninja-1.12.1 sed -i '/int Guess/a \ int j = 0;\ char* jobs = getenv( "NINJAJOBS" );\ if ( jobs != NULL ) j = atoi( jobs );\ if ( j > 0 ) return j;\ ' src/ninja.cc python3 configure.py --bootstrap install -vm755 ninja /usr/bin/ install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja cd ../ rm -rf ninja-1.12.1 tar -xf meson-1.5.1.tar.gz cd meson-1.5.1 pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD pip3 install --no-index --find-links dist meson install -vDm644 data/shell-completions/bash/meson /usr/share/bash-completion/completions/meson install -vDm644 data/shell-completions/zsh/_meson /usr/share/zsh/site-functions/_meson cd ../ rm -rf meson-1.5.1 tar -xJvf coreutils-9.5.tar.xz cd coreutils-9.5 patch -Np1 -i ../coreutils-9.5-i18n-2.patch autoreconf -fiv FORCE_UNSAFE_CONFIGURE=1 ./configure \ --prefix=/usr \ --enable-no-install-program=kill,uptime make make install mv -v /usr/bin/chroot /usr/sbin mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 sed -i 's/"1"/"8"/' /usr/share/man/man8/chroot.8 cd ../ rm -rf coreutils-9.5 tar -xf check-0.15.2.tar.gz cd check-0.15.2 ./configure --prefix=/usr --disable-static make make docdir=/usr/share/doc/check-0.15.2 install cd ../ rm -rf check-0.15.2 tar -xJvf diffutils-3.10.tar.xz cd diffutils-3.10 ./configure --prefix=/usr make make install cd ../ rm -rf diffutils-3.10 tar -xJvf gawk-5.3.0.tar.xz cd gawk-5.3.0 sed -i 's/extras//' Makefile.in ./configure --prefix=/usr make rm -f /usr/bin/gawk-5.3.0 make install ln -sv gawk.1 /usr/share/man/man1/awk.1 mkdir -pv /usr/share/doc/gawk-5.3.0 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-5.3.0 cd ../ rm -rf gawk-5.3.0 tar -xJvf findutils-4.10.0.tar.xz cd findutils-4.10.0 ./configure --prefix=/usr --localstatedir=/var/lib/locate make make install cd ../ rm -rf findutils-4.10.0 tar -xf groff-1.23.0.tar.gz cd groff-1.23.0 PAGE=A4 ./configure --prefix=/usr make make install cd ../ rm -rf groff-1.23.0 tar -xJvf grub-2.12.tar.xz cd grub-2.12 unset {C,CPP,CXX,LD}FLAGS echo depends bli part_gpt > grub-core/extra_deps.lst ./configure --prefix=/usr \ --sysconfdir=/etc \ --disable-efiemu \ --disable-werror make make install mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions cd ../ rm -rf grub-2.12 tar -xJvf gzip-1.13.tar.xz cd gzip-1.13 ./configure --prefix=/usr make make install cd ../ rm -rf gzip-1.13 tar -xJvf iproute2-6.10.0.tar.xz cd iproute2-6.10.0 sed -i /ARPD/d Makefile rm -fv man/man8/arpd.8 make NETNS_RUN_DIR=/run/netns make SBINDIR=/usr/sbin install mkdir -pv /usr/share/doc/iproute2-6.10.0 cp -v COPYING README* /usr/share/doc/iproute2-6.10.0 cd ../ rm -rf iproute2-6.10.0 tar -xJvf kbd-2.6.4.tar.xz cd kbd-2.6.4 patch -Np1 -i ../kbd-2.6.4-backspace-1.patch sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in ./configure --prefix=/usr --disable-vlock make make install cp -R -v docs/doc -T /usr/share/doc/kbd-2.6.4 cd ../ rm -rf kbd-2.6.4 tar -xf libpipeline-1.5.7.tar.gz cd libpipeline-1.5.7 ./configure --prefix=/usr make make install cd ../ rm -rf libpipeline-1.5.7 tar -xf make-4.4.1.tar.gz cd make-4.4.1 ./configure --prefix=/usr make make install cd ../ rm -rf make-4.4.1 tar -xJvf patch-2.7.6.tar.xz cd patch-2.7.6 ./configure --prefix=/usr make make install cd ../ rm -rf patch-2.7.6 tar -xJvf tar-1.35.tar.xz cd tar-1.35 FORCE_UNSAFE_CONFIGURE=1 \ ./configure --prefix=/usr make make install make -C doc install-html docdir=/usr/share/doc/tar-1.35 cd ../ rm -rf tar-1.35 tar -xJvf texinfo-7.1.tar.xz cd texinfo-7.1 ./configure --prefix=/usr make make install make TEXMF=/usr/share/texmf install-tex cd ../ rm -rf texinfo-7.1 tar -xf vim-9.1.0660.tar.gz cd vim-9.1.0660 echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h ./configure --prefix=/usr make make install ln -sv vim /usr/bin/vi for L in /usr/share/man/{,*/}man1/vim.1; do ln -sv vim.1 $(dirname $L)/vi.1 done ln -sv ../vim/vim91/doc /usr/share/doc/vim-9.1.0660 cat > /etc/vimrc << "EOF" " Begin /etc/vimrc " Ensure defaults are set before customizing settings, not after source $VIMRUNTIME/defaults.vim let skip_defaults_vim=1 set nocompatible set backspace=2 set mouse= syntax on if (&term == "xterm") || (&term == "putty") set background=dark endif " End /etc/vimrc EOF cd ../ rm -rf vim-9.1.0660 tar -xf MarkupSafe-2.1.5.tar.gz cd MarkupSafe-2.1.5 pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD pip3 install --no-index --no-user --find-links dist Markupsafe cd ../ rm -rf MarkupSafe-2.1.5 tar -xf jinja2-3.1.4.tar.gz cd jinja2-3.1.4 pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD pip3 install --no-index --no-user --find-links dist Jinja2 cd ../ rm -rf jinja2-3.1.4 tar -xf systemd-256.4.tar.gz cd systemd-256.4 sed -i -e 's/GROUP="render"/GROUP="video"/' \ -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in sed '/systemd-sysctl/s/^/#/' -i rules.d/99-systemd.rules.in sed '/NETWORK_DIRS/s/systemd/udev/' -i src/basic/path-lookup.h mkdir -p build cd build meson setup .. \ --prefix=/usr \ --buildtype=release \ -D mode=release \ -D dev-kvm-mode=0660 \ -D link-udev-shared=false \ -D logind=false \ -D vconsole=false export udev_helpers=$(grep "'name' :" ../src/udev/meson.build | \ awk '{print $3}' | tr -d ",'" | grep -v 'udevadm') ninja udevadm systemd-hwdb \ $(ninja -n | grep -Eo '(src/(lib)?udev|rules.d|hwdb.d)/[^ ]*') \ $(realpath libudev.so --relative-to .) \ $udev_helpers install -vm755 -d {/usr/lib,/etc}/udev/{hwdb.d,rules.d,network} install -vm755 -d /usr/{lib,share}/pkgconfig install -vm755 udevadm /usr/bin/ install -vm755 systemd-hwdb /usr/bin/udev-hwdb ln -svfn ../bin/udevadm /usr/sbin/udevd cp -av libudev.so{,*[0-9]} /usr/lib/ install -vm644 ../src/libudev/libudev.h /usr/include/ install -vm644 src/libudev/*.pc /usr/lib/pkgconfig/ install -vm644 src/udev/*.pc /usr/share/pkgconfig/ install -vm644 ../src/udev/udev.conf /etc/udev/ install -vm644 rules.d/* ../rules.d/README /usr/lib/udev/rules.d/ install -vm644 $(find ../rules.d/*.rules \ -not -name '*power-switch*') /usr/lib/udev/rules.d/ install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d/ install -vm755 $udev_helpers /usr/lib/udev install -vm644 ../network/99-default.link /usr/lib/udev/network tar -xvf ../../udev-lfs-20230818.tar.xz make -f udev-lfs-20230818/Makefile.lfs install tar -xf ../../systemd-man-pages-256.4.tar.xz \ --no-same-owner --strip-components=1 \ -C /usr/share/man --wildcards '*/udev*' '*/libudev*' \ '*/systemd.link.5' \ '*/systemd-'{hwdb,udevd.service}.8 sed 's|systemd/network|udev/network|' \ /usr/share/man/man5/systemd.link.5 \ > /usr/share/man/man5/udev.link.5 sed 's/systemd\(\\\?-\)/udev\1/' /usr/share/man/man8/systemd-hwdb.8 \ > /usr/share/man/man8/udev-hwdb.8 sed 's|lib.*udevd|sbin/udevd|' \ /usr/share/man/man8/systemd-udevd.service.8 \ > /usr/share/man/man8/udevd.8 rm /usr/share/man/man*/systemd* unset udev_helpers udev-hwdb update cd ../../ rm -rf systemd-256.4 tar -xJvf man-db-2.12.1.tar.xz cd man-db-2.12.1 ./configure --prefix=/usr \ --docdir=/usr/share/doc/man-db-2.12.1 \ --sysconfdir=/etc \ --disable-setuid \ --enable-cache-owner=bin \ --with-browser=/usr/bin/lynx \ --with-vgrind=/usr/bin/vgrind \ --with-grap=/usr/bin/grap \ --with-systemdtmpfilesdir= \ --with-systemdsystemunitdir= make make install cd ../ rm -rf man-db-2.12.1 tar -xJvf procps-ng-4.0.4.tar.xz cd procps-ng-4.0.4 ./configure --prefix=/usr \ --docdir=/usr/share/doc/procps-ng-4.0.4 \ --disable-static \ --disable-kill make make install cd ../ rm -rf procps-ng-4.0.4 tar -xJvf util-linux-2.40.2.tar.xz cd util-linux-2.40.2 ./configure --bindir=/usr/bin \ --libdir=/usr/lib \ --runstatedir=/run \ --sbindir=/usr/sbin \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ --disable-su \ --disable-setpriv \ --disable-runuser \ --disable-pylibmount \ --disable-liblastlog2 \ --disable-static \ --without-python \ --without-systemd \ --without-systemdsystemunitdir \ ADJTIME_PATH=/var/lib/hwclock/adjtime \ --docdir=/usr/share/doc/util-linux-2.40.2 make make install cd ../ rm -rf util-linux-2.40.2 tar -xf e2fsprogs-1.47.1.tar.gz cd e2fsprogs-1.47.1 mkdir -v build cd build ../configure --prefix=/usr \ --sysconfdir=/etc \ --enable-elf-shlibs \ --disable-libblkid \ --disable-libuuid \ --disable-uuidd \ --disable-fsck make make install rm -fv /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a gunzip -v /usr/share/info/libext2fs.info.gz install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo install -v -m644 doc/com_err.info /usr/share/info install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info sed 's/metadata_csum_seed,//' -i /etc/mke2fs.conf cd ../../ rm -rf e2fsprogs-1.47.1 tar -xf sysklogd-2.6.1.tar.gz cd sysklogd-2.6.1 ./configure --prefix=/usr \ --sysconfdir=/etc \ --runstatedir=/run \ --without-logger make make install cat > /etc/syslog.conf << "EOF" # Begin /etc/syslog.conf auth,authpriv.* -/var/log/auth.log *.*;auth,authpriv.none -/var/log/sys.log daemon.* -/var/log/daemon.log kern.* -/var/log/kern.log mail.* -/var/log/mail.log user.* -/var/log/user.log *.emerg * # Do not open any internet ports. secure_mode 2 # End /etc/syslog.conf EOF cd ../ rm -rf sysklogd-2.6.1 tar -xJvf sysvinit-3.10.tar.xz cd sysvinit-3.10 patch -Np1 -i ../sysvinit-3.10-consolidated-1.patch make make install cd ../ rm -rf sysklogd-2.6.1 rm -rf /tmp/{*,.*} find /usr/lib /usr/libexec -name \*.la -delete find /usr -depth -name $(uname -m)-lfs-linux-gnu\* | xargs rm -rf userdel -r tester tar -xJvf lfs-bootscripts-20240825.tar.xz cd lfs-bootscripts-20240825 make install cd ../ rm -rf lfs-bootscripts-20240825 bash /usr/lib/udev/init-net-rules.sh CONFIGURE NETWORKING cd /etc/sysconfig/ cat > ifconfig.ens32 << "EOF" ONBOOT=yes IFACE=ens32 SERVICE=ipv4-static IP=10.1.1.13 GATEWAY=10.1.1.1 PREFIX=24 BROADCAST=10.1.1.255 EOF cat > /etc/resolv.conf << "EOF" # Begin /etc/resolv.conf nameserver 8.8.8.8 nameserver 1.1.1.1 # End /etc/resolv.conf EOF echo "LFS" > /etc/hostname cat > /etc/hosts << "EOF" # Begin /etc/hosts 127.0.0.1 localhost.localdomain localhost 127.0.1.1 LFS.DOMINION LFS 10.1.1.13 LFS.DOMINION LFS [alias1] [alias2 ...] ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters # End /etc/hosts EOF cat > /etc/inittab << "EOF" # Begin /etc/inittab id:3:initdefault: si::sysinit:/etc/rc.d/init.d/rc S l0:0:wait:/etc/rc.d/init.d/rc 0 l1:S1:wait:/etc/rc.d/init.d/rc 1 l2:2:wait:/etc/rc.d/init.d/rc 2 l3:3:wait:/etc/rc.d/init.d/rc 3 l4:4:wait:/etc/rc.d/init.d/rc 4 l5:5:wait:/etc/rc.d/init.d/rc 5 l6:6:wait:/etc/rc.d/init.d/rc 6 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now su:S06:once:/sbin/sulogin s1:1:respawn:/sbin/sulogin 1:2345:respawn:/sbin/agetty --noclear tty1 9600 2:2345:respawn:/sbin/agetty tty2 9600 3:2345:respawn:/sbin/agetty tty3 9600 4:2345:respawn:/sbin/agetty tty4 9600 5:2345:respawn:/sbin/agetty tty5 9600 6:2345:respawn:/sbin/agetty tty6 9600 # End /etc/inittab EOF cat > /etc/sysconfig/clock << "EOF" # Begin /etc/sysconfig/clock UTC=0 # Set this to any options you might need to give to hwclock, # such as machine hardware clock type for Alphas. CLOCKPARAMS= # End /etc/sysconfig/clock EOF cat > /etc/sysconfig/console << "EOF" # Begin /etc/sysconfig/console UNICODE="1" FONT="Lat2-Terminus16" # End /etc/sysconfig/console EOF LC_ALL=en_AU locale language LC_ALL=en_AU locale charmap LC_ALL=en_AU locale int_curr_symbol LC_ALL=en_AU locale int_prefix cat > /etc/profile << "EOF" # Begin /etc/profile for i in $(locale); do unset ${i%=*} done if [[ "$TERM" = linux ]]; then export LANG=C.UTF-8 else export LANG=en_AU.UTF8 fi # End /etc/profile EOF cat > /etc/inputrc << "EOF" # Begin /etc/inputrc # Modified by Chris Lynn # Allow the command prompt to wrap to the next line set horizontal-scroll-mode Off # Enable 8-bit input set meta-flag On set input-meta On # Turns off 8th bit stripping set convert-meta Off # Keep the 8th bit for display set output-meta On # none, visible or audible set bell-style none # All of the following map the escape sequence of the value # contained in the 1st argument to the readline specific functions "\eOd": backward-word "\eOc": forward-word # for linux console "\e[1~": beginning-of-line "\e[4~": end-of-line "\e[5~": beginning-of-history "\e[6~": end-of-history "\e[3~": delete-char "\e[2~": quoted-insert # for xterm "\eOH": beginning-of-line "\eOF": end-of-line # for Konsole "\e[H": beginning-of-line "\e[F": end-of-line # End /etc/inputrc EOF cat > /etc/shells << "EOF" # Begin /etc/shells /bin/sh /bin/bash # End /etc/shells EOF MAKING LFS BOOTABLE blkid will give you a listing of what the device names are. in this case the lfs hdd is /dev/sdb1 cat > /etc/fstab << "EOF" # Begin /etc/fstab # file system mount-point type options dump fsck # order /dev/sdb1 / ext4 defaults 1 1 /dev/sda5 swap swap pri=1 0 0 proc /proc proc nosuid,noexec,nodev 0 0 sysfs /sys sysfs nosuid,noexec,nodev 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /run tmpfs defaults 0 0 devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 tmpfs /dev/shm tmpfs nosuid,nodev 0 0 cgroup2 /sys/fs/cgroup cgroup2 nosuid,noexec,nodev 0 0 # End /etc/fstab EOF TIME TO COMPILE AGAIN lmao did you really think this was over? cd /sources/12.2/ tar -xJvf linux-6.10.5.tar.xz cd linux-6.10.5 make mrproper make defconfig it is now time to follow the instructions in the book for setting the appropriate menuconfig options. we can open the menu with make menuconfig make make modules_install cp -iv arch/x86/boot/bzImage /boot/vmlinuz-6.10.5-lfs-12.2 cp -iv System.map /boot/System.map-6.10.5 cp -iv .config /boot/config-6.10.5 cp -r Documentation -T /usr/share/doc/linux-6.10.5 install -v -m755 -d /etc/modprobe.d cat > /etc/modprobe.d/usb.conf << "EOF" # Begin /etc/modprobe.d/usb.conf install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true # End /etc/modprobe.d/usb.conf EOF cd ../ rm -rf linux-6.10.5 INSTALL GRUB. make sure you are pointing it to the DRIVE lfs is on, not the PARTITION. grub-install /dev/sdb --target i386-pc cat > /boot/grub/grub.cfg << "EOF" # Begin /boot/grub/grub.cfg set default=0 set timeout=5 insmod part_gpt insmod ext2 set root=(hd0,gpt1) menuentry "GNU/Linux, Linux 6.10.5-lfs-12.2" { linux /boot/vmlinuz-6.10.5-lfs-12.2 root=/dev/sdb1 ro } EOF echo 12.2 > /etc/lfs-release cat > /etc/lsb-release << "EOF" DISTRIB_ID="Linux From Scratch" DISTRIB_RELEASE="12.2" DISTRIB_CODENAME="existentialism" DISTRIB_DESCRIPTION="Linux From Scratch" EOF cat > /etc/os-release << "EOF" NAME="Linux From Scratch" VERSION="12.2" ID=lfs PRETTY_NAME="Linux From Scratch 12.2" VERSION_CODENAME="existentialism" HOME_URL="onecloudemoji.github.io" EOF logout umount -v $LFS/dev/pts mountpoint -q $LFS/dev/shm && umount -v $LFS/dev/shm umount -v $LFS/dev umount -v $LFS/run umount -v $LFS/proc umount -v $LFS/sys umount -v $LFS reboot ta da