Compare commits

..

10 commits
10.0 ... master

Author SHA1 Message Date
Luís Mendes
bbe94abbc3 Adding full lfs-final.sh log 2022-09-07 21:05:21 -03:00
Luís Mendes
c77ff4a20e Adding full lfs-system.sh log 2022-09-07 20:28:32 -03:00
Luís Mendes
47ea842f3c Adding full lfs-chroot.sh log 2022-09-07 17:46:50 -03:00
Luís Mendes
7098fa38e5 Adding full lfs-cross.sh log 2022-09-07 17:21:00 -03:00
Luís Mendes
3267f185d6 Fixing error in grub config 2022-09-07 17:15:31 -03:00
Luís Mendes
0bd339d574 Removing old logs 2022-09-07 12:59:02 -03:00
Luís Mendes
893567d6e5 Updating to LFS 11.2 2022-09-07 12:55:14 -03:00
Luís Mendes
b5c078a5c9 Updating all scripts, instructions and screenshots for LFS 11.0 2021-09-14 14:05:01 -03:00
Luís Mendes
bbf422af1b Adding build logs to compare with your own builds 2021-02-02 12:36:21 -03:00
Luís Guilherme Bergamini Mendes
7d279f45b3
Update README.md 2021-02-02 08:14:16 -03:00
11 changed files with 238113 additions and 632 deletions

View file

@ -1,5 +1,5 @@
# lfs-scripts :penguin: # lfs-scripts :penguin:
Instructions and scripts to build LFS (Linux From Scratch), version 10.0, as simply as possible (I know, not that simple, but anyway). Instructions and scripts to build Linux From Scratch (LFS), version 11.2, as simply as possible (I know, not that simple, but anyway).
![Output of uname -a](https://github.com/luisgbm/lfs-scripts/blob/master/img/uname.png?raw=true) ![Output of uname -a](https://github.com/luisgbm/lfs-scripts/blob/master/img/uname.png?raw=true)
@ -7,13 +7,13 @@ Instructions and scripts to build LFS (Linux From Scratch), version 10.0, as sim
# Foreword # Foreword
First, this guide does not replace reading the whole LFS book. I highly recommend that you read it at least once. Only then you should use the automation scripts provided here. First, this guide does not replace reading the whole LFS book. I highly recommend that you read it at least once. Only then you should use the automated scripts provided here.
This build will be accomplished inside a virtual machine. I'll be using Oracle VirtualBox, but you can use the tool of your personal preference. I'm running an Arch Linux VM, feel free to use your GNU/Linux distribution of choice. Just be sure to install the development tools available (base-devel package on Arch). This build will be accomplished inside a virtual machine. I'll be using Oracle VirtualBox, but you can use any tool of your personal preference. I'm running an Arch Linux VM, feel free to use your GNU/Linux distribution of choice. Just be sure to install the development tools available (base-devel package on Arch).
My VM has two virtual hard disks: one for the host (Arch Linux itself) and another for building LFS. You could also use a single hard disk with two partitions, that's also up to personal taste. I've decided to use two separate hard disks so I can completely isolate LFS from the host after the build. At the end, you'll be able to create a separate VM and boot from it directly. My VM has two virtual hard disks: one for the host (Arch Linux itself) and another for building LFS. You could also use a single hard disk with two partitions, that's also up to personal taste. I've decided to use two separate hard disks so I can completely isolate LFS from the host after the build. At the end, you'll be able to create a separate VM and boot from it directly.
The packages needed to build LFS were downloaded from [here](http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/lfs-packages-10.0.tar) (423 MB), other mirrors are available [here](http://linuxfromscratch.org/lfs/download.html) (look for the "LFS HTTP/FTP Sites" section at the bottom, the file you need is lfs-packages-10.0.tar). The packages needed to build LFS were downloaded from [here](http://ftp.osuosl.org/pub/lfs/lfs-packages/lfs-packages-11.2.tar) (474 MB), other mirrors are available [here](http://linuxfromscratch.org/lfs/download.html) (look for the "LFS HTTP/FTP Sites" section at the bottom, the file you need is lfs-packages-11.0.tar).
# Build instructions # Build instructions
@ -22,7 +22,6 @@ The packages needed to build LFS were downloaded from [here](http://ftp.lfs-matr
Create a partition and a filesystem in the virtual hard disk (/dev/sdb): Create a partition and a filesystem in the virtual hard disk (/dev/sdb):
``` ```
mkdir /mnt/lfs
fdisk /dev/sdb fdisk /dev/sdb
``` ```
@ -48,15 +47,14 @@ Source the file:
source .bashrc source .bashrc
``` ```
Download all the packages and extract them to $LFS/sources. The tcl package must be renamed in order to work with the scripts that will follow. Download all the packages and extract them to $LFS/sources.
``` ```
cd $LFS cd $LFS
cp /<location_of_the_package>/lfs-packages-10.0.tar . cp /<location_of_the_package>/lfs-packages-11.2.tar .
tar xf lfs-packages-10.0.tar tar xf lfs-packages-11.2.tar
mv 10.0 sources mv 11.2-rc1 sources
chmod -v a+wt $LFS/sources chmod -v a+wt $LFS/sources
mv $LFS/sources/tcl8.6.10-src.tar.gz $LFS/sources/tcl8.6.10.tar.gz
``` ```
Copy all the shell scripts from this repository to your $LFS directory: Copy all the shell scripts from this repository to your $LFS directory:
@ -68,7 +66,17 @@ cp /<location_of_the_scripts>/*.sh $LFS
Create the basic filesystem for LFS: Create the basic filesystem for LFS:
``` ```
mkdir -pv $LFS/{bin,etc,lib,sbin,usr,var,lib64,tools} mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin}
for i in bin lib sbin; do
ln -sv usr/$i $LFS/$i
done
case $(uname -m) in
x86_64) mkdir -pv $LFS/lib64 ;;
esac
mkdir -pv $LFS/tools
``` ```
Create the lfs user, used during the initial build process (you will have to type a password): Create the lfs user, used during the initial build process (you will have to type a password):
@ -114,19 +122,20 @@ LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/usr/bin PATH=/usr/bin
if [ ! -L /bin ]; then PATH=/bin:$PATH; fi if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
PATH=$LFS/tools/bin:$PATH PATH=$LFS/tools/bin:$PATH
export LFS LC_ALL LFS_TGT PATH CONFIG_SITE=$LFS/usr/share/config.site
export LFS LC_ALL LFS_TGT PATH CONFIG_SITE
EOF EOF
source ~/.bashrc source ~/.bashrc
``` ```
Run the lfs-cross.sh script, which will build the cross-toolchain and cross compiling temporary tools from chapters 5 and 6: Run the lfs-cross.sh script, which will build the cross toolchain and cross compiling temporary tools from chapters 5 and 6:
``` ```
sh $LFS/lfs-cross.sh | tee $LFS/lfs-cross.log sh $LFS/lfs-cross.sh | tee $LFS/lfs-cross.log
``` ```
Return to being root: Exit from the lfs user to become root again:
``` ```
exit exit
@ -145,8 +154,6 @@ Prepare virtual kernel file systems:
``` ```
mkdir -pv $LFS/{dev,proc,sys,run} mkdir -pv $LFS/{dev,proc,sys,run}
mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3
mount -v --bind /dev $LFS/dev mount -v --bind /dev $LFS/dev
mount -v --bind /dev/pts $LFS/dev/pts mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc mount -vt proc proc $LFS/proc
@ -164,8 +171,8 @@ chroot "$LFS" /usr/bin/env -i \
HOME=/root \ HOME=/root \
TERM="$TERM" \ TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \ PS1='(lfs chroot) \u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \ PATH=/usr/bin:/usr/sbin \
/bin/bash --login +h /bin/bash --login
``` ```
Create essential directories, files and symlinks: Create essential directories, files and symlinks:
@ -175,7 +182,8 @@ mkdir -pv /{boot,home,mnt,opt,srv}
mkdir -pv /etc/{opt,sysconfig} mkdir -pv /etc/{opt,sysconfig}
mkdir -pv /lib/firmware mkdir -pv /lib/firmware
mkdir -pv /media/{floppy,cdrom} mkdir -pv /media/{floppy,cdrom}
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} mkdir -pv /usr/{,local/}{include,src}
mkdir -pv /usr/local/{bin,lib,sbin}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man} mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8} mkdir -pv /usr/{,local/}share/man/man{1..8}
@ -186,14 +194,21 @@ ln -sfv /run/lock /var/lock
install -dv -m 0750 /root install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp install -dv -m 1777 /tmp /var/tmp
ln -sv /proc/self/mounts /etc/mtab ln -sv /proc/self/mounts /etc/mtab
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
cat > /etc/hosts << EOF
127.0.0.1 localhost $(hostname)
::1 localhost
EOF
cat > /etc/passwd << "EOF" cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false bin:x:1:1:bin:/dev/null:/usr/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false
EOF EOF
cat > /etc/group << "EOF" cat > /etc/group << "EOF"
root:x:0: root:x:0:
bin:x:1:daemon bin:x:1:daemon
@ -216,15 +231,21 @@ messagebus:x:18:
input:x:24: input:x:24:
mail:x:34: mail:x:34:
kvm:x:61: kvm:x:61:
uuidd:x:80:
wheel:x:97: wheel:x:97:
nogroup:x:99:
users:x:999: users:x:999:
nogroup:x:65534:
EOF EOF
echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd
echo "tester:x:101:" >> /etc/group
install -o tester -d /home/tester
touch /var/log/{btmp,lastlog,faillog,wtmp} touch /var/log/{btmp,lastlog,faillog,wtmp}
chgrp -v utmp /var/log/lastlog chgrp -v utmp /var/log/lastlog
chmod -v 664 /var/log/lastlog chmod -v 664 /var/log/lastlog
chmod -v 600 /var/log/btmp chmod -v 600 /var/log/btmp
exec /bin/bash --login +h
exec /usr/bin/bash --login
``` ```
Run the lfs-chroot.sh script, which will build additional temporary tools: Run the lfs-chroot.sh script, which will build additional temporary tools:
@ -236,8 +257,9 @@ sh /lfs-chroot.sh | tee /lfs-chroot.log
Cleanup before the final build phase: Cleanup before the final build phase:
``` ```
find /usr/{lib,libexec} -name \*.la -delete
rm -rf /usr/share/{info,man,doc}/* rm -rf /usr/share/{info,man,doc}/*
find /usr/{lib,libexec} -name \*.la -delete
rm -rf /tools
``` ```
For the final build phase, run the lfs-system.sh script: For the final build phase, run the lfs-system.sh script:
@ -252,17 +274,6 @@ You must now set a password for the root user (you will have to type a password)
passwd root passwd root
``` ```
Logout from the chroot environment and re-enter it with updated configuration:
```
logout
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
```
Run the final script to configure the rest of the system: Run the final script to configure the rest of the system:
``` ```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# LFS 10.0 Build Script # LFS 11.2 Build Script
# Builds the additional temporary tools from chapter 7 # Builds the additional temporary tools from chapter 7
# by Luís Mendes :) # by Luís Mendes :)
# 14/09/2020 # 06/Sep/2022
package_name="" package_name=""
package_ext="" package_ext=""
@ -11,65 +11,53 @@ begin() {
package_name=$1 package_name=$1
package_ext=$2 package_ext=$2
echo "[lfs-chroot] Starting build of $package_name at $(date)"
tar xf $package_name.$package_ext tar xf $package_name.$package_ext
cd $package_name cd $package_name
} }
finish() { finish() {
echo "[lfs-chroot] Finishing build of $package_name at $(date)"
cd /sources cd /sources
rm -rf $package_name rm -rf $package_name
} }
cd /sources cd /sources
# 7.7. Libstdc++ from GCC-10.2.0, Pass 2 # 7.7. Gettext-0.21
begin gcc-10.2.0 tar.xz
ln -s gthr-posix.h libgcc/gthr-default.h
mkdir -v build
cd build
../libstdc++-v3/configure \
CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--host=$(uname -m)-lfs-linux-gnu \
--disable-libstdcxx-pch
make
make install
finish
# 7.8. Gettext-0.21
begin gettext-0.21 tar.xz begin gettext-0.21 tar.xz
./configure --disable-shared ./configure --disable-shared
make make
cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin
finish finish
# 7.9. Bison-3.7.1 # 7.8. Bison-3.8.2
begin bison-3.7.1 tar.xz begin bison-3.8.2 tar.xz
./configure --prefix=/usr \ ./configure --prefix=/usr \
--docdir=/usr/share/doc/bison-3.7.1 --docdir=/usr/share/doc/bison-3.8.2
make make
make install make install
finish finish
# 7.10. Perl-5.32.0 # 7.9. Perl-5.36.0
begin perl-5.32.0 tar.xz begin perl-5.36.0 tar.xz
sh Configure -des \ sh Configure -des \
-Dprefix=/usr \ -Dprefix=/usr \
-Dvendorprefix=/usr \ -Dvendorprefix=/usr \
-Dprivlib=/usr/lib/perl5/5.32/core_perl \ -Dprivlib=/usr/lib/perl5/5.36/core_perl \
-Darchlib=/usr/lib/perl5/5.32/core_perl \ -Darchlib=/usr/lib/perl5/5.36/core_perl \
-Dsitelib=/usr/lib/perl5/5.32/site_perl \ -Dsitelib=/usr/lib/perl5/5.36/site_perl \
-Dsitearch=/usr/lib/perl5/5.32/site_perl \ -Dsitearch=/usr/lib/perl5/5.36/site_perl \
-Dvendorlib=/usr/lib/perl5/5.32/vendor_perl \ -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \
-Dvendorarch=/usr/lib/perl5/5.32/vendor_perl -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl
make make
make install make install
finish finish
# 7.11. Python-3.8.5 # 7.10. Python-3.10.6
begin Python-3.8.5 tar.xz begin Python-3.10.6 tar.xz
./configure --prefix=/usr \ ./configure --prefix=/usr \
--enable-shared \ --enable-shared \
--without-ensurepip --without-ensurepip
@ -77,18 +65,19 @@ make
make install make install
finish finish
# 7.12. Texinfo-6.7 # 7.11. Texinfo-6.8
begin texinfo-6.7 tar.xz begin texinfo-6.8 tar.xz
./configure --prefix=/usr ./configure --prefix=/usr
make make
make install make install
finish finish
# 7.13. Util-linux-2.36 # 7.12. Util-linux-2.38.1
begin util-linux-2.36 tar.xz begin util-linux-2.38.1 tar.xz
mkdir -pv /var/lib/hwclock mkdir -pv /var/lib/hwclock
./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
--docdir=/usr/share/doc/util-linux-2.36 \ --libdir=/usr/lib \
--docdir=/usr/share/doc/util-linux-2.38.1 \
--disable-chfn-chsh \ --disable-chfn-chsh \
--disable-login \ --disable-login \
--disable-nologin \ --disable-nologin \
@ -97,7 +86,8 @@ mkdir -pv /var/lib/hwclock
--disable-runuser \ --disable-runuser \
--disable-pylibmount \ --disable-pylibmount \
--disable-static \ --disable-static \
--without-python --without-python \
runstatedir=/run
make make
make install make install
finish finish

View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# LFS 10.0 Build Script # LFS 11.2 Build Script
# Builds the cross-toolchain and cross compiling temporary tools from chapters 5 and 6 # Builds the cross-toolchain and cross compiling temporary tools from chapters 5 and 6
# by Luís Mendes :) # by Luís Mendes :)
# 14/09/2020 # 06/Sep/2022
package_name="" package_name=""
package_ext="" package_ext=""
@ -11,38 +11,43 @@ begin() {
package_name=$1 package_name=$1
package_ext=$2 package_ext=$2
echo "[lfs-cross] Starting build of $package_name at $(date)"
tar xf $package_name.$package_ext tar xf $package_name.$package_ext
cd $package_name cd $package_name
} }
finish() { finish() {
echo "[lfs-cross] Finishing build of $package_name at $(date)"
cd $LFS/sources cd $LFS/sources
rm -rf $package_name rm -rf $package_name
} }
cd $LFS/sources cd $LFS/sources
# 5.2. Binutils-2.35 - Pass 1 # 5.2. Binutils-2.39 - Pass 1
begin binutils-2.35 tar.xz begin binutils-2.39 tar.xz
mkdir -v build mkdir -v build
cd build cd build
../configure --prefix=$LFS/tools \ ../configure --prefix=$LFS/tools \
--with-sysroot=$LFS \ --with-sysroot=$LFS \
--target=$LFS_TGT \ --target=$LFS_TGT \
--disable-nls \ --disable-nls \
--enable-gprofng=no \
--disable-werror --disable-werror
make make
make install make install
finish finish
# 5.3. GCC-10.2.0 - Pass 1 # 5.3. GCC-12.2.0 - Pass 1
begin gcc-10.2.0 tar.xz begin gcc-12.2.0 tar.xz
tar -xf ../mpfr-4.1.0.tar.xz tar -xf ../mpfr-4.1.0.tar.xz
mv -v mpfr-4.1.0 mpfr mv -v mpfr-4.1.0 mpfr
tar -xf ../gmp-6.2.0.tar.xz tar -xf ../gmp-6.2.1.tar.xz
mv -v gmp-6.2.0 gmp mv -v gmp-6.2.1 gmp
tar -xf ../mpc-1.1.0.tar.gz tar -xf ../mpc-1.2.1.tar.gz
mv -v mpc-1.1.0 mpc mv -v mpc-1.2.1 mpc
case $(uname -m) in case $(uname -m) in
x86_64) x86_64)
sed -e '/m64=/s/lib64/lib/' \ sed -e '/m64=/s/lib64/lib/' \
@ -54,11 +59,10 @@ cd build
../configure \ ../configure \
--target=$LFS_TGT \ --target=$LFS_TGT \
--prefix=$LFS/tools \ --prefix=$LFS/tools \
--with-glibc-version=2.11 \ --with-glibc-version=2.36 \
--with-sysroot=$LFS \ --with-sysroot=$LFS \
--with-newlib \ --with-newlib \
--without-headers \ --without-headers \
--enable-initfini-array \
--disable-nls \ --disable-nls \
--disable-shared \ --disable-shared \
--disable-multilib \ --disable-multilib \
@ -78,17 +82,16 @@ cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h
finish finish
# 5.4. Linux-5.8.3 API Headers # 5.4. Linux-5.19.2 API Headers
begin linux-5.8.3 tar.xz begin linux-5.19.2 tar.xz
make mrproper make mrproper
make headers make headers
find usr/include -name '.*' -delete find usr/include -type f ! -name '*.h' -delete
rm usr/include/Makefile
cp -rv usr/include $LFS/usr cp -rv usr/include $LFS/usr
finish finish
# 5.5. Glibc-2.32 # 5.5. Glibc-2.36
begin glibc-2.32 tar.xz begin glibc-2.36 tar.xz
case $(uname -m) in case $(uname -m) in
i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3 i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
;; ;;
@ -96,27 +99,28 @@ case $(uname -m) in
ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3 ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
;; ;;
esac esac
patch -Np1 -i ../glibc-2.32-fhs-1.patch patch -Np1 -i ../glibc-2.36-fhs-1.patch
mkdir -v build mkdir -v build
cd build cd build
echo "rootsbindir=/usr/sbin" > configparms
../configure \ ../configure \
--prefix=/usr \ --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT \
--build=$(../scripts/config.guess) \ --build=$(../scripts/config.guess) \
--enable-kernel=3.2 \ --enable-kernel=3.2 \
--with-headers=$LFS/usr/include \ --with-headers=$LFS/usr/include \
libc_cv_slibdir=/lib libc_cv_slibdir=/usr/lib
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
echo 'int main(){}' > dummy.c sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd
$LFS_TGT-gcc dummy.c echo 'int main(){}' | gcc -xc -
readelf -l a.out | grep '/ld-linux' readelf -l a.out | grep ld-linux
rm -v dummy.c a.out rm -v a.out
$LFS/tools/libexec/gcc/$LFS_TGT/10.2.0/install-tools/mkheaders $LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders
finish finish
# 5.6. Libstdc++ from GCC-10.2.0, Pass 1 # 5.6. Libstdc++ from GCC-12.2.0
begin gcc-10.2.0 tar.xz begin gcc-12.2.0 tar.xz
mkdir -v build mkdir -v build
cd build cd build
../libstdc++-v3/configure \ ../libstdc++-v3/configure \
@ -126,15 +130,14 @@ cd build
--disable-multilib \ --disable-multilib \
--disable-nls \ --disable-nls \
--disable-libstdcxx-pch \ --disable-libstdcxx-pch \
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/10.2.0 --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/12.2.0
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
rm -v $LFS/usr/lib/lib{stdc++,stdc++fs,supc++}.la
finish finish
# 6.2. M4-1.4.18 # 6.2. M4-1.4.19
begin m4-1.4.18 tar.xz begin m4-1.4.19 tar.xz
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
./configure --prefix=/usr \ ./configure --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT \
--build=$(build-aux/config.guess) --build=$(build-aux/config.guess)
@ -142,8 +145,8 @@ make
make DESTDIR=$LFS install make DESTDIR=$LFS install
finish finish
# 6.3. Ncurses-6.2 # 6.3. Ncurses-6.3
begin ncurses-6.2 tar.gz begin ncurses-6.3 tar.gz
sed -i s/mawk// configure sed -i s/mawk// configure
mkdir build mkdir build
pushd build pushd build
@ -157,31 +160,30 @@ popd
--mandir=/usr/share/man \ --mandir=/usr/share/man \
--with-manpage-format=normal \ --with-manpage-format=normal \
--with-shared \ --with-shared \
--without-normal \
--with-cxx-shared \
--without-debug \ --without-debug \
--without-ada \ --without-ada \
--without-normal \ --disable-stripping \
--enable-widec --enable-widec
make make
make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so
mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib
ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so
finish finish
# 6.4. Bash-5.0 # 6.4. Bash-5.1.16
begin bash-5.0 tar.gz begin bash-5.1.16 tar.gz
./configure --prefix=/usr \ ./configure --prefix=/usr \
--build=$(support/config.guess) \ --build=$(support/config.guess) \
--host=$LFS_TGT \ --host=$LFS_TGT \
--without-bash-malloc --without-bash-malloc
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
mv $LFS/usr/bin/bash $LFS/bin/bash
ln -sv bash $LFS/bin/sh ln -sv bash $LFS/bin/sh
finish finish
# 6.5. Coreutils-8.32 # 6.5. Coreutils-9.1
begin coreutils-8.32 tar.xz begin coreutils-9.1 tar.xz
./configure --prefix=/usr \ ./configure --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT \
--build=$(build-aux/config.guess) \ --build=$(build-aux/config.guess) \
@ -189,66 +191,68 @@ begin coreutils-8.32 tar.xz
--enable-no-install-program=kill,uptime --enable-no-install-program=kill,uptime
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin
mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin
mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin
mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin
mv -v $LFS/usr/bin/chroot $LFS/usr/sbin mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
mkdir -pv $LFS/usr/share/man/man8 mkdir -pv $LFS/usr/share/man/man8
mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8 mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8 sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8
finish finish
# 6.6. Diffutils-3.7 # 6.6. Diffutils-3.8
begin diffutils-3.7 tar.xz begin diffutils-3.8 tar.xz
./configure --prefix=/usr --host=$LFS_TGT ./configure --prefix=/usr --host=$LFS_TGT
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
finish finish
# 6.7. File-5.39 # 6.7. File-5.42
begin file-5.39 tar.gz begin file-5.42 tar.gz
./configure --prefix=/usr --host=$LFS_TGT mkdir build
pushd build
../configure --disable-bzlib \
--disable-libseccomp \
--disable-xzlib \
--disable-zlib
make
popd
./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess)
make FILE_COMPILE=$(pwd)/build/src/file
make DESTDIR=$LFS install
rm -v $LFS/usr/lib/libmagic.la
finish
# 6.8. Findutils-4.9.0
begin findutils-4.9.0 tar.xz
./configure --prefix=/usr \
--localstatedir=/var/lib/locate \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
finish finish
# 6.8. Findutils-4.7.0 # 6.9. Gawk-5.1.1
begin findutils-4.7.0 tar.xz begin gawk-5.1.1 tar.xz
sed -i 's/extras//' Makefile.in
./configure --prefix=/usr \ ./configure --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT \
--build=$(build-aux/config.guess) --build=$(build-aux/config.guess)
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
mv -v $LFS/usr/bin/find $LFS/bin
sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb
finish finish
# 6.9. Gawk-5.1.0 # 6.10. Grep-3.7
begin gawk-5.1.0 tar.xz begin grep-3.7 tar.xz
sed -i 's/extras//' Makefile.in
./configure --prefix=/usr \ ./configure --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT
--build=$(./config.guess)
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
finish finish
# 6.10. Grep-3.4 # 6.11. Gzip-1.12
begin grep-3.4 tar.xz begin gzip-1.12 tar.xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--bindir=/bin
make
make DESTDIR=$LFS install
finish
# 6.11. Gzip-1.10
begin gzip-1.10 tar.xz
./configure --prefix=/usr --host=$LFS_TGT ./configure --prefix=/usr --host=$LFS_TGT
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
mv -v $LFS/usr/bin/gzip $LFS/bin
finish finish
# 6.12. Make-4.3 # 6.12. Make-4.3
@ -273,38 +277,35 @@ finish
# 6.14. Sed-4.8 # 6.14. Sed-4.8
begin sed-4.8 tar.xz begin sed-4.8 tar.xz
./configure --prefix=/usr \ ./configure --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT
--bindir=/bin
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
finish finish
# 6.15. Tar-1.32 # 6.15. Tar-1.34
begin tar-1.32 tar.xz begin tar-1.34 tar.xz
./configure --prefix=/usr \ ./configure --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT \
--build=$(build-aux/config.guess) \ --build=$(build-aux/config.guess)
--bindir=/bin
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
finish finish
# 6.16. Xz-5.2.5 # 6.16. Xz-5.2.6
begin xz-5.2.5 tar.xz begin xz-5.2.6 tar.xz
./configure --prefix=/usr \ ./configure --prefix=/usr \
--host=$LFS_TGT \ --host=$LFS_TGT \
--build=$(build-aux/config.guess) \ --build=$(build-aux/config.guess) \
--disable-static \ --disable-static \
--docdir=/usr/share/doc/xz-5.2.5 --docdir=/usr/share/doc/xz-5.2.6
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
mv -v $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin rm -v $LFS/usr/lib/liblzma.la
mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so
finish finish
# 6.17. Binutils-2.35 - Pass 2 # 6.17. Binutils-2.39 - Pass 2
begin binutils-2.35 tar.xz begin binutils-2.39 tar.xz
sed '6009s/$add_dir//' -i ltmain.sh
mkdir -v build mkdir -v build
cd build cd build
../configure \ ../configure \
@ -313,34 +314,37 @@ cd build
--host=$LFS_TGT \ --host=$LFS_TGT \
--disable-nls \ --disable-nls \
--enable-shared \ --enable-shared \
--enable-gprofng=no \
--disable-werror \ --disable-werror \
--enable-64-bit-bfd --enable-64-bit-bfd
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install
rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la}
finish finish
# 6.18. GCC-10.2.0 - Pass 2 # 6.18. GCC-12.2.0 - Pass 2
begin gcc-10.2.0 tar.xz begin gcc-12.2.0 tar.xz
tar -xf ../mpfr-4.1.0.tar.xz tar -xf ../mpfr-4.1.0.tar.xz
mv -v mpfr-4.1.0 mpfr mv -v mpfr-4.1.0 mpfr
tar -xf ../gmp-6.2.0.tar.xz tar -xf ../gmp-6.2.1.tar.xz
mv -v gmp-6.2.0 gmp mv -v gmp-6.2.1 gmp
tar -xf ../mpc-1.1.0.tar.gz tar -xf ../mpc-1.2.1.tar.gz
mv -v mpc-1.1.0 mpc mv -v mpc-1.2.1 mpc
case $(uname -m) in case $(uname -m) in
x86_64) x86_64)
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
;; ;;
esac esac
sed '/thread_header =/s/@.*@/gthr-posix.h/' \
-i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
mkdir -v build mkdir -v build
cd build cd build
mkdir -pv $LFS_TGT/libgcc
ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h
../configure \ ../configure \
--build=$(../config.guess) \ --build=$(../config.guess) \
--host=$LFS_TGT \ --host=$LFS_TGT \
--target=$LFS_TGT \
LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \
--prefix=/usr \ --prefix=/usr \
CC_FOR_TARGET=$LFS_TGT-gcc \
--with-build-sysroot=$LFS \ --with-build-sysroot=$LFS \
--enable-initfini-array \ --enable-initfini-array \
--disable-nls \ --disable-nls \
@ -351,7 +355,6 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h
--disable-libquadmath \ --disable-libquadmath \
--disable-libssp \ --disable-libssp \
--disable-libvtv \ --disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++ --enable-languages=c,c++
make make
make DESTDIR=$LFS install make DESTDIR=$LFS install

View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# LFS 10.0 Build Script # LFS 11.2 Build Script
# Final steps to configure the system # Final steps to configure the system
# by Luís Mendes :) # by Luís Mendes :)
# 17/09/2020 # 07/Sep/2022
package_name="" package_name=""
package_ext="" package_ext=""
@ -11,14 +11,14 @@ begin() {
package_name=$1 package_name=$1
package_ext=$2 package_ext=$2
echo "[lfs-scripts] Starting build of $package_name at $(date)" echo "[lfs-final] Starting build of $package_name at $(date)"
tar xf $package_name.$package_ext tar xf $package_name.$package_ext
cd $package_name cd $package_name
} }
finish() { finish() {
echo "[lfs-scripts] Finishing build of $package_name at $(date)" echo "[lfs-final] Finishing build of $package_name at $(date)"
cd /sources cd /sources
rm -rf $package_name rm -rf $package_name
@ -26,19 +26,19 @@ finish() {
cd /sources cd /sources
# 9.2. LFS-Bootscripts-20200818 # 9.2. LFS-Bootscripts-20220723
begin lfs-bootscripts-20200818 tar.xz begin lfs-bootscripts-20220723 tar.xz
make install make install
finish finish
# 9.4.1.2. Creating Custom Udev Rules # 9.4.1.2. Creating Custom Udev Rules
bash /lib/udev/init-net-rules.sh bash /usr/lib/udev/init-net-rules.sh
# 9.5.1. Creating Network Interface Configuration Files # 9.5.1. Creating Network Interface Configuration Files
cd /etc/sysconfig/ cd /etc/sysconfig/
cat > ifconfig.enp0s3 << "EOF" cat > ifconfig.eth0 << "EOF"
ONBOOT=yes ONBOOT=yes
IFACE=enp0s3 IFACE=eth0
SERVICE=ipv4-static SERVICE=ipv4-static
IP=192.168.1.2 IP=192.168.1.2
GATEWAY=192.168.1.1 GATEWAY=192.168.1.1
@ -197,17 +197,17 @@ EOF
cd /sources cd /sources
# 10.3. Linux-5.8.3 # 10.3. Linux-5.19.2
begin linux-5.8.3 tar.xz begin linux-5.19.2 tar.xz
make mrproper make mrproper
make defconfig make defconfig
make make
make modules_install make modules_install
cp -iv arch/x86/boot/bzImage /boot/vmlinuz-5.8.3-lfs-10.0 cp -iv arch/x86/boot/bzImage /boot/vmlinuz-5.19.2-lfs-11.2
cp -iv System.map /boot/System.map-5.8.3 cp -iv System.map /boot/System.map-5.19.2
cp -iv .config /boot/config-5.8.3 cp -iv .config /boot/config-5.19.2
install -d /usr/share/doc/linux-5.8.3 install -d /usr/share/doc/linux-5.19.2
cp -r Documentation/* /usr/share/doc/linux-5.8.3 cp -r Documentation/* /usr/share/doc/linux-5.19.2
finish finish
# 10.3.2. Configuring Linux Module Load Order # 10.3.2. Configuring Linux Module Load Order
@ -231,25 +231,25 @@ set timeout=5
insmod ext2 insmod ext2
set root=(hd0,1) set root=(hd0,1)
menuentry "GNU/Linux, Linux 5.8.3-lfs-10.0" { menuentry "GNU/Linux, Linux 5.19.2-lfs-11.2" {
linux /boot/vmlinuz-5.8.3-lfs-10.0 root=/dev/sda1 ro linux /boot/vmlinuz-5.19.2-lfs-11.2 root=/dev/sda1 ro
} }
EOF EOF
# 11.1. The End # 11.1. The End
echo 10.0 > /etc/lfs-release echo 11.2 > /etc/lfs-release
cat > /etc/lsb-release << "EOF" cat > /etc/lsb-release << "EOF"
DISTRIB_ID="Linux From Scratch" DISTRIB_ID="Linux From Scratch"
DISTRIB_RELEASE="10.0" DISTRIB_RELEASE="11.2"
DISTRIB_CODENAME="Linux From Scratch" DISTRIB_CODENAME="Linux From Scratch"
DISTRIB_DESCRIPTION="Linux From Scratch" DISTRIB_DESCRIPTION="Linux From Scratch"
EOF EOF
cat > /etc/os-release << "EOF" cat > /etc/os-release << "EOF"
NAME="Linux From Scratch" NAME="Linux From Scratch"
VERSION="10.0" VERSION="11.2
ID=lfs ID=lfs
PRETTY_NAME="Linux From Scratch 10.0" PRETTY_NAME="Linux From Scratch 11.2"
VERSION_CODENAME="Linux From Scratch" VERSION_CODENAME="Linux From Scratch"
EOF EOF
echo "[lfs-scripts] The end" echo "[lfs-final] The end"

File diff suppressed because it is too large Load diff

28293
logs/lfs-chroot.log Normal file

File diff suppressed because one or more lines are too long

71345
logs/lfs-cross.log Normal file

File diff suppressed because one or more lines are too long

3709
logs/lfs-final.log Normal file

File diff suppressed because it is too large Load diff

134095
logs/lfs-system.log Normal file

File diff suppressed because one or more lines are too long