限制linux内核的内存区域

Far*_*had 5 linux kernel memory u-boot

我在 P1022RDK(P1022 核心)平台上运行 ltib Linux。我有 512 MB = 0x20000000 内存。我希望我的 Linux 内核使用主板内存的后半部分(即从 256 MB 到 512 MB),并希望将前半部分内存保留用于其他目的。

为此,我正在使用 ltib 构建 Linux 内核,并设置以下内核配置。请建议我是否以正确的方式做。

CONFIG_LOWMEM_SIZE = 0x10000000 # 256 MB 
CONFIG_PHYSICAL_START = 0x10000000 # Starting from 256MB (second half of memory)
Run Code Online (Sandbox Code Playgroud)

在 Uboot 上,我通过以下方式加载内核:

setenv loadaddr 0x11000000 # Kernel base = 0x10000000 + 0x01000000 (offset) 
setenv fdtaddr 0x10c00000 # Kernel base = 0x10000000 + 0x00c00000 (offset) 
bootm $loadaddr - $fdtaddr My kernel Load address is 0x10000000 & kernel entry point is 0x10000000
Run Code Online (Sandbox Code Playgroud)

使用上述配置/步骤,我的内核在 Uboot 上停留在以下位置:

Booting kernel from Legacy Image at 11000000 ...

Image Name: Linux-2.6.32.13 
Image Type: PowerPC Linux Kernel Image (gzip compressed) 
Data Size: 3352851 Bytes = 3.2 MB 
Load Address: 10000000 
Entry Point: 10000000 
Verifying Checksum ... OK

Flattened Device Tree blob at 10c00000

Booting using the fdt blob at 0x10c00000 
Uncompressing Kernel Image ... OK
Run Code Online (Sandbox Code Playgroud)

应该在这里解压缩 FDT 并继续

有什么想法吗?

Dav*_*rtz 3

我认为您必须以相反的方式执行此操作,并保留顶部 256MB 未使用。CONFIG_PHYSICAL_START 的作用与您想象的不同。它控制内核加载的位置,而不是内核使用哪些物理页。