scripts: add adjust_kernel_config to help adjust kernel options

This commit is contained in:
Lukas Rusak 2021-02-13 17:14:47 -08:00
parent c1054355a1
commit d33beeefed
No known key found for this signature in database
GPG Key ID: 8C310C807E7393A3

40
tools/adjust_kernel_config Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
if [ -z "${1}" -o "${1}" == "help" -o "${1}" == "--help" -o "${1}" == "h" -o "${1}" == "-h" ]; then
echo -e "A kernel config command must be specified:\n"
echo -e "${0} menuconfig"
echo -e ""
echo -e "To see all available config commands use:\n"
echo -e "${0} commands"
exit
fi
KERNEL_CONFIG_COMMAND="$1"
. config/options linux
${SCRIPTS}/unpack linux
AVAILABLE_KERNEL_CONFIG_COMMANDS="$(kernel_make -C ${PKG_BUILD} help | sed -n '/Configuration targets:/,/Other generic targets:/p' | sed -n -E 's/^ ([a-z0-9]+)[ -]*.*/\1/p')"
print_config_commands() {
echo -e "Available kernel config commands are:\n\n${AVAILABLE_KERNEL_CONFIG_COMMANDS}"
}
if [ "${1}" == "commands" ]; then
print_config_commands
exit
fi
if [ -z "$(echo ${AVAILABLE_KERNEL_CONFIG_COMMANDS} | grep ${KERNEL_CONFIG_COMMAND})" ]; then
echo -e "\"${KERNEL_CONFIG_COMMAND}\" is not an available kernel config command\n"
print_config_commands
exit
fi
tools/check_kernel_config
kernel_make KCONFIG_CONFIG=${PKG_KERNEL_CFG_FILE} -C ${PKG_BUILD} ${KERNEL_CONFIG_COMMAND}