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 C&P of change in rpi.conf (maybe...



details:   https://anonhg.NetBSD.org/src/rev/f3383a3750b6
branches:  trunk
changeset: 342379:f3383a3750b6
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Dec 19 14:57:49 2015 +0000

description:
C&P of change in rpi.conf (maybe factor out)

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/armv7.conf |  19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r 7b228f83c6ba -r f3383a3750b6 distrib/utils/embedded/conf/armv7.conf
--- a/distrib/utils/embedded/conf/armv7.conf    Sat Dec 19 13:28:22 2015 +0000
+++ b/distrib/utils/embedded/conf/armv7.conf    Sat Dec 19 14:57:49 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.9 2015/12/13 23:02:56 jmcneill Exp $
+# $NetBSD: armv7.conf,v 1.10 2015/12/19 14:57:49 skrll Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -73,6 +73,23 @@
                )
 
        fi
+
+       #
+       # 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 >> ${mnt}/etc/rc.local << 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_amlogic() {



Home | Main Index | Thread Index | Old Index