简体   繁体   中英

Android HAL .so not build

I was following this guide to learn HAL layer and framework layer in AOSP. I've managed to run the whole process. But there's one small issue. When I build the whole ROM/Android, hello.default.so won't be built/shown up in the following ,

  • ${output}/system/lib/hw
  • ${output}/system/lib64/hw
  • ${output}/vendor/lib/hw
  • ${output}/vendor/lib64/hw

Only by manually executing mmm hardware/libhardware/modules/hello/ , can I get the hello.default.so.

I have remember to append the module into PRODUCT_PACKAGES macro as following. Packages/Modules vim, hello-lkm-client have been successfully integrated. But not the hello.default module.

PRODUCT_PACKAGES += \
    vim
PRODUCT_PACKAGES += \
    hello-lkm-client
PRODUCT_PACKAGES += \
    hello.default

Here's the Android.mk file for the hello HAL


include $(CLEAR_VARS)

LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_SHARED_LIBRARIES := liblog
#############
# I'm following $hw/modules/gralloc/Android.mk 
#############
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
# LOCAL_C_INCLUDES := hardware/libhardware

LOCAL_SRC_FILES := hello.c
LOCAL_HEADER_LIBRARIES := libhardware_headers

LOCAL_MODULE := hello.default
# LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog

include $(BUILD_SHARED_LIBRARY)

Here's the complete hello HAL module.

OK, found it. I have to add the hello module in Android.mk of Module modules , just like the following.

chang@ryzen:~/bulk2/rockpi4-atv9-chang/hardware/libhardware$ git diff
diff --git a/modules/Android.mk b/modules/Android.mk
index a430a650..7bbeaeb9 100644
--- a/modules/Android.mk
+++ b/modules/Android.mk
@@ -2,5 +2,6 @@ hardware_modules := \
     camera \
     gralloc \
     sensors \
-    hw_output
+    hw_output \
+       hello

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM