Why does my board seem to have 811MB of RAM instead of 1GB?

Started by mossroy, January 26, 2014, 12:24:32 AM

Previous topic - Next topic

mossroy

I hope it's not a silly question...

I just received my A20 board, and started it with the Debian SD-card bought from Olimex too.

Debian reports that it only has ~811MB of available RAM :
root@A20:~# free -m
             total       used       free     shared    buffers     cached
Mem:           811        248        562          0          8        179
-/+ buffers/cache:         60        750
Swap:            0          0          0
root@A20:~# lshw -C memory
  *-memory               
       description: System memory
       physical id: 0
       size: 811MiB


and "top" reports :
KiB Mem:    830948 total

I thought that the A20 board had 1GB of RAM?

Is it some kind of shared memory, allocated for the video? If so, is it possible to disable the video output and use all the physical memory? (I plan to use it as a headless server)



mossroy

Thanks for the hint, progmetalbg
But I did not succeed yet. I certainly missed something, here is what I did :
- created a file /boot/boot.cmd with content :
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait loglevel=8 panic=10 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16
- installed package uboot-mkimage
- ran this command-line in /boot :
mkimage -C none -A arm -T script -d boot.cmd boot.scr
So I have a /boot/boot.scr file but it does not seem to be used.

I still have 811MB of RAM, and cat /proc/cmdline still only gives :
console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait loglevel=8 panic=10

I boot on a Debian SD-card (bought from olimex).
I also tried to put boot.cmd and boot.scr files at the root of both partitions of the SD-card, but it was not better.

Any idea of what I did wrong?

progmetalbg

You are right, it seems that this method is not working with the latest kernel 3.4.75+ for some reason.
Luckily I found an easier way that works (at least for me).
First remove boot.cmd and boot.scr from /boot.
Then create uEnv.txt file with your favourite text editor in /boot with the following contents:
extraargs=sunxi_no_mali_mem_reserve sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=8
As a final step reboot the board.
This is what I see:
[root@alarm ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           995         43        951          0          8         18
-/+ buffers/cache:         17        978
Swap:            0          0          0

and my /proc/cmdline:
console=ttyS0,115200 root=/dev/mmcblk0p1 rootwait loglevel=8 panic=10 sunxi_no_mali_mem_reserve sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=8
You can try decreasing sunxi_fb_mem_reserve even further.

mossroy

Great, this worked!

Here are a few more details on how it could work on my board (A20-OLinuXino-MICRO-4GB) :

- First of all, the Debian SD-card I have (purchased from Olimex) does not mount /boot by default (/etc/fstab is empty). So you have either to mount it to the partition where the uImage file is, or manually create the uEnv.txt file in this partition (for example by reading the SD-card from a regular computer that would automatically mount the partition).
A basic way to mount /boot on each reboot, is to add this line to /etc/fstab :
UUID=587A-1A07 /boot           auto    defaults        0       2
The UUID above has be replaced with the one of your SD-card. You can find yours by typing :
ls -al /dev/disk/by-uuid/
and find the one that is linked to device mmcblk0p1
For me it gave :
total 0
drwxr-xr-x 2 root root 100 Jan  1  2010 .
drwxr-xr-x 5 root root 100 Jan  1  2010 ..
lrwxrwxrwx 1 root root  15 Jan  1  2010 587A-1A07 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root  13 Jan  1  2010 804A-8E6E -> ../../mmcblk0
lrwxrwxrwx 1 root root  15 Jan  1  2010 933f3feb-cee6-494f-875f-b33bfb3cc5c6 -> ../../mmcblk0p2

With /boot mounted, a "ls -al /boot" now gives me :
drwxr-xr-x  3 root root   16384 Feb  6 11:06 .
drwxr-xr-x 25 root root    4096 Feb  6 10:16 ..
drwxr-xr-x  2 root root    2048 Nov  4 12:55 back_up
-rwxr-xr-x  1 root root   56736 Jan 25 21:40 script.bin
-rwxr-xr-x  1 root root     107 Feb  6 10:33 uEnv.txt
-rwxr-xr-x  1 root root 4558376 Nov  1 18:10 uImage


- On my board, it worked with "sunxi_fb_mem_reserve=16", but not with "sunxi_fb_mem_reserve=8". I don't know why, but it does not boot properly with only 8MB for this value. So my uEnv.txt has the following content :
extraargs=sunxi_no_mali_mem_reserve sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16
And free -m gives me :
             total       used       free     shared    buffers     cached
Mem:           986        126        860          0          3         60
-/+ buffers/cache:         61        925
Swap:            0          0          0


So I "won" 175 MB of RAM  :) (in exchange to not using the GPU)
Thanks!