<> = LinuxFromScratch = * https://www.linuxfromscratch.org/ 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 * https://www.linuxfromscratch.org/lfs/downloads/stable/wget-list {{{#!highlight sh # https://www.linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-11.3-NOCHUNKS.html uname -a # Linux debian 5.10.0-22-amd64 #1 SMP Debian 5.10.178-3 (2023-04-22) x86_64 GNU/Linux cd ~ mkdir lfs cd lfs wget https://www.linuxfromscratch.org/lfs/downloads/stable/wget-list xargs -l wget < wget-list # wget --input-file=wget-list --continue --directory-prefix=$LFS/sources mkdir sources mv *patch *xz *gz *bz2 sources/ # As root sudo bash cd sources chmod 666 . -R export LFS=/home/vagrant/lfs echo $LFS mkdir -pv $LFS cd $LFS mkdir sources wget https://www.linuxfromscratch.org/lfs/downloads/stable/wget-list xargs -l wget < wget-list cd .. cat > version-check.sh << "EOF" #!/bin/bash # Simple script to list version numbers of critical development tools export LC_ALL=C bash --version | head -n1 | cut -d" " -f2-4 MYSH=$(readlink -f /bin/sh) echo "/bin/sh -> $MYSH" echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash" unset MYSH echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- bison --version | head -n1 if [ -h /usr/bin/yacc ]; then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`"; elif [ -x /usr/bin/yacc ]; then echo yacc is `/usr/bin/yacc --version | head -n1` else echo "yacc not found" fi echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2 diff --version | head -n1 find --version | head -n1 gawk --version | head -n1 if [ -h /usr/bin/awk ]; then echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`"; elif [ -x /usr/bin/awk ]; then echo awk is `/usr/bin/awk --version | head -n1` else echo "awk not found" fi gcc --version | head -n1 g++ --version | head -n1 grep --version | head -n1 gzip --version | head -n1 cat /proc/version m4 --version | head -n1 make --version | head -n1 patch --version | head -n1 echo Perl `perl -V:version` python3 --version sed --version | head -n1 tar --version | head -n1 makeinfo --version | head -n1 # texinfo version xz --version | head -n1 echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c if [ -x dummy ] then echo "g++ compilation OK"; else echo "g++ compilation failed"; fi rm -f dummy.c dummy EOF sudo rm /bin/sh sudo ln -s /bin/bash /bin/sh sudo apt install bison texinfo gawk bash version-check.sh # As root user sudo bash export LFS=/home/vagrant/lfs 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 groupadd lfs useradd -s /bin/bash -g lfs -m -k /dev/null lfs echo -e "lfs\nlfs\n" | passwd lfs chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools,sources} chgrp -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools,sources} chmod 755 sources/ case $(uname -m) in x86_64) chown -v lfs $LFS/lib64 ;; esac }}} == Build cross compiler system == === Logged in as lfs user === {{{#!highlight sh 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=/home/vagrant/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 source ~/.bash_profile source ~/.bashrc echo $LFS # Basic build steps # cd /mnt/lfs/sources/ # untar package as lfs user # go to package folder # build # go back to /mnt/lfs/sources/ # delete extracted package }}} === binutils as lfs user === {{{#!highlight sh cd $LFS/sources/ tar xvif binutils*.xz cd $(ls binutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) mkdir -v build cd build ../configure --prefix=$LFS/tools \ --with-sysroot=$LFS \ --target=$LFS_TGT \ --disable-nls \ --enable-gprofng=no \ --disable-werror make make install cd $LFS/sources/ rm -rf $(ls binutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === gcc === {{{#!highlight sh cd $LFS/sources/ tar xvif gcc*.xz cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) tar -xf ../mpfr-4.2.0.tar.xz mv -v mpfr-4.2.0 mpfr tar -xf ../gmp-6.2.1.tar.xz mv -v gmp-6.2.1 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.37 \ --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 $LFS/sources/ rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === Linux-6.1.11 API Headers === {{{#!highlight sh cd $LFS/sources/ tar xvif linux*.xz cd $(ls linux*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) make mrproper make headers find usr/include -type f ! -name '*.h' -delete cp -rv usr/include $LFS/usr cd $LFS/sources/ rm -rf $(ls linux*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === glibc === {{{#!highlight sh cd $LFS/sources/ tar xvif glibc*.xz cd $(ls glibc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) 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.37-fhs-1.patch mkdir -v build cd build echo "rootsbindir=/usr/sbin" > configparms ../configure \ --prefix=/usr \ --host=$LFS_TGT \ --build=$(../scripts/config.guess) \ --enable-kernel=3.2 \ --with-headers=$LFS/usr/include \ 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 $LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders cd $LFS/sources/ rm -rf $(ls glibc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === Libstdc++ === {{{#!highlight sh cd $LFS/sources/ tar xvif gcc*.xz cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) 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++/12.2.0 make make DESTDIR=$LFS install rm -v $LFS/usr/lib/lib{stdc++,stdc++fs,supc++}.la cd $LFS/sources/ rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === m4 === {{{#!highlight sh cd $LFS/sources/ tar xvif m4*.xz cd $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make[1]: Leaving directory '/home/vagrant/lfs/sources/m4-1.4.19' make: *** [Makefile:1974: all] Error 2 cd $LFS/sources/ tar xvif gcc*.xz cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h $LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders cd $LFS/sources/ cd $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) rm -rf $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === ncurses === {{{#!highlight sh cd $LFS/sources/ tar xvzf ncurses*.gz cd $(ls ncurses*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) 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 \ --enable-widec time make make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so cd $LFS/sources/ rm -rf $(ls ncurses*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === bash === {{{#!highlight sh cd $LFS/sources/ tar xvzf bash*.gz cd $(ls bash*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) ./configure --prefix=/usr \ --build=$(sh support/config.guess) \ --host=$LFS_TGT \ --without-bash-malloc time make make DESTDIR=$LFS install ln -sv bash $LFS/bin/sh cd $LFS/sources/ rm -rf $(ls bash*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === coreutils === {{{#!highlight sh cd $LFS/sources/ tar xvif coreutils*.xz cd $(ls coreutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) \ --enable-install-program=hostname \ --enable-no-install-program=kill,uptime time 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 $LFS/sources/ rm -rf $(ls coreutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === diffutils === {{{#!highlight sh cd $LFS/sources/ tar xvif diffutils*.xz cd $(ls diffutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr --host=$LFS_TGT time make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls diffutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === file === {{{#!highlight sh cd $LFS/sources/ tar xvzf file*.gz cd $(ls file*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) mkdir build pushd build ../configure --disable-bzlib \ --disable-libseccomp \ --disable-xzlib \ --disable-zlib make popd ./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess) time make FILE_COMPILE=$(pwd)/build/src/file make DESTDIR=$LFS install rm -v $LFS/usr/lib/libmagic.la cd $LFS/sources/ rm -rf $(ls file*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === findutils === {{{#!highlight sh cd $LFS/sources/ tar xvif findutils*.xz cd $(ls findutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --localstatedir=/var/lib/locate \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls findutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === gawk === {{{#!highlight sh cd $LFS/sources/ APP=gawk tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) sed -i 's/extras//' Makefile.in ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === grep === {{{#!highlight sh cd $LFS/sources/ APP=grep tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --host=$LFS_TGT make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === gzip === {{{#!highlight sh cd $LFS/sources/ APP=gzip tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr --host=$LFS_TGT make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === make === {{{#!highlight sh cd $LFS/sources/ APP=make tar xvif $APP*.gz cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) sed -e '/ifdef SIGPIPE/,+2 d' \ -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \ -i src/main.c ./configure --prefix=/usr \ --without-guile \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === patch === {{{#!highlight sh cd $LFS/sources/ APP=patch tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === sed === {{{#!highlight sh cd $LFS/sources/ APP=sed tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --host=$LFS_TGT make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === tar === {{{#!highlight sh cd $LFS/sources/ APP=tar tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) make make DESTDIR=$LFS install cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === xz === {{{#!highlight sh cd $LFS/sources/ APP=xz tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) \ --disable-static \ --docdir=/usr/share/doc/xz-5.4.1 make make DESTDIR=$LFS install rm -v $LFS/usr/lib/liblzma.la cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === binutils pass 2 === {{{#!highlight sh cd $LFS/sources/ APP=binutils tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) 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 make make DESTDIR=$LFS install rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la} cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === gcc part 2 === {{{#!highlight sh cd $LFS/sources/ APP=gcc tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) tar -xf ../mpfr-4.2.0.tar.xz mv -v mpfr-4.2.0 mpfr tar -xf ../gmp-6.2.1.tar.xz mv -v gmp-6.2.1 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-libssp \ --disable-libvtv \ --enable-languages=c,c++ make make DESTDIR=$LFS install ln -sv gcc $LFS/usr/bin/cc cd $LFS/sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === As root user === {{{#!highlight sh sudo bash export LFS=/home/vagrant/lfs echo $LFS /home/vagrant/lfs cd $LFS chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools} case $(uname -m) in x86_64) chown -R root:root $LFS/lib64 ;; esac mkdir -pv $LFS/{dev,proc,sys,run} mount -v --bind /dev $LFS/dev mount -v --bind /dev/pts $LFS/dev/pts mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys mount -vt tmpfs tmpfs $LFS/run if [ -h $LFS/dev/shm ]; then mkdir -pv $LFS/$(readlink $LFS/dev/shm) else mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm fi chroot "$LFS" /usr/bin/env -i \ HOME=/root \ TERM="$TERM" \ PS1='(lfs chroot) \u:\w\$ ' \ PATH=/usr/bin:/usr/sbin \ /bin/bash --login # in chroot state the bash prompt will say "I have no name!" 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/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: usb:x:14: 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 echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd echo "tester:x:101:" >> /etc/group install -o tester -d /home/tester 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 }}} === gettext === {{{#!highlight sh cd /sources/ APP=gettext tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --disable-shared make cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === bison === {{{#!highlight sh cd /sources/ APP=bison tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --docdir=/usr/share/doc/bison-3.8.2 make make install cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === perl === {{{#!highlight sh cd /sources/ APP=perl tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) sh Configure -des \ -Dprefix=/usr \ -Dvendorprefix=/usr \ -Dprivlib=/usr/lib/perl5/5.36/core_perl \ -Darchlib=/usr/lib/perl5/5.36/core_perl \ -Dsitelib=/usr/lib/perl5/5.36/site_perl \ -Dsitearch=/usr/lib/perl5/5.36/site_perl \ -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \ -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl make make install cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === python === {{{#!highlight sh cd /sources/ APP=Python tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --enable-shared \ --without-ensurepip make make install cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === texinfo === {{{#!highlight sh cd /sources/ APP=texinfo tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr make make install cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === util-linux === {{{#!highlight sh cd /sources/ APP=util-linux tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) mkdir -pv /var/lib/hwclock ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ --libdir=/usr/lib \ --docdir=/usr/share/doc/util-linux-2.38.1 \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ --disable-su \ --disable-setpriv \ --disable-runuser \ --disable-pylibmount \ --disable-static \ --without-python \ runstatedir=/run make make install cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === Cleaning === {{{#!highlight sh rm -rf /usr/share/{info,man,doc}/* find /usr/{lib,libexec} -name \*.la -delete rm -rf /tools }}} === Backup as root === {{{#!highlight sh exit # leave chroot echo $LFS mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm umount $LFS/dev/pts umount $LFS/{sys,proc,run,dev} cd $LFS tar -cJpf $HOME/lfs-temp-tools-11.3.tar.xz . }}} === Restore as root if required === {{{#!highlight sh echo $LFS cd $LFS rm -rf ./* tar -xpf $HOME/lfs-temp-tools-11.3.tar.xz }}} == Build system based on the cross compiler == === Prepare Virtual Kernel File Systems === {{{#!highlight sh findmnt | grep $LFS mkdir -pv $LFS/{dev,proc,sys,run} mount -v --bind /dev $LFS/dev mount -v --bind /dev/pts $LFS/dev/pts mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys mount -vt tmpfs tmpfs $LFS/run if [ -h $LFS/dev/shm ]; then mkdir -pv $LFS/$(readlink $LFS/dev/shm) else mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm fi }}} === Enter the chroot env === {{{#!highlight sh chroot "$LFS" /usr/bin/env -i \ HOME=/root \ TERM="$TERM" \ PS1='(lfs chroot) \u:\w\$ ' \ PATH=/usr/bin:/usr/sbin \ /bin/bash --login }}} === man pages === {{{#!highlight sh cd /sources/ APP=man-pages tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) make prefix=/usr install cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === iana === {{{#!highlight sh cd /sources/ APP=iana tar xvif $APP*.gz cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) cp services protocols /etc cd /sources/ rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === glibc === {{{#!highlight sh cd /sources/ APP=glibc tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) patch -Np1 -i ../glibc-2.37-fhs-1.patch sed '/width -=/s/workend - string/number_length/' \ -i stdio-common/vfprintf-process-arg.c mkdir -v build cd build echo "rootsbindir=/usr/sbin" > configparms ../configure --prefix=/usr \ --disable-werror \ --enable-kernel=3.2 \ --enable-stack-protector=strong \ --with-headers=/usr/include \ 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 cp -v ../nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd mkdir -pv /usr/lib/locale localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true localedef -i en_US -f ISO-8859-1 en_US localedef -i en_US -f UTF-8 en_US.UTF-8 localedef -i pt_PT -f ISO-8859-1 pt_PT localedef -i pt_PT@euro -f ISO-8859-15 pt_PT@euro localedef -i pt_PT -f UTF-8 pt_PT.UTF-8 make localedata/install-locales localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true cat > /etc/nsswitch.conf << "EOF" passwd: files group: files shadow: files hosts: files dns networks: files protocols: files services: files ethers: files rpc: files EOF tar -xf ../../tzdata2022g.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 echo -e "7\n 37\n 1\n 1\n" | tzselect # 7\n 37\n 1\n 1\n # Europe Portugal Mainland yes ln -sfv /usr/share/zoneinfo/Europe/Portugal /etc/localtime cat > /etc/ld.so.conf << "EOF" /usr/local/lib /opt/lib # Add an include directory include /etc/ld.so.conf.d/*.conf EOF mkdir -pv /etc/ld.so.conf.d cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === zlib === {{{#!highlight sh cd /sources/ APP=zlib tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr make make check make install rm -fv /usr/lib/libz.a cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === bzip2 === {{{#!highlight sh cd /sources/ APP=bzip2 tar xvif $APP*.gz cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) 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 /sources/ rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === xz === {{{#!highlight sh cd /sources/ APP=xz tar xvif $APP*.xz cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/xz-5.4.1 make make check make install cd /sources/ rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' ) }}} === zstd === {{{#!highlight sh cd /sources/ APP=zstd tar xvif $APP*.gz cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) make prefix=/usr make check make prefix=/usr install rm -v /usr/lib/libzstd.a cd /sources/ rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === file === {{{#!highlight sh cd /sources/ APP=file EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === readline === {{{#!highlight sh cd /sources/ APP=readline tar xvif $APP*.gz cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) sed -i '/MV.*old/d' Makefile.in sed -i '/{OLDSUFF}/c:' support/shlib-install patch -Np1 -i ../readline-8.2-upstream_fix-1.patch ./configure --prefix=/usr \ --disable-static \ --with-curses \ --docdir=/usr/share/doc/readline-8.2 make SHLIB_LIBS="-lncursesw" make SHLIB_LIBS="-lncursesw" install install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.2 cd /sources/ rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' ) }}} === m4 === {{{#!highlight sh cd /sources/ APP=m4 EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === bc === {{{#!highlight sh cd /sources/ APP=bc EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) CC=gcc ./configure --prefix=/usr -G -O3 -r make make test make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === flex === {{{#!highlight sh cd /sources/ APP=flex EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --docdir=/usr/share/doc/flex-2.6.4 \ --disable-static make make check make install ln -sv flex /usr/bin/lex cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === tcl === {{{#!highlight sh cd /sources/ APP=tcl8.6.13-src EXTENSION=gz FOLDER=tcl8.6.13 tar xvzf $APP*.$EXTENSION cd $FOLDER SRCDIR=$(pwd) cd unix ./configure --prefix=/usr \ --mandir=/usr/share/man make sed -e "s|$SRCDIR/unix|/usr/lib|" \ -e "s|$SRCDIR|/usr/include|" \ -i tclConfig.sh sed -e "s|$SRCDIR/unix/pkgs/tdbc1.1.5|/usr/lib/tdbc1.1.5|" \ -e "s|$SRCDIR/pkgs/tdbc1.1.5/generic|/usr/include|" \ -e "s|$SRCDIR/pkgs/tdbc1.1.5/library|/usr/lib/tcl8.6|" \ -e "s|$SRCDIR/pkgs/tdbc1.1.5|/usr/include|" \ -i pkgs/tdbc1.1.5/tdbcConfig.sh sed -e "s|$SRCDIR/unix/pkgs/itcl4.2.3|/usr/lib/itcl4.2.3|" \ -e "s|$SRCDIR/pkgs/itcl4.2.3/generic|/usr/include|" \ -e "s|$SRCDIR/pkgs/itcl4.2.3|/usr/include|" \ -i pkgs/itcl4.2.3/itclConfig.sh unset SRCDIR make test 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.13-html.tar.gz --strip-components=1 mkdir -v -p /usr/share/doc/tcl-8.6.13 cp -v -r ./html/* /usr/share/doc/tcl-8.6.13 cd /sources/ rm -rf $FOLDER }}} === expect === {{{#!highlight sh cd /sources/ APP=expect EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --with-tcl=/usr/lib \ --enable-shared \ --mandir=/usr/share/man \ --with-tclinclude=/usr/include make make test make install ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === dejagnu === {{{#!highlight sh cd /sources/ APP=dejagnu EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) 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 make check cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === binutils === {{{#!highlight sh cd /sources/ APP=binutils EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) expect -c "spawn ls" 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 \ --with-system-zlib make tooldir=/usr make -k check grep '^FAIL:' $(find -name '*.log') # expected to 12 tests fail grep '^FAIL:' $(find -name '*.log') | wc -l make tooldir=/usr install rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a rm -fv /usr/share/man/man1/{gprofng,gp-*}.1 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === gmp === {{{#!highlight sh cd /sources/ APP=gmp EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) cp -v configfsf.guess config.guess cp -v configfsf.sub config.sub ./configure --prefix=/usr \ --enable-cxx \ --disable-static \ --docdir=/usr/share/doc/gmp-6.2.1 make make html make check 2>&1 | tee gmp-check-log awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log # check all 197 pass make install make install-html cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === mpfr === {{{#!highlight sh cd /sources/ APP=mpfr EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -e 's/+01,234,567/+1,234,567 /' \ -e 's/13.10Pd/13Pd/' \ -i tests/tsprintf.c ./configure --prefix=/usr \ --disable-static \ --enable-thread-safe \ --docdir=/usr/share/doc/mpfr-4.2.0 make make html make check # ensure that all 197 tests passed make install make install-html cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === mpc === {{{#!highlight sh cd /sources/ APP=mpc EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/mpc-1.3.1 make make html make check make install make install-html cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === attr === {{{#!highlight sh cd /sources/ APP=attr EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-static \ --sysconfdir=/etc \ --docdir=/usr/share/doc/attr-2.5.1 make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === acl === {{{#!highlight sh cd /sources/ APP=acl EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/acl-2.3.1 make make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === libcap === {{{#!highlight sh cd /sources/ APP=libcap EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -i '/install -m.*STA/d' libcap/Makefile make prefix=/usr lib=lib make test make prefix=/usr lib=lib install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === shadow === {{{#!highlight sh cd /sources/ APP=shadow EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) 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 SHA512:' \ -e 's@#\(SHA_CRYPT_..._ROUNDS 5000\)@\100@' \ -e 's:/var/spool/mail:/var/mail:' \ -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \ -i etc/login.defs # no cracklib support touch /usr/bin/passwd ./configure --sysconfdir=/etc \ --disable-static \ --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 sed -i '/MAIL/s/yes/no/' /etc/default/useradd # input root pwd passwd root cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === gcc === {{{#!highlight sh cd /sources/ APP=gcc EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) 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 \ --disable-multilib \ --disable-bootstrap \ --with-system-zlib time make # 43 SBU # real 65m28.356s ulimit -s 32768 chown -Rv tester . su tester -c "PATH=$PATH make -k check" # started 16:14 ../contrib/test_summary make install chown -v -R root:root \ /usr/lib/gcc/$(gcc -dumpmachine)/12.2.0/include{,-fixed} ln -svr /usr/bin/cpp /usr/lib ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/12.2.0/liblto_plugin.so \ /usr/lib/bfd-plugins/ echo 'int main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib' # should show # [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log grep -B4 '^ /usr/include' dummy.log grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' grep "/lib.*/libc.so.6 " dummy.log rm -v dummy.c a.out dummy.log mkdir -pv /usr/share/gdb/auto-load/usr/lib mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === pkg-config === {{{#!highlight sh cd /sources/ APP=pkg-config EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --with-internal-glib \ --disable-host-tool \ --docdir=/usr/share/doc/pkg-config-0.29.2 make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === ncurses === {{{#!highlight sh cd /sources/ APP=ncurses EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --mandir=/usr/share/man \ --with-shared \ --without-debug \ --without-normal \ --with-cxx-shared \ --enable-pc-files \ --enable-widec \ --with-pkg-config-libdir=/usr/lib/pkgconfig make make DESTDIR=$PWD/dest install install -vm755 dest/usr/lib/libncursesw.so.6.4 /usr/lib rm -v dest/usr/lib/libncursesw.so.6.4 cp -av dest/* / for lib in ncurses form panel menu ; do rm -vf /usr/lib/lib${lib}.so echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc done rm -vf /usr/lib/libcursesw.so echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so ln -sfv libncurses.so /usr/lib/libcurses.so mkdir -pv /usr/share/doc/ncurses-6.4 cp -v -R doc/* /usr/share/doc/ncurses-6.4 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === sed === {{{#!highlight sh cd /sources/ APP=sed EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make html chown -Rv tester . su tester -c "PATH=$PATH make check" make install install -d -m755 /usr/share/doc/sed-4.9 install -m644 doc/sed.html /usr/share/doc/sed-4.9 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === psmisc === {{{#!highlight sh cd /sources/ APP=psmisc EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === gettext === {{{#!highlight sh cd /sources/ APP=gettext EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/gettext-0.21.1 make make check make install chmod -v 0755 /usr/lib/preloadable_libintl.so cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === bison === {{{#!highlight sh cd /sources/ APP=bison EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2 make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === grep === {{{#!highlight sh cd /sources/ APP=grep EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -i "s/echo/#echo/" src/egrep.sh ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === bash === {{{#!highlight sh cd /sources/ APP=bash EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --without-bash-malloc \ --with-installed-readline \ --docdir=/usr/share/doc/bash-5.2.15 make chown -Rv tester . su -s /usr/bin/expect tester << EOF set timeout -1 spawn make tests expect eof lassign [wait] _ _ _ value exit $value EOF make install exec /usr/bin/bash --login cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === libtool === {{{#!highlight sh cd /sources/ APP=libtool EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make -k check make install rm -fv /usr/lib/libltdl.a cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === gdbm === {{{#!highlight sh cd /sources/ APP=gdbm EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-static \ --enable-libgdbm-compat make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === gperf === {{{#!highlight sh cd /sources/ APP=gperf EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1 make make -j1 check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === expat === {{{#!highlight sh cd /sources/ APP=expat EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/expat-2.5.0 make make check make install install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.5.0 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === inetutils === {{{#!highlight sh cd /sources/ APP=inetutils EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --bindir=/usr/bin \ --localstatedir=/var \ --disable-logger \ --disable-whois \ --disable-rcp \ --disable-rexec \ --disable-rlogin \ --disable-rsh \ --disable-servers make make check make install mv -v /usr/{,s}bin/ifconfig cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === less === {{{#!highlight sh cd /sources/ APP=less EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr --sysconfdir=/etc make make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === perl === {{{#!highlight sh cd /sources/ APP=perl EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) export BUILD_ZLIB=False export BUILD_BZIP2=0 sh Configure -des \ -Dprefix=/usr \ -Dvendorprefix=/usr \ -Dprivlib=/usr/lib/perl5/5.36/core_perl \ -Darchlib=/usr/lib/perl5/5.36/core_perl \ -Dsitelib=/usr/lib/perl5/5.36/site_perl \ -Dsitearch=/usr/lib/perl5/5.36/site_perl \ -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \ -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl \ -Dman1dir=/usr/share/man/man1 \ -Dman3dir=/usr/share/man/man3 \ -Dpager="/usr/bin/less -isR" \ -Duseshrplib \ -Dusethreads make make test make install unset BUILD_ZLIB BUILD_BZIP2 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === XML-Parser === {{{#!highlight sh cd /sources/ APP=XML-Parser EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) perl Makefile.PL make make test make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === intltool-0.51.0.tar.gz === {{{#!highlight sh cd /sources/ APP=intltool EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -i 's:\\\${:\\\$\\{:' intltool-update.in ./configure --prefix=/usr make make check make install install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === autoconf-2.71.tar.xz === {{{#!highlight sh cd /sources/ APP=autoconf EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -e 's/SECONDS|/&SHLVL|/' \ -e '/BASH_ARGV=/a\ /^SHLVL=/ d' \ -i.orig tests/local.at ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === automake-1.16.5.tar.xz === {{{#!highlight sh cd /sources/ APP=automake EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.5 make make -j4 check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === openssl-3.0.8.tar.gz === {{{#!highlight sh cd /sources/ APP=openssl EXTENSION=gz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./config --prefix=/usr \ --openssldir=/etc/ssl \ --libdir=lib \ shared \ zlib-dynamic make make test 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.0.8 cp -vfr doc/* /usr/share/doc/openssl-3.0.8 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === kmod-30.tar.xz === {{{#!highlight sh cd /sources/ APP=kmod EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --sysconfdir=/etc \ --with-openssl \ --with-xz \ --with-zstd \ --with-zlib make make install for target in depmod insmod modinfo modprobe rmmod; do ln -sfv ../bin/kmod /usr/sbin/$target done ln -sfv kmod /usr/bin/lsmod cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === elfutils-0.188.tar.bz2 === {{{#!highlight sh cd /sources/ APP=elfutils EXTENSION=bz2 tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-debuginfod \ --enable-libdebuginfod=dummy make make check make -C libelf install install -vm644 config/libelf.pc /usr/lib/pkgconfig rm /usr/lib/libelf.a cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === libffi-3.4.4.tar.gz === {{{#!highlight sh cd /sources/ APP=libffi EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --disable-static \ --with-gcc-arch=native make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === Python-3.11.2.tar.xz === {{{#!highlight sh cd /sources/ APP=Python-3 EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --enable-shared \ --with-system-expat \ --with-system-ffi \ --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.11.2/html tar --strip-components=1 \ --no-same-owner \ --no-same-permissions \ -C /usr/share/doc/python-3.11.2/html \ -xvf ../python-3.11.2-docs-html.tar.bz2 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === wheel-0.38.4.tar.gz === {{{#!highlight sh cd /sources/ APP=wheel EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) PYTHONPATH=src pip3 wheel -w dist --no-build-isolation --no-deps $PWD pip3 install --no-index --find-links=dist wheel cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === ninja-1.11.1.tar.gz === {{{#!highlight sh cd /sources/ APP=ninja EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) export NINJAJOBS=4 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 ./ninja ninja_test ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots 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 /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === meson-1.0.0.tar.gz === {{{#!highlight sh cd /sources/ APP=meson EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) pip3 wheel -w dist --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 /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === coreutils-9.1.tar.xz === {{{#!highlight sh cd /sources/ APP=coreutils EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) patch -Np1 -i ../coreutils-9.1-i18n-1.patch autoreconf -fiv FORCE_UNSAFE_CONFIGURE=1 ./configure \ --prefix=/usr \ --enable-no-install-program=kill,uptime make make NON_ROOT_USERNAME=tester check-root echo "dummy:x:102:tester" >> /etc/group chown -Rv tester . su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check" sed -i '/dummy/d' /etc/group 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 /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === check-0.15.2.tar.gz === {{{#!highlight sh cd /sources/ APP=check EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr --disable-static make make check make docdir=/usr/share/doc/check-0.15.2 install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === diffutils-3.9.tar.xz === {{{#!highlight sh cd /sources/ APP=diffutils EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === gawk-5.2.1.tar.xz === {{{#!highlight sh cd /sources/ APP=gawk EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -i 's/extras//' Makefile.in ./configure --prefix=/usr make make check make LN='ln -f' install mkdir -pv /usr/share/doc/gawk-5.2.1 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-5.2.1 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === findutils-4.9.0.tar.xz === {{{#!highlight sh cd /sources/ APP=findutils EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) case $(uname -m) in i?86) TIME_T_32_BIT_OK=yes ./configure --prefix=/usr --localstatedir=/var/lib/locate ;; x86_64) ./configure --prefix=/usr --localstatedir=/var/lib/locate ;; esac make chown -Rv tester . su tester -c "PATH=$PATH make check" make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === groff-1.22.4.tar.gz === {{{#!highlight sh cd /sources/ APP=groff EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) PAGE=A4 ./configure --prefix=/usr make make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === grub-2.06.tar.xz === {{{#!highlight sh cd /sources/ APP=grub EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) unset {C,CPP,CXX,LD}FLAGS patch -Np1 -i ../grub-2.06-upstream_fixes-1.patch ./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 /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === gzip-1.12.tar.xz === {{{#!highlight sh cd /sources/ APP=gzip EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === iproute2-6.1.0.tar.xz === {{{#!highlight sh cd /sources/ APP=iproute2 EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) 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.1.0 cp -v COPYING README* /usr/share/doc/iproute2-6.1.0 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === kbd-2.5.1.tar.xz === {{{#!highlight sh cd /sources/ APP=kbd EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) patch -Np1 -i ../kbd-2.5.1-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 check make install mkdir -pv /usr/share/doc/kbd-2.5.1 cp -R -v docs/doc/* /usr/share/doc/kbd-2.5.1 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === libpipeline-1.5.7.tar.gz === {{{#!highlight sh cd /sources/ APP=libpipeline EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === make-4.4.tar.gz === {{{#!highlight sh cd /sources/ APP=make EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -e '/ifdef SIGPIPE/,+2 d' \ -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \ -i src/main.c ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === patch-2.7.6.tar.xz === {{{#!highlight sh cd /sources/ APP=patch EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === tar-1.34.tar.xz === {{{#!highlight sh cd /sources/ APP=tar EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) FORCE_UNSAFE_CONFIGURE=1 \ ./configure --prefix=/usr make make check make install make -C doc install-html docdir=/usr/share/doc/tar-1.34 cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === texinfo-7.0.2.tar.xz === {{{#!highlight sh cd /sources/ APP=texinfo EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr make make check make install make TEXMF=/usr/share/texmf install-tex cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === vim-9.0.1273.tar.xz === {{{#!highlight sh cd /sources/ APP=vim EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h ./configure --prefix=/usr make chown -Rv tester . su tester -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log 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/vim90/doc /usr/share/doc/vim-9.0.1273 cat > /etc/vimrc << "EOF" 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 EOF cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === eudev-3.2.11.tar.gz === {{{#!highlight sh cd /sources/ APP=eudev EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -i '/udevdir/a udev_dir=${udevdir}' src/udev/udev.pc.in ./configure --prefix=/usr \ --bindir=/usr/sbin \ --sysconfdir=/etc \ --enable-manpages \ --disable-static make mkdir -pv /usr/lib/udev/rules.d mkdir -pv /etc/udev/rules.d make check make install tar -xvf ../udev-lfs-20171102.tar.xz make -f udev-lfs-20171102/Makefile.lfs install udevadm hwdb --update cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === man-db-2.11.2.tar.xz === {{{#!highlight sh cd /sources/ APP=man-db EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --docdir=/usr/share/doc/man-db-2.11.2 \ --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 check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === procps-ng-4.0.2.tar.xz === {{{#!highlight sh cd /sources/ APP=procps EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure --prefix=/usr \ --docdir=/usr/share/doc/procps-ng-4.0.2 \ --disable-static \ --disable-kill make make check make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === util-linux-2.38.1.tar.xz === {{{#!highlight sh cd /sources/ APP=util-linux EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ --bindir=/usr/bin \ --libdir=/usr/lib \ --sbindir=/usr/sbin \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ --disable-su \ --disable-setpriv \ --disable-runuser \ --disable-pylibmount \ --disable-static \ --without-python \ --without-systemd \ --without-systemdsystemunitdir \ --docdir=/usr/share/doc/util-linux-2.38.1 make chown -Rv tester . su tester -c "make -k check" make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === e2fsprogs-1.47.0.tar.gz === {{{#!highlight sh cd /sources/ APP=e2fsprogs EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) mkdir -v build cd build ../configure --prefix=/usr \ --sysconfdir=/etc \ --enable-elf-shlibs \ --disable-libblkid \ --disable-libuuid \ --disable-uuidd \ --disable-fsck make make check 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 /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === sysklogd-1.5.1.tar.gz === {{{#!highlight sh cd /sources/ APP=sysklogd EXTENSION=gz tar xvzf $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c sed -i 's/union wait/int/' syslogd.c make make BINDIR=/sbin install cat > /etc/syslog.conf << "EOF" 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 * EOF cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === sysvinit-3.06.tar.xz === {{{#!highlight sh cd /sources/ APP=sysvinit EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) patch -Np1 -i ../sysvinit-3.06-consolidated-1.patch make make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) }}} === Stripping === {{{#!highlight sh save_usrlib="$(cd /usr/lib; ls ld-linux*[^g]) libc.so.6 libthread_db.so.1 libquadmath.so.0.0.0 libstdc++.so.6.0.30 libitm.so.1.0.0 libatomic.so.1.2.0" cd /usr/lib for LIB in $save_usrlib; do objcopy --only-keep-debug $LIB $LIB.dbg cp $LIB /tmp/$LIB strip --strip-unneeded /tmp/$LIB objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB install -vm755 /tmp/$LIB /usr/lib rm /tmp/$LIB done online_usrbin="bash find strip" online_usrlib="libbfd-2.40.so libsframe.so.0.0.0 libhistory.so.8.2 libncursesw.so.6.4 libm.so.6 libreadline.so.8.2 libz.so.1.2.13 $(cd /usr/lib; find libnss*.so* -type f)" for BIN in $online_usrbin; do cp /usr/bin/$BIN /tmp/$BIN strip --strip-unneeded /tmp/$BIN install -vm755 /tmp/$BIN /usr/bin rm /tmp/$BIN done for LIB in $online_usrlib; do cp /usr/lib/$LIB /tmp/$LIB strip --strip-unneeded /tmp/$LIB install -vm755 /tmp/$LIB /usr/lib rm /tmp/$LIB done for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \ $(find /usr/lib -type f -name \*.a) \ $(find /usr/{bin,sbin,libexec} -type f); do case "$online_usrbin $online_usrlib $save_usrlib" in *$(basename $i)* ) ;; * ) strip --strip-unneeded $i ;; esac done unset BIN LIB save_usrlib online_usrbin online_usrlib }}} === Cleaning Up === {{{#!highlight sh 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 }}} === lfs-bootscripts-20230101.tar.xz === {{{#!highlight sh cd /sources/ APP=lfs-bootscripts EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) make install cd /sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) bash /usr/lib/udev/init-net-rules.sh cat /etc/udev/rules.d/70-persistent-net.rules cat > /etc/sysconfig/ifconfig.eth0 << "EOF" ONBOOT=yes IFACE=eth0 SERVICE=ipv4-static IP=192.168.1.2 GATEWAY=192.168.1.1 PREFIX=24 BROADCAST=192.168.1.255 EOF cat > /etc/resolv.conf << "EOF" domain nameserver nameserver EOF echo "vitux" > /etc/hostname cat > /etc/hosts << "EOF" 127.0.0.1 localhost.localdomain localhost 127.0.1.1 vitux.bitarus.mooo.com ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters EOF cat > /etc/inittab << "EOF" 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 EOF cat > /etc/sysconfig/clock << "EOF" UTC=1 # Set this to any options you might need to give to hwclock, # such as machine hardware clock type for Alphas. CLOCKPARAMS= EOF cat > /etc/sysconfig/console << "EOF" KEYMAP="pt-latin1" FONT="lat1-16 -m 8859-1" UNICODE="1" EOF locale -a locale -a | grep -i pt kk_KZ.pt154 pt_BR pt_BR.iso88591 pt_BR.utf8 pt_PT pt_PT.iso88591 pt_PT.iso885915@euro pt_PT.utf8 pt_PT@euro cat > /etc/profile << "EOF" export LANG=pt_PT.utf8 EOF cat > /etc/inputrc << "EOF" # 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 EOF cat > /etc/shells << "EOF" /bin/sh /bin/bash EOF cat > /etc/fstab << "EOF" # file-system mount-point type options dump fsck # order #/dev/ / defaults 1 1 #/dev/ 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 EOF }}} === linux-6.1.11.tar.xz === {{{#!highlight sh cd /sources/ APP=linux EXTENSION=xz tar xvif $APP*.$EXTENSION cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) make mrproper make menuconfig # Processor type and features ---> # [*] Build a relocatable kernel [CONFIG_RELOCATABLE] # [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] # General setup ---> # [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] # < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] # General architecture-dependent options ---> # [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] # [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] # Device Drivers ---> # Graphics support ---> # Frame buffer Devices ---> # <*> Support for frame buffer devices ---> # Console display driver support ---> # [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] # Generic Driver Options ---> # [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] # [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] # [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [CONFIG_DEVTMPFS_MOUNT] # Processor type and features ---> # [*] Support x2apic [CONFIG_X86_X2APIC] # Device Drivers ---> # [*] PCI Support ---> [CONFIG_PCI] # [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI] # [*] IOMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT] # [*] Support for Interrupt Remapping [CONFIG_IRQ_REMAP] /sources/linux-6.1.11# find . -name .config ./.config 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 \ -e CONFIG_DEVTMPFS_MOUNT -e CONFIG_DEVTMPFS=y -e CONFIG_UEVENT_HELPER -e CONFIG_FRAMEBUFFER_CONSOLE=y \ -e CONFIG_STACKPROTECTOR=y -e CONFIG_STACKPROTECTOR_STRONG=y -e CONFIG_RELOCATABLE=y -e CONFIG_RANDOMIZE_BASE=y \ -e CONFIG_WERROR -e CONFIG_IKHEADERS # # CONFIG_WERROR is not set # # CONFIG_IKHEADERS is not set # CONFIG_RELOCATABLE=y # CONFIG_RANDOMIZE_BASE=y # CONFIG_STACKPROTECTOR=y # CONFIG_STACKPROTECTOR_STRONG=y # CONFIG_PCI=y # CONFIG_PCI_MSI=y # # CONFIG_UEVENT_HELPER is not set # CONFIG_DEVTMPFS=y # CONFIG_DEVTMPFS_MOUNT=y # CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_IOMMU_SUPPORT=y # CONFIG_IRQ_REMAP=y # https://www.linuxfromscratch.org/hints/downloads/files/kernel-configuration.txt make help make make modules_install cp -iv arch/x86/boot/bzImage /boot/vmlinuz-6.1.11-lfs-11.3 cp -iv System.map /boot/System.map-6.1.11 cp -iv .config /boot/config-6.1.11 install -d /usr/share/doc/linux-6.1.11 cp -r Documentation/* /usr/share/doc/linux-6.1.11 install -v -m755 -d /etc/modprobe.d cat > /etc/modprobe.d/usb.conf << "EOF" 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 EOF cd $LFS/sources/ rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" ) echo 11.3 > /etc/lfs-release cat > /etc/lsb-release << "EOF" DISTRIB_ID="Linux From Scratch" DISTRIB_RELEASE="11.3" DISTRIB_CODENAME="Vitux" DISTRIB_DESCRIPTION="Linux From Scratch" EOF cat > /etc/os-release << "EOF" NAME="Linux From Scratch" VERSION="11.3" ID=lfs PRETTY_NAME="Linux From Scratch 11.3" VERSION_CODENAME="Vitux" EOF cd / # as chroot du . -hs # 2.0G du sources/ -hs # 603M sources/ sh version-check.sh # To make a backup, leave the chroot environment: exit mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm umount $LFS/dev/pts umount $LFS/{sys,proc,run,dev} LFS=/home/vagrant/lfs echo $LFS cd $LFS time tar -cJpf /root/lfs-build-11.3.tar.xz . # real 17m18.550s tar tvaf /root/lfs-build-11.3.tar.xz # -p, --preserve-permissions # -f, --file=ARCHIVE # -J, --xz Filter the archive through xz scp lfs*xz xyz@xyz.com:/media/LFS/ }}} == Add partition in VM to host LFS build == {{{#!highlight sh # Add dymamic disk 8 GB to debian built with vagrant .... vagrant halt # VirtualBox, debian VM, settings storage sata add hard disk # Create VDI dynamically allocated with 8 GB vagrant up # sd 2:0:0:0: [sdb] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB) sudo cfdisk /dev/sdb # label type gpt # new 8GB linux fs # write yes quit sudo mkfs -v -t ext4 /dev/sdb1 export LFS=/mnt/lfs sudo mkdir -pv $LFS sudo mount -v -t ext4 /dev/sdb1 $LFS sudo bash # change fstab in debian host cat >>/etc/fstab << "EOF" /dev/sdb1 /mnt/lfs ext4 defaults 1 1 EOF exit sudo bash export LFS=/mnt/lfs cd ~ cp lfs-build-11.3.tar.xz $LFS cd $LFS rm -rf ./* tar -xpf /root/lfs-build-11.3.tar.xz ls chown root:root $LFS/* cat $LFS/etc/inittab cat $LFS/etc/fstab # Update LFS fstab cat >>$LFS/etc/fstab << "EOF" /dev/sdb1 / ext4 defaults 1 1 EOF # Update debian grub to have an entry to LFS cat >>/etc/grub.d/40_custom << "EOF" menuentry "GNU/Linux, Linux 6.1.11-lfs-11.3" { linux /boot/vmlinuz-6.1.11-lfs-11.3 root=/dev/sdb1 ro } EOF update-grub vagrant reload # select grun entry for lfs # login with root:root df -h # uses 2.7G rm lfs-build-11.3.tar.xz rm -rf sources/* df -h # uses 1.4 GB }}} = 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 {{{#!highlight sh sudo apt install qemu-system genisoimage cd /tmp wget https://saimei.ftp.acc.umu.se/debian-cd/current/amd64/iso-cd/debian-12.1.0-amd64-netinst.iso sudo mount -o loop /vagrant/debian-12.1.0-amd64-netinst.iso /mnt/iso # reuse isolinux from debian iso mkdir /tmp/debiancd mkdir /tmp/debiancd/isolinux mkdir /tmp/debiancd/install.amd cd /mnt/iso cp isolinux/isolinux.cfg isolinux/*c32 isolinux/menu.cfg isolinux/txt.cfg /tmp/debiancd/isolinux cp install.amd/initrd.gz install.amd/vmlinuz /tmp/debiancd/install.amd/ cp /mnt/iso/isolinux/isolinux.bin /tmp/debiancd/isolinux/ # isolinux.cfg cat > debiancd/isolinux/isolinux.cfg << EOF default bootcd prompt 1 timeout 40 label bootcd kernel /install.amd/vmlinuz append initrd=/install.amd/test.cpio.gz vga=788 EOF # hello.c cat > hello.c << EOF #include #include int main(int argc, char *argv[]) { printf("Hello world!\n"); sleep(999999999); } EOF gcc -static hello.c -o init # build cpio initramfs echo init | cpio -o -H newc | gzip > test.cpio.gz cp test.cpio.gz debiancd/install.amd/test.cpio.gz cd /tmp/ 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/ rm /vagrant/output.iso cp output.iso /vagrant # the output.iso can be launched in VirtualBox booting the iso in a VM Other Linux, Linux 64 bit # test with qemu qemu-system-x86_64 -kernel debiancd/install.amd/vmlinuz -initrd test.cpio.gz /dev/zero # test with qemu with kernel in debian system qemu-system-x86_64 -kernel /boot/vmlinuz-5.10.0-22-amd64 -initrd test.cpio.gz /dev/zero # test with qemu with kernel from lfs qemu-system-x86_64 -kernel /home/vagrant/lfs/boot/lfskernel -initrd test.cpio.gz /dev/zero # test with qemu with kernel from lfs 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 === {{{#!highlight sh cd tmp/ wget http://deb.debian.org/debian/pool/main/m/mbr/mbr_1.2.1.tar.xz tar tvaf mbr_1.2.1.tar.xz cd mbr-1.2.1/ ls ./configure make clean make make install }}} === 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. {{{#!highlight sh lsblk cfdisk (dev/sdc # new partition FAT16 }}} {{{#!highlight sh lsblk read -p "Target device: " DEVICE echo "Install MBR on device $DEVICE" read -p "Enter to continue" install-mbr $DEVICE --force PARTITION=${DEVICE}1 echo "Format $PARTITION" read -p "Enter to continue" # create an MS-DOS FAT filesystem mkdosfs $PARTITION echo "Install syslinux" read -p "Enter to continue" # install the SYSLINUX bootloader on a FAT filesystem syslinux $PARTITION echo "Build ramfs" rm -rf ramfs/ mkdir ramfs cd ramfs cat > hello.c << EOF #include #include #include #include int main(void) { char data[256]; DIR *d; struct dirent *dir; printf("Hello world!\n"); d = opendir("/dev"); if (d) { while ((dir = readdir(d)) != NULL) { printf("%s\n", dir->d_name); } closedir(d); } int loop=1; while(loop == 1){ printf("> "); scanf("%s",data); printf("<%s>\n", data); if( strcmp("exit",data) == 0) loop=0; } // sleep(3600); return(0); } EOF # compile static code gcc -static hello.c -o init # build cpio gz find . | cpio -H newc -o | gzip > ../ramfs.gz # copy data to initramfs mount $PARTITION /mnt cd /mnt cat > syslinux.cfg << EOF default vmlinuz append initrd=initrd.gz init=/init EOF cp /boot/vmlinuz vmlinuz # slackware kernel #cp /root/vmlinuz-6.1.11-lfs-11.3 vmlinuz cp /root/ramfs.gz initrd.gz ls . cd ~ umount /mnt/ sync }}}