[yocto] Limit RAM for Linux

Nathan Rossi nathan at nathanrossi.com
Mon Jun 8 21:45:26 PDT 2015


On Tue, Jun 9, 2015 at 4:06 AM, Edward Wingate <edwingate8 at gmail.com> wrote:
>
> I am using Yocto with meta-xilinx layer to create a distribution for a
> custom Zynq 7000 board with 512MB RAM. In my uEnv, I'm loading the
> kernel to 0x0010_0000, device tree to 0x0190_0000 and ramdisk image to
> 0x0210_0000.
>
> Later in the boot process, I see this:
>     Loading Kernel Image ... OK
>     Loading Ramdisk to 1e16f000, end 1ed221fc ... OK
>     Loading Device Tree to 1e166000, end 1e16ef40 ... OK
>
> I'd like to restrict Linux to the lower 256MB out of 512MB of RAM.
> When I add mem=256MB to boot arguments, the kernel doesn't boot.  I
> can specify "mem=" down to only 494M, I assume to get it just over
> those 0x1exx_xxxx addresses. Any lower and the kernel doesn't boot.
> Where do the 0x1exx_xxxx come from and how can I change those?

Those values are generated via u-boot based on the value of fdt_high
and initrd_high which are set in the u-boot environment. (At least for
Zynq)

If you have a look at the default environment you will see them set to
0x20000000:
http://git.denx.de/?p=u-boot.git;a=blob;f=include/configs/zynq-common.h;h=1a52e7d538261a9d36b078d61e00e60bf8918227;hb=HEAD#l217

You can override those environment variables with your uEnv.txt file,
setting it to 0x10000000 will make sure they fdt/initrd is loaded into
the first 256M.

Regards,
Nathan

>
> I also tried changing the memory in device tree.  It was originally:
> ps7_ddr_0: memory at 0 {
>     device_type = "memory"
>     reg = <0x0 0x200000000>;
> }
>
> I changed reg to <0x0 0x10000000> thinking this would limit the RAM
> that Linux sees to the lower 256MB, but Linux still reports seeing all
> 512MB of RAM.
>
> Can anyone point me to where else my configuration needs to change?
> Thanks for your help.
>
> Edward
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto



More information about the yocto mailing list