mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-12 19:57:41 +04:00
wifi-detect adds runtime wlan data to /etc/board.json. It rewrites the file on flash at least twice on every boot: the run before kmodloader sees no wiphy and removes the data, and the hotplug run adds it again. board_detect now writes the board.d data to /etc/board-base.json and copies it to /tmp/sysinfo/board.json on every boot. base-files ships /etc/board.json as a symlink to the copy in tmpfs, so readers do not change. If /etc/board.json is not a symlink, for example a file kept across a reflash or a file added to the image, board_detect replaces it with the symlink. The sysupgrade overlay backup skips board-base.json, as it skips board.json. If /tmp/board.json exists when board_detect creates board-base.json, board_detect uses it instead of running board.d again. That file comes from preinit_config_board() or the x86 diag.sh in the same boot. The preinit shell holds their exported jshn state, and board.d run from it writes an empty object. Changes in behaviour: - Changes to /etc/board.json do not persist. Persistent changes go to /etc/board-base.json. - Removing /etc/board.json no longer runs board.d again. - board_detect exits 0 when the target file exists. Before, it exited 1. As a result, preinit_match_diag_led() in the x86 diag.sh now uses the /tmp/board.json from preinit_config_board(). Signed-off-by: Felix Fietkau <nbd@nbd.name>