From 27ffdc363303d35878e379b099b60e31be4360bd Mon Sep 17 00:00:00 2001 From: kevadesu Date: Sun, 10 Nov 2024 17:56:27 +0100 Subject: [PATCH] Finally finished the Einrichter as LFS part --- Einrichter-CLI.sh | 28 ++++++++++++----- Einrichter-as-LFS.sh | 67 +++++++++++++++++++++++++++++++++++++++-- Einrichter-in-chroot.sh | 7 +++++ README.md | 2 +- 4 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 Einrichter-in-chroot.sh diff --git a/Einrichter-CLI.sh b/Einrichter-CLI.sh index fbb579e..f5c3323 100644 --- a/Einrichter-CLI.sh +++ b/Einrichter-CLI.sh @@ -8,7 +8,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) EINRICHTER_VER=0.1.0 function main() { - + einrichter.colours + einrichter.installer.pkgs + einrichter.installer.DirLayout + einrichter.installer.SafeUser + einrichter.installer.SafeUser.end } function einrichter.colours() { @@ -164,15 +168,25 @@ function einrichter.installer.SafeUser() { su - lfs } -function einrichter.installer.SafeUser.end() { - -} - -chown --from lfs -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools} +function einrichter.installer.chroot() { + 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 ;; + x86_64) chown --from lfs -R root:root $LFS/lib64 ;; esac + echo -e "${BBlue}[i] ${Blue}Copying third installer to the root of ${LFS}...${Color_Off}" + cp $SCRIPT_DIR/Einrichter-in-chroot.sh $LFS/ + echo -e "${BBlue}[i] ${Blue}Making the installer executable...${Color_Off}" + chmod +x $LFS/Einrichter-in-chroot.sh + echo -e "${BBlue}[i] ${Blue}Attempting chroot...${Color_Off}" + echo -e "${BBlue}[i] ${Blue}You are about to switch to the chroot environment. When you enter the chroot environment, run the Einrichter-in-chroot.sh script located in the root of the filesystem by typing \"/Einrichter-in-chroot.sh\".${Color_Off}" + chroot $LFS } +# NEEDS REVIEW!!! +## 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 +## } function einrichter.installer.bg() { diff --git a/Einrichter-as-LFS.sh b/Einrichter-as-LFS.sh index 9b4778f..762e001 100644 --- a/Einrichter-as-LFS.sh +++ b/Einrichter-as-LFS.sh @@ -3,6 +3,7 @@ main() { eal.setup.env eal.setup.toolchain + eal.install.cross-toolchain } function eal.setup.env() { @@ -48,7 +49,8 @@ function eal.install.cross-toolchain() { eal.notification.extracting sleep 0.5 tar -xvf $LFS/sources/binutils-2.43.1.tar.xz - cd $LFS/sources/binutils-2.43.1/ + mv binutils-2.43.1 binutils + cd $LFS/sources/binutils/ mkdir -v build cd build eal.notification.buildconf @@ -386,6 +388,67 @@ function eal.install.cross-toolchain() { make DESTDIR=$LFS install rm -v $LFS/usr/lib/liblzma.la popd -} + pushd $LFS/sources/binutils + sed '6009s/$add_dir//' -i ltmain.sh + yes | rm -r build + mkdir -v build + cd build + ../configure \ + --prefix=/usr \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --disable-nls \ + --enable-shared \ + --enable-gprofng=no \ + --disable-werror \ + --enable-64-bit-bfd \ + --enable-new-dtags \ + --enable-default-hash-style=gnu + make + make DESTDIR=$LFS install + rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la} + popd + EIR_PKG=GCC + pushd $LFS/sources/gcc + 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 + yes | rm -r build + mkdir -v build + cd build + eal.notification.buildconf + ../configure \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --target=$LFS_TGT \ + LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \ + --prefix=/usr \ + --with-build-sysroot=$LFS \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-multilib \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libsanitizer \ + --disable-libssp \ + --disable-libvtv \ + --enable-languages=c,c++ + eal.notification.compiling + make + eal.notification.installing + make DESTDIR=$LFS install + ln -sv gcc $LFS/usr/bin/cc + popd + popd + echo "Operations as LFS user are now over. Switching to chroot" +} + main \ No newline at end of file diff --git a/Einrichter-in-chroot.sh b/Einrichter-in-chroot.sh new file mode 100644 index 0000000..2c16ecf --- /dev/null +++ b/Einrichter-in-chroot.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +main() { + +} + +main \ No newline at end of file diff --git a/README.md b/README.md index 0991a3a..7c370eb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ TylkoLinux, an LFS system ## Status -LFS v12.2-systemd book chapter: 5.6. +LFS v12.2-systemd book chapter: just starting 7.3. ## To do ```md