You are not logged in.
Hey all, basically, getting Arch working with my laptop was a pain due to the lack of power options and graphics control, especially using the open source drivers. My laptop would overheat due to both the dedicated and integrated graphs cards would be running at the same time and my CPUs were running at 100%. After a long while of looking around, I finally found a solution, and being the nice guy I am, I decided to make a script to streamline the process for most people. It mounts the debugging filesystem, adds it to fstab, installs the necessary tools, loads the correct module, and also lets you change power plans, as well as check on battery, graphics card status, and cpu status. this is basically version one so i guess ill add a bit to it over time.
*** MAKE SURE KMS IS ENABLED ON YOUR KERNEL GRUB/SYSLINUX LINE EG: "radeon.modset=1"
******ERROR CHECKING:
if you have the debug fs mounted already, unmount it with umount /sys/kernel/debug
if you get an error modprobing, check what modules are supported from your cpu with ls /lib/modules/$(uname -r)/kernel/drivers/cpufreq/
with the debugging fs mounted, running cat /sys/kernel/debug/vgaswitcheroo/switch to find out what your graphic adapters are named and if needed replace the IGD and DIS with yours
you may have to modify some parts of the program, but i tried my best to make it as easy as I can
Installation:
copy it and save it as foo.sh
chmod 777 it for good measures
RUN AS ROOT
chmod 777 foo.sh
./foo.sh
#! /bin/bash
#By: Dominic dos Santos
#dom.doss@gmail.com
#mount -t debugfs none /sys/kernel/debug --mount debugging fs
#echo"IGD"> /sys/kernel/debug/vgaswitcheroo/switch && echo"OFF"> /sys/kernel/debug/vgaswitcheroo/switch --onboard graphics
#echo"DIS"> /sys/kernel/debug/vgaswitcheroo/switch && echo"OFF"> /sys/kernel/debug/vgaswitcheroo/switch --dedicated graphics
#cpufreq-set -c 3 -g powersave # --powersave cpu freq set
#cpufreq-set -c 3 -g performance # --performance
#cpufreq-set -c 3 -g ondemand #--...
#!!!PLEASE NOTE!!! I am using a quad core laptop, therefore I have the '-c 3' argument. Cores are as such: 0 1 2 3
#Dual core would be '-c 1', 6 core would be 5
#
#
echo "RUNNING THIS WIH X RUNNING WILL NOT MODIFY THE GRAPHICS CARD SETINGS"
#
#
#checking if debugging fs is mounted, if not, mounting.
if [ -f /sys/kernel/debug/vgaswitcheroo/switch ]; then
echo "DEBUGFS is mounted, continuing wih program"
else
read -p "Press ENTER to mount the debugging directory (REQUIRED)"
mount -t debugfs none /sys/kernel/debug #the mount fs command
echo "Add to fstab?"
read fs
if [ "$fs" == "y" ]; then
echo "debugfs /sys/kernel/debug debugfs 0 0" >> /etc/fstab #add the required line to the fstab
fi
read -p "We are now going to install the cpu drivers and load the required modules."
pacman -S cpufrequtils
echo "Do you have an [a]MD or [i]ntel cpu?" #load the [correct] module now
read input
if [ "$input" == "a" ]; then #AMD
modprobe powernow-k8
elif [ "$input" == "i" ]; then #INTEL
modprobe acpi-cpufreq
fi
echo "REMEMBER TO ADD acpi-cpufreq cpufreq_powersave cpufreq_ondemand cpufreq_performance to your rc.conf beside MODULES=( ****** FOR INTEL CARDS ONLY!"
echo "OR powernow-k8 cpufreq_powersave cpufreq_ondemand cpufreq_performance ****** FOR AMD CPU's ONLY!"
fi
#menu
echo -e "Welcome to my CPU and Videocard Power and Performance Switcherooer"
echo " 1: Powersave"
echo " 2: On Demand"
echo " 3: Performance"
echo " 4: Check Status"
echo "Please select an option"
read input
if [ "$input" = 1 ]; then
#Powersave
#Set CPU to "Powersave", set VGA to onboard and disables one not being used, ie. the dedicated
cpufreq-set -c 3 -g powersave
echo "IGD" > /sys/kernel/debug/vgaswitcheroo/switch
echo "OFF" > /sys/kernel/debug/vgaswitcheroo/switch #the "OFF" infers to cutting the power to the one that isn't selected
elif [ "$input" = 2 ]; then
#On Demand
#Set CPU to "On Demand", set VGA to onboard and disables one not being used, ie. the dedicated
cpufreq-set -c 3 -g ondemand
echo "IGD"> /sys/kernel/debug/vgaswitcheroo/switch
echo "OFF"> /sys/kernel/debug/vgaswitcheroo/switch
elif [ "$input" = 3 ]; then
#Performance
#Set CPU to "Performance", set VGA to the dedicated graphics card and disables the onboard
cpufreq-set -c 3 -g performance
echo "DIS"> /sys/kernel/debug/vgaswitcheroo/switch
echo "OFF"> /sys/kernel/debug/vgaswitcheroo/switch
elif [ "$input" = 4 ]; then # status check
echo " 1: Battery"
echo " 2: Graphics Card"
echo " 3: CPU Info"
read status
if [ "$status" = 1 ]; then #battery
acpi
read -p "Press Enter"
elif [ "$status" = 2 ]; then #battery
cat /sys/kernel/debug/vgaswitcheroo/switch
read -p "Press Enter"
elif [ "$status" = 3 ]; then #battery
cpufreq-info
read -p "Press Enter"
fi
fi
Last edited by imagoose (2012-02-15 22:51:13)
Offline
Thats great, thank you. I have an older Dell Studio XPS 13 which has NVIDIA Hybrid SLI. Its current power usage in Arch is killing me (about an hour and a half, where as i can get 3-4 hrs in win7). Right now I am doing all the work through the integrated graphics card, per my xorg.conf, but i dont think i've managed to disable the discrete card yet. When I get on the laptop I'll let you know how it goes.
Offline