From f39f718d55c6cc170a63d8d6312186817e20cfab Mon Sep 17 00:00:00 2001 From: kvj Date: Mon, 11 Dec 2023 19:21:56 +0100 Subject: [PATCH] Initial commit --- kernbuild | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 kernbuild diff --git a/kernbuild b/kernbuild new file mode 100755 index 0000000..6c0b281 --- /dev/null +++ b/kernbuild @@ -0,0 +1,71 @@ +#!/bin/bash + +red='\033[0;31m' +clear='\033[0m' +green='\033[0;32m' +yellow='\033[0;33m' +blue='\033[0;34m' +italic='\e[3m' +norm='\e[0m' + +if [ $USER = "root" ]; then + root="" +else + root="doas" +fi + +# echo -e "${blue}${italic} TEXT ${clear}${norm}" +echo -e "${blue}${italic}eselect kernel list ${clear}${norm}" +eselect kernel list +echo -e "${yellow}Is the correct kernel version selected?${clear} [${green}y/${clear}${red}n${clear}]" +read -p "$ ~ " +if [[ $REPLY =~ ^[Yy]$ ]] +then + echo " " + #echo -e "${red} TEXT ${clear}" + echo -e "${red} Changing directory to "/usr/src/linux/".${clear}" + echo -e "${blue}${italic} cd /usr/src/linux/ ${clear}${norm}" + cd /usr/src/linux/ && + echo " " + + echo -e "${yellow}Do you want to change kernel configuration before compiling?${clear} [${green}y/${clear}${red}n${clear}]" + read -p "$ ~ " + if [[ $REPLY =~ ^[Yy]$ ]] + then + echo -e "${red} Running menuconfig. ${clear}" + echo -e "${blue}${italic} ${root} make -j16 menuconfig ${clear}${norm}" + ${root} make -j16 menuconfig && + echo "" + fi + + + echo -e "${red} Compiling kernel. ${clear}" + echo -e "${blue}${italic} ${root} make -j16 KCFLAGS='-O3 -march=native -mtune=native -pipe' ${clear}${norm}" + ${root} make -j16 KCFLAGS="-O3 -march=native -mtune=native -pipe" && + echo " " + + + echo -e "${red} Installing modules. ${clear}" + echo -e "${blue}${italic} ${root} make modules_install ${clear}${norm}" + ${root} make modules_install && + echo " " + + + echo -e "${red} Installing kernel. ${clear}" + echo -e "${blue}${italic} ${root} make install ${clear}${norm}" + ${root} make install && + echo " " + + + echo -e "${red} Installing nVidia GPU drivers. ${clear}" + echo -e "${blue}${italic} ${root} emerge nvidia-drivers ${clear}${norm}" + ${root} emerge nvidia-drivers && + echo " " + + echo -e "${red} Updating GRUB' configuration file.${clear}" + echo -e "${blue}${italic} ${root} grub-mkconfig -o /boot/grub/grub.cfg ${clear}${norm}" + ${root} grub-mkconfig -o /boot/grub/grub.cfg + echo " " + +fi +