Skip to content

hi3516ev200: finish the Goke-to-HiSilicon symbol mapping - #215

Merged
widgetii merged 1 commit into
mainfrom
fix/ev200-goke-symbols
Aug 30, 2026
Merged

widgetii merged 1 commit into
mainfrom
fix/ev200-goke-symbols

Conversation

@widgetii

Copy link
Copy Markdown
Member

Eight of the thirty hi3516ev200 sensor drivers cannot be loaded on a HiSilicon image. They name Goke SDK entry points, nothing in a HiSilicon rootfs defines those, and ld.so refuses the library at relocation time — so a camera with one of these sensors gets no video at all:

dlopen "/usr/lib/sensors/libsns_gc2053.so" error: Error relocating
/usr/lib/sensors/libsns_gc2053.so: GK_API_ISP_GetModParam: symbol not found

Reported in OpenIPC/firmware#2338 (gc2053). Affected: gc2053, f37, sc2231, sc500ai, gc4023, gc5603, os02g10, sp2308.

Why

hicompat.h exists for exactly this — it maps GK_API_* onto HI_MPI_* when SDK_CODE says HiSilicon, and re-declares each name so the prototype follows whichever spelling the macro produced. It was incomplete in two independent ways, four drivers each:

drivers what was missing
mapped, but one name absent gc2053, f37, sc2231, sc500ai GK_API_ISP_GetModParam was never in the list
never included the header gc4023, gc5603, os02g10, sp2308 so none of the six mappings reached them

gc5603 is in both groups, which is why it was short seven symbols rather than one or six.

A third thing had to change to make the first fix possible: hicompat.h could not be included from a *_sensor_ctl.c at all. Those bring in gk_api_isp.h alone, and the header's AE/AWB prototypes need types from ae_comm.h and awb_comm.h that only the *_cmos.c files happened to have already. It now includes what it names.

Verification

Whole tree built both ways from the same sources:

SDK_CODE drivers built still naming GK_API_*
0x3516E200 (HiSilicon) 30 0
0x7205200 (Goke) 30 29

The second row is the one that matters for regressions: a Goke build must go on resolving against Goke's libisp, and only the HiSilicon build is remapped. The mapping is inside #if SDK_CODE == 0x3516E200, so that is what you would expect — this confirms it.

On hardware, a hi3516ev300 running the 2026-08-29 OpenIPC nightly, swapping only the shipped libsns_gc2053.so for the rebuilt one:

shipped rebuilt
relocation error yes no
Sensor driver loaded no yes
Cannot start SDK yes no

That board carries an imx335, so the stream then times out for want of a gc2053 on the bus — loading the driver is what was being tested, and there is no lab board with any of the eight affected sensors to take it further.

Eight of the thirty sensor drivers in this tree cannot be loaded on a
HiSilicon hi3516ev200 image. They name Goke SDK entry points, and nothing
in a HiSilicon rootfs defines those, so ld.so refuses the library at
relocation time and the camera has no video at all:

  dlopen "/usr/lib/sensors/libsns_gc2053.so" error: Error relocating
  /usr/lib/sensors/libsns_gc2053.so: GK_API_ISP_GetModParam: symbol not found

hicompat.h already exists for exactly this: it maps GK_API_* onto the
HI_MPI_* equivalents when SDK_CODE says HiSilicon, and declares each name
so the prototype follows whichever spelling the macro produced. It was
just incomplete in two ways, and each accounts for four of the eight.

  - GK_API_ISP_GetModParam was never mapped. gc2053, f37, sc2231 and
    sc500ai read the ISP's quick-start flag through it and were left with
    that one symbol unresolved.

  - Four drivers never included the header at all, so none of the six
    mappings reached them: gc4023, gc5603, os02g10 and sp2308. gc5603 is
    in both groups, which is why it was short seven symbols rather than
    one or six.

The header also could not be included from a *_sensor_ctl.c, which brings
in gk_api_isp.h alone — its AE and AWB prototypes need types from
ae_comm.h and awb_comm.h, which only the *_cmos.c files happened to have
already. It now includes what it names, so it stands on its own.

Verified by building the whole tree both ways with the same sources:

  SDK_CODE=0x3516E200   30 drivers,  0 left naming GK_API_*
  SDK_CODE=0x7205200    30 drivers, 29 still naming GK_API_*

which is the point — the Goke build must go on resolving against Goke's
libisp, and only the HiSilicon one is remapped.

On a hi3516ev300 running the 2026-08-29 OpenIPC nightly, replacing the
shipped libsns_gc2053.so with the rebuilt one turns

  Error relocating ...: GK_API_ISP_GetModParam: symbol not found
  Cannot start SDK

into a driver that loads and an SDK that starts. (That board carries an
imx335, so the stream then times out for want of a gc2053 on the bus —
the load itself is what was being tested.)

Reported in OpenIPC/firmware#2338.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Complete hi3516ev200 Goke-to-HiSilicon sensor symbol mapping

🐞 Bug fix 🕐 20-40 Minutes

Grey Divider

AI Description

• Maps the missing ISP module-parameter call to its HiSilicon equivalent.
• Applies compatibility aliases across all eight affected sensor drivers.
• Makes the compatibility header self-contained for sensor-control translation units.
Diagram

