From 7f645680072a6128b1dce3ec8bc6c831888c58df Mon Sep 17 00:00:00 2001 From: arcanedev Date: Thu, 27 Oct 2022 16:16:22 +0000 Subject: [PATCH] added applicable build script --- README.md | 14 ++------------ kernel_build.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 kernel_build.sh diff --git a/README.md b/README.md index 072922a..8e5ffa5 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,8 @@ - `xbps-install -Sy make gcc xz elfutils elfutils-devel flex ncurses-devel openssl openssl-devel argp-standalone gcc-ada mpc libmpc-devel gmp-devel perl` ### Steps to create -- `cd /usr/src/` -- `wget https://git.arrr.cloud/whichdoc/plague-kernel/-/raw/main/5.10-hardened.config -o linux-hardened-"$KVER"/.config` -- `/usr/bin/curl --verbose --tlsv1.3 --proto =https -L -O --url "https://github.com/anthraxx/linux-hardened/archive/refs/tags/5.10."$KVER"-hardened1.tar.gz"` -- `tar -xvf 5.10."$KVER"-hardened1.tar.gz` -- `cd 5.10."$KVER"-hardened1` -- `make oldconfig` -- `make menuconfig` # (if any changes are required) -- `make --jobs=4` # start compiling with your number of allocated threads -- `make modules_install` # create /lib/modules/$kver -- `cp ./arch/x86_64/boot/bzImage /boot/vmlinuz-5.10."$KVER"-hardened1_1 && dracut --kver 5.10."$KVER"-hardened1_1 --force` -- `grub-mkconfig -o /boot/grub/grub.cfg` -- `xbps-reconfigure -fa` +1. Set the KVER variable to which version you want to obtain from Anthraxx's linux-hardened repository +2. Run `bash kernel_build.sh` ### Steps to import/configure release - Built into PlagueOS installer diff --git a/kernel_build.sh b/kernel_build.sh new file mode 100644 index 0000000..6e1c3fd --- /dev/null +++ b/kernel_build.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Set VAR +KVER='' +#KVER='5.10.145-hardened1' +#KVER='5.15.74-hardened1' + +# Dependencies +xbps-install -Sy make gcc xz elfutils elfutils-devel flex ncurses-devel openssl openssl-devel argp-standalone gcc-ada mpc libmpc-devel gmp-devel perl + +# 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://git.arrr.cloud/whichdoc/plague-kernel/-/raw/main/5.10-hardened.config -o .config + + +# Address system and file timing for clock skew runtime compilation error +plague-time-sync +find . -type f | xargs -n 5 touch +make clean + +# Compilation +make oldconfig +make menuconfig +echo "Compiling "$KVER"" +make --jobs=9 +make modules_install + +# Ensure /boot is rw +mount -o remount,rw /boot +cp ./arch/x86_64/boot/bzImage /boot/vmlinuz-"$KVER"_1 +dracut --kver "$KVER"_1 --force +grub-mkconfig -o /boot/grub/grub.cfg + +# remove sysmap/signing keys +rm /lib/modules/"$KVER"_1/source/certs/signing_key* +rm /lib/modules/"$KVER"_1/source/System.map +rm /lib/modules/"$KVER"_1/source +rm /lib/modules/"$KVER"_1/build