Repository navigation
hi3536dv100: build the closed MPP modules from the SDK's .ko files - #268
Conversation
The script restores __ksymtab_<sym> names for modules a vendor ran through strip --strip-unneeded, assuming the 12-byte struct kernel_symbol of 5.x kernels. Hi3536DV100's SDK ships unstripped modules for a 4.9 kernel, where the struct is 8 bytes. On those it added a duplicate of every export it hit, and named one after the __ksymtab_strings section. modpost would then have seen every module exporting "__ksymtab_strings". Restore only when the input has no __ksymtab_ symbols of its own, and never take a section symbol for an export. Stripped 12-byte inputs such as gk7206v100's take the same path as before.
Every module the SDK ships closed is now built here as well, as for gk7206v100: base, sys, vdec, vfmw, jpegd, tde, region, vgs, vpss, vou, hifb, hdmi, venc, chnl, jpege, aio, ai, ao, aenc, adec and hi_acodec, from Hi3536DV100_SDK_V2.0.2.0 mpp/ko. scripts/ko2obj.sh turns each .ko into kernel/obj/hi3536dv100/<mod>.o: init_module is renamed, .modinfo is dropped, and the SDK kernel's struct module gives way to the one modpost builds. A wrapper in kernel/init/hi3536dv100/ supplies module_init/exit and the license the vendor .ko declared. vdec and vfmw declare none, which the kernel treats as proprietary anyway, so their wrappers say Proprietary. Exports and module_params survive the relink: each object's __ksymtab_ symbols match its .ko's exactly. Built against the OpenIPC hi3536dv100 kernel: 27 open_*.ko, with no undefined imports and no duplicate exports. On a lab Hi3536DV100 the whole set (21 relinked, plus open_osal and open_wdt from source), under the vendor file names: - loads through load_hisilicon with its module parameters applied (vdec VBSource/MiniBufMode, vpss vpss_vb_source, sys mem_total, hifb video); - creates every device node, and the MPI probe returns 0 throughout; - drives VO at 720P@60 out of VGA and HDMI, with HDMI enabled and the PHY up, for a vdec asking for 3 display buffers, the minimum the vendor vou accepts; - shows msposd's OSD on the relinked hifb, ARGB1555 at 1280x720. No oops.
PR Summary by QodoBuild Hi3536DV100 closed MPP modules from SDK .ko files
AI Description
Diagram
High-Level Assessment
Files changed (45)
|
Code Review by Qodo
1.
|
…on symbols Two Qodo findings on #268: - The check for intact export names counted __ksymtab_strings, a section symbol, so a stripped input that kept it would have skipped the restoration it needs. Only __ksymtab_<sym> names count now. - Run on the SDK's own file names, the script turned hi3536dv100_base.ko into _hi3536dv100_hi3536dv100_base_init, which the wrappers do not call. The committed objects had been made from renamed copies, and nothing recorded that. A leading "<prefix>_" now comes off the module name too, and hi3536dv100.kbuild records the loop that regenerates the objects. Running that loop on the SDK's mpp/ko reproduces all 21 committed objects byte for byte.
…ll 27 modules The first run on #267 failed after the kernel had built: the step looked for the cross compiler in output/host/bin. Firmware builds with per-package directories, and output/host/ is only assembled at the end of a full build, so after br-linux alone the toolchain is in output/per-package/linux/host/bin. The local check had run against a tree that had finished a full build, which is why it passed. With #268 in, the verify step lists all 27 modules: the six built from source, and the 21 closed MPP modules relinked from the SDK's .ko files. Checked in a layout with only per-package/ and build/, as CI has after br-linux: both steps pass, with 27 modules found.
…ll 27 modules The first run on #267 failed after the kernel had built: the step looked for the cross compiler in output/host/bin. Firmware builds with per-package directories, and output/host/ is only assembled at the end of a full build, so after br-linux alone the toolchain is in output/per-package/linux/host/bin. The local check had run against a tree that had finished a full build, which is why it passed. With #268 in, the verify step lists all 27 modules: the six built from source, and the 21 closed MPP modules relinked from the SDK's .ko files. Checked in a layout with only per-package/ and build/, as CI has after br-linux: both steps pass, with 27 modules found.
Problem
#266 brought in hi3536dv100's source modules (OSAL, sys_config, wdt, IR, cipher, tlv320aic31), but not the closed MPP modules. Other families build every closed module here as well:
.kofiles, viascripts/ko2obj.shand a wrapper per module.hi3536dv100's MPP modules were still only the prebuilt
.kofiles in firmware.Change
scripts/ko2obj.shfix (eae85c9).__ksymtab_<sym>names for stripped modules, assuming the 12-bytestruct kernel_symbolof 5.x kernels.__ksymtab_stringssection, so modpost would see every module exporting__ksymtab_strings.__ksymtab_symbols of its own, and never takes a section symbol for an export.The MPP set (
00ca8c6). Built fromHi3536DV100_SDK_V2.0.2.0mpp/ko, the same release as the mirrored headers and the SDK libmpi:kernel/obj/hi3536dv100/<mod>.o, each with its.cmdstub.kernel/init/hi3536dv100/<mod>_init.c, each declaring the license its vendor.kodid. vdec and vfmw declare none, which the kernel treats as proprietary anyway.__ksymtab_symbol set matches its.ko's exactly.hi3536dv100.kbuild: aDV100_BLOBSlist, the same pattern as gk7206v100'sXM_BLOBS. The header now records this part of the SDK too.hi_osal.koandsys_config.ko, because both are built from source.Testing
Build. All 27
open_*.ko(6 from source, 21 relinked) build against the OpenIPC hi3536dv100 kernel. modpost reports noundefined!and no duplicate exports. Each relinked module depends only onopen_osalandopen_base, oropen_aiofor acodec.Lab Hi3536DV100. OpenIPC
hi3536dv100_lite, with the whole set from this tree (21 relinked, plusopen_osalandopen_wdtfrom source) installed under the vendor file names and loaded with the SDK V2.0.2.0 libmpi:load_hisiliconloads all 23. Its module parameters still apply:/sys/module/open_vdec/parameters/VBSource=0,MiniBufMode=0,open_vpssvpss_vb_source=0,open_sysmem_total=256,open_hifbvideo=hifb:vram0_size:8100,vram1_size:128.vou.koaccepts 3–15; stock vdec asks for 2), drives VO at 720P@60 out of VGA and HDMI./proc/umap/hdmi0showsHDMIEnable: YESandPhyOutputEnable: YES.Follow-ups
open_*, soload_hisilicon'srmmodlines need updating.vouneeds 3 display buffers, while vdec uses 2.