Skip to content

Commit

Permalink
added blobs/ made Carliv touch default recovery build
Browse files Browse the repository at this point in the history
  • Loading branch information
patraanjan23 committed Apr 28, 2015
1 parent d0a392d commit b80d67a
Show file tree
Hide file tree
Showing 30 changed files with 3,675 additions and 1,267 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.mk~
*.txt~
*.sh~
*.fstab~
*.rc~
*.mt6582~
*.prop~
*.gitignore~
*~
64 changes: 55 additions & 9 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@ USE_CAMERA_STUB := true
-include vendor/micromax/a106/BoardConfigVendor.mk

#board info
TARGET_ARCH := arm
TARGET_NO_BOOTLOADER := true
TARGET_NO_FACTORYIMAGE := true
TARGET_BOARD_PLATFORM := mt6582
TARGET_ARCH := arm
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_VARIANT := cortex-a7
TARGET_CPU_SMP := true
ARCH_ARM_HAVE_TLS_REGISTER := true

#boot
TARGET_NO_BOOTLOADER := true
TARGET_BOOTLOADER_BOARD_NAME := a106
TARGET_NO_FACTORYIMAGE := true
BOARD_CUSTOM_BOOTIMG_MK := $(LOCAL_PATH)/boot.mk

#blob hacks
COMMON_GLOBAL_CFLAGS += -DDISABLE_HW_ID_MATCH_CHECK
TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK := true

# BT
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_MTK := true
BOARD_BLUETOOTH_DOES_NOT_USE_RFKILL := true
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/micromax/a106/bluetooth

#kernel
BOARD_KERNEL_CMDLINE :=
Expand All @@ -40,10 +53,7 @@ BOARD_MKBOOTIMG_ARGS := --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 -
TARGET_RECOVERY_INITRC := $(LOCAL_PATH)/recovery/recovery.rc
TARGET_RECOVERY_FSTAB := $(LOCAL_PATH)/recovery/fstab.mt6582
TARGET_PREBUILT_RECOVERY_KERNEL := $(LOCAL_PATH)/kernel

BOARD_CUSTOM_BOOTIMG_MK := $(LOCAL_PATH)/boot.mk
BOARD_HAS_NO_SELECT_BUTTON := true
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/virtual/android_usb/android0/f_mass_storage/lun%d/file"

#patches from C3C0
#CWM_EMMC_BOOT_DEVICE_NAME := /dev/bootimg
Expand All @@ -53,20 +63,56 @@ TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/virtual/android_usb/android0/f_
#CWM_EMMC_UBOOT_DEVICE_NAME := /dev/uboot
#CWM_EMMC_UBOOT_DEVICE_SIZE := 0x00060000

#flipped screen
BOARD_HAS_FLIPPED_SCREEN := true

#neon cflags for cortex-a7
#TARGET_GLOBAL_CFLAGS += -mcpu=cortex-a7 -mfpu=neon -mfloat-abi=softfp
#TARGET_GLOBAL_CPPFLAGS += -mcpu=cortex-a7 -mfpu=neon -mfloat-abi=softfp
TARGET_GLOBAL_CFLAGS += -mcpu=cortex-a7 -mfpu=neon -mfloat-abi=softfp
TARGET_GLOBAL_CPPFLAGS += -mcpu=cortex-a7 -mfpu=neon -mfloat-abi=softfp

#user image is ext4
TARGET_USERIMAGES_USE_EXT4:=true

# EGL settings
BOARD_EGL_CFG := device/micromax/a106/egl.cfg
USE_OPENGL_RENDERER := true
BOARD_EGL_WORKAROUND_BUG_10194508 := true

# wifi
WPA_SUPPLICANT_VERSION := VER_0_8_X
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_WLAN_DEVICE := mediatek
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_mt66xx
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_mt66xx
WIFI_DRIVER_FW_PATH_PARAM:="/dev/wmtWifi"
WIFI_DRIVER_FW_PATH_STA:=STA
WIFI_DRIVER_FW_PATH_AP:=AP
WIFI_DRIVER_FW_PATH_P2P:=P2P

