Introduce a new flag to force reapply linux-clear defconfig mods

This commit is contained in:
Yaraslau Furman 2024-12-03 21:42:50 +02:00
parent 19b52c1f63
commit 5139ded653

View file

@ -35,6 +35,13 @@
# Set to anything but null to activate. # Set to anything but null to activate.
: "${_use_current:=""}" : "${_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 # Determines whether the kernel configuration should be
# copied into the source tree before compilation starts. # copied into the source tree before compilation starts.
# #
@ -181,6 +188,9 @@ modify_defconfig() {
[[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig [[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig
[[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig [[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
[[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig [[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
# Don't crash if all three are false
true
} }
# Copies the kernel config # Copies the kernel config
@ -193,9 +203,6 @@ copy_defconfig() {
# modprobe configs # modprobe configs
zcat /proc/config.gz > ./.config zcat /proc/config.gz > ./.config
make ${BUILD_FLAGS[*]} olddefconfig make ${BUILD_FLAGS[*]} olddefconfig
# If a user wants to modify the config based on the current one
modify_defconfig
else else
warning "Your kernel was not compiled with IKCONFIG_PROC." warning "Your kernel was not compiled with IKCONFIG_PROC."
warning "Unable to read kernel configuration, aborting." warning "Unable to read kernel configuration, aborting."
@ -301,13 +308,6 @@ update_defconfig() {
[[ -n "${_subarch}" ]] && yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig [[ -n "${_subarch}" ]] && yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig
# Ask for subarch # Ask for subarch
[[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig [[ -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 # Prepares the installation
@ -315,10 +315,10 @@ prepare() {
cd "${_src_linux}" || exit 1 cd "${_src_linux}" || exit 1
apply_patches apply_patches
[[ -n "${_use_current}" ]] && copy_defconfig [[ -n "${_use_current}" ]] && copy_defconfig
[[ -z "${_use_current}" ]] && update_defconfig [[ -n "${_optimize_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
[[ -n "${_localmodcfg}" ]] && [[ -n "${_localmodcfg}" ]] &&
@ -327,7 +327,14 @@ prepare() {
else else
echo ":: No modprobed.db file was found at ${HOME}/.config, skipping" echo ":: No modprobed.db file was found at ${HOME}/.config, skipping"
fi fi
# Open configuration editors
modify_defconfig
# Save configuration
# shellcheck disable=SC2015
[[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true
# Write kernel version # Write kernel version
make -s kernelrelease > version make -s kernelrelease > version
} }