Initial commit

main
kvj 2023-12-11 19:21:56 +01:00
parent 78e31c4474
commit f39f718d55
1 changed files with 71 additions and 0 deletions

71
kernbuild Executable file
View File

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