[Hi3751V811][Android8.0]海思平台 - bluetooth(mt7668u)模组的编译过程

平台 内核版本 安卓版本
Hi3751V811 Linux4.1 Android8.0

文章目录

    • 查看我们有哪些设备
    • 如何配置MT7668U编译

查看我们有哪些设备

[Hi3751V811][Android8.0]海思平台 - bluetooth(mt7668u)模组的编译过程_第1张图片
目录:android/device/hisilicon/bigfish/sdk/source/component/wifi/drv

如何配置MT7668U编译

目录:android/device/hisilicon/Hi3751V811/BoardConfig.mk

# ------> Wifi + BT <------------
# RTL8822BU
BOARD_WIFI_BLUETOOTH_DEVICE_RTL8822BU := n
# MT7668U
BOARD_WIFI_BLUETOOTH_DEVICE_MT7668U   := y
# AP6356E
BOARD_WIFI_BLUETOOTH_DEVICE_AP6356E   := n

##  Stable configuration definitions
ifeq ($(BOARD_WIFI_BLUETOOTH_DEVICE_AP6356E),y)
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_BCM := true
endif
ifeq ($(BOARD_WIFI_BLUETOOTH_DEVICE_RTL8822BU),y)
BOARD_WIFI_VENDOR := realtek
BOARD_BLUETOOTH_DEVICE_REALTEK := y
BOARD_HAVE_BLUETOOTH_RTK := true
BOARD_HAVE_BLUETOOTH_RTK_IF := usb
BOARD_HAVE_BLUETOOTH_RTK_COEX := true
endif
ifeq ($(BOARD_WIFI_BLUETOOTH_DEVICE_MT7668U), y)
BOARD_WIFI_VENDOR := mediatek
BOARD_BLUETOOTH_DEVICE_MT7668U := y
endif

内核部分:
目录:android/device/hisilicon/Hi3751V811/AndroidBoard.mk

LOCAL_PATH := $(call my-dir)

# bigfish
-include device/hisilicon/bigfish/build/bigfish.mk

目录:android/device/hisilicon/bigfish/build/bigfish.mk
bigfish.mk可以看出

# kernel
-include device/hisilicon/bigfish/build/kernel.mk
# rootfs_sdk
-include device/hisilicon/bigfish/build/rootfs_sdk.mk
# loader
-include device/hisilicon/bigfish/build/loader.mk
# recovery
-include device/hisilicon/bigfish/build/recovery.mk
# ext4
-include device/hisilicon/bigfish/build/ext4.mk
# emmc
-include device/hisilicon/bigfish/build/emmc.mk
# bootargs
-include device/hisilicon/bigfish/build/bootargs.mk
# wifi
-include device/hisilicon/bigfish/build/wifi.mk
# security
ifeq ($(strip $(HISILICON_SECURITY_L2)),true)
-include device/hisilicon/bigfish/build/security.mk
endif
-include device/hisilicon/bigfish/build/trustedcore.mk

可以看下我们重点关注的wifi.mk文件:

include $(CLEAR_VARS)
WIFI_CFG := \
        CFG_HI_WIFI_DEVICE_RTL8822BU=$(BOARD_WIFI_BLUETOOTH_DEVICE_RTL8822BU) \
        CFG_HI_WIFI_DEVICE_MT7668U=$(BOARD_WIFI_BLUETOOTH_DEVICE_MT7668U) \
        CFG_HI_WIFI_DEVICE_AP6XXX=$(BOARD_WIFI_BLUETOOTH_DEVICE_AP6356E) \
        CFG_HI_WIFI_MODE_STA=y CFG_HI_WIFI_MODE_AP=y

