Skip to content

hisilicon-opensdk: restrict fpv variant to IMX307 + IMX335 sensors#2132

Merged
widgetii merged 1 commit into
masterfrom
feat/fpv-restrict-to-imx307-imx335
May 24, 2026
Merged

hisilicon-opensdk: restrict fpv variant to IMX307 + IMX335 sensors#2132
widgetii merged 1 commit into
masterfrom
feat/fpv-restrict-to-imx307-imx335

Conversation

@widgetii

Copy link
Copy Markdown
Member

Summary

Restricts HISILICON_OPENSDK_SENSORS to the four high-fps-validated Sony entries (IMX307 + IMX307_2L + IMX335 + IMX335_2L) when OPENIPC_VARIANT=fpv AND OPENIPC_SOC_FAMILY ∈ {hi3516ev200, gk7205v200}. Restores hi3516ev200_fpv / hi3516ev300_fpv (and any future device-specific *_fpv_* matrix entry under these families) to a buildable state.

Why

PR #2054 (2026-05-08, "build 30 sensor drivers from source") moved hi3516ev200 + gk7205v200 sensor .so files from pre-built vendor blobs to source-built. The source builds are ~+160 KB compressed in the squashfs vs the vendor's stripped pre-built ones, pushing every _fpv variant past the 5120 KB NOR rootfs cap:

hi3516ev200_fpv : 5196 KB / 5120 KB (76 KB over)
hi3516ev300_fpv : 5196 KB / 5120 KB (76 KB over)

Bisect proof

Using OpenIPC/builder#94's firmware_ref input on build-one.yml:

