Compare commits

..

No commits in common. "master" and "10.0" have entirely different histories.
master ... 10.0

11 changed files with 626 additions and 238107 deletions

View file

@ -1,5 +1,5 @@
# lfs-scripts :penguin:
Instructions and scripts to build Linux From Scratch (LFS), version 11.2, as simply as possible (I know, not that simple, but anyway).
Instructions and scripts to build LFS (Linux From Scratch), version 10.0, 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)
@ -7,13 +7,13 @@ Instructions and scripts to build Linux From Scratch (LFS), version 11.2, as sim
# 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 automated 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 automation scripts provided here.
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).
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).
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.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).
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).
# Build instructions
@ -22,6 +22,7 @@ The packages needed to build LFS were downloaded from [here](http://ftp.osuosl.o
Create a partition and a filesystem in the virtual hard disk (/dev/sdb):
```
mkdir /mnt/lfs
fdisk /dev/sdb
```
@ -47,14 +48,15 @@ Source the file:
source .bashrc
```
Download all the packages and extract them to $LFS/sources.
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.
```
cd $LFS
cp /<location_of_the_package>/lfs-packages-11.2.tar .
tar xf lfs-packages-11.2.tar
mv 11.2-rc1 sources
cp /<location_of_the_package>/lfs-packages-10.0.tar .
tar xf lfs-packages-10.0.tar
mv 10.0 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:
@ -66,17 +68,7 @@ cp /<location_of_the_scripts>/*.sh $LFS
Create the basic filesystem for LFS:
```
mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin}
for i in bin lib sbin; do
ln -sv usr/$i $LFS/$i
done
case $(uname -m) in
x86_64) mkdir -pv $LFS/lib64 ;;
esac
mkdir -pv $LFS/tools
mkdir -pv $LFS/{bin,etc,lib,sbin,usr,var,lib64,tools}
```
Create the lfs user, used during the initial build process (you will have to type a password):
@ -122,20 +114,19 @@ 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
export LFS LC_ALL LFS_TGT PATH
EOF
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
```
Exit from the lfs user to become root again:
Return to being root:
```
exit
@ -154,6 +145,8 @@ Prepare virtual kernel file systems:
```
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/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc
@ -171,8 +164,8 @@ chroot "$LFS" /usr/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \
PATH=/usr/bin:/usr/sbin \
/bin/bash --login
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login +h
```
Create essential directories, files and symlinks:
@ -182,8 +175,7 @@ mkdir -pv /{boot,home,mnt,opt,srv}
mkdir -pv /etc/{opt,sysconfig}
mkdir -pv /lib/firmware
mkdir -pv /media/{floppy,cdrom}
mkdir -pv /usr/{,local/}{include,src}
mkdir -pv /usr/local/{bin,lib,sbin}
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
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}
@ -194,21 +186,14 @@ ln -sfv /run/lock /var/lock
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
ln -sv /proc/self/mounts /etc/mtab
cat > /etc/hosts << EOF
127.0.0.1 localhost $(hostname)
::1 localhost
EOF
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/usr/bin/false
daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false
uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF
cat > /etc/group << "EOF"
root:x:0:
bin:x:1:daemon
@ -231,21 +216,15 @@ messagebus:x:18:
input:x:24:
mail:x:34:
kvm:x:61:
uuidd:x:80:
wheel:x:97:
nogroup:x:99:
users:x:999:
nogroup:x:65534:
EOF
echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd
echo "tester:x:101:" >> /etc/group
install -o tester -d /home/tester
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
exec /usr/bin/bash --login
exec /bin/bash --login +h
```
Run the lfs-chroot.sh script, which will build additional temporary tools:
@ -257,9 +236,8 @@ sh /lfs-chroot.sh | tee /lfs-chroot.log
Cleanup before the final build phase:
```
rm -rf /usr/share/{info,man,doc}/*
find /usr/{lib,libexec} -name \*.la -delete
rm -rf /tools
rm -rf /usr/share/{info,man,doc}/*
```
For the final build phase, run the lfs-system.sh script:
@ -274,6 +252,17 @@ You must now set a password for the root user (you will have to type a password)
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:
```
@ -282,4 +271,4 @@ sh /lfs-final.sh | tee /lfs-final.log
# The end
You can now create a new VM using the virtual hard disk with the LFS build. It will be bootable and fully functional. Enjoy!
You can now create a new VM using the virtual hard disk with the LFS build. It will be bootable and fully functional. Enjoy!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long