AMD 64 k10 temperature module in Ubuntu
June 18th, 2009
Pallo has a great post on the Ubuntu mailing list on how to install the temperature module for new AMD 64 bit processors (link). The issue is that every time the kernel is updated the module needs to be rebuilt as well. I therefore wrote a quick bash script to download the necessary code, compile the module, and install it in the correct location. You need to have the linux-source package installed along with the typical build tools.
#!/bin/bash
# Get the code for the k10 temperature module
wget http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20080718/d51be536/attachment.bin# Create a directory for the module to be built in
mkdir k10temp && mv attachment.bin k10temp/k10temp.c
cd k10temp# Create the make file
echo ‘obj-m := k10temp.o’ > Makefile
echo ‘KDIR := /lib/modules/$(shell uname -r)/build’ >> Makefile
echo ‘PWD := $(shell pwd)’ >> Makefile
echo ‘default:’ >> Makefile
echo ‘$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules’ >> Makefile# Compile the module
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules# Insert the module and store it with the rest of the modules
sudo insmod k10temp.ko
sudo cp k10temp.ko /lib/modules/$(uname -r)/kernel/drivers/hwmon
sudo depmod# Add k10temp to /etc/modules if not there so it will start at boot
if grep -q k10temp /etc/modules
then
echo ‘k10temp already in /etc/modules’
else
sudo echo ‘k10temp’ >> /etc/modules
echo ‘k10temp added to /etc/modules’
fi# Remove the temporary files
cd ..
rm -r k10temp
Entry Filed under: Ubuntu
10 Comments Add your own
1. Dugar | August 13th, 2009 at 10:15 am
Что делать? ubuntu 9.04
make: Вход в каталог `/usr/src/linux-headers-2.6.28-13-generic’
make[1]: *** Нет правила для сборки цели `/home/amd/k10temp.c’, требуемой для `/home/amd/k10temp.o’. Останов.
make: *** [_module_/home/amd] Ошибка 2
make: Выход из каталога `/usr/src/linux-headers-2.6.28-13-generic’
2. bananaman | August 16th, 2009 at 10:58 am
It looks like you wrote it wrong. I keep getting this error:
./new file.sh: 12: shell: not found
./new file.sh: 13: shell: not found
./new file.sh: 15: MAKE: not found
./new file.sh: 15: KDIR: not found
./new file.sh: 15: PWD: not found
make: Entering directory `/usr/src/linux-headers-2.6.28-14-generic’
Building modules, stage 2.
MODPOST 0 modules
make: Leaving directory `/usr/src/linux-headers-2.6.28-14-generic’
insmod: can’t read ‘k10temp.ko’: No such file or directory
cp: cannot stat `k10temp.ko’: No such file or directory
‘k10temp already in /etc/modules’
3. marten | August 22nd, 2009 at 3:39 pm
-bananaman,
I am sorry to hear that the script is not working for you. It is copy and pasted directly from the file, which works fine for me (I have used it after two kernel updates since you left the comment). Therefore I do not think there is an error in the code posted.
You do need to have the typical build tools installed for compiling code along with the kernel source code. Otherwise I don’t think there are other packages used (but I may be wrong).
I do not know what the first error “shell: not found” is from. I tried googleing the error but didn’t come up with anything useful.
4. neophile | October 5th, 2009 at 7:25 pm
There was some formatting done by copy and paste. I got the same errors written. I retyped all the ‘ characters. This solved the problem. Thank you for posting this code.
5. marten | October 5th, 2009 at 11:12 pm
-neophile,
Thanks for the information.
6. marcus | November 1st, 2009 at 8:15 am
It worked, eventually ;P
But bro you really gotta make them quotes normal ^_^
I don’t understand why there’s still a need to compile stuff on your own pc .. can’t the people that made this pre-compile it and put it in a nice and easy .deb package or whatever so it install itself?
Anyways, it worked so I’m cool ^_^
Thanks
7. Vladislav63 | March 23rd, 2010 at 7:52 am
Спасибо огромное!
8. Vladislav78 | March 29th, 2010 at 6:15 pm
Спасибо афтуру за хороший пост. Внимательно прочел, почерпнул много важного для себя.
9. Vladislav98 | April 5th, 2010 at 5:17 pm
Я писал что-то подобное, но у Вас тема более глубого раскрыта
10. Valera11 | April 29th, 2010 at 3:17 pm
Great post! I like the blog!
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed