Aug
20
The latest apt-get update && apt-get upgrade had a kernel update to 2.6.18-5. This kernel is still missing some of the Macbook patches, so I had to get the source, patch and build a package. This took longer than I thought, because a few things had changed. So, here are the bits and pieces that I had to do to get my Macbook back to working the way it had been.
Firstly get the source for this new kernel with apt-get source linux-image-2.6.18-5-686. This downloads the kernel source to a linux-2.6-2.6.21 directory.
If you haven’t already, get the Mactel patches from the Subversion repository at https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk; cd into the kernel/mactel-patches-2.6.21/ directory and run ./apply /path/to/linux/source.
At this point, you should configure the kernel. To do this, I used make oldconfig. You can go with the default on most of the new options you’re prompted on I think. The only ones I changed were some of the Apple specific ones. Watch out for them, and decide yourself if you want to include them. I can’t remember off-hand right now what they were.
After building, installing and booting this new kernel, it looked like the harddrive was renamed from sda to hda. However, using hda only got the system to boot a small bit further (this was using a root=/dev/hda3 kernel boot parameter, and changing sda to hda in /etc/fstab). To fix this, in the kernel configuration (I used make menuconfig), do the following
- Under Device drivers, turn off ATA/ATAPI/MFM/RLL Support
- Under Serial ATA (prod) and Parallel ATA (experimental) drivers, set both ATA device support and Intel ESB, ICH, PIIX3, PIIX4, PATA/SATA support to ‘m’ (to build kernel modules instead of compiling support into the kernel)
While you’re configuring the kernel, do the following also, if, like me, you change the order of the F keys and the FN keys.
- Under HID Devices, set Generic HID support to ‘m’ instead of ‘y’
I like the F keys first, so in previous kernels I set pb_fnmode=2 for the usbhid module. However, this option moved to the hid module at some point, but in the default debian kernel build, hid is built into the kernel. I rebuilt it as a module and put
options hid pb_fnmode=2
into /etc/modprobe.d/options. If you have a similar line for usbhid in there already, comment it out.
At this point, you should compile and install your new kernel. The commands below also create a kernel headers package, as well as the kernel image package, which you can skip if you don’t require it.
make-kpkg clean
make-kpkg –initrd kernel-image
make-kpkg kernel-headers
dpkg -i ../linux-image-2.6.21-mactel*
dpkg -i ../linux-headers-2.6.21-mactel*
lilo
I’m using lilo as the bootloader. If you’re using grub, replace the lilo command above with grub-install to update the MBR with the new kernel image.
You can now reboot to the new kernel.
The last thing I can think of is to install the madwifi drivers for the wireless card.
apt-get install madwifi-source
cd /usr/src
tar xjvf madwifi.tar.bz2
cd modules/madwifi
make
make install
This depends on the kernel headers package being installed. If you didn’t create one, or didn’t install it, you can build the modules with
make -C /path/to/linux/source SUBDIRS=`pwd` modules
make -C /path/to/linux/source SUBDIRS=`pwd` modules_install
I think that covers most of what I had to do to get 2.6.21 running.
Jul
24
So, I had a problem with my MacBook – the harddrive failed twice (or, at least, that’s what all the symptoms pointed to). After it failed the second time and I brought it back, the nice Apple tech support guy messed around with it a bit more, and replaced both the drive and the logic board (as he called it). It’s been working fine since, so kudos to them.
Of course, this meant that I had to install Linux on it again. This time, I decided I’d go with Debian, instead of Ubuntu. You’d think there wouldn’t be much difference, but there is.

