armbian-build/extensions/kernel-localmodconfig.sh
Ricardo Pardini 53266feff8
armbian-next: kernel: deterministic .config mtime handling; kernel build logging sections reorg
- .config is now compared with previous one byte-wise, diff shown, and mtime preserved directly via `cp -p`
- this does away with the previous mtime-based BS I had written during the fasthash era (and thus remove file-mtime.sh, regen lib)
- split some functions, to better control the interactive piece in the _middle_ of kernel config process
- no more `kernel_config_maybe_interactive()`, now `kernel_config()` that controls its own logging sections
- extract `kernel_determine_toolchain()` out of config into make
- introduce internal hook `armbian_kernel_config()` that runs before custom version (for .config defaults, coming soon)
2023-02-18 07:42:39 -03:00

22 lines
1.2 KiB
Bash

function extension_prepare_config__prepare_localmodconfig() {
# If defined, ${KERNEL_CONFIG_FROM_LSMOD} can contain a lsmod to apply to the kernel configuration.
# to get a file for this run 'lsmod > my_machine.lsmod' and then put it in userpatches/lsmod/
export KERNEL_CONFIG_FROM_LSMOD="${KERNEL_CONFIG_FROM_LSMOD:-}"
display_alert "localmodconfig INIT lsmod" "${KERNEL_CONFIG_FROM_LSMOD}" "warn"
# If there, make sure it exists
local lsmod_file="${SRC}/userpatches/lsmod/${KERNEL_CONFIG_FROM_LSMOD}.lsmod"
if [[ ! -f "${lsmod_file}" ]]; then
exit_with_error "Can't find lsmod file ${lsmod_file}, configure with KERNEL_CONFIG_FROM_LSMOD=xxx"
fi
}
# This needs much more love than this. can be used to make "light" versions of kernels, that compile 3x-5x faster or more
function custom_kernel_config_post_defconfig__apply_localmodconfig() {
if [[ "a${KERNEL_CONFIG_FROM_LSMOD}a" != "aa" ]]; then
display_alert "localmodconfig with lsmod" "${KERNEL_CONFIG_FROM_LSMOD}" "warn"
local lsmod_file="${SRC}/userpatches/lsmod/${KERNEL_CONFIG_FROM_LSMOD}.lsmod"
run_kernel_make "LSMOD=${lsmod_file}" localmodconfig "> /dev/null" # hide output, it's way too long. stderr still shows
fi
}