Initial commit of LFS notes and scripts.
This commit is contained in:
18
lfs-notes/misc/packages.sh
Normal file
18
lfs-notes/misc/packages.sh
Normal file
@@ -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
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
68
lfs-notes/p2_preparing_the_build/c4_final_prep/c4_notes.md
Normal file
68
lfs-notes/p2_preparing_the_build/c4_final_prep/c4_notes.md
Normal file
@@ -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`
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
# Chapter 9 - System Configuration
|
||||
## Sections 9.1
|
||||
|
||||
3
lfs-notes/p4_building_the_lfs_system/intro.md
Normal file
3
lfs-notes/p4_building_the_lfs_system/intro.md
Normal file
@@ -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.
|
||||
Reference in New Issue
Block a user