From f36852812efad33aa70d86f14fb4b1be46651116 Mon Sep 17 00:00:00 2001 From: "Rich O." Date: Wed, 28 Oct 2026 16:39:31 -0400 Subject: [PATCH] Trim unused features from the Hazelwood RAK4631 repeater build Drop display, GPS, INA, RS232, KISS host and every sensor driver except SHTC3 (RAK1901) from RAK_4631_repeater_unified_lora_ota, keeping the env name and therefore OTA target id 05F5FFAE. The Full image shrinks by about 125 KB, leaving more in-place room for LoRa OTA deltas. check_firmware_capabilities.py accepts capabilities listed in MESHCORE_LOCAL_OMIT_CAPABILITIES as deliberately omitted, and fails if a listed one is still present. --- local_build.sh | 17 +++++++++++++++++ scripts/check_firmware_capabilities.py | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/local_build.sh b/local_build.sh index 5f0987a0d..ff30faeb4 100755 --- a/local_build.sh +++ b/local_build.sh @@ -37,6 +37,23 @@ case "${2:-}" in *companion*) LOCAL_BUILD_FLAGS="${LOCAL_BUILD_FLAGS} -DBLE_PIN_CODE=123456" ;; esac +# Hazelwood RAK4631 repeaters (KM-Test, Treebeard): no display, GPS, INA, RS232 +# or KISS host; Treebeard's only sensor is a RAK1901 (SHTC3). Dropping the rest +# shrinks the image by ~100 KB, which leaves more in-place room for LoRa OTA +# deltas. The env name must stay as is: it is the OTA target id (05F5FFAE). +# Upstream qualification still expects these features from the env name, so +# list them for scripts/check_firmware_capabilities.py to accept as omitted. +case "${2:-}" in + RAK_4631_repeater_unified_lora_ota) + LOCAL_BUILD_FLAGS="${LOCAL_BUILD_FLAGS} -UDISPLAY_CLASS -UENV_INCLUDE_GPS -UWITH_RS232_BRIDGE -UMESH_ENABLE_HOST_KISS" + for sensor in AHTX0 BME280 BME680 BME680_BSEC BMP085 BMP280 INA219 INA226 INA260 INA3221 LPS22HB MLX90614 RAK12035 SHT4X VL53L0X; do + LOCAL_BUILD_FLAGS="${LOCAL_BUILD_FLAGS} -UENV_INCLUDE_${sensor}" + done + MESHCORE_LOCAL_OMIT_CAPABILITIES="bridge.rs232,bridge.rs232.merged,sensor.gps,sensor.ina219,sensor.ina226,sensor.ina260,sensor.ina3221,radio2.kiss.host,radio2.kiss.usb" + export MESHCORE_LOCAL_OMIT_CAPABILITIES + ;; +esac + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS:+${PLATFORMIO_BUILD_FLAGS} }${LOCAL_BUILD_FLAGS}" if [ -d /opt/homebrew/bin ]; then diff --git a/scripts/check_firmware_capabilities.py b/scripts/check_firmware_capabilities.py index bd6b99dd3..9bebd389f 100644 --- a/scripts/check_firmware_capabilities.py +++ b/scripts/check_firmware_capabilities.py @@ -301,6 +301,25 @@ def main() -> int: } ) + # Local builds may deliberately compile features out of an existing OTA + # identity. Listed capabilities must then be absent: drop their checks and + # record the omission as a reduction. One that is still present means the + # trim did not apply, so it fails. + omitted = {value.strip() for value in + os.environ.get("MESHCORE_LOCAL_OMIT_CAPABILITIES", "").split(",") if value.strip()} + kept_checks = [] + for check in checks: + if check["capability"] not in omitted: + kept_checks.append(check) + elif check["present"]: + print(f"capability check failed: {check['capability']} is listed in " + "MESHCORE_LOCAL_OMIT_CAPABILITIES but still present", file=sys.stderr) + malformed = True + else: + args.reduction.append(f"locally omitted: {check['capability']}") + checks = kept_checks + args.capability = [value for value in args.capability if value not in omitted] + capabilities = stable_unique( args.capability + [check["capability"] for check in checks] )