讨论广场 问答详情
OH 增加外部gn子模块
Juusi 2025-08-12 14:18:23
24 评论 分享

OH 增加外部gn子模块
我写了个gn
 

import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")

config("bt_warnings") {
  cflags = [
    "-Wall",
    "-Werror",
    "-Wno-switch",
    "-Wno-unused-function",
    "-Wno-unused-parameter",
    "-Wno-unused-variable",
    "-Wno-implicit-function-declaration",
    "-Wno-incompatible-pointer-types",
    "-Wno-unused-but-set-variable",
  ]
}

ohos_prebuilt_etc("rtl8852bs_fw") {
  source = "//vendor/${product_company}/${product_name}/bluetooth/rtl8852bs_fw"
  install_images = [ chipset_base_dir ]
  relative_install_dir = "firmware"
  part_name = "rockchip_products"
  install_enable = true
}

ohos_prebuilt_etc("rtl8852bs_config") {
  source = "//vendor/${product_company}/${product_name}/bluetooth/rtl8852bs_config"
  install_images = [ chipset_base_dir ]
  relative_install_dir = "firmware"
  part_name = "rockchip_products"
  install_enable = true
}

ohos_shared_library("libbt_vendor_realtek") {
  output_name = "libbt_vendor_realtek"
  sources = [
    "src/bt_list.c",
    "src/bt_skbuff.c",
    "src/bt_vendor_rtk.c",
    "src/hardware_uart.c",
    "src/hardware_usb.c",
    "src/hardware.c",
    "src/hci_h5_snoop.c",
    "src/hci_h5.c",
    "src/rtk_btservice.c",
    "src/rtk_btsnoop_net.c",
    "src/rtk_heartbeat.c",
    "src/rtk_parse.c",
    "src/rtk_poll.c",
    "src/rtk_socket.c",
    "src/upio.c",
    "src/userial_vendor.c",
  ]

  include_dirs = [
    "include",
    "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
    "//foundation/communication/bluetooth/services/bluetooth/hardware/include",
    "//drivers/peripheral/bluetooth/hdi/ohos/hardware/bt/v1_0/server/implement",
  ]

  cflags = [
    "-DUSE_CONTROLLER_BDADDR=TRUE",
    "-DFW_AUTO_DETECTION=TRUE",
    "-DBT_WAKE_VIA_PROC=FALSE",
    "-DSCO_PCM_ROUTING=0",
    "-DSCO_PCM_IF_CLOCK_RATE=1",
    "-DSCO_PCM_IF_FRAME_TYPE=0",
    "-DSCO_PCM_IF_SYNC_MODE=0",
    "-DSCO_PCM_IF_CLOCK_MODE=0",
    "-DPCM_DATA_FMT_SHIFT_MODE=0",
    "-DPCM_DATA_FMT_FILL_BITS=0x03",
    "-DPCM_DATA_FMT_FILL_METHOD=0",
    "-DPCM_DATA_FMT_FILL_NUM=0",
    "-DPCM_DATA_FMT_JUSTIFY_MODE=0",
  ]

  configs = [ ":bt_warnings" ]

  external_deps = [
    "c_utils:utils",    
    "hilog:libhilog",
  ]

  install_enable = true
  install_images = [ chipset_base_dir ]

  part_name = "rockchip_products"
}

group("vendor_realtek") {
  deps = [
    ":libbt_vendor_realtek",
    ":rtl8852bs_fw",
    ":rtl8852bs_config",
  ]
}

在/device/board/hihope/rk3568/ohos.build里面增加了这个

 

但是报错//vendor/hihope/rk3568/bluetooth_realtek:libbt_vendor_realtek depend part c_utils, need set part deps info to rockchip_products.

是否还需要在哪里增加

24 评论 分享
写回答
全部评论(1)

//vendor/hihope/rk3568/bluetooth_realtek:libbt_vendor_realtek 把你这个加入白名单试试看

2025-08-12 14:28:57