# Allow more than one lun file
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/virtual/android_usb/android0/f_mass_storage/lun%d/file"
#TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/mt_usb/musb-hdrc.0/gadget/lun%d/file"




###########
#Carliv3.3#
###########
RECOVERY_VARIANT := carliv
BOARD_HAS_MTK:=true
BOARD_NEEDS_MTK_GETSIZE := true
DEVICE_RESOLUTION := 480x800

#######
#philz#
#######
#BOARD_USE_MTK_LAYOUT := true
#BOARD_MTK_BOOT_LABEL := "/bootimg"
#BRIGHTNESS_SYS_FILE := "/sys/class/leds/lcd-backlight/brightness"

#TARGET_SCREEN_HEIGHT := 800
#TARGET_SCREEN_WIDTH := 480


########################
Expand Down
7 changes: 7 additions & 0 deletions bluetooth/bdroid_buildcfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H

#define BTM_DEF_LOCAL_NAME "Micromax Unite 2"
#define BTA_AV_MAX_A2DP_MTU 1788

#endif
19 changes: 16 additions & 3 deletions device_a106.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ else
endif

PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel \
$(LOCAL_KERNEL):kernel

#rootfs
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/recovery/fstab:root/fstab \
$(LOCAL_PATH)/recovery/fstab.mt6582:root/fstab.mt6582
$(LOCAL_PATH)/recovery/fstab.mt6582:root/fstab.mt6582 \
$(LOCAL_PATH)/root/ueventd.mt6582.rc:root/ueventd.mt6582.rc \
$(LOCAL_PATH)/root/init.mt6582.rc:root/init.mt6582.rc \
$(LOCAL_PATH)/root/init.modem.rc:root/init.modem.rc \
$(LOCAL_PATH)/root/init.protect.rc:root/init.protect.rc \
$(LOCAL_PATH)/root/init.mt6582.usb.rc:/root/init.mt6582.usb.rc

#SELinux
PRODUCT_COPY_FILES += \
Expand All @@ -35,10 +40,18 @@ PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0
PRODUCT_NAME := full_a106
PRODUCT_DEVICE := a106

# wifi
PRODUCT_PACKAGES += \
lib_driver_cmd_mtk \
gralloc.mt6582

PRODUCT_TAGS += dalvik.gc.type-precise

PRODUCT_COPY_FILES_OVERRIDES += \
root/fstab.goldfish \
root/init.goldfish.rc \
recovery/root/fstab.goldfish
recovery/root/fstab.goldfish \
root/ueventd.goldfish.rc


ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 \
Expand Down
2 changes: 2 additions & 0 deletions egl.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0 0 android
0 1 mtk
Binary file added kernel.nohead
Binary file not shown.
Binary file added kernel.old
Binary file not shown.
Binary file added kernel.wiko
Binary file not shown.
40 changes: 40 additions & 0 deletions libbt-vendor-mtk/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

ifneq ($(BOARD_HAVE_BLUETOOTH_MTK),)

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_C_INCLUDES := external/bluetooth/bluedroid/hci/include

LOCAL_CFLAGS := -g -c -W -Wall -O2 -D_POSIX_SOURCE

LOCAL_SRC_FILES := libbt-vendor-mtk.c

LOCAL_SHARED_LIBRARIES := \
libnativehelper \
libcutils \
libutils \
liblog \
libdl

LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libbt-vendor
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)

include $(BUILD_SHARED_LIBRARY)

endif
171 changes: 171 additions & 0 deletions libbt-vendor-mtk/libbt-vendor-mtk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
* Bluetooth Vendor Library for MTK's libbluetoothdrv blob
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#define LOG_TAG "libbt_vendor_mtk"

#include <stdio.h>
#include <dlfcn.h>
#include <utils/Log.h>
#include <pthread.h>
#include <fcntl.h>
#include <errno.h>
#include <bt_vendor_lib.h>
#include <bt_hci_lib.h>
#include <bt_hci_bdroid.h>
#include <utils.h>

/**
* TODO: check/fix this value. does this make sense for MTK? It is taken from TI
* Low power mode: default transport idle timer
*/
#define WL_DEFAULT_LPM_IDLE_TIMEOUT 200

