Commit Graph

488 Commits

Author SHA1 Message Date
Igor Velkov
1b74748622
Extension: ccache-remote — shared compilation cache via Redis/HTTP (#9369)
* add hook to allow customizing before kernel make env creation
* Hook runs in docker_cli_prepare_launch() just before DOCKER_EXTRA_ARGS
is processed, allowing extensions to add Docker arguments with a more
descriptive hook name than add_host_dependencies.
* Extension: ccache-remote

Enables ccache with remote Redis storage for sharing compilation cache across build hosts.

Features:
- Auto-discovery via Avahi/mDNS (ccache.local hostname)
- Explicit Redis server configuration via CCACHE_REMOTE_STORAGE
- Build statistics display at end of build (hit/miss/error rates)
- Support for both Docker and native builds
- Hooks for kernel and u-boot compilation environments

Documentation includes server setup instructions with security warnings,
client mDNS configuration, and cache sharing requirements.


* uboot: fix ccache environment and add extension hook

U-Boot build uses `env -i` which clears all environment variables.
CCACHE_DIR and CCACHE_TEMPDIR were not explicitly passed to make,
unlike kernel build (kernel-make.sh). This caused ccache to use
default directory instead of configured Armbian one, breaking
cache statistics and shared cache functionality.

Changes:
- Add CCACHE_DIR and CCACHE_TEMPDIR to uboot_make_envs
- Add uboot_make_config hook for extensions (similar to kernel_make_config),
  allowing modification of environment variables before compilation

* add long list of allowed ccache-related env vars
* set permissions to ccache files RW for everyone if cache not private
* ccache: add ccache_post_compilation hook for extensions
* ccache-remote: use ccache_post_compilation hook instead of cleanup handler

Show remote ccache stats after each compilation (kernel, uboot) via hook,
instead of once at the end via cleanup handler. Stats now shown even on
build failure.

* ccache: show stats with safe arithmetic
* ccache/uboot: improve code comments per review feedback

- uboot.sh: clarify ARMBIAN=foe workaround for dual-compiler scenario
- ccache-remote.sh: document that CCACHE_REDIS_CONNECT_TIMEOUT must be
  set before extension loads

* ccache-remote: mask storage URLs in logs

Mask CCACHE_REMOTE_STORAGE when emitting Docker env debug logs.

* ccache-remote: extract ccache_inject_envs() helper to deduplicate passthrough loops

Extract ccache_inject_envs() helper to deduplicate identical passthrough
loops in kernel and uboot make config hooks.

ccache-remote: rename functions to follow project naming conventions

Rename get_redis_stats and mask_storage_url to ccache_get_redis_stats
and ccache_mask_storage_url to follow project naming conventions.

ccache-remote: mask credentials in debug log output for passthrough loops

Mask CCACHE_REMOTE_STORAGE value through ccache_mask_storage_url() before
logging in both Docker env and make env passthrough loops to avoid leaking
credentials into build logs.

* ccache-remote: add HTTP/WebDAV backend and DNS discovery
* ccache-remote: move extension script into directory layout
* ccache-remote: add server setup docs and config files
* ccache-remote: validate Redis credentials in URLs
* ccache-remote: document Redis auth options and safe passwords

Add separate insecure config example for trusted networks.

Recommend URL-safe hex passwords and update setup docs.

* ccache-remote: improve Docker loopback handling and IPv6 host parsing
2026-03-01 01:18:35 +01:00
Igor Velkov
cb3bedf527 (#9400 P3b) patching: add missing -r flag to read
Other read calls in the same file already use -r.
Without -r, backslashes in user input are interpreted as escape characters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 01:15:10 +01:00
Igor Velkov
a0123f5d7a fix(kernel-headers): preserve build-time autoconf.h across postinst olddefconfig (#9425)
При упаковке linux-headers скомпилированные бинарники из scripts/ удаляются,
так как они собраны под хост сборки, а не под целевую машину (типичный случай
кросс-сборки). Поэтому postinst при установке пакета пересобирает их нативно,
предварительно запустив `make olddefconfig`.

Однако olddefconfig не только подготавливает окружение — он заново вычисляет
конфигурацию ядра, проверяя тулчейн, доступный на целевом хосте при установке.
Если инструменты, использовавшиеся при сборке ядра, на целевой машине отсутствуют
или имеют другую версию, olddefconfig молча отключает соответствующие CONFIG_*
опции (например, CONFIG_CC_IS_CLANG, CONFIG_LTO_CLANG, CONFIG_DEBUG_INFO_BTF).

В результате установленный пакет заголовков описывает не то ядро, которое
реально собрано и работает, а то, которое можно было бы собрать на данном хосте.

Это затрагивает:
- include/generated/autoconf.h (используется препроцессором C)
- include/config/auto.conf + маркер-файлы include/config/ (используются
  make-правилами kbuild)
- include/generated/rustc_cfg (используется Rust-сборками)

Все эти файлы — артефакты сборки и должны описывать скомпилированное ядро,
а не возможности хоста установки.

Исправление: при упаковке сохраняем сайдкар-тарбол с build-time версиями
include/config/ и include/generated/{autoconf.h,rustc_cfg}; восстанавливаем
его в postinst в самом конце, после всех make-шагов.

Fixes: https://github.com/armbian/build/issues/9425

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 22:29:08 +01:00
SuperKali
a8977dcd7d kernel: centralize netfilter legacy xtables config for all families
Add version-gated NETFILTER_XTABLES_LEGACY and BRIDGE_NF_EBTABLES_LEGACY
support in armbian-kernel.sh for kernels >= 6.18. Also add missing
ebtables table modules (BRIDGE_EBT_BROUTE, BRIDGE_EBT_T_FILTER,
BRIDGE_EBT_T_NAT) unconditionally to the nftables config function.

This ensures all hardware families automatically get legacy xtables
support when building kernels 6.18+, fixing Docker and Proxmox
firewall breakage without requiring per-family config changes.
2026-02-24 04:46:50 +01:00
Aurimas Niekis
e832bb3129 feat(drivers): add RTL8812EU/RTL8822EU wireless driver for EXTRA_WIFI
Integrate the libc0607/rtl88x2eu-20230815 out-of-tree driver into the build
system under EXTRA_WIFI for kernels >= 3.14 and < 6.19.

- Fetch pinned upstream commit ccb31f4ee346d5c2dd45475d276171b2f8de8350
- Install sources under drivers/net/wireless/rtl8822eu
- Enable AP and P2P modes in driver Makefile
- Hook into kernel Kconfig and Makefile via CONFIG_RTL8822EU

Tested working on `6.12.74-current-sunxi` and `6.6.75-legacy-sunxi`.
2026-02-22 16:59:49 +01:00
Rosen Penev
65d823f343
board configs: disable unprivelaged BPF (#9082)
Fixes wrong CPU vulnerability output:

/sys/devices/system/cpu/vulnerabilities/spectre_v2:Mitigation:Vulnerable: Unprivileged eBPF enabled

It's enabled but CONFIG_BPF_UNPRIV_DEFAULT_OFF being unset causes the warning.

This warning happens on ARM32 and ARM64 devices.

Edited with:
find -name "*.config" -exec sed -i 's/# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set/CONFIG_BPF_UNPRIV_DEFAULT_OFF=y/g' '{}' ;

CONFIG_BPF_UNPRIV_DEFAULT_OFF is a Linux kernel build-time hardening option that disables unprivileged use of the bpf() syscall (and thus unprivileged eBPF loading) by default by setting kernel.unprivileged_bpf_disabled=2 at boot. With this default, only privileged processes (e.g., with CAP_SYS_ADMIN / CAP_BPF, depending on kernel) can load eBPF unless an administrator explicitly relaxes it. [1], [2]
Operational behavior you should know

kernel.unprivileged_bpf_disabled semantics (as documented in the kernel sysctl docs/patch):

    0: unprivileged bpf() allowed
    1: unprivileged bpf() blocked and cannot be re-enabled until reboot (no transition back to 0 while running)
    2: unprivileged bpf() blocked but admin can later switch to 0 or 1 if needed
    If CONFIG_BPF_UNPRIV_DEFAULT_OFF=y, the default becomes 2 instead of 0. [2]

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2026-02-08 14:33:35 -05:00
Igor Velkov
b7bc3a770d clang: enable colored diagnostic output for kernel compilation
When building kernels with KERNEL_COMPILER=clang, compiler warnings
were displayed without color despite -fdiagnostics-color=always being
set in KCFLAGS. This GCC-native flag is not reliably honored by clang
when invoked through ccache and the kernel build system with LLVM=1.

Add -fcolor-diagnostics (clang's native flag) to the clang-specific
extra_warnings to ensure colored warning output.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:12:25 +01:00
Igor Velkov
e9f1902134
uwe5622: fix compilation with clang on Linux 6.19 (#9314)
In Linux 6.19, net_device->dev_addr is const unsigned char *.
Clang with -Werror,-Wincompatible-pointer-types-discards-qualifiers
rejects passing dev_addr to non-const parameters and memcpy into it.

Fix by:
- Replacing memcpy(dev->dev_addr, ...) with dev_addr_set()
- Using local buffer + ether_addr_copy for sprdwl_set_mac_addr call
  that needs mutable addr (the function modifies it in-place)
- Changing u8 *mac pointer to u8 mac[ETH_ALEN] array in cfg80211.c
  where dev_addr was assigned to a non-const pointer

Relates to #9049
2026-01-31 13:51:07 +01:00
Ricardo Pardini
82a8f85644 cli: kernel-dtb: check dtc for version 1.7.2 before producing normalized dts
- 1.7.2 does not resolve phandles in dts<->dts mode, which is much more useful
- I learned about this from https://lore.kernel.org/u-boot/20251219024102.145220-1-marek.vasut+renesas@mailbox.org/
- also add `-s` (sorted) flag, which further enhances comparability
- hint: Debian Trixie has 1.7.2; Ubuntu Noble only 1.7.0
2026-01-25 11:36:34 +01:00
Igor Velkov
a661744d1d kernel: add custom_kernel_make_params extension hook
Add a new extension hook point in run_kernel_make_internal() that allows
extensions to modify kernel make parameters before compilation.

Extensions can now modify:
- common_make_params_quoted - parameters passed to make
- common_make_envs - environment variables for make

This enables features like CROSS_COMPILE_COMPAT for 32-bit compat vDSO
on arm64 builds without modifying core build scripts.

Refs: https://github.com/armbian/build/issues/9216

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:36:20 +01:00
Igor Velkov
e9885c71af Fix "modpost not foud" error since error in rust coreutils uutils/coreutils#8924 2026-01-22 12:25:08 +01:00
Ricardo Pardini
acfd9c8dcb "get completely rid of dead code toolchain stuff", pt2
- this stuff has been laying around, unused, for years
2026-01-14 20:08:21 +01:00
Ricardo Pardini
84a7e45f29 u-boot: fix and unify CROSS_COMPILE and PATH after predatory maintenance
- also avoid spurious space in `CROSS_COMPILE` when `CCACHE` is not set
2026-01-14 20:08:21 +01:00
Ricardo Pardini
6889c8c0a4 drop find_toolchains, SKIP_EXTERNAL_TOOLCHAINS and all $toolchain PATH injections
- we've had SKIP_EXTERNAL_TOOLCHAINS=yes for ~5 years now
- drop all usages, mostly through `find_toolchains()`
- drop all manual PATH env injections (we've centralized if ever needed)
2026-01-14 20:08:21 +01:00
Ricardo Pardini
001c65df07 u-boot: run binwalk on all the produced u-boot bins (always)
- optionally, if UBOOT_BINS_TO_OUTPUT=yes, copy them out to output/
- this might reveal differences in binwalk itself more than u-boot
- but better than nothing
2026-01-12 23:37:03 +01:00
Ricardo Pardini
6e7d2798e3 u-boot: allow custom LOGLEVEL with UBOOT_LOGLEVEL (default to 6) 2026-01-09 00:40:11 +01:00
Ricardo Pardini
7213d8e8c6 u-boot: better CONFIG_LOG/LOGLEVEL/LOG_MAX_LEVEL (=6) 2026-01-09 00:40:11 +01:00
Ricardo Pardini
287931ac6e armbian-kernel: more eBPF-oriented options for userspace tooling 2026-01-08 19:40:54 +01:00
Ricardo Pardini
0562e3a79f atf: once again no-warn-rwx-segment woes
- turns out everybody was wrong, including me
- some (older?) ATF sources won't work, ever; thus
  - introduce ATF_SKIP_LDFLAGS=yes to skip it completely
  - introduce ATF_SKIP_LDFLAGS_WL=yes to only skip the `-Wl,` prefix
    - this is for ATF's that pass flag directly to linker, not gcc
- artifact-uboot: hash atf-building code into artifact version
2026-01-08 12:20:14 +01:00
tabris
4cc12701e7 framework - update comments around armbian_kernel_config__enable_various_filesystems to use extension_hook_opt_out 2026-01-08 12:07:56 +01:00
Igor Velkov
74e8171074 Remove -Wno-error=unknown-warning-option from clang KCFLAGS.
This flag was breaking kernel's cc-option detection, causing GCC-specific
warnings (-Wpacked-not-aligned, -Wstringop-truncation, -Wmaybe-uninitialized)
to be incorrectly added to btrfs/drm/coresight builds when using clang.
2026-01-08 12:04:39 +01:00
Paolo Sabatino
288b14defa apply rtl8723cs bluetooth only with kernels >= 6.1 2026-01-08 11:56:44 +01:00
Ricardo Pardini
d61b644ef5 framework & kernel options - simplify armbian_kernel_config_apply_opts_from_arrays, no more ambiguity opts_m vs opts_y (part 2) 2026-01-07 11:14:30 +01:00
tabris
0c21be1f67 framework & kernel options - simplify armbian_kernel_config_apply_opts_from_arrays, no more ambiguity opts_m vs opts_y 2026-01-07 11:14:30 +01:00
tabris
7ea0983321 framework and kernel config hooks - split FS modules into a separate hook function to allow customization 2026-01-07 11:14:30 +01:00
Paolo Sabatino
707025f422 rtl8723cs: stop including proprietary driver for kernel 6.19 onwards
* rtw88 mainline driver has good enough support for rtl8723cs
   so stop patching the kernel with this ancient driver
 * fixes rtl8703b (same chip as 8723cs) bluetooth firmware name file
2026-01-07 09:50:08 +01:00
tabris
eaac082190 kernel configs - enable EROFS as module, ditto overlayfs & F2FS 2025-12-29 09:16:28 +01:00
Igor Pecovnik
4d60ce08f2 chore: update copyright years to 2026
Update all copyright notices in shell scripts from 2025 to 2026.

## Changes

- **Igor Pecovnik**: 2013-2025 → 2013-2026 (129 files)
- **Ricardo Pardini**: 2023-2025 → 2023-2026, 2020-2025 → 2020-2026 (5 files)

## Additional Improvements

Also updated the backtitle in `lib/functions/configuration/interactive.sh`:
- Changed title from "Armbian building script" to "Armbian Linux build framework"
- Removed docs link for cleaner display
- Uses dynamic year calculation with separate declaration (fixes shellcheck SC2155)
2025-12-25 12:03:34 +01:00
Werner
3d46ef80e0
sunxi: bump edge to 6.18 (#9049)
* sunxi-6.18: make the mess even worse

* fixing one of megis patches and add sunxi 32bit to the mess

* rewrite against 6.18

* fix media-ov5640-Don-t-powerup-the-sensor-during-driver-probe.patch

* fix media-sun6i-csi-implement-vidioc_enum_framesizes.patch

* fix misc-modem-power-Power-manager-for-modems.patch

* Fix usb-gadget-Fix-dangling-pointer-in-netdev-private-data.patch, include rewrite

* fix mmc-sunxi-mmc-Remove-runtime-PM.patch, two hunks no longer apply

* re-extract all of megis patches

* remove unneeded branch

* add note to disabled patch

* auto-generated, out of date

* drop megous drm patches in favor of Jernej's work. disable broken patches

* disable patch which breaks compilation for armhf

* disable breaking patch, rewrite everything

* remove patches unrelated to sunxi family

* fix spi dev compatible patch

* fix tsc2007 patch

* drop mainlined patch, adjust x96 mate T95 eth sd card hack

* remove upstreamed patch

* re-enable no longer broken

* another rewrite to align stuff properly

* adjust various comments in series.conf

* recover lost overlays

* uew5622: fix compilation against Linux 6.18

* fix Add-sunxi-addr-driver-Used-to-fix-uwe5622-bluetooth-MAC-address.patch

* adjust patch subject to make sense

* restore fixup creation
restore overlay prefix on opiz2
this needs to be properly sorted at some point

* bump to 6.18.1
sunxi and sunxi64 build just fine

* fix and re-enable drv-mfd-axp20x-add-sysfs-interface.patch

* rewrite patches
2025-12-16 12:35:24 +01:00
SuperKali
9e1d62fbec
rtw88: Add kernel 6.18 support and clean up patch logic (#9041)
- Created patch/misc/rtw88/6.18/ directory with upstream driver patches
- Removed obsolete kernel 6.16 reference from patch conditions
- Updated comment to clarify that RF path detection fix is only needed
  for kernel 6.1.x (upstreamed in 6.18+)

This fixes RTL8822CS WiFi initialization failures on kernel 6.18 where
the driver was not being properly patched due to missing version directory.

Fixes SDIO timeout errors during chip initialization.
2025-12-08 23:58:15 +01:00
tabris
f53eac4253 framework - enable NTSYNC as a module on most kernels 2025-12-05 19:38:00 +01:00
Igor Pecovnik
43addca1d4 Add compilation of resolve_btfids to the kernel headers postinst script 2025-12-05 19:36:05 +01:00
Igor Pecovnik
43e89b4313 Make pahole as hard dependency on kernel headers 2025-12-05 19:36:05 +01:00
Ricardo Pardini
efdfb11328 kernel-config: don't leak grep stuff to stdout; mention Armbian and defconfig in rewritten .config comment 2025-11-08 13:13:38 +01:00
tabris
bb783640f4 framework kernel machinery - always save KERNEL_MAJOR_MINOR into generated config/kernel/foo.config 2025-11-08 11:35:37 +01:00
tabris
1f315c7819 Framework - armbian-kernel.sh - followup to #8820
Don't override CONFIG_FOO=y with CONFIG_FOO=m when opts_m contains
CONFIG_FOO
2025-11-06 15:48:07 -05:00
Igor
81ad50f257
Revitalize Espressobin - fix atf compilation bug, bump kernels (#8873)
* Revitalize Espressobin - fix atf compilation bug, bump kernels
* Drop forced systemd networking as this is now anyway in minimal by default
2025-11-06 00:19:49 +01:00
Ricardo Pardini
fab1be2e8b armbian-kernel: remove forced EXT4/BTRFS as builtins (let each kernel .config decide)
- some families want builtin, some want modules, let each decide
2025-11-06 00:15:46 +01:00
Ricardo Pardini
db5534ed5c armbian-kernel: drop CONFIG_ prefix, fix comments
- also fix for opt_m logging mismatch caught by the AI
2025-11-06 00:15:46 +01:00
Ricardo Pardini
5eeb998509 armbian-kernel: standardize on opts_y/opts_n/opts_m + opts_val arrays
- call_extensions_kernel_config() now declares the vars and calls
  armbian_kernel_config_apply_opts_from_arrays() at the end
- so each individual hook doesn't need to
- adapt family code using the old way too
2025-11-06 00:15:46 +01:00
Ricardo Pardini
e0adc40a75 armbian-kernel: rework everything into arrays + armbian_kernel_config_apply_opts_from_arrays
- so hashes and changes are consistent
2025-11-06 00:15:46 +01:00
Ricardo Pardini
03b7b2645d armbian-kernel: remove inconsistent conditionals
- one shall NOT use the contents of .config to determine what's in the .config
- also: introduce `opts_m` for armbian_kernel_config_apply_opts_from_arrays()
2025-11-06 00:15:46 +01:00
Ricardo Pardini
6a2b2d6760 armbian-kernel: BTRFS_FS & EXT4_FS as built-in, not modules 2025-11-06 00:15:46 +01:00
Ricardo Pardini
7c80838190 armbian-kernel: shfmt + trim whitespace; no changes 2025-11-06 00:15:46 +01:00
Ricardo Pardini
5e45b9c0f1 armbian-kernel: fix inconsistency in the ZRAM_BACKEND stuff; add a rant 2025-11-06 00:15:46 +01:00
Ricardo Pardini
f38ad454af uboot: set CONFIG_LOCALVERSION more reliably on script/config-enabled uboot sources
- keep old sed for old u-boots only
- don't start it with a dash, as that gets confused with cmdline arg eventually
  - instead use an underscore
2025-11-02 18:10:12 +01:00
Ricardo Pardini
3dfcbf4348 uboot: uboot-config now prints diff with pre-menuconfig defconfig 2025-11-02 18:10:01 +01:00
Igor
8b0f9ad1ef
Wireless driver patching: fix inconsistency in matching (#8789)
* Wireless driver patching: fix inconsistency in matching

Mathing Allwinner family via LINUXFAMILY is giving different results. sunxi doesn't cover sun5* ...

* Re-adding wireless drivers that fall out of this bug + few additional
2025-10-23 22:30:12 +02:00
Ricardo Pardini
19ab210ceb drivers_network: update rtl8723DS with amazingfate's fix for 6.18
- see https://github.com/armbian/rtl8723ds/pull/4
2025-10-19 01:43:30 +02:00
Ricardo Pardini
842e6b66f9 drivers_network: update rtl8852bs with amazingfate's fix for 6.18
- see 72c75150d7
2025-10-19 01:43:30 +02:00