改DDR容量

1.在文件kernel/fs/proc/meminfo.c中:

/*
* Tagged format, for easy grepping and expansion.
 */
seq_printf(m,
"MemTotal:       %8lu kB\n"
"MemFree:        %8lu kB\n"
"Buffers:        %8lu kB\n"
"Cached:         %8lu kB\n"
"SwapCached:     %8lu kB\n"
"Active:         %8lu kB\n"
"Inactive:       %8lu kB\n"
"Active(anon):   %8lu kB\n"
"Inactive(anon): %8lu kB\n"
"Active(file):   %8lu kB\n"
"Inactive(file): %8lu kB\n"
"Unevictable:    %8lu kB\n"
"Mlocked:        %8lu kB\n"
#ifdef CONFIG_HIGHMEM
"HighTotal:      %8lu kB\n"
"HighFree:       %8lu kB\n"
"LowTotal:       %8lu kB\n"
"LowFree:        %8lu kB\n"
#endif
#ifndef CONFIG_MMU
"MmapCopy:       %8lu kB\n"
#endif
"SwapTotal:      %8lu kB\n"
"SwapFree:       %8lu kB\n"
"Dirty:          %8lu kB\n"
"Writeback:      %8lu kB\n"
"AnonPages:      %8lu kB\n"
"Mapped:         %8lu kB\n"
"Shmem:          %8lu kB\n"
"Slab:           %8lu kB\n"
"SReclaimable:   %8lu kB\n"
"SUnreclaim:     %8lu kB\n"
"KernelStack:    %8lu kB\n"
"PageTables:     %8lu kB\n"
#ifdef CONFIG_QUICKLIST
"Quicklists:     %8lu kB\n"
#endif
"NFS_Unstable:   %8lu kB\n"
"Bounce:         %8lu kB\n"
"WritebackTmp:   %8lu kB\n"
"CommitLimit:    %8lu kB\n"
"Committed_AS:   %8lu kB\n"
"VmallocTotal:   %8lu kB\n"
"VmallocUsed:    %8lu kB\n"
"VmallocChunk:   %8lu kB\n"
#ifdef CONFIG_MEMORY_FAILURE
"HardwareCorrupted: %5lu kB\n"
#endif
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
"AnonHugePages:  %8lu kB\n"
#endif
,
#ifdef CONFIG_PLAT_RK
#ifdef CONFIG_RK29_MEM_SIZE_M
(unsigned long)CONFIG_RK29_MEM_SIZE_M * 1024,
#else
#ifdef CONFIG_RK30_MEM_SIZE_M
(unsigned long)CONFIG_RK30_MEM_SIZE_M * 1024,

#else
(unsigned long)ddr_get_cap() >> 10,
#endif
#endif
#else
K(i.totalram),
#endif
K(i.freeram),
K(i.bufferram),
K(cached),
K(total_swapcache_pages),
K(pages[LRU_ACTIVE_ANON]   + pages[LRU_ACTIVE_FILE]),
K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]),
K(pages[LRU_ACTIVE_ANON]),
K(pages[LRU_INACTIVE_ANON]),
K(pages[LRU_ACTIVE_FILE]),
K(pages[LRU_INACTIVE_FILE]),
K(pages[LRU_UNEVICTABLE]),
K(global_page_state(NR_MLOCK)),
#ifdef CONFIG_HIGHMEM
K(i.totalhigh),
K(i.freehigh),
K(i.totalram-i.totalhigh),
K(i.freeram-i.freehigh),
#endif
#ifndef CONFIG_MMU
K((unsigned long) atomic_long_read(&mmap_pages_allocated)),
#endif
K(i.totalswap),
K(i.freeswap),
K(global_page_state(NR_FILE_DIRTY)),
K(global_page_state(NR_WRITEBACK)),
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
K(global_page_state(NR_ANON_PAGES)
 + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
 HPAGE_PMD_NR),
#else
K(global_page_state(NR_ANON_PAGES)),
#endif
K(global_page_state(NR_FILE_MAPPED)),
K(global_page_state(NR_SHMEM)),
K(global_page_state(NR_SLAB_RECLAIMABLE) +
global_page_state(NR_SLAB_UNRECLAIMABLE)),
K(global_page_state(NR_SLAB_RECLAIMABLE)),
K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
global_page_state(NR_KERNEL_STACK) * THREAD_SIZE / 1024,
K(global_page_state(NR_PAGETABLE)),
#ifdef CONFIG_QUICKLIST
K(quicklist_total_size()),
#endif
K(global_page_state(NR_UNSTABLE_NFS)),
K(global_page_state(NR_BOUNCE)),
K(global_page_state(NR_WRITEBACK_TEMP)),
K(allowed),
K(committed),
(unsigned long)VMALLOC_TOTAL >> 10,
vmi.used >> 10,
vmi.largest_chunk >> 10
#ifdef CONFIG_MEMORY_FAILURE
,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10)
#endif
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
  HPAGE_PMD_NR)
#endif
);

2.在kernel/arch/arm/mach-rk30/Kconfig文件中添加:

config RK30_MEM_SIZE_M
int "DDR Memory size (in MB)"
default 512

3.在内核中用make menuconfig 找到上一步对应项,输入要改的容量值即可。

你可能感兴趣的:(linux)