Made progress on building the kernel

This commit is contained in:
Alexander Hill 2025-12-20 23:58:05 -05:00
parent d640c01cb1
commit e93c2168f5
2 changed files with 54 additions and 0 deletions

View File

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

View File

@ -1,5 +1,31 @@
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
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/
}