Complete from-scratch Linux distribution targeting AMD Ryzen 9 9950X3D + NVIDIA RTX 5090 on ASUS ROG CROSSHAIR X870E HERO. Deliverables: - dpack: custom package manager in Rust (3,800 lines) - TOML package parser, dependency resolver, build sandbox - CRUX Pkgfile and Gentoo ebuild converters - Shared library conflict detection - 124 package definitions across 4 repos (core/extra/desktop/gaming) - 34 toolchain bootstrap scripts (LFS 13.0 adapted for Zen 5) - Linux 6.19.8 kernel config (hardware-specific, fully commented) - SysVinit init system with rc.d service scripts - Live ISO builder (UEFI-only, squashfs+xorriso) - Interactive installer (GPT partitioning, EFISTUB boot) - Integration test checklist (docs/TESTING.md) No systemd. No bootloader. No display manager. Kernel boots via EFISTUB → auto-login → dwl Wayland compositor. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
90 lines
2.8 KiB
Bash
Executable File
90 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# ============================================================================
|
|
# DarkForge Linux — Phase 0, Chapter 6: GCC Pass 2
|
|
# ============================================================================
|
|
# Purpose: Rebuild GCC with the temporary toolchain. This produces a
|
|
# compiler that runs on the target and generates code for the target.
|
|
# Unlike Pass 1, this includes libstdc++, threading, and shared libs.
|
|
# Hardware-specific flags (-march=znver5) are STILL not applied here;
|
|
# they come when we build the final native GCC in the chroot.
|
|
# Inputs: ${LFS}/sources/gcc-15.2.0.tar.xz + mpfr, gmp, mpc
|
|
# Outputs: Full GCC in ${LFS}/usr/
|
|
# Assumes: All Chapter 5 + Chapter 6 packages (006-021) complete
|
|
# Ref: LFS 13.0 §6.18
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
source "${LFS}/sources/darkforge-env.sh"
|
|
|
|
PACKAGE="gcc"
|
|
VERSION="15.2.0"
|
|
SRCDIR="${LFS}/sources"
|
|
|
|
echo "=== Building ${PACKAGE}-${VERSION} (Pass 2) ==="
|
|
|
|
cd "${SRCDIR}"
|
|
tar -xf "${PACKAGE}-${VERSION}.tar.xz"
|
|
cd "${PACKAGE}-${VERSION}"
|
|
|
|
# Extract and link GCC's arithmetic library dependencies
|
|
tar -xf ../mpfr-4.2.2.tar.xz
|
|
mv -v mpfr-4.2.2 mpfr
|
|
tar -xf ../gmp-6.3.0.tar.xz
|
|
mv -v gmp-6.3.0 gmp
|
|
tar -xf ../mpc-1.3.1.tar.gz
|
|
mv -v mpc-1.3.1 mpc
|
|
|
|
# Fix lib64 directory naming (same as Pass 1)
|
|
case $(uname -m) in
|
|
x86_64)
|
|
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
|
|
;;
|
|
esac
|
|
|
|
# Override the default build rule for libgcc and libstdc++ headers
|
|
# to use our target-specific header directory
|
|
sed '/thread_header =/s/@.*@/gthr-posix.h/' \
|
|
-i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
|
|
|
|
mkdir -v build
|
|
cd build
|
|
|
|
# Configure GCC Pass 2
|
|
# Key differences from Pass 1:
|
|
# --with-build-sysroot=$LFS: use target sysroot during build
|
|
# --enable-default-pie/ssp: security hardening
|
|
# --disable-bootstrap: skip the 3-stage bootstrap (not building natively yet)
|
|
../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++
|
|
|
|
make
|
|
make DESTDIR="${LFS}" install
|
|
|
|
# Create cc symlink (many build systems expect 'cc' to exist)
|
|
ln -sfv gcc "${LFS}/usr/bin/cc"
|
|
|
|
# Cleanup
|
|
cd "${SRCDIR}"
|
|
rm -rf "${PACKAGE}-${VERSION}"
|
|
|
|
echo "=== ${PACKAGE}-${VERSION} Pass 2 complete ==="
|
|
echo ""
|
|
echo ">>> Cross-compilation phase (Chapters 5+6) COMPLETE."
|
|
echo ">>> Next: Enter chroot environment (Chapter 7 scripts)."
|