mirror of
https://0xacab.org/optout/plague-kernel.git
synced 2024-09-28 22:26:09 +00:00
55 lines
1.5 KiB
Bash
55 lines
1.5 KiB
Bash
#!/bin/bash
|
|
|
|
# Set VAR
|
|
KVER='6.6.15-hardened1'
|
|
#KVER='5.10.145-hardened1'
|
|
|
|
# Dependencies
|
|
sudo dnf install binutils /usr/include/{libelf.h,openssl/pkcs7.h} \
|
|
/usr/bin/{bc,bison,flex,gcc,git,openssl,make,perl,pahole,zstd}
|
|
|
|
function set_kver() {
|
|
echo "Enter the kernel version to use (e.g., '6.6.15-hardened1'):"
|
|
while true; do
|
|
read -e -i "${KVER:-}" -p "" KVER
|
|
if [[ $(echo $KVER | grep -E '^[0-9]+\.[0-9]+\.[0-9]+(-hardened1)$') == '' ]]; then
|
|
echo "Invalid format.";
|
|
else
|
|
break;
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Invoke function to prompt end-user for desired version (must be an active release in the Anthraxx Linux-Hardened repository)
|
|
set_kver
|
|
|
|
# Staging w/ error handling
|
|
if [[ ! -f /usr/src/"$KVER".tar.gz ]]; then
|
|
/usr/bin/curl --verbose --tlsv1.3 --proto =https -L -O --url "https://github.com/anthraxx/linux-hardened/archive/refs/tags/"$KVER".tar.gz"
|
|
fi
|
|
|
|
if [[ ! -d /usr/src/linux-hardened-"$KVER" ]]; then
|
|
tar -xf "$KVER".tar.gz -C /usr/src/
|
|
fi
|
|
|
|
cd /usr/src/linux-hardened-"$KVER"
|
|
wget https://0xacab.org/optout/plague-kernel/-/raw/main/6.6.15-hardened1.config -O .config
|
|
|
|
|
|
# Compilation
|
|
yes "" | make olddefconfig
|
|
make menuconfig
|
|
# Exit if making no changes
|
|
|
|
echo "Compiling "$KVER""
|
|
make -j $(nproc --all)
|
|
|
|
# Installing kernel
|
|
## Ensure /boot is rw
|
|
mount -o remount,rw /boot
|
|
make -j $(nproc --all)
|
|
command -v installkernel && make modules_install INSTALL_MOD_STRIP=1 install
|
|
|
|
# remove sysmap/signing keys
|
|
rm /lib/modules/"$KVER"_1/source/certs/signing_key*
|
|
rm /lib/modules/"$KVER"_1/source/System.map |