commit 386dc3cec7f6d53ffa8cec34555282856e87199c Author: Shaun Setlock Date: Mon Jan 20 15:44:57 2025 -0500 Initial commit of LFS notes and scripts. diff --git a/lfs-notes/misc/packages.sh b/lfs-notes/misc/packages.sh new file mode 100644 index 0000000..e0339c7 --- /dev/null +++ b/lfs-notes/misc/packages.sh @@ -0,0 +1,18 @@ +# For doing Linux +dnf install -y vim tmux git wget tree +# For bpytop +dnf install python-pip3 +python3 -m pip install psutil +mkdir -p /root/sources && cd /root/sources +git clone https://github.com/aristocratos/bpytop.git +cd bpytop +make install +# For fastfetch +dnf install cmake +mkdir -p /root/sources && cd /root/sources +git clone https://github.com/fastfetch-cli/fastfetch.git +cd fastfetch +mkdir build && cd build +cmake .. +cmake --build . --target fastfetch --target flashfetch +cmake --install . --prefix /usr/local diff --git a/lfs-notes/p2_preparing_the_build/c2_preparing_the_host_system/c2_notes.md b/lfs-notes/p2_preparing_the_build/c2_preparing_the_host_system/c2_notes.md new file mode 100644 index 0000000..c54eebc --- /dev/null +++ b/lfs-notes/p2_preparing_the_build/c2_preparing_the_host_system/c2_notes.md @@ -0,0 +1,63 @@ +# Chapter 2 +## Section 2 Preparing Host +Two issues encountered after running `bash version_check.sh`. +1. Missing `texinfo` +`dnf install texinfo -y` +2. `yacc` is NOT `bison` +`ln -s /usr/bin/bison /usr/bin/yacc` +## Section 4 Partitioning +Label disk with GPT. +``` +fdisk /dev/sdb +g +w +``` +Create partitions. +1. Boot ("/boot") - 1M + - Ensure the partition type is switched to "Bios boot". +1. Swap - 2G + - Ensure the partition type is switched to "Linux swap". +1. Root ("/") - 10G +1. Home ("/home") - 10G +## Section 5 Filesystems +Make swap on the swap partition. +`mkswap /dev/sdb2` +`swaplabel -L lfs_swap /dev/sdb2` +Make ext4 on / and /home. +`mkfs -v -t ext4 /dev/sdb3` +`e2label /dev/sdb3 lfs_root` +`mkfs -v -t ext4 /dev/sdb4` +`e2label /dev/sdb4 lfs_home +## Section 6 Setting $LFS +I will follow the book. +`export LFS=/mnt/lfs` +`echo "export LFS=/mnt/lfs" >> /root/.bash_profile` +## Mounting LFS Filesystems (via /etc/fstab) +The book outlines temporarily mounting, and indicates consideration should be given to /etc/fstab entries. +First, we'll make the /mnt/lfs mountpoint(s). The below will create both /mnt/lfs and /mnt/lfs/home. +`mkdir -pv $LFS/home` +We will append the following to the host's /etc/fstab file. +``` +# LFS mounts +UUID=49600a93-8e64-4ac1-b7d9-7a5ccdb2b179 /mnt/lfs ext4 defaults,nofail 0 0 +UUID=0c0505fe-b133-4257-888e-9b16f4fca86c /mnt/lfs/home ext4 defaults,nofail 0 0 +UUID=5bd12ccf-c72f-4cca-8a6a-7d40e847fc42 none swap defaults,nofail 0 0 +``` +Then load the new /etc/fstab file. +`systemctl daemon-reload` +And finally mount the new filesystems automatically. +`mount -a` +With the following output ... +``` +# lsblk + +sdb 8:16 0 30G 0 disk +├─sdb1 8:17 0 511M 0 part +├─sdb2 8:18 0 2G 0 part +├─sdb3 8:19 0 10G 0 part /mnt/lfs +└─sdb4 8:20 0 10G 0 part /mnt/lfs/home +``` + + + + diff --git a/lfs-notes/p2_preparing_the_build/c2_preparing_the_host_system/version-check.sh b/lfs-notes/p2_preparing_the_build/c2_preparing_the_host_system/version-check.sh new file mode 100644 index 0000000..98bd83d --- /dev/null +++ b/lfs-notes/p2_preparing_the_build/c2_preparing_the_host_system/version-check.sh @@ -0,0 +1,90 @@ +#!/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 diff --git a/lfs-notes/p2_preparing_the_build/c3_packages_and_patches/c3_notes.md b/lfs-notes/p2_preparing_the_build/c3_packages_and_patches/c3_notes.md new file mode 100644 index 0000000..e17b897 --- /dev/null +++ b/lfs-notes/p2_preparing_the_build/c3_packages_and_patches/c3_notes.md @@ -0,0 +1,20 @@ +# Chapter 3 +## Section 1 Intro +## Section 2 Packages +Make a directory for all the sources of packages/patches we're going to build. +`mkdir -v $LFS/sources` +Make it sticky and writable. +`chmod -v a+wt $LFS/sources` +Fetch the list of all packages needed. +`wget https://www.linuxfromscratch.org/lfs/downloads/stable-systemd/wget-list` +Pull them all down. +`wget --input-file=wget-list --continue --directory-prefix=$LFS/sources` +Fetch their MD5 checksums. +`wget https://www.linuxfromscratch.org/lfs/downloads/stable-systemd/md5sums` +Check every package for its integrity. +``` +pushd $LFS/sources + md5sum -c md5sums +popd +``` +## Section 3 Patches diff --git a/lfs-notes/p2_preparing_the_build/c4_final_prep/c4_notes.md b/lfs-notes/p2_preparing_the_build/c4_final_prep/c4_notes.md new file mode 100644 index 0000000..a62978a --- /dev/null +++ b/lfs-notes/p2_preparing_the_build/c4_final_prep/c4_notes.md @@ -0,0 +1,68 @@ +# Chapter 4 +## Section 1 Intro +## Section 2 Simple File Structure +We start by building simple of the early pieces of the file structure. +The following is to be performed as root. These directories are not owned by an unprivileged user. +``` +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 +``` +We will also make a special, temporary directory for the cross compiler toolchain. +`mkdir -pv $LFS/tools` +## Section 3 The lfs User +As a measure of caution, let's proceed with the remaining steps as a normal user. +We will use the name lfs since it is unlikely to be found on the host system. +``` +groupadd lfs +useradd -s /bin/bash -g lfs -m -k /dev/null lfs +``` +Though not strictly required, we can set the password for the lfs user. +`passwd lfs` +Then, let's transfer ownership of this simple file structure to the lfs user. +``` +chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools} +case $(uname -m) in + x86_64) chown -v lfs $LFS/lib64 ;; +esac +``` +Finally, let's become lfs. +`su - lfs` +## Section 4 Setting Up The Environment +Create the bash profile for lfs. +``` +cat > ~/.bash_profile << "EOF" +exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash +EOF +``` +And the bashrc for lfs. +``` +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 +``` +Since this system will only be used for this project, it is safe to force builds to use all cores. +``` +cat >> ~/.bashrc << "EOF" +export MAKEFLAGS=-j$(nproc) +EOF +``` +Finally, let's load this new environment setup contained within the bash profile and rc. +`source ~/.bash_profile` + + diff --git a/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c5_compiling_cross_toolchain/c5_notes.md b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c5_compiling_cross_toolchain/c5_notes.md new file mode 100644 index 0000000..335e7cf --- /dev/null +++ b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c5_compiling_cross_toolchain/c5_notes.md @@ -0,0 +1,124 @@ +# Chapter 5 +## Section 2 Install Binutils (1st Pass) +A couple things to check before proceeding: +1. `echo $LFS` to ensure that environment variable is pointing in the correct location. +1. `whoami` to ensure we are running as the lfs user. +>[!Recall We are about create the cross-compiler and associated tools.] +We start by extracting the tar. +`tar -xvf binutils-2.43.1.tar.xz` +Then, move into the unpacked tape archive. +`cd binutils-2.43.1` +Create a subdirectory where we will build the files, and move into it. +``` +mkdir -v build +cd build +``` +Prepare for compilation. +``` +../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 +``` +We now have a Makefile, so we can run `make` to compile `binutils`. +`make` +And finally, we can install the compiled package into an area of our lfs environment, again using make. +`make install` +## Section 3 Install of GCC (1st Pass) +Similar to binutils, the steps are, +1. Upack the tar of GCC. +1. EXTRA STEP, GCC requires additional packages, so unpack those within the extracted GCC folder. +1. EXTRA STEP, set a variable so that 64-bit OS's know to use lib64. +1. Create build directory. +1. configure, make, make install ... +1. EXTRA STEP, one file is incomplete the follow command is needed to complete it temporarily. +``` +cd .. +cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ + `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include/limits.h +``` +## Section 4 Install Linux API Headers +This one is a little different, +1. Remove stale files with make, +`make mrproper` +1. Generate headers with make, +``` +make headers +find usr/include -type f ! -name '*.h' -delete +cp -rv usr/include $LFS/usr +``` +## Section 5 Install Glibc +Start by unpacking the tarball. +`tar -xvf glibc-2.40.tar.xz` +Create symbolic links for LSB compliance of 64-bit systems. +``` +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 +``` +glibc has a patch in this release, so we need to apply it. +`patch -Np1 -i ../glibc-2.40-fhs-1.patch` +Create a build directory, as usual. +`mkdir -v build && cd build` +Create a file called configparams that ensure `ldconfig` and `sln` are available. +`echo "rootsbindir=/usr/sbin" > configparms` +Then, configure to prepare for compilation. +``` +../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 +``` +Then compile and install, +``` +make +make DESTDIR=$LFS install +``` +Fix a hardcoded path using sed, +`sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd` +Finally, run some tests. +``` +bash-5.1$ echo 'int main(){}' | $LFS_TGT-gcc -xc - +readelf -l a.out | grep ld-linux + [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] +bash-5.1$ rm -v a.out +removed 'a.out' +bash-5.1$ +``` +## Section 6 Install libstdc++ +libstdc++ is part of GCC, but had to skip it during the first install of GCC because we didnt have glibc yet. +Unpack (or change back into) gcc and create a build directory. +`mkdir -v build && cd build` +Configure the make tool. +``` +../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 +``` +Compile and install. +``` +make +make DESTDIR=$LFS install +``` +Finally, remove libtool archive files because they're "harmful" for cross-compilation. +`rm -v $LFS/usr/lib/lib{stdc++{,exp,fs},supc++}.la` + + + diff --git a/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c6_cross_compiling_temp_tools/c6_notes.md b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c6_cross_compiling_temp_tools/c6_notes.md new file mode 100644 index 0000000..3bd79d1 --- /dev/null +++ b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c6_cross_compiling_temp_tools/c6_notes.md @@ -0,0 +1,26 @@ +# Chapter 6 +This chapter is all about creating tools to enable building even more tools. +In this case, these tools are cross compiled. (i.e. Built with host and targeted at lfs root.) +The tools that are created are runnable in the new, target environment. They'll be create tools natively, after chroot. +Here's the list: +1. M4 +1. Ncurses +1. Bash +1. Coreutils +1. Diffutils +1. File +1. Findutils +1. Gawk +1. Grep +1. Gzip +1. Make +1. Patch +1. Sed +1. Tar +1. xz +1. Binutils (2nd Pass) +1. GCC (2nd Pass) + + + + diff --git a/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c7_chroot_and_additional_tools/c7_notes.md b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c7_chroot_and_additional_tools/c7_notes.md new file mode 100644 index 0000000..2c5b957 --- /dev/null +++ b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/c7_chroot_and_additional_tools/c7_notes.md @@ -0,0 +1,190 @@ +# Chapter 7 - Chroot and Build More Tools +## Sections 7.1 - 7.3 +First, the small starter filesystem we built at $LFS needs to be owned by root. +Otherwise, when we chroot, these files will be owned by a user ID for a user that doesn't exist. +``` +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 +``` +We can now build the "virtual filesystems" which are not on disk, hence the name. +These are used by the kernel so other systems can interact with it. +`mkdir -pv $LFS/{dev,proc,sys,run}` +Here's a snapshot of the environment we've built, so far ... +``` +[root@lfs ~]# tree $LFS -L 1 +/mnt/lfs +├── bin -> usr/bin +├── dev +├── etc +├── home +├── lib -> usr/lib +├── lib64 +├── lost+found +├── proc +├── run +├── sbin -> usr/sbin +├── sources +├── sys +├── tools +├── usr +└── var + +``` +Typically, at boot, the kernel populates /dev with *devtmpfs* but since we will be chroot'ing into this +filesystem, we can bind mount our host's /dev directory. +`mount -v --bind /dev $LFS/dev` +We can now create the remaining virtual filesystems and mount them at their mountpoints. +``` +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 +``` +And finally, deal with `shm`, as needed. +``` +if [ -h $LFS/dev/shm ]; then + install -v -d -m 1777 $LFS$(realpath /dev/shm) +else + mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm +fi +``` +## Section 7.4 (Chroot!!!) +Now that all the packages which are required to build the rest of the needed tools are on the system, it is time to enter +the chroot environment and finish installing the temporary tools. +This environment will also be used to install the final system. As user root, run the following command to enter the environment that is, at the moment, populated with nothing but temporary tools. +``` +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 +``` +## Section 7.5 - Directories +From within this chroot, we can start building out the directory structure. +``` +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 +``` +*NOTE* This includes a sticky bit on certain directories will allow users to write, but not delete another user's files. +# Section 7.6 Essential Files and Symlinks +We link the modern /proc location of kernel mountpoint. +`ln -sv /proc/self/mounts /etc/mtab` +Create an `/etc/hosts/` file. +``` +cat > /etc/hosts << EOF +127.0.0.1 localhost $(hostname) +::1 localhost +EOF +``` +We need root to be able to login, so `/etc/passwd` and `/etc/groups` files are needed. +``` +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 +systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/usr/bin/false +systemd-journal-remote:x:74:74:systemd Journal Remote:/:/usr/bin/false +systemd-journal-upload:x:75:75:systemd Journal Upload:/:/usr/bin/false +systemd-network:x:76:76:systemd Network Management:/:/usr/bin/false +systemd-resolve:x:77:77:systemd Resolver:/:/usr/bin/false +systemd-timesync:x:78:78:systemd Time Synchronization:/:/usr/bin/false +systemd-coredump:x:79:79:systemd Core Dumper:/:/usr/bin/false +uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false +systemd-oom:x:81:81:systemd Out Of Memory Daemon:/:/usr/bin/false +nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false +EOF +``` +and +``` +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: +systemd-journal:x:23: +input:x:24: +mail:x:34: +kvm:x:61: +systemd-journal-gateway:x:73: +systemd-journal-remote:x:74: +systemd-journal-upload:x:75: +systemd-network:x:76: +systemd-resolve:x:77: +systemd-timesync:x:78: +systemd-coredump:x:79: +uuidd:x:80: +systemd-oom:x:81: +wheel:x:97: +users:x:999: +nogroup:x:65534: +EOF +``` +We should also define the locale for packages which require it. +`localedef -i C -f UTF-8 C.UTF-8` +Add an ordinary user for some packages that need a regular user for testing. +``` +echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd +echo "tester:x:101:" >> /etc/group +install -o tester -d /home/tester +``` +We are about to have our first user login, so let's make a couple log locations. +``` +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 +``` +Finally, we can now be able to login as `root`. (Or `tester`, theoretically.) +`exec /usr/bin/bash --login` +*NOTE:*The "i have no name" should change. +# Section 7.7-7.12 +Just follow the book for these package installations. +- Gettext +- Bison +- Perl +- Python +- Texinfo +- Util-linux +# Section 7.13 Clean Up +Some clean up steps can be done before performing the final package installs. +``` +rm -rf /usr/share/{info,man,doc}/* +find /usr/{lib,libexec} -name \*.la -delete +rm -rf /tools +``` +*NOTE:*The final step is to make a backup, but I'll just snapshot the VM. diff --git a/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/intro.md b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/intro.md new file mode 100644 index 0000000..1067a26 --- /dev/null +++ b/lfs-notes/p3_building_the_cross_toolchain_temporary_tools/intro.md @@ -0,0 +1,5 @@ +# Introduction to Part III +There are really three steps. +1. Build a limited cross compiler and its required libraries. +1. Use this cross toolchain to build utilities that are isolated from the host. +1. `chroot` into the new environment and complete the build of tools needed to construct the final system. diff --git a/lfs-notes/p4_building_the_lfs_system/c8_installing_basic_system_software/c8_notes.md b/lfs-notes/p4_building_the_lfs_system/c8_installing_basic_system_software/c8_notes.md new file mode 100644 index 0000000..3ffac60 --- /dev/null +++ b/lfs-notes/p4_building_the_lfs_system/c8_installing_basic_system_software/c8_notes.md @@ -0,0 +1,93 @@ +# Chapter 8 - Install Basic System Software +## Sections 8.3 - 8.822 +Just follow the book for these package installations. +- [x] Man-pages-6.9.1 +- [x] Iana-Etc-20240806 +- [x] Glibc-2.40 +- [x] Zlib-1.3.1 +- [x] Bzip2-1.0.8 +- [x] Xz-5.6.2 +- [x] Lz4-1.10.0 +- [x] Zstd-1.5.6 +- [x] File-5.45 +- [x] Readline-8.2.13 +- [x] M4-1.4.19 +- [x] Bc-6.7.6 +- [x] Flex-2.6.4 +- [x] Tcl-8.6.14 +- [x] Expect-5.45.4 +- [x] DejaGNU-1.6.3 +- [x] Pkgconf-2.3.0 +- [x] Binutils-2.43.1 +- [x] GMP-6.3.0 +- [x] MPFR-4.2.1 +- [x] MPC-1.3.1 +- [x] Attr-2.5.2 +- [x] Acl-2.3.2 +- [x] Libcap-2.70 +- [x] Libxcrypt-4.4.36 +- [x] Shadow-4.16.0 +- [x] GCC-14.2.0 +- [x] Ncurses-6.5 +- [x] Sed-4.9 +- [x] Psmisc-23.7 +- [x] Gettext-0.22.5 +- [x] Bison-3.8.2 +- [x] Grep-3.11 +- [x] Bash-5.2.32 +- [x] Libtool-2.4.7 +- [x] GDBM-1.24 +- [x] Gperf-3.1 +- [x] Expat-2.6.2 +- [x] Inetutils-2.5 +- [x] Less-661 +- [x] Perl-5.40.0 +- [x] XML::Parser-2.47 +- [x] Intltool-0.51.0 +- [x] Autoconf-2.72 +- [x] Automake-1.17 +- [x] OpenSSL-3.3.1 +- [x] Kmod-33 +- [x] Libelf from Elfutils-0.191 +- [x] Libffi-3.4.6 +- [x] Python-3.12.5 +- [x] Flit-Core-3.9.0 +- [x] Wheel-0.44.0 +- [x] Setuptools-72.2.0 +- [x] Ninja-1.12.1 +- [x] Meson-1.5.1 +- [x] Coreutils-9.5 +- [x] Check-0.15.2 +- [x] Diffutils-3.10 +- [x] Gawk-5.3.0 +- [x] Findutils-4.10.0 +- [x] Groff-1.23.0 +- [x] GRUB-2.12 +- [x] Gzip-1.13 +- [x] IPRoute2-6.10.0 +- [x] Kbd-2.6.4 +- [x] Libpipeline-1.5.7 +- [x] Make-4.4.1 +- [x] Patch-2.7.6 +- [x] Tar-1.35 +- [x] Texinfo-7.1 +- [x] Vim-9.1.0660 +- [x] MarkupSafe-2.1.5 +- [x] Jinja2-3.1.4 +- [x] Systemd-256.4 +- [ ] D-Bus-1.14.10 +- [x] Man-DB-2.12.1 +- [x] Procps-ng-4.0.4 +- [x] Util-linux-2.40.2 +- [x] E2fsprogs-1.47.1 +- [x] Sysklogd-2.6.1 +- [x] SysVinit-3.10 + +## Cleaning Up +A script was created to perform the cleanup steps. +``` +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 +``` diff --git a/lfs-notes/p4_building_the_lfs_system/c8_installing_basic_system_software/c9_notes.md b/lfs-notes/p4_building_the_lfs_system/c8_installing_basic_system_software/c9_notes.md new file mode 100644 index 0000000..ea47d88 --- /dev/null +++ b/lfs-notes/p4_building_the_lfs_system/c8_installing_basic_system_software/c9_notes.md @@ -0,0 +1,3 @@ +# Chapter 9 - System Configuration +## Sections 9.1 + diff --git a/lfs-notes/p4_building_the_lfs_system/intro.md b/lfs-notes/p4_building_the_lfs_system/intro.md new file mode 100644 index 0000000..93d8e62 --- /dev/null +++ b/lfs-notes/p4_building_the_lfs_system/intro.md @@ -0,0 +1,3 @@ +# Introduction to Part IV +In this chapter, we start constructing the LFS system in earnest. +The installation of this software is straightforward. Although in many cases the installation instructions could be made shorter and more generic, we have opted to provide the full instructions for every package to minimize the possibilities for mistakes. The key to learning what makes a Linux system work is to know what each package is used for and why you (or the system) may need it. diff --git a/lfs-scripts/acl.sh b/lfs-scripts/acl.sh new file mode 100644 index 0000000..09dbaa2 --- /dev/null +++ b/lfs-scripts/acl.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="acl-2.3.2" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/acl-2.3.2 +make && make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/attr.sh b/lfs-scripts/attr.sh new file mode 100644 index 0000000..9fd8be4 --- /dev/null +++ b/lfs-scripts/attr.sh @@ -0,0 +1,28 @@ +# Set the package we're building. +package="attr-2.5.2" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --disable-static \ + --sysconfdir=/etc \ + --docdir=/usr/share/doc/attr-2.5.2 +make +make check +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/autoconf.sh b/lfs-scripts/autoconf.sh new file mode 100644 index 0000000..f82d6bc --- /dev/null +++ b/lfs-scripts/autoconf.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="autoconf-2.72" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +make check +make install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/automake.sh b/lfs-scripts/automake.sh new file mode 100644 index 0000000..a11edd6 --- /dev/null +++ b/lfs-scripts/automake.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="automake-1.17" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.17 +make +make -j$(($(nproc)>4?$(nproc):4)) check +make install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/bash.sh b/lfs-scripts/bash.sh new file mode 100644 index 0000000..68605aa --- /dev/null +++ b/lfs-scripts/bash.sh @@ -0,0 +1,29 @@ +# Set the package we're building. +package="bash-5.2.32" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --without-bash-malloc \ + --with-installed-readline \ + bash_cv_strtold_broken=no \ + --docdir=/usr/share/doc/bash-5.2.32 +make +chown -R 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 diff --git a/lfs-scripts/bison.sh b/lfs-scripts/bison.sh new file mode 100644 index 0000000..d8b405d --- /dev/null +++ b/lfs-scripts/bison.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="bison-3.8.2" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2 +make && make check && make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/blank.sh b/lfs-scripts/blank.sh new file mode 100644 index 0000000..41c474f --- /dev/null +++ b/lfs-scripts/blank.sh @@ -0,0 +1,22 @@ +# Set the package we're building. +package="" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/c8_cleanup.sh b/lfs-scripts/c8_cleanup.sh new file mode 100644 index 0000000..f0ed873 --- /dev/null +++ b/lfs-scripts/c8_cleanup.sh @@ -0,0 +1,4 @@ +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 diff --git a/lfs-scripts/check.sh b/lfs-scripts/check.sh new file mode 100644 index 0000000..8cb298b --- /dev/null +++ b/lfs-scripts/check.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="check-0.15.2" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr --disable-static +make +make check +make docdir=/usr/share/doc/check-0.15.2 install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/coreutils.sh b/lfs-scripts/coreutils.sh new file mode 100644 index 0000000..32576f2 --- /dev/null +++ b/lfs-scripts/coreutils.sh @@ -0,0 +1,37 @@ +# Set the package we're building. +package="coreutils-9.5" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 NON_ROOT_USERNAME=tester check-root +groupadd -g 102 dummy -U tester +chown -R tester . +su tester -c "PATH=$PATH make -k RUN_EXPENSIVE_TESTS=yes check" \ + < /dev/null +groupdel dummy +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/diffutils.sh b/lfs-scripts/diffutils.sh new file mode 100644 index 0000000..c1e3617 --- /dev/null +++ b/lfs-scripts/diffutils.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="diffutils-3.10" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +make check +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/e2fsprogs.sh b/lfs-scripts/e2fsprogs.sh new file mode 100644 index 0000000..65c05a4 --- /dev/null +++ b/lfs-scripts/e2fsprogs.sh @@ -0,0 +1,41 @@ +# Set the package we're building. +package="e2fsprogs-1.47.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/expat.sh b/lfs-scripts/expat.sh new file mode 100644 index 0000000..0ceaad6 --- /dev/null +++ b/lfs-scripts/expat.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="expat-2.6.2" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/expat-2.6.2 +make && make check && make install +install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.6.2 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/findutils.sh b/lfs-scripts/findutils.sh new file mode 100644 index 0000000..38426c2 --- /dev/null +++ b/lfs-scripts/findutils.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="findutils-4.10.0" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr --localstatedir=/var/lib/locate +make +chown -R tester . +su tester -c "PATH=$PATH make check" +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/flit_core.sh b/lfs-scripts/flit_core.sh new file mode 100644 index 0000000..6b967e5 --- /dev/null +++ b/lfs-scripts/flit_core.sh @@ -0,0 +1,24 @@ +# Set the package we're building. +package="flit_core-3.9.0" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD +pip3 install --no-index --no-user --find-links dist flit_core + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/gawk.sh b/lfs-scripts/gawk.sh new file mode 100644 index 0000000..8d4cdf2 --- /dev/null +++ b/lfs-scripts/gawk.sh @@ -0,0 +1,31 @@ +# Set the package we're building. +package="gawk-5.3.0" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +sed -i 's/extras//' Makefile.in +./configure --prefix=/usr +make +chown -R tester . +su tester -c "PATH=$PATH make check" +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/gcc.sh b/lfs-scripts/gcc.sh new file mode 100644 index 0000000..c1e3c0d --- /dev/null +++ b/lfs-scripts/gcc.sh @@ -0,0 +1,68 @@ +# Set the package we're building. +package="gcc-14.2.0" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 +chown -R tester . +su tester -c "PATH=$PATH make -k check" +../contrib/test_summary +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.1ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/14.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' +sleep 10 +grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log +sleep 10 +grep -B4 '^ /usr/include' dummy.log +sleep 10 +grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' +sleep 10 +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/gdbm.sh b/lfs-scripts/gdbm.sh new file mode 100644 index 0000000..79bece8 --- /dev/null +++ b/lfs-scripts/gdbm.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="gdbm-1.24" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --disable-static \ + --enable-libgdbm-compat +make && make check && make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/gettext.sh b/lfs-scripts/gettext.sh new file mode 100644 index 0000000..854f7e7 --- /dev/null +++ b/lfs-scripts/gettext.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="gettext-0.22.5" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/gettext-0.22.5 +make && make check && make install +chmod -v 0755 /usr/lib/preloadable_libintl.so + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/gmp.sh b/lfs-scripts/gmp.sh new file mode 100644 index 0000000..f5a4c78 --- /dev/null +++ b/lfs-scripts/gmp.sh @@ -0,0 +1,10 @@ +./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 +awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log +make install +make install-html diff --git a/lfs-scripts/gperf.sh b/lfs-scripts/gperf.sh new file mode 100644 index 0000000..e30d156 --- /dev/null +++ b/lfs-scripts/gperf.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="gperf-3.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1 +make && make -j1 check && make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/grep.sh b/lfs-scripts/grep.sh new file mode 100644 index 0000000..4432d14 --- /dev/null +++ b/lfs-scripts/grep.sh @@ -0,0 +1,24 @@ +# Set the package we're building. +package="grep-3.11" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +sed -i "s/echo/#echo/" src/egrep.sh +./configure --prefix=/usr +make && make check && make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/groff.sh b/lfs-scripts/groff.sh new file mode 100644 index 0000000..750da0f --- /dev/null +++ b/lfs-scripts/groff.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="groff-1.23.0" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +PAGE=letter ./configure --prefix=/usr +make +make check +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/grub.sh b/lfs-scripts/grub.sh new file mode 100644 index 0000000..18dae3e --- /dev/null +++ b/lfs-scripts/grub.sh @@ -0,0 +1,30 @@ +# Set the package we're building. +package="grub-2.12" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/gzip.sh b/lfs-scripts/gzip.sh new file mode 100644 index 0000000..57e81aa --- /dev/null +++ b/lfs-scripts/gzip.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="gzip-1.13" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +make check +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/inetutils.sh b/lfs-scripts/inetutils.sh new file mode 100644 index 0000000..ea27d07 --- /dev/null +++ b/lfs-scripts/inetutils.sh @@ -0,0 +1,35 @@ +# Set the package we're building. +package="inetutils-2.5" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 check && make install +mv -v /usr/{,s}bin/ifconfig + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/intltool.sh b/lfs-scripts/intltool.sh new file mode 100644 index 0000000..e02cdb5 --- /dev/null +++ b/lfs-scripts/intltool.sh @@ -0,0 +1,27 @@ +# Set the package we're building. +package="intltool-0.51.0" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/iproute2.sh b/lfs-scripts/iproute2.sh new file mode 100644 index 0000000..e9cf4e0 --- /dev/null +++ b/lfs-scripts/iproute2.sh @@ -0,0 +1,27 @@ +# Set the package we're building. +package="iproute2-6.10.0" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/jinja2.sh b/lfs-scripts/jinja2.sh new file mode 100644 index 0000000..5427324 --- /dev/null +++ b/lfs-scripts/jinja2.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="jinja2-3.1.4" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD +pip3 install --no-index --no-user --find-links dist Jinja2 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/kbd.sh b/lfs-scripts/kbd.sh new file mode 100644 index 0000000..9bdf691 --- /dev/null +++ b/lfs-scripts/kbd.sh @@ -0,0 +1,29 @@ +# Set the package we're building. +package="kbd-2.6.4" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 check +make install +cp -R -v docs/doc -T /usr/share/doc/kbd-2.6.4 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/kmod.sh b/lfs-scripts/kmod.sh new file mode 100644 index 0000000..a11f240 --- /dev/null +++ b/lfs-scripts/kmod.sh @@ -0,0 +1,35 @@ +# Set the package we're building. +package="kmod-33" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/less.sh b/lfs-scripts/less.sh new file mode 100644 index 0000000..461b171 --- /dev/null +++ b/lfs-scripts/less.sh @@ -0,0 +1,24 @@ +# Set the package we're building. +package="less-661" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr --sysconfdir=/etc +make && make check && make install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/libcap.sh b/lfs-scripts/libcap.sh new file mode 100644 index 0000000..97c2953 --- /dev/null +++ b/lfs-scripts/libcap.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="libcap-2.70" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +sed -i '/install -m.*STA/d' libcap/Makefile +make prefix=/usr lib=lib +make test +make prefix=/usr lib=lib install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/libelf.sh b/lfs-scripts/libelf.sh new file mode 100644 index 0000000..69476e9 --- /dev/null +++ b/lfs-scripts/libelf.sh @@ -0,0 +1,29 @@ +# Set the package we're building. +package="elfutils-0.191" +extension=".tar.bz2" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/libffi.sh b/lfs-scripts/libffi.sh new file mode 100644 index 0000000..77286b9 --- /dev/null +++ b/lfs-scripts/libffi.sh @@ -0,0 +1,27 @@ +# Set the package we're building. +package="libffi-3.4.6" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --disable-static \ + --with-gcc-arch=native +make +make check +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/libpipeline.sh b/lfs-scripts/libpipeline.sh new file mode 100644 index 0000000..b4378a3 --- /dev/null +++ b/lfs-scripts/libpipeline.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="libpipeline-1.5.7" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +make check +make install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/libtool.sh b/lfs-scripts/libtool.sh new file mode 100644 index 0000000..ae239a0 --- /dev/null +++ b/lfs-scripts/libtool.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="libtool-2.4.7" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +make -k check +make install +rm -fv /usr/lib/libltdl.a + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/libxcrypt.sh b/lfs-scripts/libxcrypt.sh new file mode 100644 index 0000000..66e3a6d --- /dev/null +++ b/lfs-scripts/libxcrypt.sh @@ -0,0 +1,29 @@ +# Set the package we're building. +package="libxcrypt-4.4.36" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --enable-hashes=strong,glibc \ + --enable-obsolete-api=no \ + --disable-static \ + --disable-failure-tokens +make +make check +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/make.sh b/lfs-scripts/make.sh new file mode 100644 index 0000000..d7d661b --- /dev/null +++ b/lfs-scripts/make.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="make-4.4.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +chown -R tester . +su tester -c "PATH=$PATH make check" +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/mandb.sh b/lfs-scripts/mandb.sh new file mode 100644 index 0000000..72704e8 --- /dev/null +++ b/lfs-scripts/mandb.sh @@ -0,0 +1,35 @@ +# Set the package we're building. +package="man-db-2.12.1" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./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 check +make install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/markupsafe.sh b/lfs-scripts/markupsafe.sh new file mode 100644 index 0000000..5f9c4e4 --- /dev/null +++ b/lfs-scripts/markupsafe.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="MarkupSafe-2.1.5" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD +pip3 install --no-index --no-user --find-links dist Markupsafe + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/meson.sh b/lfs-scripts/meson.sh new file mode 100644 index 0000000..8bf2e55 --- /dev/null +++ b/lfs-scripts/meson.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="meson-1.5.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/mpc.sh b/lfs-scripts/mpc.sh new file mode 100644 index 0000000..0151474 --- /dev/null +++ b/lfs-scripts/mpc.sh @@ -0,0 +1,29 @@ +# Set the package we're building. +package="mpc-1.3.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/mpc-1.3.1 +make +make html +make check +make install +make install-html + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/mpfr.sh b/lfs-scripts/mpfr.sh new file mode 100644 index 0000000..7200383 --- /dev/null +++ b/lfs-scripts/mpfr.sh @@ -0,0 +1,25 @@ +# Set the package we're building. +package="mpfr-4.2.1" + +# Decompress the source. +tar xvf ${package}.tar.xz + +# Enter the unpacked sources. +cd ${package} + +# LFS commands. +./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 + +# Exit sources directory. +cd .. + +# Remove the directory of source files. +rm -rf ${package} diff --git a/lfs-scripts/ncurses.sh b/lfs-scripts/ncurses.sh new file mode 100644 index 0000000..b234730 --- /dev/null +++ b/lfs-scripts/ncurses.sh @@ -0,0 +1,43 @@ +# Set the package we're building. +package="ncurses-6.5" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./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 + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/ninja.sh b/lfs-scripts/ninja.sh new file mode 100644 index 0000000..46a8fcf --- /dev/null +++ b/lfs-scripts/ninja.sh @@ -0,0 +1,32 @@ +# Set the package we're building. +package="ninja-1.12.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/openssl.sh b/lfs-scripts/openssl.sh new file mode 100644 index 0000000..5ef140f --- /dev/null +++ b/lfs-scripts/openssl.sh @@ -0,0 +1,32 @@ +# Set the package we're building. +package="openssl-3.3.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./config --prefix=/usr \ + --openssldir=/etc/ssl \ + --libdir=lib \ + shared \ + zlib-dynamic +make +HARNESS_JOBS=$(nproc) 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.3.1 +cp -vfr doc/* /usr/share/doc/openssl-3.3.1 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/patch.sh b/lfs-scripts/patch.sh new file mode 100644 index 0000000..d63b70b --- /dev/null +++ b/lfs-scripts/patch.sh @@ -0,0 +1,26 @@ +# Set the package we're building. +package="patch-2.7.6" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +make check +make install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/perl.sh b/lfs-scripts/perl.sh new file mode 100644 index 0000000..01ea2db --- /dev/null +++ b/lfs-scripts/perl.sh @@ -0,0 +1,41 @@ +# Set the package we're building. +package="perl-5.40.0" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 +TEST_JOBS=$(nproc) make test_harness +make install +unset BUILD_ZLIB BUILD_BZIP2 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/procps-ng.sh b/lfs-scripts/procps-ng.sh new file mode 100644 index 0000000..6dfef6c --- /dev/null +++ b/lfs-scripts/procps-ng.sh @@ -0,0 +1,30 @@ +# Set the package we're building. +package="procps-ng-4.0.4" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --docdir=/usr/share/doc/procps-ng-4.0.4 \ + --disable-static \ + --disable-kill +make +chown -R tester . +su tester -c "PATH=$PATH make check" +make install + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/psmisc.sh b/lfs-scripts/psmisc.sh new file mode 100644 index 0000000..076c5f8 --- /dev/null +++ b/lfs-scripts/psmisc.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="psmisc-23.7" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make && make check && make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/python3.sh b/lfs-scripts/python3.sh new file mode 100644 index 0000000..0979cd4 --- /dev/null +++ b/lfs-scripts/python3.sh @@ -0,0 +1,40 @@ +# Set the package we're building. +package="Python-3.12.5" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr \ + --enable-shared \ + --with-system-expat \ + --enable-optimizations +make +make test TESTOPTS="--timeout 120" +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 + + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/scp_to_lfs.sh b/lfs-scripts/scp_to_lfs.sh new file mode 100755 index 0000000..b3fe614 --- /dev/null +++ b/lfs-scripts/scp_to_lfs.sh @@ -0,0 +1 @@ +scp -r ./* root@lfs.home.lan:/mnt/lfs/sources/scripts diff --git a/lfs-scripts/sed.sh b/lfs-scripts/sed.sh new file mode 100644 index 0000000..a8172d1 --- /dev/null +++ b/lfs-scripts/sed.sh @@ -0,0 +1,28 @@ +# Set the package we're building. +package="sed-4.9" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make && make html +chown -R 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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/setuptools.sh b/lfs-scripts/setuptools.sh new file mode 100644 index 0000000..9394582 --- /dev/null +++ b/lfs-scripts/setuptools.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="setuptools-72.2.0" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD +pip3 install --no-index --find-links dist setuptools + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/shadow.sh b/lfs-scripts/shadow.sh new file mode 100644 index 0000000..55a7853 --- /dev/null +++ b/lfs-scripts/shadow.sh @@ -0,0 +1,43 @@ +# Set the package we're building. +package="shadow-4.16.0" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 +passwd root + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/sysklogd.sh b/lfs-scripts/sysklogd.sh new file mode 100644 index 0000000..5cd5d73 --- /dev/null +++ b/lfs-scripts/sysklogd.sh @@ -0,0 +1,43 @@ +# Set the package we're building. +package="sysklogd-2.6.1" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/sysvinit.sh b/lfs-scripts/sysvinit.sh new file mode 100644 index 0000000..03762ca --- /dev/null +++ b/lfs-scripts/sysvinit.sh @@ -0,0 +1,24 @@ +# Set the package we're building. +package="sysvinit-3.10" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +patch -Np1 -i ../sysvinit-3.10-consolidated-1.patch +make +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/tar.sh b/lfs-scripts/tar.sh new file mode 100644 index 0000000..ebf3c0b --- /dev/null +++ b/lfs-scripts/tar.sh @@ -0,0 +1,27 @@ +# Set the package we're building. +package="tar-1.35" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +FORCE_UNSAFE_CONFIGURE=1 \ +./configure --prefix=/usr +make +make check +make install +make -C doc install-html docdir=/usr/share/doc/tar-1.35 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/texinfo.sh b/lfs-scripts/texinfo.sh new file mode 100644 index 0000000..96107f7 --- /dev/null +++ b/lfs-scripts/texinfo.sh @@ -0,0 +1,32 @@ +# Set the package we're building. +package="texinfo-7.1" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./configure --prefix=/usr +make +make check +make install +make TEXMF=/usr/share/texmf install-tex +pushd /usr/share/info + rm -v dir + for f in * + do install-info $f dir 2>/dev/null + done +popd + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/udev.sh b/lfs-scripts/udev.sh new file mode 100644 index 0000000..2b32b23 --- /dev/null +++ b/lfs-scripts/udev.sh @@ -0,0 +1,80 @@ +# Set the package we're building. +package="systemd-256.4" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/util-linux.sh b/lfs-scripts/util-linux.sh new file mode 100644 index 0000000..53efd81 --- /dev/null +++ b/lfs-scripts/util-linux.sh @@ -0,0 +1,42 @@ +# Set the package we're building. +package="util-linux-2.40.2" +extension=".tar.xz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +./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 +# skipping tests +make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/vim.sh b/lfs-scripts/vim.sh new file mode 100644 index 0000000..f3a559c --- /dev/null +++ b/lfs-scripts/vim.sh @@ -0,0 +1,50 @@ +# Set the package we're building. +package="vim-9.1.0660" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h +./configure --prefix=/usr +make +chown -R tester . +su tester -c "TERM=xterm-256color 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/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 + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/virtual_kernel_filesystem_prep_and_chroot.sh b/lfs-scripts/virtual_kernel_filesystem_prep_and_chroot.sh new file mode 100644 index 0000000..17d8043 --- /dev/null +++ b/lfs-scripts/virtual_kernel_filesystem_prep_and_chroot.sh @@ -0,0 +1,19 @@ +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 +if [ -h $LFS/dev/shm ]; then + install -v -d -m 1777 $LFS$(realpath /dev/shm) +else + mount -vt 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 \ + MAKEFLAGS="-j$(nproc)" \ + TESTSUITEFLAGS="-j$(nproc)" \ + /bin/bash --login diff --git a/lfs-scripts/wheel.sh b/lfs-scripts/wheel.sh new file mode 100644 index 0000000..27ed85e --- /dev/null +++ b/lfs-scripts/wheel.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="wheel-0.44.0" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD +pip3 install --no-index --find-links=dist wheel + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package} diff --git a/lfs-scripts/xml_parser.sh b/lfs-scripts/xml_parser.sh new file mode 100644 index 0000000..8d7e274 --- /dev/null +++ b/lfs-scripts/xml_parser.sh @@ -0,0 +1,23 @@ +# Set the package we're building. +package="XML-Parser-2.47" +extension=".tar.gz" + +# Decompress the source. +echo "Unpacking ${package}${extension} ..." +tar xvf ${package}${extension} + +# Enter the unpacked sources. +echo "Entering ${package} directory ..." +cd ${package} + +# LFS commands. +perl Makefile.PL +make && make test && make install + +# Exit sources directory. +echo "Exiting ${package} directory ..." +cd .. + +# Remove the directory of source files. +echo "Removing ${package} directory ..." +rm -rf ${package}