Add back #62 Add initial -rc support to the install.sh script. (#100)

was merged after starting the work on the unified build script
add 5.10 RC to opt_ver case
This commit is contained in:
Tony 2020-10-27 13:42:39 -04:00 committed by GitHub
parent f7faa3dd1b
commit 191febe4e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,11 @@ source linux-tkg-config/prepare
# Run init script that is also run in PKGBUILD, it will define some env vars that we will use
_tkg_initscript
if [[ "$_sub" = rc* ]]; then
# if an RC version, subver will always be 0
_kernel_subver=0
fi
case "$_basever" in
"54")
opt_ver="4.19-v5.4"
@ -40,6 +45,9 @@ case "$_basever" in
"59")
opt_ver="5.8%2B"
;;
"510")
opt_ver="5.8%2B"
;;
esac
_cpu_opt_patch_link="https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/master/enable_additional_cpu_optimizations_for_gcc_v10.1%2B_kernel_v${opt_ver}.patch"
@ -118,40 +126,70 @@ if [ "$1" = "install" ] || [ "$1" = "config" ]; then
_distro=""
fi
if [ -d linux-${_basekernel}.orig ]; then
rm -rf linux-${_basekernel}.orig
fi
if [ -d linux-${_basekernel} ]; then
msg2 "Reseting files in linux-$_basekernel to their original state and getting latest updates"
cd "$_where"/linux-${_basekernel}
git checkout --force linux-$_basekernel.y
git clean -f -d -x
git pull
msg2 "Done"
cd "$_where"
if [[ "$_sub" = rc* ]]; then
if [ -d linux-main.orig ]; then
rm -rf linux-main.orig
fi
if [ -d linux-main ]; then
msg2 "Reseting files in linux-main to their original state and getting latest updates"
cd "$_where"/linux-main
git reset --hard HEAD
git clean -f -d -x
git checkout master
git pull
git checkout "v${_basekernel}-${_sub}"
msg2 "Done"
cd "$_where"
else
msg2 "Shallow git cloning linux kernel master branch"
# Shallow clone the past 3 weeks
_clone_start_date=$(date -d "$(date +"%Y/%m/%d") - 21 day" +"%Y/%m/%d")
git clone --branch master --single-branch --shallow-since=$_clone_start_date https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git "$_where"/linux-main
cd "$_where"/linux-main
git checkout "v${_basekernel}-${_sub}"
msg2 "Done"
fi
else
msg2 "Shallow git cloning linux $_basekernel"
git clone --branch linux-$_basekernel.y --single-branch --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-${_basekernel}
msg2 "Done"
if [ -d linux-${_basekernel}.orig ]; then
rm -rf linux-${_basekernel}.orig
fi
if [ -d linux-${_basekernel} ]; then
msg2 "Reseting files in linux-$_basekernel to their original state and getting latest updates"
cd "$_where"/linux-${_basekernel}
git checkout --force linux-$_basekernel.y
git clean -f -d -x
git pull
msg2 "Done"
cd "$_where"
else
msg2 "Shallow git cloning linux $_basekernel"
git clone --branch linux-$_basekernel.y --single-branch --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-${_basekernel}
msg2 "Done"
fi
# Define current kernel subversion
if [ -z $_kernel_subver ]; then
cd "$_where"/linux-${_basekernel}
_kernelverstr=`git describe`
_kernel_subver=${_kernelverstr:5}
fi
fi
# Define current kernel subversion
if [ -z $_kernel_subver ]; then
cd "$_where"/linux-${_basekernel}
_kernelverstr=`git describe`
_kernel_subver=${_kernelverstr:5}
cd "$_where"
fi
cd "$_where"
msg2 "Downloading Graysky2's CPU optimisations patch"
wget "$_cpu_opt_patch_link"
# Follow Ubuntu install isntructions in https://wiki.ubuntu.com/KernelTeam/GitKernelBuild
# cd in linux folder, copy Ubuntu's current config file, update with new params
cd "$_where"/linux-${_basekernel}
if [[ "$_sub" = rc* ]]; then
cd "$_where"/linux-main
else
cd "$_where"/linux-${_basekernel}
fi
msg2 "Copying current kernel's config and running make oldconfig..."
cp /boot/config-`uname -r` .config
@ -220,7 +258,11 @@ if [ "$1" = "install" ]; then
read -p "Do you want to install the new Kernel ? y/[n]: " _install
if [[ $_install =~ [yY] ]] || [ $_install = "yes" ] || [ $_install = "Yes" ]; then
cd "$_where"
_kernelname=$_basekernel.$_kernel_subver-$_kernel_flavor
if [[ "$_sub" = rc* ]]; then
_kernelname=$_basekernel.$_kernel_subver-$_sub-$_kernel_flavor
else
_kernelname=$_basekernel.$_kernel_subver-$_kernel_flavor
fi
_headers_deb="linux-headers-${_kernelname}*.deb"
_image_deb="linux-image-${_kernelname}_*.deb"
_kernel_devel_deb="linux-libc-dev_${_kernelname}*.deb"
@ -236,7 +278,13 @@ if [ "$1" = "install" ]; then
# Se we can actually refer properly to the rpm files.
_kernel_flavor=${_kernel_flavor//-/_}
if make -j ${_thread_num} rpm-pkg EXTRAVERSION="_${_kernel_flavor}"; then
if [[ "$_sub" = rc* ]]; then
_extra_ver_str="_${_sub}_${_kernel_flavor}"
else
_extra_ver_str="_${_kernel_flavor}"
fi
if make -j ${_thread_num} rpm-pkg EXTRAVERSION="${_extra_ver_str}"; then
msg2 "Building successfully finished!"
cd "$_where"
@ -253,7 +301,11 @@ if [ "$1" = "install" ]; then
read -p "Do you want to install the new Kernel ? y/[n]: " _install
if [ "$_install" = "y" ] || [ "$_install" = "Y" ] || [ "$_install" = "yes" ] || [ "$_install" = "Yes" ]; then
_kernelname=$_basekernel.${_kernel_subver}_$_kernel_flavor
if [[ "$_sub" = rc* ]]; then
_kernelname=$_basekernel.${_kernel_subver}_${_sub}_$_kernel_flavor
else
_kernelname=$_basekernel.${_kernel_subver}_$_kernel_flavor
fi
_headers_rpm="kernel-headers-${_kernelname}*.rpm"
_kernel_rpm="kernel-${_kernelname}*.rpm"
_kernel_devel_rpm="kernel-devel-${_kernelname}*.rpm"