Various refactorings + Enable Clang LTO (#248)

* Enable Clang LTO

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: improve kernel prompting and selection code

- Subversion are to be directly edited in the _kver_subver_map
variable at the top of the file
- _supported_kernels is theoretically not needed, but it's needed
for the prompting to happen with the correct order, since the
keys in _kver_subver_map are hash-ordered, which is not the
natural ordering

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: update comment

* prepare: improve compiler selection and LTO enablement code path

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* install.sh: use _prompt_from_array for distro selection

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: move optiprofile prompt to _prompt_from_array

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: improve cpu sched fallback code

* install.sh: move set -e at the top

* prepare: use arrays for HZ configs

* prepare: enable default selection in _prompt_from_array

* prepare: use _prompt_from_array for _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: update _rr_interval prompting

* prepare: update and use config script for tickless

* prepare: use scripts/config accross the entire script

* prepare: change last lines to scripts/config

* prepare: small fixes

* customization.cfg: revert back to old values for _tickless

* prepare: revert back to old numbering for _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: msg2 used _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: be smarter/dumber with _rr_interval

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: remove last manual interventions to .config

* prepare: fix condition

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: improve cpu march handling and implement prompt

Making `make` prompt wasn't working on my Gentoo for a
reason I don't understand anymore. The configs are unset
by the script. So it always goes for generic by default.
Maybe they need to be entirely deleted from the .config
file.

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: fix name for MuQSS.c

* prepare: use _sched for scheduler source code files

* install.sh: use sudo to clean root owned files in linux-src-git

* prepare: remove useless code

* prepare: fix issue with MuQSS

* Add CacULE scheduler

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* 5.13 rc4

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: Remove voluntary_preempt, OFenable and disable_acpi_cpufreq options

* prepare: Prevent config prompt w/ modprobed-db

Rebase of @CodingKoopa PR

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: Empty LOCALVERSION config option for Arch at the correct spot

@CodingKoopa spotted the issue and reported it, thanks!

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* prepare: use _enable _undefine and _disable wrappers

Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

* Restore the state tracker for makepkg usage

* Fix tickless array selection order for nohz idle/hz periodic

* Also handle the disabling part of the generic march selector

* Replace _undefine() calls with _disable()

* Preserve the case of config options passed to scripts/config

* Echo the CONFIG_EXPERT options without blank lines

And with a header/footer
Makes searching for config setting bugs easier

* prepare: uppercase config options with "tr"

Co-authored-by: Etienne JUVIGNY <ti3nou@gmail.com>
This commit is contained in:
Adel Kara Slimane
2021-06-01 20:14:47 +02:00
committed by GitHub
parent 3e6a12eb76
commit dea8847167
4 changed files with 638 additions and 770 deletions

View File

@@ -36,7 +36,12 @@ if [ -e "$_EXT_CONFIG_PATH" ]; then
source "$_EXT_CONFIG_PATH"
fi
# Make sure we're in a clean state
if [ ! -e "$_where"/BIG_UGLY_FROGMINER ]; then
_tkg_initscript
else
source "$_where"/BIG_UGLY_FROGMINER
fi
if [[ "$_sub" = rc* ]]; then
_srcpath="linux-${_basekernel}-${_sub}"

View File

@@ -42,6 +42,7 @@ _force_all_threads="true"
_noccache="false"
# Set to true to use modprobed db to clean config from unneeded modules. Speeds up compilation considerably. Requires root - https://wiki.archlinux.org/index.php/Modprobed-db
# Using this option can trigger user prompts if the config doesn't go smoothly.
# !!!! Make sure to have a well populated db !!!! - Leave empty to be asked about it at build time
_modprobeddb="false"
@@ -84,6 +85,12 @@ _cpusched=""
# For advanced users.
_compiler=""
# Clang LTO mode, only available with the "llvm" compiler - options are "no", "full" or "thin".
# "no: do not enable LTO"
# "full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains."
# "thin: uses multiple threads, faster and uses less memory, may have a lower runtime performance than Full."
_lto_mode=""
# CPU sched_yield_type - Choose what sort of yield sched_yield will perform
# For PDS and MuQSS: 0: No yield. (Recommended option for gaming on PDS and MuQSS)
# 1: Yield only to better priority/deadline tasks. (Default - can be unstable with PDS on some platforms)
@@ -110,7 +117,7 @@ _numadisable="false"
# Set to "true" to enable misc additions - May contain temporary fixes pending upstream or changes that can break on non-Arch - Kernel default is "true"
_misc_adds="true"
# Set to "1" to use CattaRappa mode (enabling full tickless), "2" for tickless idle only, or "0" for periodic ticks.
# Set to "0" for periodic ticks, "1" to use CattaRappa mode (enabling full tickless) and "2" for tickless idle only.
# Full tickless can give higher performances in various cases but, depending on hardware, lower consistency. Just tickless idle can perform better on some platforms (mostly AMD based).
_tickless=""
@@ -166,7 +173,7 @@ _random_trust_cpu="false"
# Valid values are "none", "smt", "mc", "mc-llc"(for zen), "smp", "all" - Kernel default is "smt"
_runqueue_sharing=""
# Timer frequency - "100" "500", "750" or "1000" ("2000" can be set for cacule cpu sched, and will fallback to 1000 for other schedulers) - More options available in kernel config prompt when left empty depending on selected cpusched - Kernel default is "500" - For MuQSS, 100Hz is recommended
# Timer frequency - "100" "500", "750" or "1000" ("2000" can be set for cacule cpu sched, and will fallback to default if set while on another schedulers) - More options available in kernel config prompt when left empty depending on selected cpusched with the default option pointed with a ">"
_timer_freq=""
# Default CPU governor - "performance", "ondemand", "schedutil" or leave empty for default (schedutil)

View File

@@ -1,5 +1,15 @@
#!/bin/bash
# Stop the script at any ecountered error
set -e
_where=`pwd`
srcdir="$_where"
source customization.cfg
source linux-tkg-config/prepare
msg2() {
echo -e " \033[1;34m->\033[1;0m \033[1;1m$1\033[1;0m" >&2
}
@@ -17,37 +27,10 @@ plain() {
}
_distro_prompt() {
while true; do
echo "Which linux distribution are you running ?"
echo "if it's not on the list, chose the closest one to it: Fedora/Suse for RPM, Ubuntu/Debian for DEB"
echo " 1) Debian"
echo " 2) Fedora"
echo " 3) Suse"
echo " 4) Ubuntu"
echo " 5) Generic"
read -p "[1-5]: " _distro_index
if [ "$_distro_index" = "1" ]; then
_distro="Debian"
break
elif [ "$_distro_index" = "2" ]; then
_distro="Fedora"
break
elif [ "$_distro_index" = "3" ]; then
_distro="Suse"
break
elif [ "$_distro_index" = "4" ]; then
_distro="Ubuntu"
break
elif [ "$_distro_index" = "5" ]; then
_distro="Generic"
break
else
echo "Wrong index."
fi
done
_prompt_from_array "Debian" "Fedora" "Suse" "Ubuntu" "Generic"
_distro="${_selected_value}"
}
_install_dependencies() {
@@ -123,8 +106,14 @@ _linux_git_branch_checkout() {
msg2 "Reseting files to their original state"
git reset --hard HEAD
if [ "${_distro}" = "Generic" ]; then
msg2 "Please enter your sudo password so the script can clean root owned files from the kernel sources"
sudo git clean -fdx
else
git clean -f -d -x
fi
fi
if [[ "$_sub" = rc* ]]; then
msg2 "Switching to master branch for RC Kernel"
@@ -171,16 +160,6 @@ _linux_git_branch_checkout() {
}
# Stop the script at any ecountered error
set -e
_where=`pwd`
srcdir="$_where"
source customization.cfg
source linux-tkg-config/prepare
if [ "$1" != "install" ] && [ "$1" != "config" ] && [ "$1" != "uninstall-help" ]; then
msg2 "Argument not recognised, options are:
- config : interactive script that shallow clones the linux 5.x.y git tree into the folder linux-src-git, then applies extra patches and prepares the .config file
@@ -282,9 +261,6 @@ if [ "$1" = "install" ] || [ "$1" = "config" ]; then
# apply linux-tkg patching script
_tkg_srcprep
# source cpuschedset since _cpusched isn't set
source "$srcdir"/cpuschedset
# Uppercase characters are not allowed in source package name for debian based distros
if [ "$_distro" = "Debian" ] || [ "$_distro" = "Ubuntu" ] && [ "$_cpusched" = "MuQSS" ]; then
_cpusched="muqss"

File diff suppressed because it is too large Load Diff