firmware_ref Date Includes #2054? rootfs.squashfs
4d88e9d 2026-05-08 13:45 UTC No (parent of #2054) 5028 KB ✅ (92 KB headroom)
1be1b6c9 2026-05-10 Yes 5188 KB ❌
7fc6cda4 2026-05-18 Yes 5196 KB ❌
master HEAD 2026-05-24 Yes 5204 KB ❌

Same builder.sh, same hisilicon-opensdk SHA, same majestic — only #2054's source-built switch differs. (Earlier attribution to majestic growth was a methodology error caught by widgetii/majestic#88 — variant-conflation in the comparison. See kaeru hi3516ev200-ev300-fpv-rootfs-size-overflow-2026-05-24 for the full trace.)

Why pruning, not compile-flag tweaks

Per-binary section anatomy explains it:

libsns_imx307.so (153 KB total)
  .text:   37,208 B (24%)
  .data:  114,648 B (75%)  ← calibration + register init tables

Sensor .so files are data-dominated 3:1 over text. -ffunction-sections + -Wl,--gc-sections and -flto mostly help .text — limited leverage when the .data is what bloats and is reachable through the exported dlopen API. Realistic flag-tweak saving: ~30 KB compressed across all sensors. Clears the current 76 KB overflow with zero margin for next drift.

Per-variant sensor pruning has dramatically higher leverage:

30 sensors × ~30-50 KB each ≈ 1 MB uncompressed in /usr/lib/sensors
fpv camera permanently paired with one sensor → 26 unused
→ ~870 KB uncompressed dead weight (~320 KB compressed in xz squashfs)

That's 4x the overflow, leaving comfortable headroom for normal package growth.

Why IMX307 + IMX335 specifically

These two sensors have fpv-validated high-fps presets shipped by recent PRs:

The 2-lane variants (_2L) are included because some board layouts use 2-lane MIPI wiring rather than 4-lane. Other sensors can be re-enabled per user request once their fpv high-fps modes are characterized.

Precedent in this file

Same shape as the existing HISILICON_OPENSDK_TRIM_SP2308 finalize hook for hi3518ev300/lite (added when a previous majestic bump exceeded that variant's cap). This is the cleaner version — restricts at install enumeration rather than removing after install.

Test plan

  • CI passes on this PR.
  • After merge, OpenIPC/builder dispatch of hi3516ev200_fpv against master HEAD produces rootfs.squashfs ≪ 5120 KB.
  • Same for hi3516ev300_fpv, gk7205v200_fpv, and the device-specific *_fpv_* matrix entries under these families.
  • /usr/lib/sensors/ on a flashed fpv camera contains only libsns_imx307{,_2l}.so + libsns_imx335{,_2l}.so.
  • FPV camera with IMX307 or IMX335 sensor still boots + streams correctly.

🤖 Generated with Claude Code

PR #2054 (2026-05-08, "build 30 sensor drivers from source") moved
hi3516ev200 and gk7205v200 sensor .so files from pre-built vendor
blobs to source-built. The source-built versions are ~+160 KB
compressed in the squashfs vs the vendor's stripped pre-built ones,
which pushed every _fpv variant past the 5120 KB NOR rootfs cap:

  hi3516ev200_fpv : 5196 KB / 5120 KB (76 KB over)
  hi3516ev300_fpv : 5196 KB / 5120 KB (76 KB over)

Bisect via OpenIPC/builder#94's firmware_ref input (build at parent
of #2054, 4d88e9d) confirmed: with the same builder.sh, same
hisilicon-opensdk VERSION, same majestic, ONLY the absence of #2054
makes the rootfs fit (5028 KB, 92 KB headroom). See kaeru
'hi3516ev200-ev300-fpv-rootfs-size-overflow-2026-05-24' for the full
investigation including the false-start on majestic (variant
conflation; widgetii/majestic#88 caught the methodology error).

Per-binary section anatomy explains why compile-flag tweaks
(-ffunction-sections + --gc-sections, -flto, -fvisibility=hidden)
have limited leverage here: a sensor .so is dominated by .data
(calibration + register tables), 3:1 over .text. Dropping unreachable
sections only helps the small .text fraction. Net realistic saving
from flag tweaks alone: ~30 KB compressed — clears the current
overflow but leaves no headroom for the next majestic / kernel module
nudge.

Per-variant sensor pruning has dramatically higher leverage: an fpv
camera is permanently paired with one sensor model, so the other 26
HISILICON_OPENSDK_SENSORS_$(family) entries are dead weight. Restricting
to the four high-fps-validated Sony entries
(IMX307 + IMX307_2L + IMX335 + IMX335_2L) saves
~26 × ~40 KB = ~1 MB uncompressed → ~300-400 KB compressed in squashfs.
Comfortably under the cap with room for future drift.

IMX307 and IMX335 are the only sensors with fpv-validated high-fps
presets so far (PRs #2090, #2091, #2093, #2094). Others can be
re-enabled per user request once their high-fps modes are checked
and the rootfs partition has room.

Follows the existing HISILICON_OPENSDK_TRIM_SP2308 pattern in this
file (hi3518ev300_lite restriction added by an earlier majestic bump).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@widgetii

Copy link
Copy Markdown
Member Author

Verification

Built hi3516ev200_fpv against this PR via OpenIPC/builder run 26365785019 using firmware_ref=5d112cc6:

- uImage:           [1954KB/2048KB]
- rootfs.squashfs:  [5016KB/5120KB]    ← under by 104 KB
  Filesystem size 5015.75 Kbytes (4.90 Mbytes)

Identical to the 2026-05-08 pre-#2054 baseline, full 104 KB headroom restored.

rootfs headroom
2026-05-08 (pre-#2054) saved baseline 5016 KB +104 KB
Today, master (#2054 + all 30 sensors) 5204 KB -84 KB
Today, this PR (#2054 + 4 sensors) 5016 KB +104 KB

-188 KB compressed savings from dropping 26 unused sensors. Ready to merge.

@widgetii widgetii merged commit 495ef0d into master May 24, 2026
99 of 100 checks passed
@widgetii widgetii deleted the feat/fpv-restrict-to-imx307-imx335 branch May 24, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant