kernel-tfg/configure-linux.sh

40 lines
1.0 KiB
Bash
Raw Normal View History

2023-09-12 11:19:32 +00:00
#!/usr/bin/env bash
set -xeu
export EXTRA_LINUX_MODULES=()
export EXTRA_LINUX_BUILTIN=()
EXTRA_LINUX_CONFIG=()
for FILE in ./extra-configs/*.sh; do
source "${FILE}"
done
if [[ "${EXTRA_LINUX_MODULES[*]}" != "" ]]; then
for CONFIG_MODULE in "${EXTRA_LINUX_MODULES[@]}"; do
EXTRA_LINUX_CONFIG+=("${CONFIG_MODULE}"'=m')
done
fi
if [[ "${EXTRA_LINUX_BUILTIN[*]}" != "" ]]; then
for CONFIG_BUILTIN in "${EXTRA_LINUX_BUILTIN[@]}"; do
EXTRA_LINUX_CONFIG+=("${CONFIG_BUILTIN}"'=y')
done
fi
function verify_config {
[[ "${EXTRA_LINUX_CONFIG[*]}" == "" ]] && >&2 echo '**** WARNING: List of extra config options to check is empty, doing nothing.'
if [[ ! -f .config ]]; then
>&2 echo '**** ERROR: The config file could not be found.'
exit 1
fi
for CONFIG_OPTION in "${EXTRA_LINUX_CONFIG[@]}"; do
if ! grep "${CONFIG_OPTION}" .config 2>&1 /dev/null; then
>&2 echo "**** ERROR: Config option '${CONFIG_OPTION}' not found in the config file."
exit 1
fi
done
}