guix-devel
[Top][All Lists]
Advanced

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

Re: Of sounds and locales


From: Mark H Weaver
Subject: Re: Of sounds and locales
Date: Mon, 27 Jul 2015 17:30:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

address@hidden writes:

> Humanists and Magicians,
> i'm very glad to began this journey around BuildYourWorld dimension!
> In particular i've successfully generated the GuixSD station at
> Libreboot X60,
> and it runs like a free deer over the woods!

Excellent!  I've used GuixSD on a Libreboot X60 in the past, and now use
a Libreboot X200.

> In this chapter, i was trying to complete system declaration
> following two quests:
> 1 - add "processor.max_cstate=2" to GRUB's kernel parameters
> 2 - Set an Italian Locale with an UK Keyboard Layout
> The first goal is to turn the laptop from a whistling kettle to a calm
> breeze [1].

Another option to reduce the whistle is to run "powertop --auto-tune"
after boot.  Here's a service definition I put into my OS config to
do this:

--8<---------------cut here---------------start------------->8---
(define (powertop-auto-tune-service)
  (let ((powertop #~(string-append #$powertop "/sbin/powertop")))
    (with-monad %store-monad
      (return
       (service
        (documentation "Run powertop --auto-tune.")
        (provision '(powertop-auto-tune))
        (requirement '(user-processes))
        (start #~(lambda _
                   (zero? (system* #$powertop "--auto-tune")))))))))
--8<---------------cut here---------------end--------------->8---

And then include (powertop-auto-tune-service) in the 'services' field.
Note, you'll need to import some extra modules at the top of the file:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu)
             (gnu services)
             (guix gexp)
             (guix store)
             (guix monads))
--8<---------------cut here---------------end--------------->8---

> I was able to install some packages, but actually, performing 'guix
> pull'
> brings my laptop off or freezed after sometime. I've attached my last
> attempt, and
> the only particular anomaly i've found was it's temperature (sensors
> attached), 2 minutes before it freezed again.

This is probably due to overheating.  Some Libreboot X60 models tend to
overheat.  My workaround was to add another service that disables the
second CPU core when it gets too hot.  Here's the service definition I
used:

--8<---------------cut here---------------start------------->8---
(define (temperature-regulation-service)
  (with-monad %store-monad
    (return
     (service
      (documentation "Regulate temperature on an overclocked Libreboot X60.")
      (provision '(temperature-regulation))
      (requirement '(user-processes))
      (start #~(lambda _
                 (let ((pid (primitive-fork)))
                   (if (positive? pid)
                       pid
                       (let ()
                         (define (current-temp)
                           (call-with-input-file
                               "/sys/class/thermal/thermal_zone0/temp"
                             read))
                         (define (set-cpu1-online! online?)
                           (call-with-output-file
                               "/sys/devices/system/cpu/cpu1/online"
                             (lambda (port)
                               (write (if online? 1 0) port))))
                         (let loop ()
                           (let ((temp (current-temp)))
                             (cond ((< temp 88000) (set-cpu1-online! #t))
                                   ((> temp 92000) (set-cpu1-online! #f))))
                           (sleep 2)
                           (loop)))))))
      (stop #~(make-kill-destructor))
      (respawn? #t)))))
--8<---------------cut here---------------end--------------->8---

and as above, you'll need to add (temperature-regulation-service) to the
services field, and of course run "guix system reconfigure <OS-CONFIG>"
and reboot.

If you find that it still crashes, you might need to lower those numbers
(88000 and 92000) a bit further.  Those mean that when the temperature
exceeds 92 degrees C, disable the second CPU, and when it drops below 88
degrees, turn it back on.

      Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]