From 19b52c1f63dde88cc6fed16830d5ea5235528a5b Mon Sep 17 00:00:00 2001 From: Yaraslau Furman Date: Fri, 22 Nov 2024 15:21:35 +0200 Subject: [PATCH 1/3] Allow modifying current defconfig Allow copying the current config and modifying it by running: _use_current=y _makenconfig=y (or other config modifier). --- PKGBUILD | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 0395a7f..9a3e9bf 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -176,6 +176,13 @@ apply_patches() { done } +# Allows user to modify the kernel config +modify_defconfig() { + [[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig + [[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig + [[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig +} + # 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]')" @@ -186,6 +193,9 @@ copy_defconfig() { # modprobe configs zcat /proc/config.gz > ./.config make ${BUILD_FLAGS[*]} olddefconfig + + # If a user wants to modify the config based on the current one + modify_defconfig else warning "Your kernel was not compiled with IKCONFIG_PROC." warning "Unable to read kernel configuration, aborting." @@ -293,9 +303,7 @@ update_defconfig() { [[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig # Open configuration editors - [[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig - [[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig - [[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig + modify_defconfig # Save configuration # shellcheck disable=SC2015 -- 2.45.2 From 5139ded65340cc3b69456dd95e46dd9ef94b222d Mon Sep 17 00:00:00 2001 From: Yaraslau Furman Date: Tue, 3 Dec 2024 21:42:50 +0200 Subject: [PATCH 2/3] Introduce a new flag to force reapply linux-clear defconfig mods --- PKGBUILD | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 9a3e9bf..42571d6 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -35,6 +35,13 @@ # Set to anything but null to activate. : "${_use_current:=""}" +# Apply optimizations from Linux-clear to the defconfig. +# This is useful for cases when _use_current is used but +# Linux-clear modifications are necessary for some reason. +# +# Set to anything but null to activate. +: "${_optimize_defconfig:=""}" + # Determines whether the kernel configuration should be # copied into the source tree before compilation starts. # @@ -181,6 +188,9 @@ modify_defconfig() { [[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig [[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig [[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig + + # Don't crash if all three are false + true } # Copies the kernel config @@ -193,9 +203,6 @@ copy_defconfig() { # modprobe configs zcat /proc/config.gz > ./.config make ${BUILD_FLAGS[*]} olddefconfig - - # If a user wants to modify the config based on the current one - modify_defconfig else warning "Your kernel was not compiled with IKCONFIG_PROC." warning "Unable to read kernel configuration, aborting." @@ -301,13 +308,6 @@ update_defconfig() { [[ -n "${_subarch}" ]] && yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig # Ask for subarch [[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig - - # Open configuration editors - modify_defconfig - - # Save configuration - # shellcheck disable=SC2015 - [[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true } # Prepares the installation @@ -315,10 +315,10 @@ prepare() { cd "${_src_linux}" || exit 1 apply_patches - + [[ -n "${_use_current}" ]] && copy_defconfig - [[ -z "${_use_current}" ]] && update_defconfig - + [[ -n "${_optimize_defconfig}" ]] || [[ -z "${_use_current}" ]] && update_defconfig + # Read and apply modprobed database # See https://aur.archlinux.org/packages/modprobed-db [[ -n "${_localmodcfg}" ]] && @@ -327,7 +327,14 @@ prepare() { else echo ":: No modprobed.db file was found at ${HOME}/.config, skipping" fi - + + # Open configuration editors + modify_defconfig + + # Save configuration + # shellcheck disable=SC2015 + [[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true + # Write kernel version make -s kernelrelease > version } -- 2.45.2 From 8054550b9fa784ec2d09d19e47dae1d330e80776 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Wed, 4 Dec 2024 19:21:53 +0100 Subject: [PATCH 3/3] Correct and add information to setting comment --- PKGBUILD | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 42571d6..1274563 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -35,9 +35,13 @@ # Set to anything but null to activate. : "${_use_current:=""}" -# Apply optimizations from Linux-clear to the defconfig. -# This is useful for cases when _use_current is used but -# Linux-clear modifications are necessary for some reason. +# Apply selected optimizations chosen by +# the package maintainers to the config. +# +# Only takes effect if '_use_current' +# is enabled. Keep disabled if you want +# to reuse your existing kernel configuration +# without any changes being applied to it. # # Set to anything but null to activate. : "${_optimize_defconfig:=""}" -- 2.45.2