aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiley Beckett <rbeckettvt@gmail.com>2026-09-27 15:16:30 -0400
committerRiley Beckett <rbeckettvt@gmail.com>2026-09-27 15:16:30 -0400
commit8b96cff2f2ffe630541151a0bdaaddc15a41ecaa (patch)
treebd2d87da27d6cd55aaf45ef45b841cc71a46c6e6
parent92cc1136b99a3b079122e2edf5fc8da9a66babd6 (diff)
bootstrap is now guaranteed to work
-rw-r--r--bootstrap.sh284
1 files changed, 279 insertions, 5 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 28264e5..c260910 100644
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -6,6 +6,23 @@ mkdir -p $bootstrapdir/tarballs
mkdir -p $bootstrapdir/tools
mkdir -p $boostrapdir/sources
+mkdir -p $bootstrapdir/usr
+mkdir -p $bootstrapdir/usr/lib
+mkdir -p $bootstrapdir/usr/bin
+mkdir -p $bootstrapdir/etc
+mkdir -p $bootstrapdir/var
+mkdir -p $bootstrapdir/run
+mkdir -p $bootstrapdir/tmp
+mkdir -p $bootstrapdir/home
+mkdir -p $bootstrapdir/boot
+ln -s lib $bootstrapdir/usr/lib64
+ln -s usr/lib $bootstrapdir/lib64
+ln -s usr/lib $bootstrapdir/lib
+ln -s bin $bootstrapdir/usr/sbin
+ln -s usr/bin $bootstrapdir/bin
+ln -s usr/bin $bootstrapdir/sbin
+
+
bootstrap_target=x86_64-rasde-linux-musl
cores=$(nproc)
@@ -28,6 +45,9 @@ curl -LO https://ftp.gnu.org/pub/gnu/make/make-4.4.1.tar.lz
curl -LO https://ftp.gnu.org/pub/gnu/patch/patch-2.8.tar.xz
curl -LO https://ftp.gnu.org/pub/gnu/sed/sed-4.10.tar.xz
curl -LO https://ftp.gnu.org/gnu/tar/tar-1.35.tar.xz
+curl -LO https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.2.tar.xz
+curl -LO https://ftp.gnu.org/pub/gnu/gmp/gmp-6.3.0.tar.xz
+curl -LO https://ftp.gnu.org/gnu/mpc/mpc-1.4.1.tar.xz
curl -LO https://tukaani.org/xz/xz-5.8.3.tar.gz
tar xf $bootstrapdir/tarballs/binutils-2.47.tar.zst -C $bootstrapdir/sources
@@ -48,18 +68,272 @@ tar xf $bootstrapdir/tarballs/make-4.4.1.tar.lz -C $bootstrapdir/sources
tar xf $bootstrapdir/tarballs/patch-2.8.tar.xz -C $bootstrapdir/sources
tar xf $bootstrapdir/tarballs/sed-4.10.tar.xz -C $bootstrapdir/sources
tar xf $bootstrapdir/tarballs/tar-1.35.tar.xz -C $bootstrapdir/sources
+tar xf $bootstrapdir/tarballs/mpfr-4.2.2.tar.xz -C $bootstrapdir/sources
+tar xf $bootstrapdir/tarballs/gmp-6.3.0.tar.xz -C $bootstrapdir/sources
+tar xf $bootstrapdir/tarballs/mpc-1.4.1.tar.xz -C $bootstrapdir/sources
tar xf $bootstrapdir/tarballs/xz-5.8.3.tar.gz -C $bootstrapdir/sources
+export PATH="$bootstrapdir/tools/bin:$PATH"
+
cd $bootstrapdir/sources/binutils*
mkdir build
cd build
../configure --prefix=$bootstrapdir/tools \
--with-sysroot=$bootstrapdir \
--target=$bootstrap_target \
- --disable-nls \
- --enable-gprofng=no \
- --disable-werror \
- --enable-new-dtags \
+ --disable-nls \
+ --enable-gprofng=no \
+ --disable-werror \
+ --enable-new-dtags \
--enable-default-hash-style=gnu
make -j$cores
-make install $cores
+make install -j$cores
+
+cd $bootstrapdir/sources/gcc*
+mkdir build
+cd build
+../configure \
+ --target=$bootstrap_target \
+ --prefix=$bootstrapdir/tools \
+ --with-sysroot=$bootstrapdir \
+ --with-newlib \
+ --without-headers \
+ --enable-default-pie \
+ --enable-default-ssp \
+ --disable-nls \
+ --disable-shared \
+ --disable-multilib \
+ --disable-threads \
+ --disable-libatomic \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --disable-libssp \
+ --disable-libvtv \
+ --disable-libstdcxx \
+ --enable-languages=c,c++
+make -j$cores
+make install -j$cores
+
+cd $bootstrapdir/sources/linux*
+make mrproper -j$cores
+make headers -j$cores
+make headers_install -j$cores
+cp -r ./usr/include $bootstrapdir/usr
+
+cd $bootstrapdir/sources/musl*
+./configure --prefix=/usr
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+ln -s ../lib/libc.so $bootstrapdir/usr/bin/ldd
+
+cd $bootstrapdir/sources/gcc*
+mkdir build-libstdcpp
+cd build-libstdcpp
+../libstdc++-v3/configure \
+ --host=$bootstrap_target \
+ --build=$(../config.guess) \
+ --prefix=/usr \
+ --disable-multilib \
+ --disable-nls \
+ --disable-libstdcxx-pch \
+ --with-gxx-include-dir=/tools/$boostrap_target/include/c++/16.2.0
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/m4*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install j$cores
+
+cd $bootstrapdir/sources/ncurses*
+mkdir build
+pushd build
+ ../configure --prefix=$LFS/tools AWK=gawk
+ make -C include
+ make -C progs tic
+ install progs/tic $LFS/tools/bin
+popd
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess) \
+ --mandir=/usr/share/man \
+ --with-manpage-format=normal \
+ --with-shared \
+ --with-normal \
+ --disable-widenc \
+ --with-cxx-shared \
+ --without-debug \
+ --without-ada \
+ --disable-stripping \
+ AWK=gawk
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+make distclean
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess) \
+ --mandir=/usr/share/man \
+ --with-manpage-format=normal \
+ --with-shared \
+ --enable-widenc \
+ --with-cxx-shared \
+ --without-debug \
+ --without-ada \
+ --disable-stripping \
+ AWK=gawk
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+ln -sf libncurses.so $bootstrapdir/usr/lib/libcurses.so
+ln -sf libncurses.a $bootstrapdir/usr/lib/libcurses.a
+
+cd $bootstrapdir/sources/bash*
+./configure --prefix=/usr \
+ --build=$(sh support/config.guess) \
+ --host=$bootstrap_target \
+ --without-bash-malloc
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+ln -s bash $bootstrapdir/bin/sh
+
+cd $bootstrapdir/sources/coreutils*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess) \
+ --enable-install-program=hostname \
+ --enable-no-install-program=kill,uptime
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/diffutils*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ gl_cv_func_strcasecmp_works=y \
+ --build=$(./build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/file*
+mkdir build
+pushd build
+ ../configure --disable-bzlib \
+ --disable-libseccomp \
+ --disable-xzlib \
+ --disable-zlib
+ make
+popd
+./configure --prefix=/usr --host=$bootstrap_target --build=$(./config.guess)
+make FILE_COMPILE=$(pwd)/build/src/file
+make DESTDIR=$bootstrapdir install
+rm -v $bootstrapdir/usr/lib/libmagic.la
+
+cd $bootstrapdir/sources/findutils*
+./configure --prefix=/usr \
+ --localstatedir=/var/lib/locate \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/gawk*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/grep*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(./build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/gzip*
+./configure --prefix=/usr --host=$bootstrap_target
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/make*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/patch*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/sed*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/tar*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+
+cd $bootstrapdir/sources/xz*
+./configure --prefix=/usr \
+ --host=$bootstrap_target \
+ --build=$(build-aux/config.guess)
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+rm -v $bootstrapdir/usr/lib/liblzma.la
+
+cd $bootstrapdir/sources/binutils*
+sed '6031s/$add_dir//' -i ltmain.sh
+rm -rf build
+mkdir build
+cd build
+../configure \
+ --prefix=/usr \
+ --build=$(../config.guess) \
+ --host=$bootstrap_target \
+ --disable-nls \
+ --enable-shared \
+ --enable-gprofng=no \
+ --disable-werror \
+ --enable-64-bit-bfd \
+ --enable-new-dtags \
+ --enable-default-hash-style=gnu
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+rm -v $bootstrapdir/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.la
+
+cd $bootstrapdir/sources/gcc*
+rm -rf build
+mkdir build
+cd build
+
+../configure \
+ --build=$(../config.guess) \
+ --host=$bootstrap_target \
+ --target=$bootstrap_target \
+ --prefix=/usr \
+ --with-build-sysroot=$bootstrapdir \
+ --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++ \
+ LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc
+make -j$cores
+make DESTDIR=$bootstrapdir install -j$cores
+ln -sv gcc $bootstrapdir/usr/bin/cc