openwrt MT7621 支持512M内存

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/junglefly/article/details/80494612

openwrt MT7621 支持512M内存

 

【问题】

MTK官方20150311版本SDKopenwrt中,如果选择MT7621,并且设置内存为512M时,编译出来的firmware无法运行;

SDK文件为mtksdk-openwrt-3.10.14-20150311-d021c937.tar,

 

 

【解决】

 

一)修改前

MTK官方20150311版本SDKopenwrt

build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14-p112871/arch/mips/ralink/memory.c

中代码如下

#if defined(CONFIG_RT2880_ASIC) ||defined(CONFIG_RT2880_FPGA)

        add_memory_region(0x08000000, RAM_SIZE,BOOT_MEM_RAM);

#elif defined(CONFIG_MT7621_ASIC) ||defined(CONFIG_MT7621_FPGA)

#if defined (CONFIG_RT2880_DRAM_512M)

        add_memory_region(0x00000000, RAM_SIZE +64*1024*1024, BOOT_MEM_RAM);

#else

        add_memory_region(0x00000000, RAM_SIZE,BOOT_MEM_RAM);

#endif

 

#else

       add_memory_region(0x00000000,RAM_SIZE, BOOT_MEM_RAM);

#endif

 

 

二)修改后

#if defined(CONFIG_RT2880_ASIC) ||defined(CONFIG_RT2880_FPGA)

        add_memory_region(0x08000000, RAM_SIZE,BOOT_MEM_RAM);

#elif defined(CONFIG_MT7621_ASIC) ||defined(CONFIG_MT7621_FPGA)

#if defined (CONFIG_RT2880_DRAM_512M)

        //add_memory_region(0x00000000, RAM_SIZE+ 64*1024*1024, BOOT_MEM_RAM);

         add_memory_region(0x00000000,RAM_SIZE - 64*1024*1024, BOOT_MEM_RAM);

        add_memory_region(0x20000000,64*1024*1024, BOOT_MEM_RAM);

#else

        add_memory_region(0x00000000, RAM_SIZE,BOOT_MEM_RAM);

#endif

 

#else

       add_memory_region(0x00000000, RAM_SIZE, BOOT_MEM_RAM);

#endif

 

 

对应openwrt trunk上,是通过DTS文件上的如下语句来解决

memory@0 {

                   device_type= "memory";

                   reg= <0x0 0x1c000000>, <0x20000000 0x4000000>;

         };

内存分两部分;NormalHighMem

l  Normal部分:起始地址0x0; 最大0x1c000000 = 488*1024*1024 = 488Mbits

l  HighMem部分:起始地址0x20000000大小0x4000000 = 64 * 1024*1024 = 64Mbits

488+64 = 512;

 

对应的log输出如下:

[   0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.

[   0.000000] Zone ranges:

[   0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]

[   0.000000]   HighMem  [mem 0x0000000010000000-0x0000000023ffffff]

[   0.000000] Movable zone start for each node

[   0.000000] Early memory node ranges

[   0.000000]   node   0: [mem0x0000000000000000-0x000000001bffffff]

[   0.000000]   node   0: [mem0x0000000020000000-0x0000000023ffffff]

 

展开阅读全文

没有更多推荐了,返回首页