Harmonyos technology community 2022-01-26 15:53:54 阅读数:822
HDF The drive subsystem is OpenHarmony One of the important features , Its main function is to implement the driver in the multi-core and multi platform Internet of things environment , Realize one-time drive development , Multi terminal deployment . Before transplantation OHOS3.0 Using the traditional linux drive , Regretful , Today, try to HDF The driver subsystem is added to the compilation framework . Know a few nouns before you start .
HCS(HDF Configuration Source) yes HDF Driver framework configuration description source code ,JSON Storage .
HC-GEN(HDF Configuration Generator) yes HCS Configure the conversion tool , Can be HDF The configuration file HCS Convert to binary HCB
HCB(HDF Configuration Binary) Binary , The driver can use HDF The configuration resolution interface provided by the framework obtains the configuration .
How to add... To the kernel HDF drive ,linux The following two directories are mainly implemented under the kernel :
drivers\adapter\khdf\linux and drivers\framework
These two directories are added to the kernel compilation through links , The process is as follows
kernel\linux\build\kernel.mk:75
You can refer to 3516 Of HDF Patch :kernel\linux\patches\linux-5.10\hi3516dv300_patch\hdf.patch
Just patching is not enough , You have to add... To the compiled configuration file of the kernel HDF Options . The first thing to do is to refer to 3516 Configuration selection for , However, some configurations are found to cause compilation failure . The test found that the following configuration can be compiled successfully .
[*] Enable HDF linux test It needs to be set up , If not set CONFIG_DRIVERS_HDF_TEST, There is something wrong with the directory structure , Would report such a mistake .
below 3 There are options to turn off , Otherwise, the following mistakes will be reported .
[ ] Enable HDF platform sdio driver
[ ] Enable HDF platform emmc driver
[ ] Enable HDF wifi
For the convenience of testing, you can compile the kernel separately , For example, my compilation command is like this .
You can analyze HDF This part of the compilation process .
linux-5.10\drivers\hdf\Makefile,hdf.patch Will add this Makefile, take khdf Add folder to compile .
linux-5.10\drivers\hdf\khdf\Makefile
drivers\adapter\khdf\linux\Makefile: Would call obj-$(CONFIG_DRIVERS_HDF) += ../../../../$(PRODUCT_PATH)/hdf_config/$(SUB_DIR)/hdf_test/ This is a OHOS3.0 default HCS File storage path . Official notes also say , Therefore, the corresponding equipment *.hcs Store in vendor\raspberrypi\RPI4B\hdf_config\khdf Folder , Reference resources 3516 Of vendor\hisilicon\Hi3516DV300\hdf_config\khdf\hdf.hcs That's it .
Reference resources 3516 Of vendor\hisilicon\Hi3516DV300\hdf_config\khdf\Makefile
among :PRODUCT_PATH Source of environment variables :kernel/linux/build/kernel_module_build.sh:42:export PRODUCT_PATH=$4
After compilation , You can upload the kernel image to the development board , Check it out. HDF Whether the driver framework starts successfully .
Join in HDF front
Join in HDF after
It's basically started successfully , Next, consider using HDF Add a device in a new way . To verify HDF Whether the drive frame works normally .
Want to know more about Hongmeng , Please visit :
51CTO Hongmeng technology community jointly built with Huawei officials
https://harmonyos.51cto.com/#bkwz
::: hljs-center
:::
copyright:author[Harmonyos technology community],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/01/202201261553513879.html