Tuesday, April 14, 2009

getting mach64 dri to work on debian

Nowadays kernels don't come with a mach64 drm module. It seems there used to be some security problems with the mach64 drm module, but this has long been fixed as claimed in in the Mach 64 DRI page. Anyway, to get it working for your current kernel, download the latest version from the freedesktop git untar it and cd into the distribution directory. after that:
cd libdrm-X.X.X/linux-core
make
Now, before installing, remove the previous modules (that came with the kernel): In debian they are usually in the
/lib/modules/`uname -r`/kernel/drivers/gpu/drm
directory. remove this directory (perhaps move it somewhere for backup) and then, back in the
libdrm-X.X.X/linux-core
directory, do
sudo make install
To see if it works, exit X, remove all the old modules:
sudo rmmod drm agpgart
and try reloading them:
sudo insmod agpgart; sudo insmod drm; sudo insmod mach64
start X and test:
glxinfo | grep render
You should have "direct rendering: Yes". If you still have "Software Rasterizer" for OpenGL, try looking through the Xorg log file at
/var/log/Xorg.0.log
. It's sometimes a memory problem. In this case, try reducing display depth. If this doesn't work, try rebooting before you give up -- sometimes the old modules just won't go away until reboot.

tuxonice for debian

Debian provides the linux-patch-tuxonice package which is in the form of a kernel patch. To use it, we must compile the kernel after applying the patch. I outline the "debian way" of doing it, which will build deb packages of the patched kernel: Make a directory for all of this kernel stuff:
mkdir kernel && cd kernel
Download the kernel source, tuxonice patch and building helpers:
sudo apt-get install linux-source-2.6 linux-tuxonice-patch build-essential fakeroot
make sure you have all the necessary dependencies for building
sudo apt-get build-dep linux-2.6
Unpack the kernel source. Use the appropriate version as installed by the above apt-get command (I will use 2.6.29 here)
tar xjvf /usr/src/linux-source-2.6.29.tar.bz2
cd linux-source-2.6.29
Build the whole thing, including patch. Note: you might have to answer some kernel configuration questions. Choose the default values unless you have a good reason not to.
fakeroot make-kpkg --added_patches tuxonice --initrd --revision=+tuxonice.1 buildpackage
You should now have the full kernel .deb files in the parent dir. Before installation, add the resume argument to the kernel command line. First find out what is the swap partition:
grep swap /etc/fstab
Now edit the /boot/grub/menu.lst file to add this to all kernels:
sudoedit /boot/grub/menu.lst
Find the line beginning with "# defoptions" and append the argument
resume=swap:/dev/hXX
where /dev/hXX is the partition from the grep command above. My line looks like this:
# defoptions=quiet resume=swap:/dev/hda5
save the file. Now install the new kernel packages:
cd ../
sudo dpkg -i linux-*-2.6.29*.deb
install the hibernate package
sudo apt-get install hibernate
after rebooting with the new kernel, use hibernate:
sudo hibernate

Monday, April 13, 2009

First rule of effective backup

Backup is important -- everyone knows it, but for backup to be really effective, it must be done regularly. While doing repetitive tasks can be very hard and error prone for us humans, computers simply excel at this, so the first rule of effective backup is:
Backups should be automatic, with as little human intervention as possible. Corollary: Unless you have a tape changer, don't use tape for backup because you'll need a human to change the tapes (and they'll forget to do it) I'll post several solutions I use which follow this rule