沙发#
发布于:2021-02-03 11:33
|
|
板凳#
发布于:2021-02-02 16:18
|
|
|
地板#
发布于:2021-02-02 16:04
conlan:这个怎么改的?我改了试试看跑分有什么不一样。回到原帖参考一下:这个是4核改8核的。原理比较简单,看一下就懂 add fack cpu Change-Id: Ib0f89e93ea3e1debb72c46aac2e6d9886fb85316 diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 02bbf72e..f9fba392 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1185,6 +1185,7 @@ static int __init topology_init(void) struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu); cpuinfo->cpu.hotpluggable = platform_can_hotplug_cpu(cpu); register_cpu(&cpuinfo->cpu, cpu); + } return 0; @@ -1301,13 +1302,71 @@ static int c_show(struct seq_file *m, void *v) seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15); } + + //fake cpu + for_each_online_cpu(i) { + /* + * glibc reads /proc/cpuinfo to determine the number of + * online processors, looking for lines beginning with + * "processor". Give glibc what it expects. + */ + seq_printf(m, "processor\t: %d\n", i + 4); + cpuid = is_smp() ? per_cpu(cpu_data, i).cpuid : read_cpuid_id(); + seq_printf(m, "model name\t: %s rev %d (%s)\n", + cpu_name, cpuid & 15, elf_platform); + +#if defined(CONFIG_SMP) + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", + per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ), + (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100); +#else + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", + loops_per_jiffy / (500000/HZ), + (loops_per_jiffy / (5000/HZ)) % 100); +#endif + /* dump out the processor features */ + seq_puts(m, "Features\t: "); + + for (j = 0; hwcap_str[j]; j++) + if (elf_hwcap & (1 << j)) + seq_printf(m, "%s ", hwcap_str[j]); + + for (j = 0; hwcap2_str[j]; j++) + if (elf_hwcap2 & (1 << j)) + seq_printf(m, "%s ", hwcap2_str[j]); + + seq_printf(m, "\nCPU implementer\t: 0x%02x\n", cpuid >> 24); + seq_printf(m, "CPU architecture: %s\n", + proc_arch[cpu_architecture()]); + + if ((cpuid & 0x0008f000) == 0x00000000) { + /* pre-ARM7 */ + seq_printf(m, "CPU part\t: %07x\n", cpuid >> 4); + } else { + if ((cpuid & 0x0008f000) == 0x00007000) { + /* ARM7 */ + seq_printf(m, "CPU variant\t: 0x%02x\n", + (cpuid >> 16) & 127); + } else { + /* post-ARM7 */ + seq_printf(m, "CPU variant\t: 0x%x\n", + (cpuid >> 20) & 15); + } + seq_printf(m, "CPU part\t: 0x%03x\n", + (cpuid >> 4) & 0xfff); + } + seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15); + } + #ifdef CONFIG_AMLOGIC_CPU_INFO cpuinfo_get_chipid(chipid, CHIPID_LEN); seq_puts(m, "Serial\t\t: "); for (i = 0; i < 16; i++) seq_printf(m, "%02x", chipid); seq_puts(m, "\n"); - seq_printf(m, "Hardware\t: %s\n\n", "Amlogic"); + + //seq_printf(m, "Hardware\t: %s\n\n", "Amlogic"); + seq_printf(m, "Hardware\t: %s\n\n", "MediaTek"); #else seq_printf(m, "Hardware\t: %s\n", machine_name); seq_printf(m, "Revision\t: %04x\n", system_rev); diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index cbb1cc6b..8740e6e0 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -355,6 +355,7 @@ static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) int register_cpu(struct cpu *cpu, int num) { int error; + char buf[16]; cpu->node_id = cpu_to_node(num); memset(&cpu->dev, 0x00, sizeof(struct device)); @@ -377,6 +378,10 @@ int register_cpu(struct cpu *cpu, int num) per_cpu(cpu_sys_devices, num) = &cpu->dev; register_cpu_under_node(num, cpu_to_node(num)); + //fake cpu link + sprintf(buf,"cpu%d",num + 4); + error = sysfs_create_link(&cpu_subsys.dev_root->kobj, &cpu->dev.kobj, buf); + if (error) return 0; return 0; } 内存改3G: --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -65,7 +65,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) available = si_mem_available(); - show_val_kb(m, "MemTotal: ", i.totalram); + show_val_kb(m, "MemTotal: ", i.totalram + i.totalram/2); show_val_kb(m, "MemFree: ", i.freeram); show_val_kb(m, "MemAvailable: ", available); show_val_kb(m, "Buffers: ", i.bufferram); |
|
5楼#
发布于:2021-02-01 14:16
|
|