graph TD
  BUILD["Sensor build"] --> SDK{"SDK target"}
  SDK -->|HiSilicon| COMPAT["Compatibility aliases"] --> HISENS["HiSilicon drivers"] --> HIAPI["HI MPI API"]
  SDK -->|Goke| GKSENS["Goke drivers"] --> GKAPI["GK API"]
Loading
High-Level Assessment

Extending the existing centralized compatibility header is the best approach because it preserves one driver source set and confines target-specific symbol selection to SDK_CODE. Duplicating drivers per SDK or adding linker-level shims would increase maintenance and packaging complexity without improving behavior.

Files changed (10) +27 / -0

Bug fix (10) +27 / -0
hicompat.hComplete and self-contain the SDK compatibility mappings +18/-0

Complete and self-contain the SDK compatibility mappings

• Adds the communication headers required by every declared ISP, AE, and AWB prototype, allowing inclusion from sensor-control files. Maps and declares GK_API_ISP_GetModParam so HiSilicon builds resolve it as HI_MPI_ISP_GetModParam.

include/hicompat.h

gc2053_sensor_ctl.cRemap gc2053 quick-start ISP lookup +1/-0

Remap gc2053 quick-start ISP lookup

• Includes hicompat.h so the gc2053 quick-start parameter call resolves to the HiSilicon ISP entry point on HiSilicon builds.

libraries/sensor/hi3516ev200/galaxycore_gc2053/gc2053_sensor_ctl.c

gc4023_cmos.cEnable compatibility aliases for gc4023 +1/-0

Enable compatibility aliases for gc4023

• Includes hicompat.h so gc4023 registration callbacks use the correct SDK-specific ISP, AE, and AWB symbols.

libraries/sensor/hi3516ev200/galaxycore_gc4023/gc4023_cmos.c

gc5603_cmos.cEnable callback aliases for gc5603 +1/-0

Enable callback aliases for gc5603

• Includes hicompat.h in the gc5603 CMOS implementation so registration callbacks map to HiSilicon APIs when required.

libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos.c

gc5603_sensor_ctl.cRemap gc5603 quick-start ISP lookup +1/-0

Remap gc5603 quick-start ISP lookup

• Includes hicompat.h in sensor control, covering the missing module-parameter symbol in addition to gc5603 callback mappings.

libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_sensor_ctl.c

os02g10_cmos.cEnable compatibility aliases for os02g10 +1/-0

Enable compatibility aliases for os02g10

• Includes hicompat.h so os02g10 callback references resolve against the selected Goke or HiSilicon SDK.

libraries/sensor/hi3516ev200/omnivision_os02g10/os02g10_cmos.c

sc2231_sensor_ctl.cRemap sc2231 quick-start ISP lookup +1/-0

Remap sc2231 quick-start ISP lookup

• Includes hicompat.h so the sc2231 module-parameter query no longer leaves a Goke symbol in HiSilicon libraries.

libraries/sensor/hi3516ev200/smart_sc2231/sc2231_sensor_ctl.c

sc500ai_sensor_ctl.cRemap sc500ai quick-start ISP lookup +1/-0

Remap sc500ai quick-start ISP lookup

• Includes hicompat.h so the sc500ai quick-start query links to HI_MPI_ISP_GetModParam on HiSilicon.

libraries/sensor/hi3516ev200/smart_sc500ai/sc500ai_sensor_ctl.c

f37_sensor_ctl.cRemap f37 quick-start ISP lookup +1/-0

Remap f37 quick-start ISP lookup

• Includes hicompat.h so the f37 module-parameter call uses the SDK-appropriate ISP symbol.

libraries/sensor/hi3516ev200/soi_f37/f37_sensor_ctl.c

sp2308_cmos.cEnable compatibility aliases for sp2308 +1/-0

Enable compatibility aliases for sp2308

• Includes hicompat.h so sp2308 registration callbacks are rewritten to HiSilicon APIs for HiSilicon builds.

libraries/sensor/hi3516ev200/superpix_sp2308/sp2308_cmos.c

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@widgetii
widgetii merged commit 001096a into main Aug 30, 2026
35 checks passed
@widgetii
widgetii deleted the fix/ev200-goke-symbols branch August 30, 2026 09:14
widgetii added a commit to OpenIPC/firmware that referenced this pull request Aug 30, 2026
Eight of the thirty sensor drivers this package builds for hi3516ev200
could not be loaded on the images it ships them in. They named Goke SDK
entry points, nothing in a HiSilicon rootfs defines those, and ld.so
refused the library at relocation time — so a camera with one of these
sensors came up with no video at all:

  dlopen "/usr/lib/sensors/libsns_gc2053.so" error: Error relocating
  /usr/lib/sensors/libsns_gc2053.so: GK_API_ISP_GetModParam: symbol not found

Affected: gc2053, f37, sc2231, sc500ai, gc4023, gc5603, os02g10, sp2308.
The other twenty-two were fine, which is why this went unnoticed — the
sensors in the images most people run are all in that group.

Fixed upstream in OpenIPC/openhisilicon#215, which completes the
GK_API_* -> HI_MPI_* mapping the tree already had. Nothing here changes
but the commit this package pins.

Checked at the pin, not just at the tag: the tarball buildroot fetches for
001096a carries the mapping and the include in all nine affected files.
Upstream built the whole tree both ways to prove the Goke side is
untouched — 0 drivers left naming GK_API_* for SDK_CODE=0x3516E200, 29 of
30 still naming them for 0x7205200, which is what a Goke image needs.

Reported in #2338.
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