Compare commits

...

6 commits

Author SHA1 Message Date
0ce919c973
6.11.9-1 (clr 6.11.6-1477) 2024-11-19 02:09:51 +01:00
28802bcd0b
Fix various things shellcheck complained about 2024-11-19 02:05:58 +01:00
6fd2cc8bf5
Add yarost12 as contributor 2024-11-19 02:05:37 +01:00
200949718f
Add comments + rename create_defconfig method 2024-11-19 01:52:26 +01:00
0d4fdeb204 Warn the user if the major version was upgraded when _use_current is set
It might be a good idea to regen the defconfig
if the major version was updated
2024-11-19 02:18:24 +02:00
7e8818327b Separate defconfig creation from re-use logic
At the moment when _use_current=y is passed to the package
compilation - the script still re-creates the defconfig which can
cause errors and cause the menuconfig to show up outta nowhere.

Fix this by bypassing the logic completely, I think that
anyone using the _use_current=y knows what they're doing
so we should be fine.
2024-11-19 02:00:33 +02:00

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# shellcheck disable=SC2034 disable=SC2048 disable=SC2086 disable=SC2154
# Maintainer: JeremyStarTM <jeremystartm@staropensource.de> # Maintainer: JeremyStarTM <jeremystartm@staropensource.de>
# Maintainer: Josip Ponjavic <josipponjavic at gmail dot com> # Maintainer: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: yarost12 <yaro330@gmail.com>
### BUILD OPTIONS ### BUILD OPTIONS
# You can modify these settings by executing "env _<setting>=<value> makepkg" # You can modify these settings by executing "env _<setting>=<value> makepkg"
@ -117,7 +120,7 @@
# Kernel version # Kernel version
_kernel_major=6.11 _kernel_major=6.11
_kernel_minor=7 _kernel_minor=9
# Clear Linux patches version # Clear Linux patches version
_clr=6-1477 _clr=6-1477
# kernel_compiler_patch version # kernel_compiler_patch version
@ -148,13 +151,12 @@ source=(
[[ -n "${_use_llvm_lto}" ]] && BUILD_FLAGS=("LLVM=1" "LLVM_IAS=1") [[ -n "${_use_llvm_lto}" ]] && BUILD_FLAGS=("LLVM=1" "LLVM_IAS=1")
export KBUILD_BUILD_HOST=archlinux export "KBUILD_BUILD_HOST=archlinux"
export KBUILD_BUILD_USER=${pkgbase} export "KBUILD_BUILD_USER=${pkgbase}"
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" export "KBUILD_BUILD_TIMESTAMP=$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
cd "${_src_linux}" || exit 1
# Applies all patches
apply_patches() {
# Patch with kernel version patches # Patch with kernel version patches
patch -Np1 -i ../patch-${_kernel_major}.${_kernel_minor} || true patch -Np1 -i ../patch-${_kernel_major}.${_kernel_minor} || true
@ -172,7 +174,27 @@ prepare() {
patch -Np1 -i "${srcdir}/cl-linux/${i}" || true patch -Np1 -i "${srcdir}/cl-linux/${i}" || true
done done
}
# Copies the kernel config
copy_defconfig() {
local "_cur_major_ver=$(zcat /proc/config.gz | grep Linux | grep -o '[0-9]*[0-9]\.[0-9]*[0-9]')"
[[ "${_cur_major_ver}" != "${_kernel_major}" ]] &&
warning "Major version was updated, you should regen the defconfig"
if [[ -s /proc/config.gz ]]; then
# modprobe configs
zcat /proc/config.gz > ./.config
make ${BUILD_FLAGS[*]} olddefconfig
else
warning "Your kernel was not compiled with IKCONFIG_PROC."
warning "Unable to read kernel configuration, aborting."
exit
fi
}
# Updates the kernel config
update_defconfig() {
# Copy configuration file (if found) # Copy configuration file (if found)
if [ -f "${startdir}/kconfig" ]; then if [ -f "${startdir}/kconfig" ]; then
echo ":: Using configuration file \"${startdir}/kconfig\"" echo ":: Using configuration file \"${startdir}/kconfig\""
@ -270,18 +292,24 @@ prepare() {
# Ask for subarch # Ask for subarch
[[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig [[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig
# Optionally use the configuration of the running kernel # Open configuration editors
# Written originally by nous, see [[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig
# https://web.archive.org/web/20110711231356/https://aur.archlinux.org/packages.php?ID=40191 (package doesn't exist anymore) [[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
[[ -n "${_use_current}" ]] && [[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
if [[ -s /proc/config.gz ]]; then
# modprobe configs # Save configuration
zcat /proc/config.gz > ./.config # shellcheck disable=SC2015
else [[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true
warning "Your kernel was not compiled with IKCONFIG_PROC." }
warning "Unable to read kernel configuration, aborting."
exit # Prepares the installation
fi prepare() {
cd "${_src_linux}" || exit 1
apply_patches
[[ -n "${_use_current}" ]] && copy_defconfig
[[ -z "${_use_current}" ]] && update_defconfig
# Read and apply modprobed database # Read and apply modprobed database
# See https://aur.archlinux.org/packages/modprobed-db # See https://aur.archlinux.org/packages/modprobed-db
@ -294,21 +322,15 @@ prepare() {
# Write kernel version # Write kernel version
make -s kernelrelease > version make -s kernelrelease > version
# Open configuration editors
[[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig
[[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
[[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
# Save configuration
[[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true
} }
# Build kernel
build() { build() {
cd "${_src_linux}" || exit 1 cd "${_src_linux}" || exit 1
make ${BUILD_FLAGS[*]} all make ${BUILD_FLAGS[*]} all
} }
# Packages the kernel package
_package() { _package() {
pkgdesc="${pkgdesc} This package includes the kernel and compiled modules." pkgdesc="${pkgdesc} This package includes the kernel and compiled modules."
depends=("coreutils" "kmod" "initramfs") depends=("coreutils" "kmod" "initramfs")
@ -318,7 +340,7 @@ _package() {
install=linux.install install=linux.install
cd "${_src_linux}" || exit 1 cd "${_src_linux}" || exit 1
local modulesdir="${pkgdir}/usr/lib/modules/$(<version)" local "modulesdir=${pkgdir}/usr/lib/modules/$(<version)"
# Create boot image # Create boot image
# systemd expects to find the kernel there to allow hibernation # systemd expects to find the kernel there to allow hibernation
@ -336,12 +358,13 @@ _package() {
rm "${modulesdir}"/build rm "${modulesdir}"/build
} }
# Packages the headers package
_package-headers() { _package-headers() {
pkgdesc="${pkgdesc} This package includes header files and scripts for building kernel modules." pkgdesc="${pkgdesc} This package includes header files and scripts for building kernel modules."
depends=("pahole") depends=("pahole")
cd "${_src_linux}" || exit 1 cd "${_src_linux}" || exit 1
local builddir="${pkgdir}/usr/lib/modules/$(<version)/build" local "builddir=${pkgdir}/usr/lib/modules/$(<version)/build"
install -Dt "${builddir}" -m644 .config Makefile Module.symvers System.map \ install -Dt "${builddir}" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux localversion.* version vmlinux
@ -418,8 +441,8 @@ _package-headers() {
pkgname=("$pkgbase" "$pkgbase-headers") pkgname=("$pkgbase" "$pkgbase-headers")
for _p in "${pkgname[@]}"; do for _p in "${pkgname[@]}"; do
eval "package_$_p() { eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}") $(declare -f "_package${_p#"$pkgbase"}")
_package${_p#$pkgbase} _package${_p#"$pkgbase"}
}" }"
done done
@ -432,6 +455,6 @@ validpgpkeys=(
) )
sha256sums=("55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e" sha256sums=("55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e"
"SKIP" "SKIP"
"4ccabe59805d7efd8165405624695255a87811cbea5c0e1d7a3981c21789b2ec" "d1c0981b5287252677e8f74a9f5d83aebceba77a4b1be24cba33102267f2c418"
"SKIP" "SKIP"
"b3fd8b1c5bbd39a577afcccf6f1119fdf83f6d72119f4c0811801bdd51d1bc61") "b3fd8b1c5bbd39a577afcccf6f1119fdf83f6d72119f4c0811801bdd51d1bc61")