Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/embedded/conf By default, RPI firmware sets th...



details:   https://anonhg.NetBSD.org/src/rev/1dba90fdf77f
branches:  trunk
changeset: 806146:1dba90fdf77f
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Feb 06 15:15:01 2015 +0000

description:
By default, RPI firmware sets the max CPU frequency to 600MHz. This can be
overridden by setting arm_freq in config.txt, but the default freq at boot
is still 600MHz.

Add logic to rc.local to compare the current vs. max CPU frequency; if they
differ, set the target frequency to the maximum.

diffstat:

 distrib/utils/embedded/conf/rpi.conf |  18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 3695a19907da -r 1dba90fdf77f distrib/utils/embedded/conf/rpi.conf
--- a/distrib/utils/embedded/conf/rpi.conf      Fri Feb 06 14:48:24 2015 +0000
+++ b/distrib/utils/embedded/conf/rpi.conf      Fri Feb 06 15:15:01 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.24 2013/11/28 13:39:18 skrll Exp $
+# $NetBSD: rpi.conf,v 1.25 2015/02/06 15:15:01 jmcneill Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -29,6 +29,22 @@
 devpubd=YES
 EOF
 
+       #
+       # If arm_freq is specified in config.txt, set CPU frequency
+       # to match at boot time.
+       #
+       cp ${release}/etc/rc.local ${mnt}/etc/rc.local
+       cat > /tmp/a << EOF
+if /sbin/sysctl -q machdep.cpu.frequency.max; then
+       cpufreq_max=\$(/sbin/sysctl -n machdep.cpu.frequency.max)
+       cpufreq_cur=\$(/sbin/sysctl -n machdep.cpu.frequency.current)
+       if [ ! "\$cpufreq_max" = "\$cpufreq_cur" ]; then
+               /sbin/sysctl -w machdep.cpu.frequency.target=\$cpufreq_max
+       fi
+fi
+EOF
+       echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" \
+           >> "$tmp/selected_sets"
 }
 
 populate() {



Home | Main Index | Thread Index | Old Index