From e93c2168f531e65352352afe9ba590339014f5f6 Mon Sep 17 00:00:00 2001 From: Alexander Hill Date: Sat, 20 Dec 2025 23:58:05 -0500 Subject: Made progress on building the kernel --- sources/linux/linux-mold.patch | 28 ++++++++++++++++++++++++++++ sources/linux/linux.spec | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 sources/linux/linux-mold.patch diff --git a/sources/linux/linux-mold.patch b/sources/linux/linux-mold.patch new file mode 100644 index 0000000..84b5de9 --- /dev/null +++ b/sources/linux/linux-mold.patch @@ -0,0 +1,28 @@ +diff -ruN vanilla/ld-version.sh maple/ld-version.sh +--- vanilla/scripts/ld-version.sh 2025-12-20 22:21:33.612821362 -0500 ++++ maple/scripts/ld-version.sh 2025-12-20 22:26:22.501951110 -0500 +@@ -41,6 +41,11 @@ + elif [ "$1" = GNU -a "$2" = gold ]; then + echo "gold linker is not supported as it is not capable of linking the kernel proper." >&2 + exit 1 ++elif [ "$1" = mold ]; then ++ version=$2 ++ min_version=$($min_tool_version mold) ++ name=mold ++ disp_name=mold + else + while [ $# -gt 1 -a "$1" != "LLD" ]; do + shift +diff -ruN vanilla/min-tool-version.sh maple/min-tool-version.sh +--- vanilla/scripts/min-tool-version.sh 2025-12-20 22:21:43.939683406 -0500 ++++ maple/scripts/min-tool-version.sh 2025-12-20 22:22:08.348357201 -0500 +@@ -36,6 +36,9 @@ + bindgen) + echo 0.65.1 + ;; ++mold) ++ echo 2.40.4 ++ ;; + *) + echo "$1: unknown tool" >&2 + exit 1 diff --git a/sources/linux/linux.spec b/sources/linux/linux.spec index dd0b5a3..2032537 100755 --- a/sources/linux/linux.spec +++ b/sources/linux/linux.spec @@ -1,5 +1,31 @@ # Maintainer: Alexander Hill SRC_HASH="d0a78bf3f0d12aaa10af3b5adcaed5bc767b5b78705e5ef885d5e930b72e25d5" SRC_NAME="linux" +SRC_PATCHES=" +5a0616535b4c04d99a3db3e8ea528e6e658fd12b11161f9dcf56f5c21a3b0e62 linux-mold.patch +" +SRC_REVISION=1 SRC_URL="https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.1.tar.xz" SRC_VERSION="6.18.1" + +build() { + tar xf ../$SRC_FILENAME + cd linux-$SRC_VERSION/ + # NOTE: Linux doesn't officially support mold, so we have to patch a couple + # of scripts to allow the kernel to build. ~ahill + patch -p1 < ../linux-mold.patch + # NOTE: LLVM=1 is required for ALL invocations of the kernel's Makefile. GNU + # tools are still used by default in a lot of places and this will + # override them with LLVM tools wherever possible. ~ahill + LLVM=1 make mrproper + # NOTE: YACC defaults to bison, which doesn't exist here, so we tell it + # where to find the parser generator manually. ~ahill + # NOTE: Similarly, since we aren't using LLVM's linker, we tell it to use + # mold manually. ~ahill + LLVM=1 make -j $TT_PROCS defconfig LD=mold YACC=byacc + LLVM=1 make -j $TT_PROCS HOSTLD=mold LD=mold YACC=byacc +} + +clean() { + rm -rf libelf-$SRC_VERSION/ +} -- cgit v1.2.3