You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
armbian-kernel.sh: introduce KERNEL_BTF=no to opt-out of BTF/CO-RE type-info on low-RAM machines
- turns out `pahole` for `vmlinux` can take multiple gigabytes of RAM to run successfully
- I can't simply decide based on available RAM, as that would make .config hashes mismatch
- thus, introduce:
- default is to enable BTF; if on low-ram host, error out unless KERNEL_BTF=yes is passed
- if KERNEL_BTF=no is passed, the BTF debug info is always disabled
- if KERNEL_BTF=yes is passed, then a warning is produced, but BTF is still enabled
- the magic number "6451 MiB" was determined empirically (and is probably bs)
if [[ "${KERNEL_BTF}"=="no" ]];then# If user is explicit by passing "KERNEL_BTF=no", then actually disable all debug info.
75
+
display_alert "Disabling eBPF and BTF info for kernel""as requested by KERNEL_BTF=no""info"
76
+
opts_y+=("CONFIG_DEBUG_INFO_NONE") # Enable the "none" option
77
+
opts_n+=("CONFIG_DEBUG_INFO""CONFIG_DEBUG_INFO_DWARF5""CONFIG_DEBUG_INFO_BTF""CONFIG_DEBUG_INFO_BTF_MODULES") # BTF & CO-RE == off
78
+
# We don't disable the eBPF options, as eBPF itself doesn't require BTF (debug info) and doesnt' consume as much memory during build as BTF debug info does.
display_alert "Considering available RAM for BTF build""${available_physical_memory_mib} MiB""info"
83
+
84
+
if [[ ${available_physical_memory_mib}-lt 6451 ]];then# If less than 6451 MiB of RAM is available, then exit with an error, telling the user to avoid pain and set KERNEL_BTF=no ...
85
+
if [[ "${KERNEL_BTF}"=="yes" ]];then# ... except if the user knows better, and has set KERNEL_BTF=yes, then we'll just warn.
86
+
display_alert "Not enough RAM available (${available_physical_memory_mib}Mib) for BTF build""but KERNEL_BTF=yes is set; enabling BTF""warn"
87
+
else
88
+
exit_with_error "Not enough RAM available (${available_physical_memory_mib}Mib) for BTF build. Please set 'KERNEL_BTF=no' to avoid running out of memory during the kernel LD/BTF build step; or ignore this check by setting 'KERNEL_BTF=yes' -- that might put a lot of load on your swap disk, if any."
0 commit comments