Last active
April 10, 2025 20:00
-
-
Save mdPlusPlus/031ec2dac2295c9aaf1fc0b0e808e21a to your computer and use it in GitHub Desktop.
Revisions
-
mdPlusPlus revised this gist
Sep 18, 2021 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,8 @@ function install_dependencies() { echo "Installing dependencies..." sudo apt -qq update sudo apt -qq install -y curl git wget # sudo apt -qq install -y bison flex kernel-package libelf-dev libssl-dev sudo apt -qq install -y bison flex libelf-dev libssl-dev } function init() { @@ -120,15 +121,15 @@ function try_acso_patch() { wget -O ../acso_5_12_13.patch "${acso_patch_5_12_13}" if $(git apply --check ../acso_5_12_13.patch) then echo "Applying acs override patch for 5.12.13+." git apply ../acso_5_12_13.patch else echo "Trying to apply acs override patch for 5.6.12+." wget -O ../acso_5_6_12.patch "${acso_patch_5_6_12}" if $(git apply --check ../acso_5_6_12.patch) then echo "Applying acs override patch for 5.6.12+." git apply ../acso_5_6_12.patch else echo "Trying to apply acs override patch for 5.4+." -
mdPlusPlus revised this gist
Jul 28, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -168,7 +168,7 @@ function try_acso_patch() { else echo "Last resort: Trying to apply acs override patch for Ubuntu repository kernel source." wget -O ../acso_4_18_ubuntu.patch "${acso_patch_4_18_ubuntu}" if $(git apply --check ../acso_4_18_ubuntu.patch) then echo "Applying acs override patch for Ubuntu repository kernel source." git apply ../acso_4_18_ubuntu.patch -
mdPlusPlus revised this gist
Jul 28, 2021 . 1 changed file with 18 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -106,22 +106,24 @@ function stable_or_mainline_or_repo() { function try_acso_patch() { ## TODO: I really should not do this manually ... acso_patch_5_12_13="https://raw.githubusercontent.com/mdPlusPlus/linux-acs-override/master/patches/acso_5_12_13.patch" acso_patch_5_6_12="https://raw.githubusercontent.com/mdPlusPlus/linux-acs-override/master/patches/acso_5_6_12.patch" acso_patch_5_4="https://raw.githubusercontent.com/mdPlusPlus/linux-acs-override/master/patches/acso_5_4.patch" acso_patch_4_18="https://raw.githubusercontent.com/mdPlusPlus/linux-acs-override/master/patches/acso_4_18.patch" acso_patch_4_17="https://raw.githubusercontent.com/mdPlusPlus/linux-acs-override/master/patches/acso_4_17.patch" acso_patch_4_14="https://raw.githubusercontent.com/mdPlusPlus/linux-acs-override/master/patches/acso_4_14.patch" acso_patch_4_10="https://raw.githubusercontent.com/mdPlusPlus/linux-acs-override/master/patches/acso_4_10.patch" acso_patch_4_18_ubuntu="https://gist.github.com/mdPlusPlus/bb3df6248ffc7c6b3772ae0901659966/raw/acso_4_18_ubuntu.patch" echo "Trying to apply acs override patch for 5.12.13+." wget -O ../acso_5_12_13.patch "${acso_patch_5_12_13}" if $(git apply --check ../acso_5_12_13.patch) then echo "Applying acs override patch for 5.6_12+." git apply ../acso_5_6_12.patch else echo "Trying to apply acs override patch for 5.6.12+." wget -O ../acso_5_6_12.patch "${acso_patch_5_6_12}" if $(git apply --check ../acso_5_6_12.patch) @@ -166,7 +168,7 @@ function try_acso_patch() { else echo "Last resort: Trying to apply acs override patch for Ubuntu repository kernel source." wget -O ../acso_4_18_ubuntu.patch "${acso_patch_4_18_ubuntu}" if $(git apply --check ../acso_4_18_ubuntu.patch) then echo "Applying acs override patch for Ubuntu repository kernel source." git apply ../acso_4_18_ubuntu.patch @@ -188,7 +190,8 @@ function try_acso_patch() { fi rm -f ../acso_5_6_12.patch fi rm -f ../acso_5_2_13.patch kernel_localversion+="-acso" } @@ -426,6 +429,6 @@ function independent_code() { echo "Make sure to check out https://github.com/gnif/vendor-reset" } ## actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Jul 28, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -75,7 +75,7 @@ function stable_or_mainline_or_repo() { read -r default fi echo -n "Do you want to install the kernel source? [y/N] " read -r source if [[ -z "${s_or_m_or_r}" || "${s_or_m_or_r}" == "s" || "${s_or_m_or_r}" == "S" ]] -
mdPlusPlus revised this gist
Jul 27, 2021 . 1 changed file with 125 additions and 105 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,11 +60,11 @@ function stable_or_mainline_or_repo() { echo -n "Do you want to apply the acs override patch? Kernels below 4.10 are not supported. [Y/n] " read -r acso echo -n "Do you want to apply the experimental AMD AGESA patch to fix VFIO setups on AGESA 0.0.7.2 and some others? [y/N] " read -r agesa # echo -n "Do you want to apply the experimental AMD Vega PCI reset patch? [y/N] " # read -r vega echo -n "Do you want to install the kernel and its headers after compilation? [Y/n] " read -r install @@ -75,6 +75,9 @@ function stable_or_mainline_or_repo() { read -r default fi echo -n "Do you want to install the kernel source [y/N] " read -r source if [[ -z "${s_or_m_or_r}" || "${s_or_m_or_r}" == "s" || "${s_or_m_or_r}" == "S" ]] then stable_preparations @@ -101,6 +104,9 @@ function stable_or_mainline_or_repo() { } function try_acso_patch() { ## TODO: I really should not do this manually ... acso_patch_5_10_4="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/5.10.4/acso.patch" acso_patch_5_6_12="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/5.6.12/acso.patch" acso_patch_5_4="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/5.4/acso.patch" acso_patch_4_18="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.18/acso.patch" @@ -109,78 +115,86 @@ function try_acso_patch() { acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" acso_patch_4_18_ubuntu="https://gist.github.com/mdPlusPlus/bb3df6248ffc7c6b3772ae0901659966/raw/acso_4_18_ubuntu.patch" echo "Trying to apply acs override patch for 5.10.4+." wget -O ../acso_5_10_4.patch "${acso_patch_5_10_4}" if $(git apply --check ../acso_5_10_4.patch) then echo "Applying acs override patch for 5.10.4+." git apply ../acso_5_10_4.patch else echo "Trying to apply acs override patch for 5.6.12+." wget -O ../acso_5_6_12.patch "${acso_patch_5_6_12}" if $(git apply --check ../acso_5_6_12.patch) then echo "Applying acs override patch for 5.6_12+." git apply ../acso_5_6_12.patch else echo "Trying to apply acs override patch for 5.4+." wget -O ../acso_5_4.patch "${acso_patch_5_4}" if $(git apply --check ../acso_5_4.patch) then echo "Applying acs override patch for 5.4+." git apply ../acso_5_4.patch else echo "Trying to apply acs override patch for 4.18+." wget -O ../acso_4_18.patch "${acso_patch_4_18}" if $(git apply --check ../acso_4_18.patch) then echo "Applying acs override patch for 4.18+." git apply ../acso_4_18.patch else echo "Trying to apply acs override patch for 4.17+." wget -O ../acso_4_17.patch "${acso_patch_4_17}" if $(git apply --check ../acso_4_17.patch) then echo "Applying acs override patch for 4.17+." git apply ../acso_4_17.patch else echo "Trying to apply acs override patch for 4.14+." wget -O ../acso_4_14.patch "${acso_patch_4_14}" if $(git apply --check ../acso_4_14.patch) then echo "Applying acs override patch for 4.14+." git apply ../acso_4_14.patch else echo "Trying to apply acs override patch for 4.10+." wget -O ../acso_4_10.patch "${acso_patch_4_10}" if $(git apply --check ../acso_4_10.patch) then echo "Applying acs override patch for 4.10+." git apply ../acso_4_10.patch else echo "Last resort: Trying to apply acs override patch for Ubuntu repository kernel source." wget -O ../acso_4_18_ubuntu.patch "${acso_patch_4_18_ubuntu}" if $(git apply --check ../acso_4_18_ubuntu.patch) then echo "Applying acs override patch for Ubuntu repository kernel source." git apply ../acso_4_18_ubuntu.patch else echo "[ERROR]: Failed to apply acs override patch. Exiting." exit fi rm -f ../acso_4_18_ubuntu.patch fi rm -f ../acso_4_10.patch fi rm -f ../acso_4_14.patch fi rm -f ../acso_4_17.patch fi rm -f ../acso_4_18.patch fi rm -f ../acso_5_4.patch fi rm -f ../acso_5_6_12.patch fi rm -f ../acso_5_10_4.patch kernel_localversion+="-acso" } function try_agesa_patch() { ## by reddit user https://www.reddit.com/user/hansmoman/ ## https://www.reddit.com/r/VFIO/comments/bqeixd/apparently_the_latest_bios_on_asrockmsi_boards/eo4neta agesa_patch="https://clbin.com/VCiYJ" agesa_patch_filename="agesa.patch" @@ -200,38 +214,38 @@ function try_agesa_patch() { kernel_localversion+="-agesa" } #function try_vega_patch() { # ## Original by github user https://gist.github.com/numinit # # vega_patch_new="https://gist.github.com/mdPlusPlus/1754d82b53269ead770133829874fbfd/raw/" # vega_patch="https://gist.githubusercontent.com/numinit/1bbabff521e0451e5470d740e0eb82fd/raw/0ec757c30cec041c3d0553bb246b5bc327d67abb/fix-vega-reset.patch" # vega_patch_filename="fix-vega-reset.patch" # # echo "Trying to apply AMD Vega reset patch." # wget -O ../${vega_patch_filename} "${vega_patch_new}" # # if $(git apply --check ../${vega_patch_filename}) # then # echo "Applying AMD Vega reset patch." # git apply ../${vega_patch_filename} # else # rm -f ../${vega_patch_filename} # wget -O ../${vega_patch_filename} "${vega_patch}" # # if $(git apply --check ../${vega_patch_filename}) # then # echo "Applying AMD Vega reset patch." # git apply ../${vega_patch_filename} # else # echo "[ERROR]: Failed to apply AMD Vega reset patch. Exiting." # exit # fi # fi # # rm -f ../${vega_patch_filename} # # kernel_localversion+="-vega" #} function stable_preparations() { echo "The newest available stable kernel version is ${stable_version}. Kernels below 4.10 are not supported." @@ -247,7 +261,7 @@ function stable_preparations() { kernel_name="linux-${kernel_version}" ## Test whether the version string starts with 3, 4, or 5 and sets the URL accordingly if [[ $stable_version == 5* ]] then stable_link="${stable_releases_5x_url}linux-${stable_version}.tar.xz" @@ -309,11 +323,11 @@ function repo_preparations() { fi fi ## linux-hwe (5.0.0-25.26~18.04.1) bionic; urgency=medium ## -> ## 5.0.0-25.26~18.04.1 #kernel_version=$(head -n 1 debian/changelog | cut -d '(' -f 2 | cut -d ')' -f 1) ## This somehow comes out empty when run in the script, but is successful when issued manually independent_code } @@ -331,13 +345,10 @@ function independent_code() { try_agesa_patch fi # if [[ "${vega}" == "y" || "${vega}" == "Y" ]] # then # try_vega_patch # fi cp "${kernel_config}" .config yes '' | make oldconfig @@ -349,12 +360,12 @@ function independent_code() { ##Enable AMD's HSA driver for ROCm support. Thanks at https://github.com/jfturcot sed -i -e 's/^#\ CONFIG_HSA_AMD\ is\ not\ set/CONFIG_HSA_AMD=y/g' .config # ## Disable debug builds # sed -i -e 's/^CONFIG_DEBUG_INFO=y/CONFIG_DEBUG_INFO=n/g' .config # sed -i -e 's/^CONFIG_DEBUG_KERNEL=y/CONFIG_DEBUG_KERNEL=n/g' .config ## check for versions containing only a single dot instead of two ## but only when not choosing the repo source if [[ "${s_or_m_or_r}" != "r" && "${s_or_m_or_r}" != "R" ]] then dots=$(echo "${kernel_version}" | awk -F "." '{print NF-1}') @@ -373,6 +384,14 @@ function independent_code() { fi fi ## Install kernel source, thanks https://github.com/meberlein if [[ "${source}" == "y" || "${source}" == "Y" ]] then source_dir="/usr/src/linux-source-${kernel_version}${kernel_localversion}" sudo mkdir -p "${source_dir}" sudo cp -a "${working_dir}/${kernel_name}/." "${source_dir}" fi make clean make -j "$(nproc)" bindeb-pkg LOCALVERSION="${kernel_localversion}" || exit @@ -384,14 +403,14 @@ function independent_code() { then if [ "$(lsb_release -s -d | cut -d ' ' -f 1)" == "Ubuntu" ] then ## removing previous commented line sudo sed -i -e 's/^#GRUB_DEFAULT=.*//g' "${grub_config}" ## commenting current line sudo sed -i 's/^GRUB_DEFAULT=/#GRUB_DEFAULT=/' "${grub_config}" ## adding line ## TODO: multilanguage! only works for en-US (and other en-*) right now! grub_line="GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${kernel_version}${kernel_localversion}\"" sudo sed -i -e "s/^#GRUB_DEFAULT=.*/\0\n${grub_line}/" "${grub_config}" @@ -400,12 +419,13 @@ function independent_code() { fi fi cd "${current_dir}" || exit rm -rf "${working_dir}" echo "Done." echo "Make sure to check out https://github.com/gnif/vendor-reset" } ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Jun 26, 2020 . 1 changed file with 13 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,8 @@ function install_dependencies() { } function init() { echo "Get the newest version of the script here: https://gist.github.com/mdPlusPlus/031ec2dac2295c9aaf1fc0b0e808e21a" echo "Initializing..." kernel_config=$(ls /boot/config-* | grep generic | sort -Vr | head -n 1) @@ -67,17 +69,17 @@ function stable_or_mainline_or_repo() { echo -n "Do you want to install the kernel and its headers after compilation? [Y/n] " read -r install if [[ -z "${install}" || "${install}" == "y" || "${install}" == "Y" ]] then echo -n "Do you want to make this kernel the new default? [Y/n] " read -r default fi if [[ -z "${s_or_m_or_r}" || "${s_or_m_or_r}" == "s" || "${s_or_m_or_r}" == "S" ]] then stable_preparations else if [[ "${s_or_m_or_r}" == "m" || "${s_or_m_or_r}" == "M" ]] then if [ "${mainline_version}" == "unavailable" ] then @@ -87,7 +89,7 @@ function stable_or_mainline_or_repo() { mainline_preparations fi else if [[ "${s_or_m_or_r}" == "r" || "${s_or_m_or_r}" == "R" ]] then repo_preparations else @@ -112,7 +114,7 @@ function try_acso_patch() { if $(git apply --check ../acso_5_6_12.patch) then echo "Applying acs override patch for 5.6_12+." git apply ../acso_5_6_12.patch else echo "Trying to apply acs override patch for 5.4+." wget -O ../acso_5_4.patch "${acso_patch_5_4}" @@ -319,17 +321,17 @@ function repo_preparations() { function independent_code() { kernel_localversion="" if [[ -z "${acso}" || ( "${acso}" != "n" && "${acso}" != "N" ) ]] then try_acso_patch fi if [[ "${agesa}" == "y" || "${agesa}" == "Y" ]] then try_agesa_patch fi if [[ "${vega}" == "y" || "${vega}" == "Y" ]] then try_vega_patch fi @@ -353,7 +355,7 @@ function independent_code() { ##check for versions containing only a single dot instead of two ##but only when not choosing the repo source if [[ "${s_or_m_or_r}" != "r" && "${s_or_m_or_r}" != "R" ]] then dots=$(echo "${kernel_version}" | awk -F "." '{print NF-1}') dashes=$(echo "${kernel_version}" | awk -F "-" '{print NF-1}') @@ -375,10 +377,10 @@ function independent_code() { make -j "$(nproc)" bindeb-pkg LOCALVERSION="${kernel_localversion}" || exit if [[ -z "${install}" || "${install}" == "y" || "${install}" == "Y" ]] then sudo dpkg -i ../linux-image-${kernel_version}${kernel_localversion}*.deb ../linux-headers-${kernel_version}${kernel_localversion}*.deb if [[ -z "${default}" || "${default}" == "y" || "${default}" == "Y" ]] then if [ "$(lsb_release -s -d | cut -d ' ' -f 1)" == "Ubuntu" ] then -
mdPlusPlus revised this gist
Jun 23, 2020 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -99,7 +99,7 @@ function stable_or_mainline_or_repo() { } function try_acso_patch() { acso_patch_5_6_12="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/5.6.12/acso.patch" acso_patch_5_4="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/5.4/acso.patch" acso_patch_4_18="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.18/acso.patch" acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" @@ -171,7 +171,8 @@ function try_acso_patch() { fi rm -f ../acso_5_4.patch fi rm -f ../acso_5_6_12.patch kernel_localversion+="-acso" } -
mdPlusPlus revised this gist
Jun 23, 2020 . 1 changed file with 47 additions and 38 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -99,70 +99,79 @@ function stable_or_mainline_or_repo() { } function try_acso_patch() { acso_patch_5_6_12="https://gitlab.com/Queuecumber/linux-acs-override/-/raw/master/workspaces/5.6.12/acso.patch" acso_patch_5_4="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/5.4/acso.patch" acso_patch_4_18="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.18/acso.patch" acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" acso_patch_4_14="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.14/acso.patch" acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" acso_patch_4_18_ubuntu="https://gist.github.com/mdPlusPlus/bb3df6248ffc7c6b3772ae0901659966/raw/acso_4_18_ubuntu.patch" echo "Trying to apply acs override patch for 5.6.12+." wget -O ../acso_5_6_12.patch "${acso_patch_5_6_12}" if $(git apply --check ../acso_5_6_12.patch) then echo "Applying acs override patch for 5.6_12+." git apply ../acso_5_4.patch else echo "Trying to apply acs override patch for 5.4+." wget -O ../acso_5_4.patch "${acso_patch_5_4}" if $(git apply --check ../acso_5_4.patch) then echo "Applying acs override patch for 5.4+." git apply ../acso_5_4.patch else echo "Trying to apply acs override patch for 4.18+." wget -O ../acso_4_18.patch "${acso_patch_4_18}" if $(git apply --check ../acso_4_18.patch) then echo "Applying acs override patch for 4.18+." git apply ../acso_4_18.patch else echo "Trying to apply acs override patch for 4.17+." wget -O ../acso_4_17.patch "${acso_patch_4_17}" if $(git apply --check ../acso_4_17.patch) then echo "Applying acs override patch for 4.17+." git apply ../acso_4_17.patch else echo "Trying to apply acs override patch for 4.14+." wget -O ../acso_4_14.patch "${acso_patch_4_14}" if $(git apply --check ../acso_4_14.patch) then echo "Applying acs override patch for 4.14+." git apply ../acso_4_14.patch else echo "Trying to apply acs override patch for 4.10+." wget -O ../acso_4_10.patch "${acso_patch_4_10}" if $(git apply --check ../acso_4_10.patch) then echo "Applying acs override patch for 4.10+." git apply ../acso_4_10.patch else echo "Last resort: Trying to apply acs override patch for Ubuntu repository kernel source." wget -O ../acso_4_18_ubuntu.patch "${acso_patch_4_18_ubuntu}" if $(git apply --check ../acso_4_18_ubuntu.patch) then echo "Applying acs override patch for Ubuntu repository kernel source." git apply ../acso_4_18_ubuntu.patch else echo "[ERROR]: Failed to apply acs override patch. Exiting." exit fi rm -f ../acso_4_18_ubuntu.patch fi rm -f ../acso_4_10.patch fi rm -f ../acso_4_14.patch fi rm -f ../acso_4_17.patch fi rm -f ../acso_4_18.patch fi rm -f ../acso_5_4.patch fi rm -f ../acso_patch_5_6_12.patch kernel_localversion+="-acso" } -
mdPlusPlus revised this gist
Dec 16, 2019 . 1 changed file with 42 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -99,60 +99,69 @@ function stable_or_mainline_or_repo() { } function try_acso_patch() { acso_patch_5_4="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/5.4/acso.patch" acso_patch_4_18="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.18/acso.patch" acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" acso_patch_4_14="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.14/acso.patch" acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" acso_patch_4_18_ubuntu="https://gist.github.com/mdPlusPlus/bb3df6248ffc7c6b3772ae0901659966/raw/acso_4_18_ubuntu.patch" echo "Trying to apply acs override patch for 5.4+." wget -O ../acso_5_4.patch "${acso_patch_5_4}" if $(git apply --check ../acso_5_4.patch) then echo "Applying acs override patch for 5.4+." git apply ../acso_5_4.patch else echo "Trying to apply acs override patch for 4.18+." wget -O ../acso_4_18.patch "${acso_patch_4_18}" if $(git apply --check ../acso_4_18.patch) then echo "Applying acs override patch for 4.18+." git apply ../acso_4_18.patch else echo "Trying to apply acs override patch for 4.17+." wget -O ../acso_4_17.patch "${acso_patch_4_17}" if $(git apply --check ../acso_4_17.patch) then echo "Applying acs override patch for 4.17+." git apply ../acso_4_17.patch else echo "Trying to apply acs override patch for 4.14+." wget -O ../acso_4_14.patch "${acso_patch_4_14}" if $(git apply --check ../acso_4_14.patch) then echo "Applying acs override patch for 4.14+." git apply ../acso_4_14.patch else echo "Trying to apply acs override patch for 4.10+." wget -O ../acso_4_10.patch "${acso_patch_4_10}" if $(git apply --check ../acso_4_10.patch) then echo "Applying acs override patch for 4.10+." git apply ../acso_4_10.patch else echo "Last resort: Trying to apply acs override patch for Ubuntu repository kernel source." wget -O ../acso_4_18_ubuntu.patch "${acso_patch_4_18_ubuntu}" if $(git apply --check ../acso_4_18_ubuntu.patch) then echo "Applying acs override patch for Ubuntu repository kernel source." git apply ../acso_4_18_ubuntu.patch else echo "[ERROR]: Failed to apply acs override patch. Exiting." exit fi rm -f ../acso_4_18_ubuntu.patch fi rm -f ../acso_4_10.patch fi rm -f ../acso_4_14.patch fi rm -f ../acso_4_17.patch fi rm -f ../acso_4_18.patch fi rm -f ../acso_5_4.patch kernel_localversion+="-acso" } -
mdPlusPlus revised this gist
Aug 20, 2019 . 1 changed file with 30 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ function install_dependencies() { echo "Installing dependencies..." sudo apt -qq update sudo apt -qq install -y curl git wget sudo apt -qq install -y bison flex kernel-package libelf-dev libssl-dev } function init() { @@ -21,6 +21,8 @@ function init() { } function get_newest_versions() { echo "Retrieving newest version information..." stable_releases_3x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/" stable_releases_4x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/" stable_releases_5x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/" @@ -41,7 +43,8 @@ function get_newest_versions() { fi repo_pkg=$(apt search 'linux-source-' | grep 'linux-source' | cut -d '/' -f 1 | awk -F- 'NF<=3' | sort -Vr | head -n 1) #repo_version=$(echo "${repo_pkg}" | cut -d '-' -f 3) repo_version=$(apt search 'linux-source-' | grep 'linux-source' | sort -Vr | head -n 1 | cut -d ' ' -f 2) } function stable_or_mainline_or_repo() { @@ -170,15 +173,15 @@ function try_agesa_patch() { echo "[ERROR]: Failed to apply AMD AGESA patch. Exiting." exit fi rm -f ../${agesa_patch_filename} kernel_localversion+="-agesa" } function try_vega_patch() { ##Original by github user https://gist.github.com/numinit vega_patch_new="https://gist.github.com/mdPlusPlus/1754d82b53269ead770133829874fbfd/raw/" vega_patch="https://gist.github.com/numinit/1bbabff521e0451e5470d740e0eb82fd/raw" vega_patch_filename="fix-vega-reset.patch" @@ -214,7 +217,7 @@ function stable_preparations() { echo -n "Which version do you want to download? [${stable_version}] " read -r user_version if ! [ -z "${user_version}" ] then stable_version="${user_version}" fi @@ -285,22 +288,15 @@ function repo_preparations() { fi fi ##linux-hwe (5.0.0-25.26~18.04.1) bionic; urgency=medium ##-> ##5.0.0-25.26~18.04.1 #kernel_version=$(head -n 1 debian/changelog | cut -d '(' -f 2 | cut -d ')' -f 1) ##This somehow comes out empty when run in the script, but is successful when issued manually independent_code } function independent_code() { kernel_localversion="" @@ -313,12 +309,12 @@ function independent_code() { then try_agesa_patch fi if [ "${vega}" == "y" ] then try_vega_patch fi ##temporary #fix_steam @@ -337,24 +333,26 @@ function independent_code() { sed -i -e 's/^CONFIG_DEBUG_KERNEL=y/CONFIG_DEBUG_KERNEL=n/g' .config ##check for versions containing only a single dot instead of two ##but only when not choosing the repo source if [ "${s_or_m_or_r}" != "r" ] then dots=$(echo "${kernel_version}" | awk -F "." '{print NF-1}') dashes=$(echo "${kernel_version}" | awk -F "-" '{print NF-1}') if [ "${dots}" -lt 2 ] then if [ "${dashes}" -lt 1 ] then ##5.1 -> 5.1.0 kernel_version="${kernel_version}.0" else ##5.1-rc1 -> 5.1.0-rc1 kernel_version="$(echo "${kernel_version}" | sed 's/-/.0-/')" fi kernel_name="linux-${kernel_version}" fi fi make clean make -j "$(nproc)" bindeb-pkg LOCALVERSION="${kernel_localversion}" || exit -
mdPlusPlus revised this gist
Jul 26, 2019 . 1 changed file with 15 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -151,7 +151,7 @@ function try_acso_patch() { rm -f ../acso_4_18.patch kernel_localversion+="-acso" } function try_agesa_patch() { @@ -302,7 +302,7 @@ function repo_preparations() { #} function independent_code() { kernel_localversion="" if [ -z "${acso}" ] || [ "${acso}" != "n" ] then @@ -318,7 +318,7 @@ function independent_code() { then try_vega_patch fi ##temporary #fix_steam @@ -336,11 +336,19 @@ function independent_code() { sed -i -e 's/^CONFIG_DEBUG_INFO=y/CONFIG_DEBUG_INFO=n/g' .config sed -i -e 's/^CONFIG_DEBUG_KERNEL=y/CONFIG_DEBUG_KERNEL=n/g' .config ##check for versions containing only a single dot instead of two dots=$(echo "${kernel_version}" | awk -F "." '{print NF-1}') dashes=$(echo "${kernel_version}" | awk -F "-" '{print NF-1}') if [ "${dots}" -lt 2 ] then if [ "${dashes}" -lt 1 ] then ##5.1 -> 5.1.0 kernel_version="${kernel_version}.0" else ##5.1-rc1 -> 5.1.0-rc1 kernel_version="$(echo "${kernel_version}" | sed 's/-/.0-/')" fi kernel_name="linux-${kernel_version}" fi @@ -364,6 +372,7 @@ function independent_code() { sudo sed -i 's/^GRUB_DEFAULT=/#GRUB_DEFAULT=/' "${grub_config}" ##adding line ## TODO multilanguage! only works for en-US (and other en-*) right now! grub_line="GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${kernel_version}${kernel_localversion}\"" sudo sed -i -e "s/^#GRUB_DEFAULT=.*/\0\n${grub_line}/" "${grub_config}" -
mdPlusPlus revised this gist
Jul 25, 2019 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -172,6 +172,8 @@ function try_agesa_patch() { fi rm -f ../${agesa_patch_filename} kernel_localversion+="-agesa" } function try_vega_patch() { @@ -203,6 +205,8 @@ function try_vega_patch() { fi rm -f ../${vega_patch_filename} kernel_localversion+="-vega" } function stable_preparations() { -
mdPlusPlus revised this gist
Jul 5, 2019 . 1 changed file with 83 additions and 41 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,6 +55,12 @@ function stable_or_mainline_or_repo() { echo -n "Do you want to apply the acs override patch? Kernels below 4.10 are not supported. [Y/n] " read -r acso echo -n "Do you want to apply the experimental AMD AGESA patch to fix VFIO setups on AGESA 0.0.7.2 and newer? [y/N] " read -r agesa echo -n "Do you want to apply the experimental AMD Vega PCI reset patch? [y/N] " read -r vega echo -n "Do you want to install the kernel and its headers after compilation? [Y/n] " read -r install @@ -148,6 +154,57 @@ function try_acso_patch() { kernel_localversion="-acso" } function try_agesa_patch() { ##by reddit user https://www.reddit.com/user/hansmoman/ ##https://www.reddit.com/r/VFIO/comments/bqeixd/apparently_the_latest_bios_on_asrockmsi_boards/eo4neta agesa_patch="https://clbin.com/VCiYJ" agesa_patch_filename="agesa.patch" echo "Trying to apply AMD AGESA patch." wget -O ../${agesa_patch_filename} "${agesa_patch}" if $(git apply --check ../${agesa_patch_filename}) then echo "Applying AMD AGESA patch." git apply ../${agesa_patch_filename} else echo "[ERROR]: Failed to apply AMD AGESA patch. Exiting." exit fi rm -f ../${agesa_patch_filename} } function try_vega_patch() { ##Original by github user https://gist.github.com/numinit vega_patch_new="https://gist.github.com/mdPlusPlus/1754d82b53269ead770133829874fbfd/raw/" vega_patch="https://gist.github.com/numinit/1bbabff521e0451e5470d740e0eb82fd/raw" vega_patch_filename="fix-vega-reset.patch" echo "Trying to apply AMD Vega reset patch." wget -O ../${vega_patch_filename} "${vega_patch_new}" if $(git apply --check ../${vega_patch_filename}) then echo "Applying AMD Vega reset patch." git apply ../${vega_patch_filename} else rm -f ../${vega_patch_filename} wget -O ../${vega_patch_filename} "${vega_patch}" if $(git apply --check ../${vega_patch_filename}) then echo "Applying AMD Vega reset patch." git apply ../${vega_patch_filename} else echo "[ERROR]: Failed to apply AMD Vega reset patch. Exiting." exit fi fi rm -f ../${vega_patch_filename} } function stable_preparations() { echo "The newest available stable kernel version is ${stable_version}. Kernels below 4.10 are not supported." echo -n "Which version do you want to download? [${stable_version}] " @@ -224,23 +281,21 @@ function repo_preparations() { fi fi independent_code } ##temporary workaround to fix steam connections on recent kernels #function fix_steam() { # wget -O "../steam.patch" "https://gist.github.com/mdPlusPlus/c76a78a807a68432487ae11066740a31/raw/4122851cb773ecf4d2e9c3881da1d0ff82294f3d/steam.patch" # # if $(git apply --check ../steam.patch) # then # echo "Applying Steam patch." # git apply ../steam.patch # fi # # rm -f ../steam.patch #} function independent_code() { kernel_localversion="-localversion" @@ -250,10 +305,20 @@ function independent_code() { try_acso_patch fi if [ "${agesa}" == "y" ] then try_agesa_patch fi if [ "${vega}" == "y" ] then try_vega_patch fi ##temporary #fix_steam cp "${kernel_config}" .config yes '' | make oldconfig ##set xhci_hcd to load as a module instead of including it directly into the kernel @@ -275,34 +340,10 @@ function independent_code() { kernel_name="linux-${kernel_version}" fi make clean make -j "$(nproc)" bindeb-pkg LOCALVERSION="${kernel_localversion}" || exit if [ -z "${install}" ] || [ "${install}" == "y" ] @@ -335,3 +376,4 @@ function independent_code() { ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Jun 24, 2019 . 1 changed file with 15 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -94,6 +94,7 @@ function try_acso_patch() { acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" acso_patch_4_14="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.14/acso.patch" acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" acso_patch_4_18_ubuntu="https://gist.github.com/mdPlusPlus/bb3df6248ffc7c6b3772ae0901659966/raw/acso_4_18_ubuntu.patch" echo "Trying to apply acs override patch for 4.18+." wget -O ../acso_4_18.patch "${acso_patch_4_18}" @@ -123,8 +124,17 @@ function try_acso_patch() { echo "Applying acs override patch for 4.10+." git apply ../acso_4_10.patch else echo "Last resort: Trying to apply acs override patch for Ubuntu repository kernel source." wget -O ../acso_4_18_ubuntu.patch "${acso_patch_4_18_ubuntu}" if $(git apply --check ../acso_4_18_ubuntu.patch) then echo "Applying acs override patch for Ubuntu repository kernel source." git apply ../acso_4_18_ubuntu.patch else echo "[ERROR]: Failed to apply acs override patch. Exiting." exit fi rm -f ../acso_4_18_ubuntu.patch fi rm -f ../acso_4_10.patch fi @@ -172,7 +182,7 @@ function stable_preparations() { fi wget "${stable_link}" tar xf "${kernel_name}.tar.xz" cd "${kernel_name}" || exit independent_code @@ -183,7 +193,7 @@ function mainline_preparations() { kernel_name="linux-${kernel_version}" wget "${mainline_link}" tar xf "${kernel_name}.tar.gz" cd "${kernel_name}" || exit independent_code @@ -193,7 +203,7 @@ function repo_preparations() { kernel_name="${repo_pkg}" sudo apt install "${repo_pkg}" tar xf "/usr/src/${kernel_name}.tar.bz2" cd "${kernel_name}" || exit makefile_version=$(grep "^VERSION" Makefile | tr -d '[:space:]' | cut -d '=' -f 2) -
mdPlusPlus revised this gist
Jun 22, 2019 . 1 changed file with 20 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -219,6 +219,19 @@ function repo_preparations() { independent_code } ##temporary workaround to fix steam connections on recent kernels function fix_steam() { wget -O "../steam.patch" "https://gist.github.com/mdPlusPlus/c76a78a807a68432487ae11066740a31/raw/4122851cb773ecf4d2e9c3881da1d0ff82294f3d/steam.patch" if $(git apply --check ../steam.patch) then echo "Applying Steam patch." git apply ../steam.patch fi rm -f ../steam.patch } function independent_code() { kernel_localversion="-localversion" @@ -227,16 +240,19 @@ function independent_code() { try_acso_patch fi ##temporary fix_steam cp "${kernel_config}" .config yes '' | make oldconfig ##set xhci_hcd to load as a module instead of including it directly into the kernel ##results in vfio_pci being able to grab usb controllers before xhci_hcd is able to sed -i -e 's/^CONFIG_USB_XHCI_HCD=y/CONFIG_USB_XHCI_HCD=m/g' .config ##Enable AMD's HSA driver for ROCm support. Thanks at https://github.com/jfturcot sed -i -e 's/^#\ CONFIG_HSA_AMD\ is\ not\ set/CONFIG_HSA_AMD=y/g' .config ##Disable debug builds sed -i -e 's/^CONFIG_DEBUG_INFO=y/CONFIG_DEBUG_INFO=n/g' .config sed -i -e 's/^CONFIG_DEBUG_KERNEL=y/CONFIG_DEBUG_KERNEL=n/g' .config @@ -275,7 +291,7 @@ function independent_code() { ##</Ubuntu specifics> # else #CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" kernel_image kernel_headers make -j "$(nproc)" bindeb-pkg LOCALVERSION="${kernel_localversion}" || exit # fi @@ -309,4 +325,3 @@ function independent_code() { ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
May 6, 2019 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -241,11 +241,19 @@ function independent_code() { sed -i -e 's/^CONFIG_DEBUG_INFO=y/CONFIG_DEBUG_INFO=n/g' .config sed -i -e 's/^CONFIG_DEBUG_KERNEL=y/CONFIG_DEBUG_KERNEL=n/g' .config ##check for versions containing only a single dot instead of two (5.1 -> 5.1.0) dots=$(echo "${kernel_version}" | awk -F"." '{print NF-1}') if [ "${dots}" -lt 2 ] then kernel_version="${kernel_version}.0" kernel_name="linux-${kernel_version}" fi make clean ##This doesn't seem to be necessary - leave commented until proper research has been done # if [ "${from_repo}" != "true" ] # then ##<Ubuntu specifics> -
mdPlusPlus revised this gist
Apr 9, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -227,7 +227,7 @@ function independent_code() { try_acso_patch fi cp "${kernel_config}" .config yes '' | make oldconfig ##set xhci_hcd to load as a module instead of including it directly into the kernel -
mdPlusPlus revised this gist
Apr 9, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/bin/bash function install_dependencies() { echo "Installing dependencies..." @@ -301,3 +301,4 @@ function independent_code() { ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Apr 9, 2019 . 1 changed file with 62 additions and 55 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ function install_dependencies() { echo "Installing dependencies..." @@ -9,37 +9,37 @@ function install_dependencies() { function init() { echo "Initializing..." kernel_config=$(ls /boot/config-* | grep generic | sort -Vr | head -n 1) grub_config="/etc/default/grub" current_dir=$(pwd) working_dir=$(mktemp -d) cd "${working_dir}" || exit install_dependencies } function get_newest_versions() { stable_releases_3x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/" stable_releases_4x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/" stable_releases_5x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/" stable_releases_3x_html=$(curl -s "${stable_releases_3x_url}") stable_releases_4x_html=$(curl -s "${stable_releases_4x_url}") stable_releases_5x_html=$(curl -s "${stable_releases_5x_url}") stable_releases_combined_html="${stable_releases_3x_html}${stable_releases_4x_html}${stable_releases_5x_html}" stable_version=$(echo "${stable_releases_combined_html}" | grep -E -o 'linux-([0-9]{1,}\.)+[0-9]{1,}' | sort -Vru | head -n 1 | cut -d '-' -f 2) mainline_link=$(curl -s https://www.kernel.org/ | grep https://git.kernel.org/torvalds/t/linux- | grep -Po '(?<=href=")[^"]*') if ! [ -z "${mainline_link}" ] then mainline_version=$(echo "${mainline_link}" | cut -d '-' -f 2,3 | cut -d '.' -f 1,2) else mainline_version="unavailable" fi repo_pkg=$(apt search 'linux-source-' | grep 'linux-source' | cut -d '/' -f 1 | awk -F- 'NF<=3' | sort -Vr | head -n 1) repo_version=$(echo "${repo_pkg}" | cut -d '-' -f 3) } @@ -51,19 +51,19 @@ function stable_or_mainline_or_repo() { echo "Repository version is: ${repo_version}" echo -n "Do you want to get a [s]table, the newest [m]ainline release candidate or the newest kernel from your [r]epositories? [S/m/r] " read -r s_or_m_or_r echo -n "Do you want to apply the acs override patch? Kernels below 4.10 are not supported. [Y/n] " read -r acso echo -n "Do you want to install the kernel and its headers after compilation? [Y/n] " read -r install if [ -z "${install}" ] || [ "${install}" == "y" ] then echo -n "Do you want to make this kernel the new default? [Y/n] " read -r default fi if [ -z "${s_or_m_or_r}" ] || [ "${s_or_m_or_r}" == "s" ] then stable_preparations @@ -74,7 +74,7 @@ function stable_or_mainline_or_repo() { then echo "Mainline version currently unavailable. Exiting." exit else mainline_preparations fi else @@ -94,7 +94,7 @@ function try_acso_patch() { acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" acso_patch_4_14="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.14/acso.patch" acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" echo "Trying to apply acs override patch for 4.18+." wget -O ../acso_4_18.patch "${acso_patch_4_18}" if $(git apply --check ../acso_4_18.patch) @@ -133,25 +133,25 @@ function try_acso_patch() { rm -f ../acso_4_17.patch fi rm -f ../acso_4_18.patch kernel_localversion="-acso" } function stable_preparations() { echo "The newest available stable kernel version is ${stable_version}. Kernels below 4.10 are not supported." echo -n "Which version do you want to download? [${stable_version}] " read -r user_version if ! [ -z "${user_version}" ] then stable_version="${user_version}" fi kernel_version="${stable_version}" kernel_name="linux-${kernel_version}" ##Test whether the version string starts with 3, 4, or 5 and sets the URL accordingly if [[ $stable_version == 5* ]] then @@ -168,34 +168,34 @@ function stable_preparations() { echo "${stable_version} is not a vaild version number. Exiting." exit fi fi fi wget "${stable_link}" tar xvf "${kernel_name}.tar.xz" cd "${kernel_name}" || exit independent_code } function mainline_preparations() { kernel_version="${mainline_version}" kernel_name="linux-${kernel_version}" wget "${mainline_link}" tar xvf "${kernel_name}.tar.gz" cd "${kernel_name}" || exit independent_code } function repo_preparations() { kernel_name="${repo_pkg}" sudo apt install "${repo_pkg}" tar xvf "/usr/src/${kernel_name}.tar.bz2" cd "${kernel_name}" || exit makefile_version=$(grep "^VERSION" Makefile | tr -d '[:space:]' | cut -d '=' -f 2) makefile_patchlevel=$(grep "^PATCHLEVEL" Makefile| tr -d '[:space:]' | cut -d '=' -f 2) makefile_sublevel=$(grep "^SUBLEVEL" Makefile | tr -d '[:space:]' | cut -d '=' -f 2) @@ -213,57 +213,67 @@ function repo_preparations() { fi fi fi from_repo="true" independent_code } function independent_code() { kernel_localversion="-localversion" if [ -z "${acso}" ] || [ "${acso}" != "n" ] then try_acso_patch fi yes '' | make oldconfig ##set xhci_hcd to load as a module instead of including it directly into the kernel ##results in vfio_pci being able to grab usb controllers before xhci_hcd is able to sed -i -e 's/^CONFIG_USB_XHCI_HCD=y/CONFIG_USB_XHCI_HCD=m/g' .config ##Enable AMD's HSA driver for ROCm support. Thanks at https://github.com/jfturcot sed -i -e 's/^#\ CONFIG_HSA_AMD\ is\ not\ set/CONFIG_HSA_AMD=y/g' .config ##Disable debug builds sed -i -e 's/^CONFIG_DEBUG_INFO=y/CONFIG_DEBUG_INFO=n/g' .config sed -i -e 's/^CONFIG_DEBUG_KERNEL=y/CONFIG_DEBUG_KERNEL=n/g' .config make clean ##This doesn't seem to necessary - leave commented until proper research has been done # if [ "${from_repo}" != "true" ] # then ##<Ubuntu specifics> # if [ "$(lsb_release -s -d | cut -d ' ' -f 1)" == "Ubuntu" ] # then # ubuntu_codename="$(lsb_release -s -c)" # cd .. || exit # cp -a /usr/share/kernel-package ubuntu-package ##error on bionic (18.04) (and probably up) # if [ $(lsb_release -s -r | cut -c1-2) -lt 18 ] # then # git clone --depth=1 "git://kernel.ubuntu.com/ubuntu/ubuntu-${ubuntu_codename}.git" # cp "ubuntu-${ubuntu_codename}/debian/control-scripts/{postinst,postrm,preinst,prerm}" ubuntu-package/pkg/image/ # cp "ubuntu-${ubuntu_codename}/debian/control-scripts/headers-postinst" ubuntu-package/pkg/headers/ # fi # cd "${kernel_name}" || exit # CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" --overlay-dir=../ubuntu-package kernel_image kernel_headers # fi ##</Ubuntu specifics> # else #CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" kernel_image kernel_headers make -j $(nproc) bindeb-pkg LOCALVERSION="${kernel_localversion}" || exit # fi if [ -z "${install}" ] || [ "${install}" == "y" ] then sudo dpkg -i ../linux-image-${kernel_version}${kernel_localversion}*.deb ../linux-headers-${kernel_version}${kernel_localversion}*.deb if [ -z "${default}" ] || [ "${default}" == "y" ] then if [ "$(lsb_release -s -d | cut -d ' ' -f 1)" == "Ubuntu" ] @@ -284,9 +294,6 @@ function independent_code() { fi cd "${current_dir}" || exit rm -rf "${working_dir}" } -
mdPlusPlus revised this gist
Feb 5, 2019 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -152,7 +152,7 @@ function stable_preparations() { kernel_name="linux-${kernel_version}" ##Test whether the version string starts with 3, 4, or 5 and sets the URL accordingly if [[ $stable_version == 5* ]] then stable_link="${stable_releases_5x_url}linux-${stable_version}.tar.xz" @@ -246,7 +246,7 @@ function independent_code() { cd .. || exit cp -a /usr/share/kernel-package ubuntu-package ##error on bionic (18.04) (and probably up) if [ $(lsb_release -s -r | cut -c1-2) -lt 18 ] then git clone --depth=1 "git://kernel.ubuntu.com/ubuntu/ubuntu-${ubuntu_codename}.git" cp "ubuntu-${ubuntu_codename}/debian/control-scripts/{postinst,postrm,preinst,prerm}" ubuntu-package/pkg/image/ @@ -294,4 +294,3 @@ function independent_code() { ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Jan 20, 2019 . No changes.There are no files selected for viewing
-
mdPlusPlus revised this gist
Jan 20, 2019 . 1 changed file with 35 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,9 +21,16 @@ function init() { } function get_newest_versions() { stable_releases_3x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/" stable_releases_4x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/" stable_releases_5x_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/" stable_releases_3x_html=$(curl -s "${stable_releases_3x_url}") stable_releases_4x_html=$(curl -s "${stable_releases_4x_url}") stable_releases_5x_html=$(curl -s "${stable_releases_5x_url}") stable_releases_combined_html="${stable_releases_3x_html}${stable_releases_4x_html}${stable_releases_5x_html}" stable_version=$(echo "${stable_releases_combined_html}" | grep -E -o 'linux-([0-9]{1,}\.)+[0-9]{1,}' | sort -Vru | head -n 1 | cut -d '-' -f 2) mainline_link=$(curl -s https://www.kernel.org/ | grep https://git.kernel.org/torvalds/t/linux- | grep -Po '(?<=href=")[^"]*') if ! [ -z "${mainline_link}" ] @@ -143,7 +150,27 @@ function stable_preparations() { kernel_version="${stable_version}" kernel_name="linux-${kernel_version}" ##Test whether the version strings starts with 3, 4, or 5 and sets the URL accordingly if [[ $stable_version == 5* ]] then stable_link="${stable_releases_5x_url}linux-${stable_version}.tar.xz" else if [[ $stable_version == 4* ]] then stable_link="${stable_releases_4x_url}linux-${stable_version}.tar.xz" else if [[ $stable_version == 3* ]] then stable_link="${stable_releases_3x_url}linux-${stable_version}.tar.xz" else echo "${stable_version} is not a vaild version number. Exiting." exit fi fi fi wget "${stable_link}" tar xvf "${kernel_name}.tar.xz" cd "${kernel_name}" || exit @@ -213,9 +240,9 @@ function independent_code() { if [ "${from_repo}" != "true" ] then ##<Ubuntu specifics> if [ "$(lsb_release -s -d | cut -d ' ' -f 1)" == "Ubuntu" ] then ubuntu_codename="$(lsb_release -s -c)" cd .. || exit cp -a /usr/share/kernel-package ubuntu-package ##error on bionic (18.04) (and probably up) @@ -239,7 +266,7 @@ function independent_code() { sudo dpkg -i ../*.deb if [ -z "${default}" ] || [ "${default}" == "y" ] then if [ "$(lsb_release -s -d | cut -d ' ' -f 1)" == "Ubuntu" ] then ##removing previous commented line sudo sed -i -e 's/^#GRUB_DEFAULT=.*//g' "${grub_config}" @@ -267,3 +294,4 @@ function independent_code() { ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Jan 15, 2019 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,7 @@ function install_dependencies() { echo "Installing dependencies..." sudo apt -qq update sudo apt -qq install -y curl git wget sudo apt -qq install -y bison flex kernel-package libssl-dev } -
mdPlusPlus revised this gist
Jan 15, 2019 . 1 changed file with 4 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,7 @@ function install_dependencies() { sudo apt -qq update sudo apt -qq install curl git wget sudo apt -qq install -y bison flex kernel-package libssl-dev } function init() { @@ -207,7 +205,7 @@ function independent_code() { yes '' | make oldconfig ##set xhci_hcd to load as a module instead of including it directly into the kernel ##results in vfio_pci being able to grab usb controllers before xhci_hcd is able to sed -i -e 's/^CONFIG_USB_XHCI_HCD=y/CONFIG_USB_XHCI_HCD=m/g' .config @@ -229,11 +227,11 @@ function independent_code() { cp "ubuntu-${ubuntu_codename}/debian/control-scripts/headers-postinst" ubuntu-package/pkg/headers/ fi cd "${kernel_name}" || exit CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" --overlay-dir=../ubuntu-package kernel_image kernel_headers fi ##</Ubuntu specifics> else CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" kernel_image kernel_headers fi @@ -270,4 +268,3 @@ function independent_code() { ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Dec 16, 2018 . 1 changed file with 28 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,9 +36,8 @@ function get_newest_versions() { mainline_version="unavailable" fi repo_pkg=$(apt search 'linux-source-' | grep 'linux-source' | cut -d '/' -f 1 | awk -F- 'NF<=3' | sort -Vr | head -n 1) repo_version=$(echo "${repo_pkg}" | cut -d '-' -f 3) } function stable_or_mainline_or_repo() { @@ -217,21 +216,24 @@ function independent_code() { if [ "${from_repo}" != "true" ] then ##<Ubuntu specifics> if [ $(lsb_release -s -d | cut -d ' ' -f 1) == "Ubuntu" ] then ubuntu_codename=$(lsb_release -s -c) cd .. || exit cp -a /usr/share/kernel-package ubuntu-package ##error on bionic (18.04) (and probably up) if [ $(lsb_release -s -r) -lt 18 ] then git clone --depth=1 "git://kernel.ubuntu.com/ubuntu/ubuntu-${ubuntu_codename}.git" cp "ubuntu-${ubuntu_codename}/debian/control-scripts/{postinst,postrm,preinst,prerm}" ubuntu-package/pkg/image/ cp "ubuntu-${ubuntu_codename}/debian/control-scripts/headers-postinst" ubuntu-package/pkg/headers/ fi cd "${kernel_name}" || exit CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" --overlay-dir=../ubuntu-package kernel_image kernel_headers kernel_source fi ##</Ubuntu specifics> else CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" kernel_image kernel_headers kernel_source fi @@ -240,17 +242,20 @@ function independent_code() { sudo dpkg -i ../*.deb if [ -z "${default}" ] || [ "${default}" == "y" ] then if [ $(lsb_release -s -d | cut -d ' ' -f 1) == "Ubuntu" ] then ##removing previous commented line sudo sed -i -e 's/^#GRUB_DEFAULT=.*//g' "${grub_config}" ##commenting current line sudo sed -i 's/^GRUB_DEFAULT=/#GRUB_DEFAULT=/' "${grub_config}" ##adding line grub_line="GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${kernel_version}${kernel_localversion}\"" sudo sed -i -e "s/^#GRUB_DEFAULT=.*/\0\n${grub_line}/" "${grub_config}" sudo update-grub fi fi fi @@ -265,3 +270,4 @@ function independent_code() { ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Oct 27, 2018 . 1 changed file with 60 additions and 58 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,10 @@ function install_dependencies() { echo "Installing dependencies..." sudo apt -qq update sudo apt -qq install curl git wget ## Apparently this does not satisfy all package requirements #sudo apt -qq build-dep linux-image-generic sudo apt -qq install build-essential kernel-package fakeroot libncurses5-dev libssl-dev ccache } function init() { @@ -15,27 +18,27 @@ function init() { current_dir=$(pwd) working_dir=$(mktemp -d) cd "${working_dir}" || exit install_dependencies } function get_newest_versions() { stable_releases="https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/" stable_version=$(curl -s "${stable_releases}" | grep -E -o 'linux-([0-9]{1,}\.)+[0-9]{1,}' | sort -Vr | head -n 1 | cut -d '-' -f 2) stable_link="${stable_releases}linux-${stable_version}.tar.xz" mainline_link=$(curl -s https://www.kernel.org/ | grep https://git.kernel.org/torvalds/t/linux- | grep -Po '(?<=href=")[^"]*') if ! [ -z "${mainline_link}" ] then mainline_version=$(echo "${mainline_link}" | cut -d '-' -f 2,3 | cut -d '.' -f 1,2) else mainline_version="unavailable" fi repo_string=$(apt search 'linux-source-' | grep 'linux-source' | sort -Vr | head -n 1) repo_pkg=$(echo "${repo_string}" | grep -E -o '^[^/]+') repo_version=$(echo "${repo_string}" | cut -d ' ' -f 2) } function stable_or_mainline_or_repo() { @@ -44,35 +47,35 @@ function stable_or_mainline_or_repo() { echo "Mainline version is: ${mainline_version}" echo "Repository version is: ${repo_version}" echo -n "Do you want to get a [s]table, the newest [m]ainline release candidate or the newest kernel from your [r]epositories? [S/m/r] " read -r s_or_m_or_r echo -n "Do you want to apply the acs override patch? Kernels below 4.10 are not supported. [Y/n] " read -r acso echo -n "Do you want to install the kernel and its headers after compilation? [Y/n] " read -r install if [ -z "${install}" ] || [ "${install}" == "y" ] then echo -n "Do you want to make this kernel the new default? [Y/n] " read -r default fi if [ -z "${s_or_m_or_r}" ] || [ "${s_or_m_or_r}" == "s" ] then stable_preparations else if [ "${s_or_m_or_r}" == "m" ] then if [ "${mainline_version}" == "unavailable" ] then echo "Mainline version currently unavailable. Exiting." exit else mainline_preparations fi else if [ "${s_or_m_or_r}" == "r" ] then repo_preparations else @@ -135,55 +138,55 @@ function try_acso_patch() { function stable_preparations() { echo "The newest available stable kernel version is ${stable_version}. Kernels below 4.10 are not supported." echo -n "Which version do you want to download? [${stable_version}] " read -r user_version if ! [ -z "${user_version}" ] then stable_version="${user_version}" fi kernel_version="${stable_version}" kernel_name="linux-${kernel_version}" wget "${stable_link}" tar xvf "${kernel_name}.tar.xz" cd "${kernel_name}" || exit independent_code } function mainline_preparations() { kernel_version="${mainline_version}" kernel_name="linux-${kernel_version}" wget "${mainline_link}" tar xvf "${kernel_name}.tar.gz" cd "${kernel_name}" || exit independent_code } function repo_preparations() { kernel_name="${repo_pkg}" sudo apt install "${repo_pkg}" tar xvf "/usr/src/${kernel_name}.tar.bz2" cd "${kernel_name}" || exit makefile_version=$(grep "^VERSION" Makefile | tr -d '[:space:]' | cut -d '=' -f 2) makefile_patchlevel=$(grep "^PATCHLEVEL" Makefile| tr -d '[:space:]' | cut -d '=' -f 2) makefile_sublevel=$(grep "^SUBLEVEL" Makefile | tr -d '[:space:]' | cut -d '=' -f 2) #makefile_extraversion=$(grep "^EXTRAVERSION" Makefile| tr -d '[:space:]' | cut -d '=' -f 2) if ! [ -z "${makefile_version}" ] then kernel_version="${makefile_version}" if ! [ -z "${makefile_patchlevel}" ] then kernel_version="${makefile_version}.${makefile_patchlevel}" if ! [ -z "${makefile_sublevel}" ] then kernel_version="${makefile_version}.${makefile_patchlevel}.${makefile_sublevel}" fi fi fi @@ -196,12 +199,12 @@ function repo_preparations() { function independent_code() { kernel_localversion="-localversion" if [ -z "${acso}" ] || [ "${acso}" != "n" ] then try_acso_patch fi cp "${kernel_config}" .config yes '' | make oldconfig @@ -215,37 +218,37 @@ function independent_code() { then ##<Ubuntu specifics> ubuntu_codename=$(lsb_release -s -c) cd .. || exit cp -a /usr/share/kernel-package ubuntu-package ##error on bionic - cosmic not tested if [ "${ubuntu_codename}" != "bionic" ] && [ "${ubuntu_codename}" != "cosmic" ] then git clone --depth=1 "git://kernel.ubuntu.com/ubuntu/ubuntu-${ubuntu_codename}.git" cp "ubuntu-${ubuntu_codename}/debian/control-scripts/{postinst,postrm,preinst,prerm}" ubuntu-package/pkg/image/ cp "ubuntu-${ubuntu_codename}/debian/control-scripts/headers-postinst" ubuntu-package/pkg/headers/ fi cd "${kernel_name}" || exit CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" --overlay-dir=../ubuntu-package kernel_image kernel_headers ##</Ubuntu specifics> else CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version="${kernel_localversion}" kernel_image kernel_headers fi if [ -z "${install}" ] || [ "${install}" == "y" ] then sudo dpkg -i ../*.deb if [ -z "${default}" ] || [ "${default}" == "y" ] then ##removing previous commented line sudo sed -i -e 's/^#GRUB_DEFAULT=.*//g' "${grub_config}" ##commenting current line sudo sed -i 's/^GRUB_DEFAULT=/#GRUB_DEFAULT=/' "${grub_config}" ##adding line grub_line="GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${kernel_version}${kernel_localversion}\"" sudo sed -i -e "s/^#GRUB_DEFAULT=.*/\0\n${grub_line}/" "${grub_config}" sudo update-grub fi @@ -255,11 +258,10 @@ function independent_code() { cd "${current_dir}" || exit rm -rf "${working_dir}" } ##actual logic init stable_or_mainline_or_repo -
mdPlusPlus revised this gist
Sep 20, 2018 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ #!/bin/bash function install_dependencies() { echo "Installing dependencies..." sudo apt -qq update sudo apt -qq install curl git wget sudo apt -qq build-dep linux-image-generic @@ -203,6 +204,11 @@ function independent_code() { cp ${kernel_config} .config yes '' | make oldconfig ##set xhci_hcd to load as a module instead of including it directly into the kernel ##results in vfio_pci being able to grab usb controllers before xhci_hcd is able to sed -i -e 's/^CONFIG_USB_XHCI_HCD=y/CONFIG_USB_XHCI_HCD=m/g' .config make clean if [ "${from_repo}" != "true" ] -
mdPlusPlus revised this gist
Jun 19, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,7 +83,7 @@ function stable_or_mainline_or_repo() { } function try_acso_patch() { acso_patch_4_18="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.18/acso.patch" acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" acso_patch_4_14="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.14/acso.patch" acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" -
mdPlusPlus revised this gist
Jun 19, 2018 . 1 changed file with 31 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,39 +83,52 @@ function stable_or_mainline_or_repo() { } function try_acso_patch() { acso_patch_4_18="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.18/acso.patch" acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" acso_patch_4_14="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.14/acso.patch" acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" echo "Trying to apply acs override patch for 4.18+." wget -O ../acso_4_18.patch "${acso_patch_4_18}" if $(git apply --check ../acso_4_18.patch) then echo "Applying acs override patch for 4.18+." git apply ../acso_4_18.patch else echo "Trying to apply acs override patch for 4.17+." wget -O ../acso_4_17.patch "${acso_patch_4_17}" if $(git apply --check ../acso_4_17.patch) then echo "Applying acs override patch for 4.17+." git apply ../acso_4_17.patch else echo "Trying to apply acs override patch for 4.14+." wget -O ../acso_4_14.patch "${acso_patch_4_14}" if $(git apply --check ../acso_4_14.patch) then echo "Applying acs override patch for 4.14+." git apply ../acso_4_14.patch else echo "Trying to apply acs override patch for 4.10+." wget -O ../acso_4_10.patch "${acso_patch_4_10}" if $(git apply --check ../acso_4_10.patch) then echo "Applying acs override patch for 4.10+." git apply ../acso_4_10.patch else echo "[ERROR]: Failed to apply acs override patch. Exiting." exit fi rm -f ../acso_4_10.patch fi rm -f ../acso_4_14.patch fi rm -f ../acso_4_17.patch fi rm -f ../acso_4_18.patch kernel_localversion="-acso" } function stable_preparations() { -
mdPlusPlus revised this gist
Jun 19, 2018 . 1 changed file with 227 additions and 113 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,132 +1,246 @@ #!/bin/bash function install_dependencies() { sudo apt -qq update sudo apt -qq install curl git wget sudo apt -qq build-dep linux-image-generic } function init() { echo "Initializing..." kernel_config=$(ls /boot/config-* | grep generic | sort -Vr | head -n 1) grub_config="/etc/default/grub" current_dir=$(pwd) working_dir=$(mktemp -d) cd ${working_dir} install_dependencies } function get_newest_versions() { stable_releases="https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/" stable_version=$(curl -s "${stable_releases}" | egrep -o 'linux-([0-9]{1,}\.)+[0-9]{1,}' | sort -Vr | head -n 1 | cut -d '-' -f 2) stable_link="${stable_releases}linux-${stable_version}.tar.xz" mainline_link=$(curl -s https://www.kernel.org/ | grep https://git.kernel.org/torvalds/t/linux- | grep -Po '(?<=href=")[^"]*') if ! [ -z ${mainline_link} ] then mainline_version=$(echo ${mainline_link} | cut -d '-' -f 2,3 | cut -d '.' -f 1,2) else mainline_version="unavailable" fi repo_string=$(apt search 'linux-source-' | grep 'linux-source' | sort -Vr | head -n 1) repo_pkg=$(echo ${repo_string} | egrep -o '^[^/]+') repo_version=$(echo ${repo_string} | cut -d ' ' -f 2) } function stable_or_mainline_or_repo() { get_newest_versions echo "Newest stable version is: ${stable_version}" echo "Mainline version is: ${mainline_version}" echo "Repository version is: ${repo_version}" echo -n "Do you want to get a [s]table, the newest [m]ainline release candidate or the newest kernel from your [r]epositories? [S/m/r] " read s_or_m_or_r echo -n "Do you want to apply the acs override patch? Kernels below 4.10 are not supported. [Y/n] " read acso echo -n "Do you want to install the kernel and its headers after compilation? [Y/n] " read install if [ -z ${install} ] || [ ${install} == "y" ] then echo -n "Do you want to make this kernel the new default? [Y/n] " read default fi if [ -z ${s_or_m_or_r} ] || [ ${s_or_m_or_r} == "s" ] then stable_preparations else if [ ${s_or_m_or_r} == "m" ] then if [ ${mainline_version} == "unavailable" ] then echo "Mainline version currently unavailable. Exiting." exit else mainline_preparations fi else if [ ${s_or_m_or_r} == "r" ] then repo_preparations else echo "Not a valid option. Exiting." exit fi fi fi } function try_acso_patch() { acso_patch_4_17="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.17/acso.patch" acso_patch_4_14="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.14/acso.patch" acso_patch_4_10="https://gitlab.com/Queuecumber/linux-acs-override/raw/master/workspaces/4.10/acso.patch" echo "Trying to apply acs override patch for 4.17+." wget -O ../acso_4_17.patch "${acso_patch_4_17}" if $(git apply --check ../acso_4_17.patch) then echo "Applying acs override patch for 4.17+." git apply ../acso_4_17.patch else echo "Trying to apply acs override patch for 4.14+." wget -O ../acso_4_14.patch "${acso_patch_4_14}" if $(git apply --check ../acso_4_14.patch) then echo "Applying acs override patch for 4.14+." git apply ../acso_4_14.patch else echo "Trying to apply acs override patch for 4.10+." wget -O ../acso_4_10.patch "${acso_patch_4_10}" if $(git apply --check ../acso_4_10.patch) then echo "Applying acs override patch for 4.10+." git apply ../acso_4_10.patch else echo "[ERROR]: Failed to apply acs override patch. Exiting." exit fi fi fi kernel_localversion="-acso" rm -f ../acso_4_17.patch ../acso_4_14.patch ../acso_4_10.patch } function stable_preparations() { echo "The newest available stable kernel version is ${stable_version}. Kernels below 4.10 are not supported." echo -n "Which version do you want to download? [${stable_version}] " read user_version if ! [ -z ${user_version} ] then stable_version=${user_version} fi kernel_version=${stable_version} kernel_name="linux-${kernel_version}" wget "${stable_link}" tar xvf ${kernel_name}.tar.xz cd ${kernel_name} independent_code } function mainline_preparations() { kernel_version=${mainline_version} kernel_name="linux-${kernel_version}" wget "${mainline_link}" tar xvf ${kernel_name}.tar.gz cd ${kernel_name} independent_code } function repo_preparations() { kernel_name=${repo_pkg} sudo apt install ${repo_pkg} tar xvf /usr/src/${kernel_name}.tar.bz2 cd ${kernel_name} makefile_version=$(cat Makefile | grep "^VERSION" | tr -d '[:space:]' | cut -d '=' -f 2) makefile_patchlevel=$(cat Makefile | grep "^PATCHLEVEL" | tr -d '[:space:]' | cut -d '=' -f 2) makefile_sublevel=$(cat Makefile | grep "^SUBLEVEL" | tr -d '[:space:]' | cut -d '=' -f 2) #makefile_extraversion=$(cat Makefile | grep "^EXTRAVERSION" | tr -d '[:space:]' | cut -d '=' -f 2) if ! [ -z ${makefile_version} ] then kernel_version=${makefile_version} if ! [ -z ${makefile_patchlevel} ] then kernel_version=${makefile_version}.${makefile_patchlevel} if ! [ -z ${makefile_sublevel} ] then kernel_version=${makefile_version}.${makefile_patchlevel}.${makefile_sublevel} fi fi fi from_repo="true" independent_code } function independent_code() { kernel_localversion="-localversion" if [ -z ${acso} ] || [ ${acso} != "n" ] then try_acso_patch fi cp ${kernel_config} .config yes '' | make oldconfig make clean if [ "${from_repo}" != "true" ] then ##<Ubuntu specifics> ubuntu_codename=$(lsb_release -s -c) cd .. cp -a /usr/share/kernel-package ubuntu-package ##error on bionic if [ "${ubuntu_codename}" != "bionic" ] then git clone --depth=1 git://kernel.ubuntu.com/ubuntu/ubuntu-${ubuntu_codename}.git cp ubuntu-${ubuntu_codename}/debian/control-scripts/{postinst,postrm,preinst,prerm} ubuntu-package/pkg/image/ cp ubuntu-${ubuntu_codename}/debian/control-scripts/headers-postinst ubuntu-package/pkg/headers/ fi cd ${kernel_name} CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version=${kernel_localversion} --overlay-dir=../ubuntu-package kernel_image kernel_headers ##</Ubuntu specifics> else CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append-to-version=${kernel_localversion} kernel_image kernel_headers fi if [ -z ${install} ] || [ ${install} == "y" ] then sudo dpkg -i ../*.deb if [ -z ${default} ] || [ ${default} == "y" ] then ##removing previous commented line sudo sed -i -e 's/^#GRUB_DEFAULT=.*//g' ${grub_config} ##commenting current line sudo sed -i 's/^GRUB_DEFAULT=/#GRUB_DEFAULT=/' ${grub_config} ##adding line grub_line="GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${kernel_version}${kernel_localversion}\"" sudo sed -i -e "s/^#GRUB_DEFAULT=.*/\0\n${grub_line}/" ${grub_config} sudo update-grub fi fi cd ${current_dir} rm -rf ${working_dir} } ##actual logic init stable_or_mainline_or_repo
NewerOlder