mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +00:00
Move macloader to hardware/samsung
There are quite a few different Samsung devices which require macloader (many of which are just using binary blobs), so we should move it out of the device trees. Change-Id: I9e23fca0ba4c17da328cace801a92fa57df9a862
This commit is contained in:
parent
76a153a66c
commit
81c2e053c0
6 changed files with 180 additions and 9 deletions
12
Android.mk
12
Android.mk
|
@ -12,17 +12,23 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
SAM_ROOT := $(call my-dir)
|
||||||
|
|
||||||
ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
|
ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
|
||||||
ifeq ($(TARGET_SOC),exynos4210)
|
ifeq ($(TARGET_SOC),exynos4210)
|
||||||
include hardware/samsung/exynos4210.mk
|
include $(SAM_ROOT)/exynos4210.mk
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_SOC),exynos4x12)
|
ifeq ($(TARGET_SOC),exynos4x12)
|
||||||
include hardware/samsung/exynos4x12.mk
|
include $(SAM_ROOT)/exynos4x12.mk
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
|
ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
|
||||||
ifneq ($(TARGET_BOOTLOADER_BOARD_NAME),herring)
|
ifneq ($(TARGET_BOOTLOADER_BOARD_NAME),herring)
|
||||||
include hardware/samsung/s5pc110.mk
|
include $(SAM_ROOT)/s5pc110.mk
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BOARD_HAVE_SAMSUNG_WIFI),true)
|
||||||
|
include $(SAM_ROOT)/macloader/Android.mk
|
||||||
|
endif
|
||||||
|
|
|
@ -16,8 +16,8 @@ ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
|
||||||
ifeq ($(TARGET_SOC),exynos4210)
|
ifeq ($(TARGET_SOC),exynos4210)
|
||||||
|
|
||||||
include $(TARGET_HAL_PATH)/Android.mk
|
include $(TARGET_HAL_PATH)/Android.mk
|
||||||
include hardware/samsung/exynos/multimedia/Android.mk
|
include $(SAM_ROOT)/exynos/multimedia/Android.mk
|
||||||
include hardware/samsung/exynos4/exynos4210/Android.mk
|
include $(SAM_ROOT)/exynos4/exynos4210/Android.mk
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -16,9 +16,9 @@ ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
|
||||||
ifeq ($(TARGET_SOC),exynos4x12)
|
ifeq ($(TARGET_SOC),exynos4x12)
|
||||||
|
|
||||||
include $(TARGET_HAL_PATH)/Android.mk
|
include $(TARGET_HAL_PATH)/Android.mk
|
||||||
include hardware/samsung/exynos/multimedia/Android.mk
|
include $(SAM_ROOT)/exynos/multimedia/Android.mk
|
||||||
include hardware/samsung/exynos4/exynos4x12/Android.mk
|
include $(SAM_ROOT)/exynos4/exynos4x12/Android.mk
|
||||||
include hardware/samsung/exynos4/ril/Android.mk
|
include $(SAM_ROOT)/exynos4/ril/Android.mk
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
17
macloader/Android.mk
Normal file
17
macloader/Android.mk
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
ifeq ($(BOARD_HAVE_SAMSUNG_WIFI),true)
|
||||||
|
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := \
|
||||||
|
macloader.cpp
|
||||||
|
|
||||||
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
|
liblog libutils
|
||||||
|
|
||||||
|
LOCAL_MODULE := macloader
|
||||||
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
|
endif
|
148
macloader/macloader.cpp
Normal file
148
macloader/macloader.cpp
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012, The CyanogenMod Project
|
||||||
|
* Daniel Hillenbrand <codeworkx@cyanogenmod.com>
|
||||||
|
* Marco Hillenbrand <marco.hillenbrand@googlemail.com>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <cutils/log.h>
|
||||||
|
|
||||||
|
#define LOG_TAG "macloader"
|
||||||
|
#define LOG_NDEBUG 0
|
||||||
|
|
||||||
|
#define MACADDR_PATH "/efs/wifi/.mac.info"
|
||||||
|
#define CID_PATH "/data/.cid.info"
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
NONE,
|
||||||
|
MURATA,
|
||||||
|
SEMCOSH,
|
||||||
|
SEMCOVE
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* murata:
|
||||||
|
* 00:37:6d
|
||||||
|
* 88:30:8a
|
||||||
|
*
|
||||||
|
* semcosh:
|
||||||
|
* 5c:0a:5b
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
FILE* file;
|
||||||
|
FILE* cidfile;
|
||||||
|
char* str;
|
||||||
|
char mac_addr_half[9];
|
||||||
|
int ret = -1;
|
||||||
|
int amode;
|
||||||
|
enum Type type = NONE;
|
||||||
|
|
||||||
|
/* open mac addr file */
|
||||||
|
file = fopen(MACADDR_PATH, "r");
|
||||||
|
if(file == 0) {
|
||||||
|
fprintf(stderr, "open(%s) failed\n", MACADDR_PATH);
|
||||||
|
ALOGE("Can't open %s\n", MACADDR_PATH);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get and compare mac addr */
|
||||||
|
str = fgets(mac_addr_half, 9, file);
|
||||||
|
if(str == 0) {
|
||||||
|
fprintf(stderr, "fgets() from file %s failed\n", MACADDR_PATH);
|
||||||
|
ALOGE("Can't read from %s\n", MACADDR_PATH);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* murata */
|
||||||
|
if(strncasecmp(mac_addr_half, "00:37:6d", 9) == 0 ||
|
||||||
|
strncasecmp(mac_addr_half, "88:30:8a", 9) == 0 ||
|
||||||
|
strncasecmp(mac_addr_half, "20:02:af", 9) == 0) {
|
||||||
|
type = MURATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* semcosh */
|
||||||
|
if(strncasecmp(mac_addr_half, "5c:0a:5b", 9) == 0) {
|
||||||
|
type = SEMCOSH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type != NONE) {
|
||||||
|
/* open cid file */
|
||||||
|
cidfile = fopen(CID_PATH, "w");
|
||||||
|
if(cidfile == 0) {
|
||||||
|
fprintf(stderr, "open(%s) failed\n", CID_PATH);
|
||||||
|
ALOGE("Can't open %s\n", CID_PATH);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(type) {
|
||||||
|
case NONE:
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
case MURATA:
|
||||||
|
/* write murata to cid file */
|
||||||
|
ALOGI("Writing murata to %s\n", CID_PATH);
|
||||||
|
ret = fputs("murata", cidfile);
|
||||||
|
break;
|
||||||
|
case SEMCOSH:
|
||||||
|
/* write semcosh to cid file */
|
||||||
|
ALOGI("Writing semcosh to %s\n", CID_PATH);
|
||||||
|
ret = fputs("semcosh", cidfile);
|
||||||
|
break;
|
||||||
|
case SEMCOVE:
|
||||||
|
/* write semcove to cid file */
|
||||||
|
ALOGI("Writing semcove to %s\n", CID_PATH);
|
||||||
|
ret = fputs("semcove", cidfile);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret != 0) {
|
||||||
|
fprintf(stderr, "fputs() to file %s failed\n", CID_PATH);
|
||||||
|
ALOGE("Can't write to %s\n", CID_PATH);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fclose(cidfile);
|
||||||
|
|
||||||
|
/* set permissions on cid file */
|
||||||
|
ALOGD("Setting permissions on %s\n", CID_PATH);
|
||||||
|
amode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||||
|
ret = chmod(CID_PATH, amode);
|
||||||
|
|
||||||
|
char* chown_cmd = (char*) malloc(strlen("chown system ") + strlen(CID_PATH));
|
||||||
|
char* chgrp_cmd = (char*) malloc(strlen("chgrp system ") + strlen(CID_PATH));
|
||||||
|
sprintf(chown_cmd, "chown system %s", CID_PATH);
|
||||||
|
sprintf(chgrp_cmd, "chgrp system %s", CID_PATH);
|
||||||
|
system(chown_cmd);
|
||||||
|
system(chgrp_cmd);
|
||||||
|
|
||||||
|
if(ret != 0) {
|
||||||
|
fprintf(stderr, "chmod() on file %s failed\n", CID_PATH);
|
||||||
|
ALOGE("Can't set permissions on %s\n", CID_PATH);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* delete cid file if no specific type */
|
||||||
|
ALOGD("Deleting file %s\n", CID_PATH);
|
||||||
|
remove(CID_PATH);
|
||||||
|
}
|
||||||
|
fclose(file);
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -14,6 +14,6 @@
|
||||||
|
|
||||||
ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
|
ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
|
||||||
|
|
||||||
include hardware/samsung/exynos3/s5pc110/Android.mk
|
include $(SAM_ROOT)/exynos3/s5pc110/Android.mk
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue