[android12-linux-5.1] [ST chip] HAL is not adjusted after transplantation

After the ST sensor chip HAL was transplanted according to the official document, the test has been unable to be dropped, and the added log has not come out. After analysis, it is found that the system comes with a HAL, which is affected.

According to the official documentation, after transplanting HAL, add PRODUCT_PACKAGES += sensors.{TARGET_BOARD_PLATFORM} in the /device/<vendor\>/<board\>/device.mk* path. The generated sensors.{TARGET_BOARD_PLATFORM}.so will be installed to the /system/vendor/lib/hw/ location of the target machine when the system is flashed.

I went into the hw directory of the target machine and found that there were two sensors.*.so, and the other one should come with the system source code. After searching the source code, I found that there is a configuration in hardware/rockchip/sensor/st/Android.mk as shown below. This configuration will generate a sensors.$(TARGET_BOARD_HARDWARE).so file and install it in the hw directory of the target machine.

LOCAL_MODULE := sensors.$(TARGET_BOARD_HARDWARE)
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw

In the HAL logic of the sensor, there is a retrieval order when opening so:

First order: sensors.$(TARGET_BOARD_HARDWARE).so

Second order: sensors.{TARGET_BOARD_PLATFORM}.so

Third order: sensors.default.so

Considering the quick implementation, I directly added a string after the file name in hardware/rockchip/sensor/st/Android.mk to change the so name without affecting our target file call. The modified picture is as follows:

After the modification is completed, just compile and flash the machine directly. After completion, you can see the logs added to our transplanted HAL when you turn on the computer, indicating that the transplanted HAL has been adjusted by the system by default.

New to the industry, share your experience. If there are any mistakes, please point them out~

 Copyright belongs to: Shenzhen Qizhi Technology Co., Ltd.-Huahua

Guess you like

Origin blog.csdn.net/lsh670660992/article/details/132496560