Last time, I installed Ubuntu from a Dapper CD I had lying around, and upgraded to Feisty in one fell apt-get dist-upgrade. And, of course, this horribly messed up lots. Simple things like icons for certain things went missing, and never came back. Sometimes, when I logged into Gnome, it wouldn’t run my .xmodmaprc and I’d have to do it manually. I swap the ` and \ keys, as they are by default on the MacBook, so that they’re in the usual position. Another minor annoyance, but it’s those types of things that grate on me. The last one which really annoyed me was the Fn key functionality. Basically, I like to have F-keys first and require pressing Fn to get that functionality. So, I passed the necessary option to the necessary kernel module to get this. This enabled Home, End, Pgup and Pgdn on the arrow keys aswell, using the Fn key. But, if I held Fn, Alt and Left Arrow (Home) in Firefox, it didn’t recognise the key as Home, and instead went back a page instead of to the home page.
So, I decided to try Debian on it and see if it fared any better. And it did. I installed from an Etch CD, and nearly everything worked out of the box. The few things that I needed to do were :
- Get the kernel source and apply the mactel kernel patches, build it and install it
- Make sure the appletouch kernel module is loaded before usbhid for the touchpad
- Install madwifi-source and madwifi-tools, and build and install the modules to support the wireless card
- Set up the touchpad for 2-tap right click, and 3-tap middle click, instead of the opposite (which is the default)
- Edit
/etc/default/acpi-support and set ACPI_SLEEP_MODE to standby. This works around an issue I had (have) where, when the power cable is plugged out and the lid is closed and reopened, the computer doesn’t return from its sleep
- Edit
/etc/acpi/events/powerbtn and comment out the action line, so that the script isn’t run. When I press the power button, the Gnome logout dialogue pops up, offering me the choice to logout, power down or reboot. The acpi script shuts the machine down immediately.
All this stuff is explained on the MacBook – Debian Wiki page, so I won’t go into the details of it here. I haven’t even tried getting the iSight camera working yet, because I don’t really have any need for it.
So, I’ve noticed from my web logs that people do end up here on quests for information about Linux, particularly Ubuntu, on MacBook. Well, here’s my advice if you’re here on one of those quests – install Debian Etch! It’s easier, quicker and works perfectly.
Jun
28
I’ve updated SvnFs further to fix RHEL build problems (thanks to Niall Donegan for his help testing the numerous proposed fixes).
Version 0.3 and upwards require version 1.4 or higher of the Subversion development libraries to compile and run. I haven’t yet updated the configure script to check for this, so this is likely the problem if you get compile errors similar to
svnclient.c:48: error: syntax error before ‘*’ token
svnclient.c: In function `_svnclient_list_func’:
svnclient.c:53: error: `path’ undeclared (first use in this function)
svnclient.c:53: error: (Each undeclared identifier is reported only once
svnclient.c:53: error: for each function it appears in.)
svnclient.c:56: error: `dirent’ undeclared (first use in this function)
svnclient.c: In function `svnclient_readdir’:
svnclient.c:81: error: `SVN_DIRENT_KIND’ undeclared (first use in this
function)
svnclient.c:81: error: `SVN_DIRENT_SIZE’ undeclared (first use in this
function)
svnclient.c:102: warning: initialization makes pointer from integer
without a cast
svnclient.c: In function `svnclient_read’:
svnclient.c:134: warning: assignment makes pointer from integer without
a cast
make[2]: *** [svnclient.o] Error 1
make[2]: Leaving directory `/root/svnfs/src’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/svnfs’
make: *** [all] Error 2
I’ve decided to work with the latest API, so I won’t be “fixing” these issues to work with older deprecated API functions.
As usual, this release is available from the SvnFs page.
Jun
24
I’ve uploaded the latest version of SvnFs. It’s available from the SvnFs page.
This provides read-only support for Subversion repositories. There are still some issues that need to be ironed out (design issues rather than bugs).
- Doing a recursive list of the repository at mount time is slow
- Reading large files is slow, due to lack of caching
Other than that, from my testing, it works pretty reliably.
I did come across an awkward bug though, which I now can’t reproduce! Basically, between the time I created the Subversion repository for SvnFs and now I’ve switched from en_IE@euro as my locale to en_IE.UTF8. Something in there caused Subversion to get mixed up and incorrectly report the filesize in the svn_dirent_t structure filled by svn_client_list(). This meant that the filesystem thought the files were smaller than they actually were, and was causing short reads. I worked around it by removing and re-adding all the files that were showing incorrect sizes, just for my own testing.
Jun
17
I’m still working, albeit slowly, on SvnFs. I’ve implemented open() and read() functions, but there are still bugs to be ironed out, so I’m not releasing it yet.
However, I’ve finally gotten around to setting up anonymous access to the code, so the latest development version can be gotten from the Subversion repository with
svn co http://www.jmadden.eu/svnrepos/svnfs/trunk
Testing reports and patches graciously accepted!
The two major bugs to be fixed are:
- Reading large files causes a segmentation fault
- The directory listing of a repository lists files that have been deleted or removed
Once those two are fixed, I think v0.3 should be ready for release, and should offer a complete readonly filesystem of a Subversion repository.
After that, I’ll need to move some code around. Doing a full listing of a Subversion repository at mount time is very slow, and probably not needed – particularly for large repositories. So that will have to change to be more scalable.
May
31
I came across usplash recently as a solution to setting up a custom bootsplash screen. It installed and worked fine, but there didn’t seem to be any way to customise the splash screen. There are plenty of HowTo’s for how to customise it in Ubuntu (like this one) but they didn’t work for Debian.
The reason is that the Debian build doesn’t use a shared library for the bootsplash screen. Instead, it’s compiled in and so will always use the testcard theme.
Changing it is pretty simple though. Firstly,
apt-get install usplash libbogl0 libbogl-dev libgd2-noxpm libgd2-noxpm-dev
apt-get source usplash
I’m presuming you already have ~/bs.png that you want to use for the bootsplash. This should have a 16 colour palette and be of the required resolution.
Next, cd into the usplash source directory and copy your bootsplash image into it.
cd usplash-0.3e
cp ~/bs.png usplash-artwork.png
For this example, I’m setting up a usplash-artwork theme.
Next, use pngtobogl to convert the png image to C code.
pngtobogl usplash-artwork.png >usplash-artwork.c
The easiest way to set up the theme is copy usplash-testcard-theme.c and edit it for your own theme. In this case, you’ll want to search for any occurances of testcard and change it to artwork. Do this with sed, awk or whatever editor you use (which, of course, should be ViM!!). The code you’ll want to change is pretty obvious in the file too. To change the colours, edit the hex values for the palette indexes. Your image should have 16 colours, and each hex value, 0×0 through 0xf, will represent one of those 16 colours. The rest are positions and sizes for the progress bar, text box and text.
Lastly, edit usplash.c and again search and replace testcard with artwork.
sed -e ‘s/testcard/artwork/g’ usplash-testcard-theme.c >usplash-artwork-theme.c
vim usplash-artwork-theme.c
** Edit the palette, progress bar, text box and text details **
vim usplash.c
** Search and replace testcard for artwork **
Now, you’re ready to compile usplash again. Just run make in the source directory. Shortly afterwards, the usplash binary is there. Next thing is to “install” it! As root do
cd /sbin
cp usplash usplash.bak
cp ~/usplash-0.3e/usplash .
update-initramfs -u
This backs up your previous usplash binary, copies in your newly compiled one and updates the kernel’s initrd to contain your newly created bootsplash image.
Lastly, reboot to see the bootsplash screen.
Tip: you can test the image without rebooting by just running your usplash binary as long as X isn’t running. It obviously won’t have any progress bar animation or text, but you’ll get a good idea of how it’ll look during boot.
Edit – 2007-08-13
Two minor updates to this. Firstly, if you run usplash just after compiling, and you get a bogl_init failed message, it’s probably because you’re not using framebuffer support. You’ll need to edit /boot/grub/menu.1st as follows :
# defoptions=quiet splash vga=791
Leave the ‘#’ in place. It’s picked up when you run update-grub and added to the kernel line for each configured kernel. So, update it now with update-grub.
The different options for vga= are :
- 785 – 640×480
- 788 – 800×600
- 791 – 1024×768
- 794 – 1280×1024
The second issue is that when you boot, the bootsplash screen is ended prematurely and a load of the usual boot-text is shown. To fix this, edit /etc/init.d/console-screen.sh and find the text unicode_stop 2> /dev/null|| true and comment it out, so it looks like
#unicode_stop 2> /dev/null|| true
Now your bootsplash screen should run right to the end of boot.
May
15
I remember when I started using GNU/Linux, back around 2000, there wasn’t much choice in media players, and they weren’t exactly feature rich. Thankfully, that has changed quite significantly now. There’s not only a wide choice in players, but also in video creation software.
As part of my new job, I have to work with these players and develop add-ons for them. It’s within the source code that I’ve developed a preference for xine.
I started with mplayer, which is a fantastic player and very featureful. But it’s a pain to develop on. After that, I looked at VLC, which again, while featureful and extensive, just didn’t suit my needs.
In between the two was xine, which has the features and format support to do most of what I want, and has a very good API and good documentation, which when combined with the source, gives all the direction I need for writing new frontends and any plugins necessary.
In short, if you need to hack on any open source media players, do give xine a look!
Apr
9
I decided to put some work into getting the advanced features of the touchpad on my MacBook working. These include double and triple tap for middle and right clicking and scrolling using the touchpad.

I started with the instructions on Simon van der Linden’s “MacBook: emulate a Synaptics touchpad with Ubuntu GNU/Linux” page. The patch on the Ubuntu forums is required to support the touchpad. However, even though this supports the touchpad, it’s fairly jittery and difficult to use.
So, next step was to apply another patch from Jason Parekh which helps fix that jitter and improves the multi-tap recognition.
Finally, I tweaked Jason’s patch a small bit, and I find it improved the jitter a bit more. Here’s the complete patch to appletouch.c that I’m using at the moment. With this, I load the appletouch.ko module with
modprobe appletouch tap_threshold=5 track_threshold=1
To do this automatically on boot, put the following into /etc/modprobe.d/options (you may have already put in a similar line from Simon van der Linden’s howto, so just edit it in that case)
install usbhid /sbin/modprobe appletouch tap_threshold=5 track_threshold=1 && sleep 2 && /sbin/modprobe –ignore-install usbhid $CMDLINE_OPTS
I have noticed some issues with slight jitters and when using the scrolling in Firefox. While using Firefox, I’ve noticed phantom clicks, which can get annoying when in the middle of a blog post and the browser’s back button gets mysteriously clicked! What I suspect is that I hit the touchpad and bring up the right-click menu, and I end up hitting the “Back” option there. Other than that, it works well, and I’m sure once I get used to it, I’ll wonder how I ever did without it!
Mar
29
This is more of a reminder for myself than anything else. If you need to convert a MS Word document to something legible, use antiword. It’s very simple, and very useful.
antiword file.doc
This converts file.doc to plain text, and outputs to standard output. It can also be used to convert Word docs to PDF, PS and XML.
Of course, if people would stop sending documents in this manufacturer controlled, proprietary format, we wouldn’t require hacks to read them. But that’s not likely to happen any time soon.
Mar
10
I’ve created this page to track releases of SvnFs. The first release, version 0.2 is now available.
Please let me know if you find it useful, and send any patches or bugs to john+svnfs@jmadden.eu.
I haven’t yet set up anonymous access to the Subversion repository for this project, but I’ll hopefully get it done during the week.
« go back —
keep looking »