#!/bin/sh VERSION="6.12.11" MAJOR_VERSION="$(echo "$VERSION" | sed -E 's/^([0-9]*)\..*$/\1/g')" SRC_DIR=".kernel" URL="https://cdn.kernel.org/pub/linux/kernel/v$MAJOR_VERSION.x/linux-$VERSION.tar.xz" TARGET_KERNEL="linux-$VERSION/arch/x86_64/boot/bzImage" mkdir -p "$SRC_DIR" cd "$SRC_DIR" if [ ! -e "linux-$VERSION" ]; then curl "$URL" | tar -J -xvf - fi if [ ! -e "$TARGET_KERNEL" ]; then cd "linux-$VERSION" make defconfig make -j$(nproc) fi echo "$SRC_DIR/$TARGET_KERNEL"