Skip to content

Commit

Permalink
fix: get kernel version (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjechow authored Jul 30, 2024
1 parent 5c383f3 commit 88d2c83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
YACKS
======

YACS is yet another compile the kernel script. It is specifically developed for building a Ubuntu kernel and tested on Linux Mint.
YACS is yet another compile kernel script. It is specifically developed for building a Ubuntu kernel and tested on Linux Mint.

It uses the Ubuntu mainline kernel config from https://kernel.ubuntu.com/~kernel-ppa/mainline/ found in the Linux modules generic dep package for configuration of the kernel.
Afterward it updates the kernel sources (linux-rolling-lts branch) from the official sources: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/.
Afterward it updates the kernel sources (linux-rolling-stable branch) from the official sources: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/.

It modifies the kernel config for O3 optimizations and disables all debugging before compiling the sources.

Expand Down
11 changes: 7 additions & 4 deletions buildKernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ else
#git pull origin linux-rolling-stable || exit 1
fi

kernelVersionDir=$(git describe --tags --abbrev=0)
kernelVersion=${kernelVersionDir#v} # remove character "v"
# get kernel version from git tag
kernelVersionDir=$(git tag --merged HEAD --sort=taggerdate | tail -n1)
kernelVersion=${kernelVersionDir#v} # remove character "v" in version string

# download corresponding git module from Ubuntu mainline repo to extract and use Ubuntu kernel config
kernelUrl=https://kernel.ubuntu.com/~kernel-ppa/mainline/${kernelVersionDir}
kernelVersionLong=$(echo "$kernelVersion" | awk 'BEGIN {FS="."}{printf "%02d%02d%02d", $1, $2, $3;}')
kernelFileName=$(curl -sL "$kernelUrl" | grep -iEo "linux-modules-${kernelVersion}-${kernelVersionLong}-generic_${kernelVersion}-${kernelVersionLong}.[0-9]{12}_amd64.deb" | head -1)
kernelDeb=${kernelUrl}/amd64/${kernelFileName}

if [[ ! -f "../${kernelFileName}" ]]; then
printf "Downloading kernel %s sources from Ubuntu... " "$kernelVersion"
printf "Downloading kernel %s config from Ubuntu... " "$kernelVersion"
if ! wget -O "../${kernelFileName}" -q "${kernelDeb}"; then
printf "\nProblem downloading kernel %s sources from Ubuntu mainline: %s. Exiting now!\n" "$kernelVersion" "$kernelDeb"
printf "\nProblem downloading kernel %s config from Ubuntu mainline: %s. Exiting now!\n" "$kernelVersion" "$kernelDeb"
exit 1
fi
printf "success\n\n"
Expand Down

0 comments on commit 88d2c83

Please sign in to comment.