Raspberry pi and ram split

5 posts / 0 new
Last post
#1 Sat, 2016-03-05 09:07
Grumph
  • Grumph's picture
  • Offline
  • Last seen: 2 years 3 weeks ago
  • Joined: 2016-03-05

I successfully installed Alpine on my RaspberryPI.

It is a RasPi B rev1, so it has only 256MB of ram. The default memory split configuration, which Alpine is using, is to give 64MB to the GPU, and 182MB for the CPU.

As I plan to use my RasPi as a headless server, I want to change this split to 16MB for the GPU and 240MB for the CPU.
But when I try to add the option gpu_mem=16 to my config.txt file, as mentionned in the official RasPi config.txt documentation, Alpine doesn't start anymore. In fact, the ACT led is blinking 4 times every few seconds, which means, I guess, that something went wrong.
I also tried to add the option to the userconfig.txt, but then nothing changes and the RAM split remains the same.

This option works perfectly with a raspian or a picore image.

Does anybody have an idea of how I can perform the split change ?

By the way, I don't understand why with 182MB of RAM available, my root partition is only 91MB.

Sat, 2016-03-05 17:19
Grumph
  • Grumph's picture
  • Offline
  • Last seen: 2 years 3 weeks ago
  • Joined: 2016-03-05

Of course, I'm stuck for hours with this problem, and right after I ask for help in a forum I find the solution ...

I took the fixup*.dat and start*.elf files from a picore image, and replaced the alpine one.
These files seem to be the GPU firmware files.
With that, I could add the gpu_mem=16 option.

But I still have the other problem : why my rootfs size is half the available RAM size ?
How can I make it grow to use most of the RAM like in piCore for example ?

EDIT: The actual fix was to copy fixup_cd.dat and start_cd.elf, which remove some GPU features, useless for headless systems. When adding gpu_mem=16, the bootloader will seek those files instead of the usual fixup.dat and start.elf.

Mon, 2016-03-14 13:46
nschmerber
  • nschmerber's picture
  • Offline
  • Last seen: 2 years 2 days ago
  • Joined: 2014-09-02

Hello Grumph,

I have the same problem on a Raspberry pi 2. But unfortunately the method you found doesnt help on a RPI2 .
I tried with the original Alpine fixup.bat and start.elf, I also replaced these files with the one of a picore7.0, same result by just adding the fixup_* and start.* files. No way to modify the memory I get from the RPI2. It always stays at 744Mb of ram (total) in Alpine whatever I put in the usercfg for gpu_mem.
As you seem to have spend a lot of time to debug this, can you maybe give me some hints so I can look further on the RPI2 ?
Or maybe does any Alpine Guru have an idea ?

Thanks in advance.

Regards,

Sat, 2016-03-26 05:26 (Reply to #3)
roger.newman
  • roger.newman's picture
  • Offline
  • Last seen: 1 year 11 months ago
  • Joined: 2016-03-26

Hi nschmerber,

I had the same problem with my RPI3 and the following "solution" also works for the RPI2.
The Problem should be solved in a more general way, but it solves the problem for now.

before

$ cat /proc/meminfo|grep Mem
MemTotal:         754508 kB
MemFree:          564360 kB
MemAvailable:     605524 kB

after

$ cat /proc/meminfo|grep Mem
MemTotal:         998108 kB
MemFree:          808472 kB
MemAvailable:     848076 kB


script

#!/bin/ash
 
## remount sd-card writeable
mount -o remount,rw /media/mmcblk0p1
 
 
## backup original files
mv /media/mmcblk0p1/config.txt /media/mmcblk0p1/config.backup
mv /media/mmcblk0p1/fixup.dat /media/mmcblk0p1/fixup.backup
mv /media/mmcblk0p1/start.elf /media/mmcblk0p1/start.backup
 
 
## download latest gpu-firmware (03/24/2016)
# default version
curl -o /media/mmcblk0p1/fixup.dat \
https://raw.githubusercontent.com/raspberrypi/firmware/046effa13ebc4cc7601df4f06f4834bd0eebb0f8/boot/fixup.dat
 
curl -o /media/mmcblk0p1/start.elf \
https://raw.githubusercontent.com/raspberrypi/firmware/046effa13ebc4cc7601df4f06f4834bd0eebb0f8/boot/start.elf
 
# cut-down version
curl -o /media/mmcblk0p1/fixup_cd.dat \
https://raw.githubusercontent.com/raspberrypi/firmware/046effa13ebc4cc7601df4f06f4834bd0eebb0f8/boot/fixup_cd.dat
 
curl -o /media/mmcblk0p1/start_cd.elf \
https://raw.githubusercontent.com/raspberrypi/firmware/046effa13ebc4cc7601df4f06f4834bd0eebb0f8/boot/start_cd.elf
 
 
## create rpi2/3 config
cat << EOF > /media/mmcblk0p1/config.txt
disable_splash=1
boot_delay=0
start_x=0
max_usb_current=1
gpu_mem=16
kernel=boot/vmlinuz-rpi2
initramfs boot/initramfs-rpi2 0x08000000
EOF
 
 
## safety 1st
sync
 
 
## enjoy
reboot


Regards,

Roger Newman

Sun, 2016-03-27 12:41
nschmerber
  • nschmerber's picture
  • Offline
  • Last seen: 2 years 2 days ago
  • Joined: 2014-09-02

Thank you roger.newman this works perfectly ! .
Regards,

Log in or register to post comments