Apr 262012
 

I have created an updated version here

I’ve created an update of the Raspberry Pi Memory Split Selector Script that has been cleaned up a bit and functions a bit differently.
The new script can detect the current memory that the system is showing, as well as determining which file has been activated.
Changing the active split will result in the script removing start.elf and copying the relevant elf file to start.elf to enable the new RAM split.
Once again, feedback is most welcome either in this post or in this thread.

The script can be downloaded from here.

Update – a new version has been created from some feedback on the forums, Get it here

Below is the code –

#!/bin/bash
##
## Raspberry Pi Memory Split Selector Script v2
## Author: SirLagz
## Website: http://sirlagz.net
##
## The purpose of this script is to make selecting the memory split
## on the RPi easy.
## Simply make this script executable if it's not already, move
## it to the directory with the elf files, and run it with ./select2.sh
## The menu should be pretty self explanatory.
##
clear
list=./*
b128det=0
b192det=0
b224det=0
bdefdet=0

for i in $list
do
case $i in
"./arm128_start.elf") b128det=1;;
"./arm192_start.elf") b192det=1;;
"./arm224_start.elf") b224det=1;;
"./start.elf") bdefdet=1;;
esac
done

if [[ "$bdefdet" -eq 0 ]] ; then
cp arm192_start.elf start.elf
current=192
fi

if [[ "$b192det" == "$bdefdet" ]] ; then
diffresult=`diff arm192_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=192
fi
fi

if [[ "$b128det" == "$bdefdet" ]] ; then
diffresult=`diff arm128_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=128
fi
fi

if [[ "$b224det" == "$bdefdet" ]] ; then
diffresult=`diff arm224_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=224
fi
fi

declare -i vram
vram=256-$current
sysram=`cat /proc/meminfo | grep MemTotal | awk -F\ '{ printf("%.0f",$2/1024) }'`
echo "##################################"
echo "## Raspberry Pi Memory ##"
echo "## Selector Script ##"
echo "##################################"
echo " Current Memory Split"
echo " CPU $current/$vram VRAM"
echo " Detected System RAM"
echo " $sysram MB"
echo "##################################"
case $current in
128)
echo "1) Set CPU/VRAM split to 192/64"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
192)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
224)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 192/64"
echo "3) Quit"
;;
*)
echo "Invalid memory detected"
;;
esac
echo "Enter Choice:";
read x

case $x in
1)
case $current in
128)
rm start.elf && cp arm192_start.elf start.elf
;;
192)
rm start.elf && cp arm128_start.elf start.elf
;;
224)
rm start.elf && cp arm128_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
2)
case $current in
128)
rm start.elf && cp arm224_start.elf start.elf
;;
192)
rm start.elf && cp arm224_start.elf start.elf
;;
224)
rm start.elf && cp arm192_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
3) exit 0;;
esac
if [[ $? -ne 0 ]]; then
echo "Memory Split setting failed"
fi

Share

  2 Responses to “Raspberry Pi Memory Split Selector Script Version 2”

  1. FYI, the raspi-config utility tool from the Debian wheezy distro for Rasperry Pi now includes the same memory split selector.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.