Supported detecting new kernel(2.6.36) & new Loongson3A03 CPU.

This commit is contained in:
Xianyi Zhang 2011-03-18 01:10:58 +00:00
parent 5838f12995
commit c84f8be453
2 changed files with 18 additions and 4 deletions

View File

@ -95,7 +95,8 @@ VERSION = 0.1
# DEBUG = 1
ifeq ($(DEBUG), 1)
COMMON_OPT += -g -DDEBUG
COMMON_OPT += -g
# -DDEBUG
else
COMMON_OPT += -O2
endif

View File

@ -99,9 +99,22 @@ int detect(void){
fclose(infile);
if (strstr(p, "Loongson-3A")) return CPU_LOONGSON3A;
else return CPU_SICORTEX;
if (strstr(p, "Loongson-3A")){
return CPU_LOONGSON3A;
}else if (strstr(p, "Loongson-3")){
infile = fopen("/proc/cpuinfo", "r");
while (fgets(buffer, sizeof(buffer), infile)){
if (!strncmp("system type", buffer, 11)){
p = strchr(buffer, ':') + 2;
break;
}
}
fclose(infile);
if (strstr(p, "loongson3a"))
return CPU_LOONGSON3A;
}else{
return CPU_SICORTEX;
}
#endif
return CPU_UNKNOWN;
}