cp $_script_loc/linux57-tkg-patches/* "$_where" # copy patches inside the PKGBUILD's dir to preserve makepkg sourcing and md5sum checking
cp $_script_loc/linux57-tkg-config/* "$_where" # copy config files and hooks inside the PKGBUILD's dir to preserve makepkg sourcing and md5sum checking
cd $_script_loc/linux-${_basekernel}
msg2 "Downloading Graysky2's CPU optimisations patch"
wget $_cpu_opt_patch_link
msg2 "Done"
cd $_script_loc
if [ -z "$_OPTIPROFILE" ] && [ ! -e "$_where"/cpuschedset ]; then
# Prompt about optimized configurations. Available variable values will overwrite customization.cfg/external config ones.
plain "Do you want to use a predefined optimized profile?"
if [ "${_cpusched}" == "MuQSS" ] || [ "${_cpusched}" == "pds" ] || [ "${_cpusched}" == "bmq" ]; then
# Disable CFS
sed -i -e 's/CONFIG_FAIR_GROUP_SCHED=y/# CONFIG_FAIR_GROUP_SCHED is not set/' ./.config
sed -i -e 's/CONFIG_CFS_BANDWIDTH=y/# CONFIG_CFS_BANDWIDTH is not set/' ./.config
# sched yield type
if [ -n "$_sched_yield_type" ]; then
CONDITION0="$_sched_yield_type"
else
plain ""
plain "CPU sched_yield_type - Choose what sort of yield sched_yield will perform."
plain ""
plain "For PDS and MuQSS:"
plain "0: No yield."
plain "1: Yield only to better priority/deadline tasks."
plain "2: Expire timeslice and recalculate deadline."
plain ""
plain "For BMQ (experimental) - No recommended value yet, so try for yourself x) :"
plain "0: No yield."
plain "1: Deboost and requeue task. (default)"
plain "2: Set rq skip task."
if [ "${_cpusched}" == "MuQSS" ]; then
read -rp "`echo $'\n 0. Supposedly best option for gaming performance - could lead to stability issues on some (AMD) platforms when combined with MuQSS\n > 1. Default and recommended option for MuQSS - could lead to stability issues on some (Intel) platforms\n 2. Can be a good option with low rr_interval on MuQSS\n [0-2?]: '`" CONDITION0;
else
read -rp "`echo $'\n > 0. Recommended option for gaming on PDS - "tkg" default\n 1. Default, but can lead to stability issues on some platforms\n 2. Can be a good option with low rr_interval on MuQSS\n [0-2?]: '`" CONDITION0;
sed -i -e 's/CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y/# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set/' ./.config
sed -i -e 's/# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set/CONFIG_CC_OPTIMIZE_FOR_SIZE=y/' ./.config
echo "# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 is not set" >> ./.config
fi
# cpu opt
if [ -n "$_processor_opt" ] && [ "$_processor_opt" != "native" ]; then
echo "# CONFIG_MNATIVE is not set" >> ./.config
fi
if [ -n "$_processor_opt" ] && [ "$_processor_opt" != "generic" ]; then
sed -i -e 's/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/' ./.config
fi
if [ "$_processor_opt" == "native" ]; then
echo "CONFIG_MNATIVE=y" >> ./.config
elif [ "$_processor_opt" == "k8" ]; then
sed -i -e 's/# CONFIG_MK8 is not set/CONFIG_MK8=y/' ./.config
elif [ "$_processor_opt" == "k8sse3" ]; then
sed -i -e 's/# CONFIG_MK8SSE3 is not set/CONFIG_MK8SSE3=y/' ./.config
elif [ "$_processor_opt" == "k10" ]; then
sed -i -e 's/# CONFIG_MK10 is not set/CONFIG_MK10=y/' ./.config
elif [ "$_processor_opt" == "barcelona" ]; then
sed -i -e 's/# CONFIG_MBARCELONA is not set/CONFIG_MBARCELONA=y/' ./.config
elif [ "$_processor_opt" == "bobcat" ]; then
sed -i -e 's/# CONFIG_MBOBCAT is not set/CONFIG_MBOBCAT=y/' ./.config
elif [ "$_processor_opt" == "jaguar" ]; then
sed -i -e 's/# CONFIG_MJAGUAR is not set/CONFIG_MJAGUAR=y/' ./.config
elif [ "$_processor_opt" == "bulldozer" ]; then
sed -i -e 's/# CONFIG_MBULLDOZER is not set/CONFIG_MBULLDOZER=y/' ./.config
elif [ "$_processor_opt" == "piledriver" ]; then
sed -i -e 's/# CONFIG_MPILEDRIVER is not set/CONFIG_MPILEDRIVER=y/' ./.config
elif [ "$_processor_opt" == "steamroller" ]; then
sed -i -e 's/# CONFIG_MSTEAMROLLER is not set/CONFIG_MSTEAMROLLER=y/' ./.config
elif [ "$_processor_opt" == "excavator" ]; then
sed -i -e 's/# CONFIG_MEXCAVATOR is not set/CONFIG_MEXCAVATOR=y/' ./.config
elif [ "$_processor_opt" == "zen" ]; then
sed -i -e 's/# CONFIG_MZEN is not set/CONFIG_MZEN=y/' ./.config
elif [ "$_processor_opt" == "zen2" ]; then
sed -i -e 's/# CONFIG_MZEN2 is not set/CONFIG_MZEN2=y/' ./.config
elif [ "$_processor_opt" == "mpsc" ]; then
sed -i -e 's/# CONFIG_MPSC is not set/CONFIG_MPSC=y/' ./.config
elif [ "$_processor_opt" == "atom" ]; then
sed -i -e 's/# CONFIG_MATOM is not set/CONFIG_MATOM=y/' ./.config
elif [ "$_processor_opt" == "core2" ]; then
sed -i -e 's/# CONFIG_MCORE2 is not set/CONFIG_MCORE2=y/' ./.config
elif [ "$_processor_opt" == "nehalem" ]; then
sed -i -e 's/# CONFIG_MNEHALEM is not set/CONFIG_MNEHALEM=y/' ./.config
elif [ "$_processor_opt" == "westmere" ]; then
sed -i -e 's/# CONFIG_MWESTMERE is not set/CONFIG_MWESTMERE=y/' ./.config
elif [ "$_processor_opt" == "silvermont" ]; then
sed -i -e 's/# CONFIG_MSILVERMONT is not set/CONFIG_MSILVERMONT=y/' ./.config
elif [ "$_processor_opt" == "sandybridge" ]; then
sed -i -e 's/# CONFIG_MSANDYBRIDGE is not set/CONFIG_MSANDYBRIDGE=y/' ./.config
elif [ "$_processor_opt" == "ivybridge" ]; then
sed -i -e 's/# CONFIG_MIVYBRIDGE is not set/CONFIG_MIVYBRIDGE=y/' ./.config
elif [ "$_processor_opt" == "haswell" ]; then
sed -i -e 's/# CONFIG_MHASWELL is not set/CONFIG_MHASWELL=y/' ./.config
elif [ "$_processor_opt" == "broadwell" ]; then
sed -i -e 's/# CONFIG_MBROADWELL is not set/CONFIG_MBROADWELL=y/' ./.config
elif [ "$_processor_opt" == "skylake" ]; then
sed -i -e 's/# CONFIG_MSKYLAKE is not set/CONFIG_MSKYLAKE=y/' ./.config
elif [ "$_processor_opt" == "skylakex" ]; then
sed -i -e 's/# CONFIG_MSKYLAKEX is not set/CONFIG_MSKYLAKEX=y/' ./.config
elif [ "$_processor_opt" == "cannonlake" ]; then
sed -i -e 's/# CONFIG_MCANNONLAKE is not set/CONFIG_MCANNONLAKE=y/' ./.config
elif [ "$_processor_opt" == "icelake" ]; then
sed -i -e 's/# CONFIG_MICELAKE is not set/CONFIG_MICELAKE=y/' ./.config
elif [ "$_processor_opt" == "goldmont" ]; then
sed -i -e 's/# CONFIG_MGOLDMONT is not set/CONFIG_MGOLDMONT=y/' ./.config
elif [ "$_processor_opt" == "goldmontplus" ]; then
sed -i -e 's/# CONFIG_MGOLDMONTPLUS is not set/CONFIG_MGOLDMONTPLUS=y/' ./.config
elif [ "$_processor_opt" == "cascadelake" ]; then
sed -i -e 's/# CONFIG_MCASCADELAKE is not set/CONFIG_MCASCADELAKE=y/' ./.config
elif [ "$_processor_opt" == "cooperlake" ]; then
sed -i -e 's/# CONFIG_MCOOPERLAKE is not set/CONFIG_MCOOPERLAKE=y/' ./.config
elif [ "$_processor_opt" == "tigerlake" ]; then
sed -i -e 's/# CONFIG_MTIGERLAKE is not set/CONFIG_MTIGERLAKE=y/' ./.config
fi
# irq threading
if [ "$_irq_threading" == "true" ]; then
echo "CONFIG_FORCE_IRQ_THREADING=y" >> ./.config
elif [ "$_irq_threading" == "false" ]; then
echo "# CONFIG_FORCE_IRQ_THREADING is not set" >> ./.config
fi
# smt nice
if [ "$_smt_nice" == "true" ]; then
echo "CONFIG_SMT_NICE=y" >> ./.config
elif [ "$_smt_nice" == "false" ]; then
echo "# CONFIG_SMT_NICE is not set" >> ./.config
fi
# random trust cpu
if [ "$_random_trust_cpu" == "true" ]; then
sed -i -e 's/# CONFIG_RANDOM_TRUST_CPU is not set/CONFIG_RANDOM_TRUST_CPU=y/' ./.config
fi
# rq sharing
if [ "$_runqueue_sharing" == "none" ]; then
echo -e "CONFIG_RQ_NONE=y\n# CONFIG_RQ_SMT is not set\n# CONFIG_RQ_MC is not set\n# CONFIG_RQ_MC_LLC is not set\n# CONFIG_RQ_SMP is not set\n# CONFIG_RQ_ALL is not set" >> ./.config
echo -e "# CONFIG_RQ_NONE is not set\nCONFIG_RQ_SMT=y\n# CONFIG_RQ_MC is not set\n# CONFIG_RQ_MC_LLC is not set\n# CONFIG_RQ_SMP is not set\n# CONFIG_RQ_ALL is not set" >> ./.config
elif [ "$_runqueue_sharing" == "mc" ]; then
echo -e "# CONFIG_RQ_NONE is not set\n# CONFIG_RQ_SMT is not set\nCONFIG_RQ_MC=y\n# CONFIG_RQ_MC_LLC is not set\n# CONFIG_RQ_SMP is not set\n# CONFIG_RQ_ALL is not set" >> ./.config
elif [ "$_runqueue_sharing" == "smp" ]; then
echo -e "# CONFIG_RQ_NONE is not set\n# CONFIG_RQ_SMT is not set\n# CONFIG_RQ_MC is not set\n# CONFIG_RQ_MC_LLC is not set\nCONFIG_RQ_SMP=y\n# CONFIG_RQ_ALL is not set" >> ./.config
elif [ "$_runqueue_sharing" == "all" ]; then
echo -e "# CONFIG_RQ_NONE is not set\n# CONFIG_RQ_SMT is not set\n# CONFIG_RQ_MC is not set\n# CONFIG_RQ_MC_LLC is not set\n# CONFIG_RQ_SMP is not set\nCONFIG_RQ_ALL=y" >> ./.config
elif [ "$_runqueue_sharing" == "mc-llc" ]; then
echo -e "# CONFIG_RQ_NONE is not set\n# CONFIG_RQ_SMT is not set\n# CONFIG_RQ_MC is not set\nCONFIG_RQ_MC_LLC=y\n# CONFIG_RQ_SMP is not set\n# CONFIG_RQ_ALL is not set" >> ./.config
fi
# timer freq
if [ -n "$_timer_freq" ] && [ "$_timer_freq" != "300" ]; then
sed -i -e 's/CONFIG_HZ_300=y/# CONFIG_HZ_300 is not set/' ./.config
sed -i -e 's/CONFIG_HZ_300_NODEF=y/# CONFIG_HZ_300_NODEF is not set/' ./.config
if [ "$_timer_freq" == "1000" ]; then
sed -i -e 's/# CONFIG_HZ_1000 is not set/CONFIG_HZ_1000=y/' ./.config
sed -i -e 's/CONFIG_HZ=300/CONFIG_HZ=1000/' ./.config
echo "# CONFIG_HZ_500 is not set" >> ./.config
echo "# CONFIG_HZ_500_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_750 is not set" >> ./.config
echo "# CONFIG_HZ_750_NODEF is not set" >> ./.config
echo "CONFIG_HZ_1000_NODEF=y" >> ./.config
echo "# CONFIG_HZ_250_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_300_NODEF is not set" >> ./.config
elif [ "$_timer_freq" == "750" ]; then
sed -i -e 's/CONFIG_HZ=300/CONFIG_HZ=750/' ./.config
echo "# CONFIG_HZ_500 is not set" >> ./.config
echo "# CONFIG_HZ_500_NODEF is not set" >> ./.config
echo "CONFIG_HZ_750=y" >> ./.config
echo "CONFIG_HZ_750_NODEF=y" >> ./.config
echo "# CONFIG_HZ_1000_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_250_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_300_NODEF is not set" >> ./.config
elif [ "$_timer_freq" == "500" ]; then
sed -i -e 's/CONFIG_HZ=300/CONFIG_HZ=500/' ./.config
echo "CONFIG_HZ_500=y" >> ./.config
echo "CONFIG_HZ_500_NODEF=y" >> ./.config
echo "# CONFIG_HZ_750 is not set" >> ./.config
echo "# CONFIG_HZ_750_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_1000_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_250_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_300_NODEF is not set" >> ./.config
elif [ "$_timer_freq" == "100" ]; then
sed -i -e 's/CONFIG_HZ=300/CONFIG_HZ=100/' ./.config
echo "# CONFIG_HZ_500 is not set" >> ./.config
echo "# CONFIG_HZ_750 is not set" >> ./.config
echo "# CONFIG_HZ_1000_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_750_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_500_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_250_NODEF is not set" >> ./.config
echo "# CONFIG_HZ_300_NODEF is not set" >> ./.config