wifi: kernel
        $(MAKE) ARCH=$(TARGET_ARCH) -C $(SDK_DIR)/source/component/wifi/drv \
                LINUX_DIR=$(ANDROID_BUILD_TOP)/$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ \
                MODULE_OUT=$(ANDROID_BUILD_TOP)/$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/modules \
                ROOTFS_DIR=$(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/system \
                SDK_CFGFILE=$(SDK_CFGFILE) $(WIFI_CFG) ANDROID_BUILD=y install
        $(MAKE) -C $(SDK_DIR)/source/component/wifi/drv \
                SDK_CFGFILE=$(SDK_CFGFILE) $(WIFI_CFG) clean

ALL_DEFAULT_INSTALLED_MODULES += wifi

.PHONY: wifi

#----------------------------------------------------------------------
# Compile BLUETOOTH Drivers
#----------------------------------------------------------------------
ifeq ($(BOARD_BLUETOOTH_DEVICE_REALTEK),y)
BLUETOOTH_DIR := $(ANDROID_BUILD_TOP)/device/hisilicon/bigfish/bluetooth/rtkbt/driver
endif

ifeq ($(BOARD_BLUETOOTH_DEVICE_MT7668U),y)
BLUETOOTH_DIR := $(ANDROID_BUILD_TOP)/device/hisilicon/bigfish/bluetooth/mt7668u/driver
endif

ifeq ($(BOARD_BLUETOOTH_DEVICE_REALTEK),y)
bluetooth: kernel
        $(MAKE) ARCH=$(TARGET_ARCH) CROSS_COMPILE=$(CROSS_COMPILE_TOOLCHAIN) \
                -C $(BLUETOOTH_DIR) \
                KERNEL_VERSION=$(HISI_LINUX_KERNEL) \
                LINUX_DIR=$(ANDROID_BUILD_TOP)/$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ \
                ANDROID_PRODUCT_OUT=$(ANDROID_BUILD_TOP)/$(PRODUCT_OUT) \
                SDK_CFGFILE=$(SDK_CFGFILE)
                if [ ! -d $(ANDROID_BUILD_TOP)/$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/modules ]; then \
                        mkdir -p $(ANDROID_BUILD_TOP)/$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/modules; \
                fi
                cp $(BLUETOOTH_DIR)/btusb.ko $(ANDROID_BUILD_TOP)/$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/modules/btusb.ko
        $(MAKE) ARCH=$(TARGET_ARCH) CROSS_COMPILE=$(CROSS_COMPILE_TOOLCHAIN) \
                         -C $(BLUETOOTH_DIR) \
                    KERNEL_VERSION=$(HISI_LINUX_KERNEL) \
                SDK_CFGFILE=$(SDK_CFGFILE) clean
ALL_DEFAULT_INSTALLED_MODULES += bluetooth
endif
ifeq ($(BOARD_BLUETOOTH_DEVICE_MT7668U),y)
bluetooth: kernel
        $(MAKE) ARCH=$(TARGET_ARCH) CROSS_COMPILE=$(CROSS_COMPILE_TOOLCHAIN) \
                -C $(BLUETOOTH_DIR) \
                KERNEL_VERSION=$(HISI_LINUX_KERNEL) \
                LINUX_DIR=$(ANDROID_BUILD_TOP)/$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ \
                ANDROID_PRODUCT_OUT=$(ANDROID_BUILD_TOP)/$(PRODUCT_OUT) \
                SDK_CFGFILE=$(SDK_CFGFILE)
                if [ ! -d $(ANDROID_BUILD_TOP)/$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/modules ]; then \
                        mkdir -p $(ANDROID_BUILD_TOP)/$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/modules; \
                fi
                cp $(BLUETOOTH_DIR)/btmtk_usb.ko $(ANDROID_BUILD_TOP)/$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/modules/btusb.ko
        $(MAKE) ARCH=$(TARGET_ARCH) CROSS_COMPILE=$(CROSS_COMPILE_TOOLCHAIN) \
                         -C $(BLUETOOTH_DIR) \
                    KERNEL_VERSION=$(HISI_LINUX_KERNEL) \
                SDK_CFGFILE=$(SDK_CFGFILE) clean
ALL_DEFAULT_INSTALLED_MODULES += bluetooth
endif


.PHONY: wifi bluetooth

Makefile目录:android/device/hisilicon/bigfish/bluetooth/mt7668u/driver/Makefile

USB_CFILES := \
        btmtk_usb_main.c \
        btmtk_usb_fifo.c

将对应的驱动编译模块加入到objects集合中来
目录:android/device/hisilicon/bigfish/sdk/source/component/wifi/drv/usb_mt7668u/Makefile

ifeq ($(CFG_HI_WIFI_DEVICE_MT7668U),y)
LOCAL_MODULE += mt7668u.ko
LOCAL_MODULE_SRC = wlan.mt76x8.mp2.20180615
LOCAL_MODULE_PATH += $(BUILD_DIR)/$(LOCAL_MODULE_SRC)/mt7668u.ko
LOCAL_PREALLOC_PATH += $(BUILD_DIR)/$(LOCAL_MODULE_SRC)/mt7668u_prealloc.ko
LOCAL_MODULE_BIN_DIR = $(BUILD_DIR)/$(LOCAL_MODULE_SRC)/bin/mt7668
LOCAL_MODULE_CFG_DIR = $(BUILD_DIR)/$(LOCAL_MODULE_SRC)/wlan_cfg/mt7668
LOCAL_MODULE_BIN += $(LOCAL_MODULE_BIN_DIR)/EEPROM_MT7668.bin \
                        $(LOCAL_MODULE_BIN_DIR)/EEPROM_MT7668_e1.bin \
                        $(LOCAL_MODULE_BIN_DIR)/mt7668_patch_e1_hdr.bin \
                        $(LOCAL_MODULE_BIN_DIR)/mt7668_patch_e2_hdr.bin \
                        $(LOCAL_MODULE_BIN_DIR)/WIFI_RAM_CODE2_USB_MT7668.bin \
                        $(LOCAL_MODULE_BIN_DIR)/WIFI_RAM_CODE_MT7668.bin

LOCAL_MODULE_CFG += $(LOCAL_MODULE_CFG_DIR)/TxPwrLimit_MT76x8.dat \
                        $(LOCAL_MODULE_CFG_DIR)/wifi.cfg

你可能感兴趣的:([Hi3751V811][Android8.0]海思平台 - bluetooth(mt7668u)模组的编译过程)