Showing posts with label computers. Show all posts
Showing posts with label computers. Show all posts

Sunday, 11 March 2012

Compiling custom module from external patch in Ubuntu 11.10 (asm58 sensors patch)


The result of the following commands is that you gain a copy of the default ubuntu kernel packages, with just your patch added (one module and one help file).

  • Install the required packages (linux sources and required programs/files to build the new kernel package).
  • Install the dependencies required for building the kernel
$ apt-get build-dep linux kernel-wedge fakeroot makedumpfile
  • Install the kernel source code
$ apt-get install linux-source
  • Extract the current ubuntu kernel source (into an allready prepared directories - by linux-source package)
$ cd /usr/src/
$ tar -xjf linux-source-x.y.z.tar.bz2
$ cd linux-source-x.y.z
$ wget http://n.neonatus.net/files/asm58-linux-3.0.0.patch
patch -p1 <asm58-linux-3.0.0.patch
  • My builds always failed with the error of not being able to touch a certain file so for that reason I create a directory beforehand so that the build goes through without an error
$ mkdir debian/stamps
  • Prepare to build the source
$ fakeroot debian/rules clean
  • Build the kernel packages
$  AUTOBUILD=1 NOEXTRAS=1 fakeroot debian/rules binary-generic-pae
You could also use binary - to build binary packages for all flavours - or select your flavour according to your hardware - they are listed in the debian.master/config/$ARCH/ directory.
  • If you are lucky enough to have multiple cores or processors utilize them during build add "DEB_BUILD_OPTIONS=parallel=2" variable in front of the command where 2 is the number of cores/processors you have available to the OS like this:
$ DEB_BUILD_OPTIONS=parallel=2 AUTOBUILD=1 NOEXTRAS=1 fakeroot debian/rules binary-generic-pae
During the build the kernel configure script will ask you to define the following:
 Asus Mozart-2 (SENSORS_ASM58) [N/m/y/?] (NEW)
Enter the letter m and press enter, which signifies to build the object as module so you can load/unload it at need. 

Now we wait... and wait... (hope you have a fast computer, or you'll) wait some more...
When the compiling finishes you will be left with a couple of new *.deb packages in your /usr/src directory, which you can install with dpkg command.
$ dpkg -i ../linux-headers-3.0.0-16-generic-pae_3.0.0-16.29_i386.deb
$ dpkg -i ../linux-image-3.0.0-16-generic-pae_3.0.0-16.29_i386.deb
Reboot and (if not allready selected) select the new kernel in the grub boot menu.
Log into the newly booted system and verify if all is fine by loading the asm58 module:

$ modprobe asm58
and verify that it is loaded ok:
$ lsmod |grep asm58
asm58                  13122  0
Now you can use the functionality of the newly compiled module by configuring lm-sensors - run sensors-detect and afterwards verify that the command sensors returns values from the sensor.


Good luck, and write a comment if you need help ;)

#Links:

Monday, 22 December 2008

Sony Ericsson W910i and its "special" ways

Yes, special... (as in special needs).


After fiddling around with many (many, many, ...) options of how to make Album Art work in visualization options, I have figured out it supports ID3 v2.3 (and v2.4 but is faulty - read on) tags that can have embedded pictures in them. It supports only image/jpeg type files. After twiddling for quite some time I converted all the tags to version 2.4.0 and UTF-8 encoded them - BIG MISTAKE, the player displays all the artists, albums and song names incorrectly than. The names seem to be split in 2 or more characters - GO SE ;). So I had to convert them all back.




Here is the final coctail of Id3 tags, that does work and display all fields ok:
  • ID3 version 2.3.0
  • Picture field with image/jpeg type
  • ISO-8859-1 (latin-1) encoding
I use Kid3-qt tag editor for most jobs with tagging my audio files.

Another glitch I noticed was that the device did not correctly disconnect when umounting the phone (as a storage device) from the PC. I use Ubuntu as my desktop and what I needed to do was to use eject (or a variation of it) to get proper disconnect - so this is the concoction I brewed to make it work properly:
in ~/.gnome2/nautilus-scripts/ create a file called Eject with the following contents:

MNTPNT=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" |tr -d '\n')
gnome-eject --pseudonym "$MNTPNT"

When right clicking on the device icon on your desktop (the storage device that displays either the internal or the storage card of your W910i phone), navigate to Scripts->Eject, now the device should be ejected correctly and the phone will display the message that the storage session is finished.

Well hopefully someone else will stumble upon this post instead of wasting a weekend arranging their music files and discovering the tags have all gone beserk...

PS: The same procedure should work on older/other SE W(alkman) model phones/players.

Tuesday, 18 November 2008

Ubuntu, VirtualBox and suspend

Hey, I know, long time no write, well, long time no time left...

and allways running around requires me to suspend my laptop a lot, mainly when suspending it with VirtualBox running. Well after resuming the suspend VirtualBox froze most of the times. Killing the program and restarting it did not work, removing the module was impossible, so the only fix was the reboot. Well until smarter thought came ofcourse.

Create an pm script (in Ubuntu go to /etc/pm/sleep.d/) create a newfile named 90virtualbox with the following contents:


#!/bin/sh

USR_RNNG=$(ps aux |grep VirtualBox |grep -v grep |cut -f1 -d' ')
if [ "x$USR_RNNG" != "x" ]; then
if [ $(id -u) -eq 0 ]; then
su $USR_RNNG -c $0
else
for VMS in $(VBoxManage list runningvms |egrep "^[0-9]"); do
VBoxManage controlvm $VMS savestate
done
fi
fi
exit 0

Dont forget to make the script executable (chmod +x 90virtualbox).

Well that works for me, now before doing ACPI suspend the virtualbox machines are suspended nicely and afterwards you have to start them again, but they are up in a heartbeat (well 5 seconds in my case).

You can do that either by running VirtualBox gui and starting them or running:
VBoxManage start UUID|name_of_virtual_machine

Happy virtualizing...