Files
darkforge/toolchain/scripts/021-binutils-pass2.sh
Danny 029642ae5b Initial commit: DarkForge Linux — Phases 0-12
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>
2026-03-19 11:30:40 +01:00

54 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# DarkForge Linux — Phase 0, Chapter 6: Binutils Pass 2
# ============================================================================
# Purpose: Rebuild binutils with the temporary toolchain. This produces
# binutils that runs on the target and generates code for the target.
# Pass 1 ran on the host; Pass 2 runs on the target (via cross-compiler).
# Inputs: ${LFS}/sources/binutils-2.46.tar.xz
# Outputs: Updated binutils in ${LFS}/usr/
# Assumes: All Chapter 5 + Chapter 6 temp tools (006-020) complete
# Ref: LFS 13.0 §6.17
# ============================================================================
set -euo pipefail
source "${LFS}/sources/darkforge-env.sh"
PACKAGE="binutils"
VERSION="2.46"
SRCDIR="${LFS}/sources"
echo "=== Building ${PACKAGE}-${VERSION} (Pass 2) ==="
cd "${SRCDIR}"
tar -xf "${PACKAGE}-${VERSION}.tar.xz"
cd "${PACKAGE}-${VERSION}"
# Remove libtool archive files that cause cross-compilation issues
sed '6009s/$add_dir//' -i ltmain.sh
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
# Remove libtool archives — they're harmful for cross-compiled libraries
rm -v "${LFS}"/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la} 2>/dev/null || true
cd "${SRCDIR}"
rm -rf "${PACKAGE}-${VERSION}"
echo "=== ${PACKAGE}-${VERSION} Pass 2 complete ==="