static void *mtklib_handle = NULL;
typedef int (*ENABLE)(int flag, void *func_cb);
typedef int (*DISABLE)(int bt_fd);

unsigned int hci_tty_fd = -1;

ENABLE mtk_bt_enable = NULL;
DISABLE mtk_bt_disable = NULL;

bt_vendor_callbacks_t *bt_vendor_cbacks = NULL;
void hw_config_cback(HC_BT_HDR *p_evt_buf);

/*******************************************************************************
*
* Function hw_config_cback
*
* Description Callback function for controller configuration
*
* Returns None
*
* *******************************************************************************/
void hw_config_cback(HC_BT_HDR *p_evt_buf)
{
ALOGI("hw_config_cback");
}

int mtk_init(const bt_vendor_callbacks_t* p_cb, unsigned char *local_bdaddr) {
const char *dlerrors;

ALOGI("libbt-vendor init for MTK blob");

if (p_cb == NULL)
{
ALOGE("init failed with no user callbacks!");
return BT_HC_STATUS_FAIL;
}

bt_vendor_cbacks = (bt_vendor_callbacks_t *) p_cb;

dlerror();

mtklib_handle = dlopen("libbluetoothdrv.so", RTLD_LAZY);
if (! mtklib_handle) {
ALOGE("Failed to open libbluetoothdrv library");
return (int)mtklib_handle;
}

mtk_bt_enable = dlsym(mtklib_handle, "mtk_bt_enable");
mtk_bt_disable = dlsym(mtklib_handle, "mtk_bt_disable");

if ((dlerrors = dlerror()) != NULL){
ALOGE("Errors while opening symbols from mtk blob");
dlclose(mtklib_handle);
}
return 0;
}

void mtk_cleanup(void) {
ALOGI("vendor cleanup");
bt_vendor_cbacks = NULL;

if (mtklib_handle) {
dlclose(mtklib_handle);
}
}

int mtk_open(void **param) {
int (*fd_array)[] = (int (*)[]) param;
int fd, idx;
fd = mtk_bt_enable(0, NULL);
if (fd < 0) {
ALOGE(" Can't open mtk fd");
return -1;
}
for (idx = 0; idx < CH_MAX; idx++)
(*fd_array)[idx] = fd;

hci_tty_fd = fd; /* for userial_close op */
return 1; /* CMD/EVT/ACL on same fd */
}

int mtk_close() {
if (hci_tty_fd == (unsigned int) -1)
return -1;
return mtk_bt_disable(hci_tty_fd);
}

int mtk_op(bt_vendor_opcode_t opcode, void **param) {
int ret = 0;

switch(opcode)
{
case BT_VND_OP_POWER_CTRL:
break;
case BT_VND_OP_SCO_CFG:
break;
case BT_VND_OP_GET_LPM_IDLE_TIMEOUT:
*((uint32_t *) param) = WL_DEFAULT_LPM_IDLE_TIMEOUT;
break;
case BT_VND_OP_LPM_SET_MODE:
break;
case BT_VND_OP_LPM_WAKE_SET_STATE:
break;
case BT_VND_OP_USERIAL_OPEN:
ret = mtk_open(param);
break;
case BT_VND_OP_USERIAL_CLOSE:
ret = mtk_close();
break;
/* Since new stack expects fwcfg_cb we are returning SUCCESS here
* in actual, firmware download is already happened when /dev/hci_tty
* opened.
*/
case BT_VND_OP_FW_CFG:
bt_vendor_cbacks->fwcfg_cb(BT_VND_OP_RESULT_SUCCESS);
break;
case BT_VND_OP_EPILOG:
bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_SUCCESS);
break;
default:
ALOGW("Unknown opcode: %d", opcode);
break;
}

return ret;
}
const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE = {
.init = mtk_init,
.op = mtk_op,
.cleanup = mtk_cleanup,
};

int main()
{
return 0;
}
Binary file removed mkimage
Binary file not shown.
Loading

0 comments on commit b80d67a

Please sign in to comment.