From d33beeefed69ef72f7b6269921b3a2f6cadc6c42 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sat, 13 Feb 2021 17:14:47 -0800 Subject: [PATCH] scripts: add adjust_kernel_config to help adjust kernel options --- tools/adjust_kernel_config | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 tools/adjust_kernel_config diff --git a/tools/adjust_kernel_config b/tools/adjust_kernel_config new file mode 100755 index 0000000000..7a8001fdc6 --- /dev/null +++ b/tools/adjust_kernel_config @@ -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}