Finally finished the Einrichter as LFS part

This commit is contained in:
kevadesu 2024-11-10 17:56:27 +01:00
parent e1c9a2a1cc
commit 27ffdc3633
4 changed files with 94 additions and 10 deletions

View file

@ -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() {

View file

@ -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

7
Einrichter-in-chroot.sh Normal file
View file

@ -0,0 +1,7 @@
#!/bin/bash
main() {
}
main

View file

@ -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