Allow modifying current defconfig

Allow copying the current config and modifying it by running:
_use_current=y _makenconfig=y (or other config modifier).
This commit is contained in:
Yaraslau Furman 2024-11-22 15:21:35 +02:00
parent 0ce919c973
commit bce10af1e6

View file

@ -176,6 +176,13 @@ apply_patches() {
done 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 # Copies the kernel config
copy_defconfig() { copy_defconfig() {
local "_cur_major_ver=$(zcat /proc/config.gz | grep Linux | grep -o '[0-9]*[0-9]\.[0-9]*[0-9]')" 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 # 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."
@ -293,9 +303,7 @@ update_defconfig() {
[[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig [[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig
# Open configuration editors # Open configuration editors
[[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig modify_defconfig
[[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
[[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
# Save configuration # Save configuration
# shellcheck disable=SC2015 # shellcheck disable=SC2015