Loading init/init.cpp +2 −14 Original line number Diff line number Diff line Loading @@ -66,8 +66,6 @@ static int property_triggers_enabled = 0; static char console[32]; static char bootmode[32]; static char hardware[32]; static unsigned revision = 0; static char qemu[32]; static struct action *cur_action = NULL; Loading Loading @@ -773,6 +771,8 @@ static void export_kernel_boot_props(void) { "ro.boot.mode", "ro.bootmode", "unknown", }, { "ro.boot.baseband", "ro.baseband", "unknown", }, { "ro.boot.bootloader", "ro.bootloader", "unknown", }, { "ro.boot.hardware", "ro.hardware", "unknown", }, { "ro.boot.revision", "ro.revision", "0", }, }; for (i = 0; i < ARRAY_SIZE(prop_map); i++) { Loading @@ -791,16 +791,6 @@ static void export_kernel_boot_props(void) property_get("ro.bootmode", tmp); strlcpy(bootmode, tmp, sizeof(bootmode)); /* if this was given on kernel command line, override what we read * before (e.g. from /proc/cpuinfo), if anything */ ret = property_get("ro.boot.hardware", tmp); if (ret) strlcpy(hardware, tmp, sizeof(hardware)); property_set("ro.hardware", hardware); snprintf(tmp, PROP_VALUE_MAX, "%d", revision); property_set("ro.revision", tmp); /* TODO: these are obsolete. We should delete them */ if (!strcmp(bootmode,"factory")) property_set("ro.factorytest", "1"); Loading Loading @@ -1014,8 +1004,6 @@ int main(int argc, char** argv) { klog_init(); property_init(); get_hardware_name(hardware, &revision); process_kernel_cmdline(); selinux_callback cb; Loading init/ueventd.cpp +3 −23 Original line number Diff line number Diff line Loading @@ -30,28 +30,13 @@ #include "util.h" #include "devices.h" #include "ueventd_parser.h" static char hardware[32]; static unsigned revision = 0; static void import_kernel_nv(char *name, int in_qemu) { if (*name != '\0') { char *value = strchr(name, '='); if (value != NULL) { *value++ = 0; if (!strcmp(name,"androidboot.hardware")) { strlcpy(hardware, value, sizeof(hardware)); } } } } #include "property_service.h" int ueventd_main(int argc, char **argv) { struct pollfd ufd; int nr; char hardware[PROP_VALUE_MAX]; char tmp[32]; /* Loading Loading @@ -83,12 +68,7 @@ int ueventd_main(int argc, char **argv) INFO("starting ueventd\n"); /* Respect hardware passed in through the kernel cmd line. Here we will look * for androidboot.hardware param in kernel cmdline, and save its value in * hardware[]. */ import_kernel_cmdline(0, import_kernel_nv); get_hardware_name(hardware, &revision); property_get("ro.hardware", hardware); ueventd_parse_config_file("/ueventd.rc"); Loading init/util.cpp +0 −33 Original line number Diff line number Diff line Loading @@ -400,39 +400,6 @@ void open_devnull_stdio(void) exit(1); } void get_hardware_name(char *hardware, unsigned int *revision) { // Hardware string was provided on kernel command line. if (hardware[0]) { return; } FILE* fp = fopen("/proc/cpuinfo", "re"); if (fp == NULL) { return; } char buf[1024]; while (fgets(buf, sizeof(buf), fp) != NULL) { if (strncmp(buf, "Hardware", 8) == 0) { const char* hw = strstr(buf, ": "); if (hw) { hw += 2; size_t n = 0; while (*hw) { if (!isspace(*hw)) { hardware[n++] = tolower(*hw); } hw++; if (n == 31) break; } hardware[n] = 0; } } else if (strncmp(buf, "Revision", 8) == 0) { sscanf(buf, "Revision : %ux", revision); } } fclose(fp); } void import_kernel_cmdline(int in_qemu, void (*import_kernel_nv)(char *name, int in_qemu)) { Loading init/util.h +0 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ void make_link(const char *oldpath, const char *newpath); void remove_link(const char *oldpath, const char *newpath); int wait_for_file(const char *filename, int timeout); void open_devnull_stdio(void); void get_hardware_name(char *hardware, unsigned int *revision); void import_kernel_cmdline(int in_qemu, void (*import_kernel_nv)(char *name, int in_qemu)); int make_dir(const char *path, mode_t mode); int restorecon(const char *pathname); Loading Loading
init/init.cpp +2 −14 Original line number Diff line number Diff line Loading @@ -66,8 +66,6 @@ static int property_triggers_enabled = 0; static char console[32]; static char bootmode[32]; static char hardware[32]; static unsigned revision = 0; static char qemu[32]; static struct action *cur_action = NULL; Loading Loading @@ -773,6 +771,8 @@ static void export_kernel_boot_props(void) { "ro.boot.mode", "ro.bootmode", "unknown", }, { "ro.boot.baseband", "ro.baseband", "unknown", }, { "ro.boot.bootloader", "ro.bootloader", "unknown", }, { "ro.boot.hardware", "ro.hardware", "unknown", }, { "ro.boot.revision", "ro.revision", "0", }, }; for (i = 0; i < ARRAY_SIZE(prop_map); i++) { Loading @@ -791,16 +791,6 @@ static void export_kernel_boot_props(void) property_get("ro.bootmode", tmp); strlcpy(bootmode, tmp, sizeof(bootmode)); /* if this was given on kernel command line, override what we read * before (e.g. from /proc/cpuinfo), if anything */ ret = property_get("ro.boot.hardware", tmp); if (ret) strlcpy(hardware, tmp, sizeof(hardware)); property_set("ro.hardware", hardware); snprintf(tmp, PROP_VALUE_MAX, "%d", revision); property_set("ro.revision", tmp); /* TODO: these are obsolete. We should delete them */ if (!strcmp(bootmode,"factory")) property_set("ro.factorytest", "1"); Loading Loading @@ -1014,8 +1004,6 @@ int main(int argc, char** argv) { klog_init(); property_init(); get_hardware_name(hardware, &revision); process_kernel_cmdline(); selinux_callback cb; Loading
init/ueventd.cpp +3 −23 Original line number Diff line number Diff line Loading @@ -30,28 +30,13 @@ #include "util.h" #include "devices.h" #include "ueventd_parser.h" static char hardware[32]; static unsigned revision = 0; static void import_kernel_nv(char *name, int in_qemu) { if (*name != '\0') { char *value = strchr(name, '='); if (value != NULL) { *value++ = 0; if (!strcmp(name,"androidboot.hardware")) { strlcpy(hardware, value, sizeof(hardware)); } } } } #include "property_service.h" int ueventd_main(int argc, char **argv) { struct pollfd ufd; int nr; char hardware[PROP_VALUE_MAX]; char tmp[32]; /* Loading Loading @@ -83,12 +68,7 @@ int ueventd_main(int argc, char **argv) INFO("starting ueventd\n"); /* Respect hardware passed in through the kernel cmd line. Here we will look * for androidboot.hardware param in kernel cmdline, and save its value in * hardware[]. */ import_kernel_cmdline(0, import_kernel_nv); get_hardware_name(hardware, &revision); property_get("ro.hardware", hardware); ueventd_parse_config_file("/ueventd.rc"); Loading
init/util.cpp +0 −33 Original line number Diff line number Diff line Loading @@ -400,39 +400,6 @@ void open_devnull_stdio(void) exit(1); } void get_hardware_name(char *hardware, unsigned int *revision) { // Hardware string was provided on kernel command line. if (hardware[0]) { return; } FILE* fp = fopen("/proc/cpuinfo", "re"); if (fp == NULL) { return; } char buf[1024]; while (fgets(buf, sizeof(buf), fp) != NULL) { if (strncmp(buf, "Hardware", 8) == 0) { const char* hw = strstr(buf, ": "); if (hw) { hw += 2; size_t n = 0; while (*hw) { if (!isspace(*hw)) { hardware[n++] = tolower(*hw); } hw++; if (n == 31) break; } hardware[n] = 0; } } else if (strncmp(buf, "Revision", 8) == 0) { sscanf(buf, "Revision : %ux", revision); } } fclose(fp); } void import_kernel_cmdline(int in_qemu, void (*import_kernel_nv)(char *name, int in_qemu)) { Loading
init/util.h +0 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ void make_link(const char *oldpath, const char *newpath); void remove_link(const char *oldpath, const char *newpath); int wait_for_file(const char *filename, int timeout); void open_devnull_stdio(void); void get_hardware_name(char *hardware, unsigned int *revision); void import_kernel_cmdline(int in_qemu, void (*import_kernel_nv)(char *name, int in_qemu)); int make_dir(const char *path, mode_t mode); int restorecon(const char *pathname); Loading