kobo® glo [sic] HD hacking [part 2]

With debian 7.9 safely booted the next job is to get X up running and happy.  To do that you’ll need a utility to switch the screen into auto update mode, and once you’re put that into your xserverrc script you’ll discover that the touchscreen doesn’t work: both the xorg evdev driver and the one in marek’s tree open and close the device node for the zForce driver multiple times during X start up. The kernel driver code for the zForce sends an activate command to the hardware immediately the device node is opened, but sends the deactivate command a short while after the device node is closed. So when X closes and then immediately re-opens the device there’s a race where the device can be open but with the hardware deactivated. I patched marek’s patches to the xorg driver to only open the device once. You’ll then have to fight xorg.conf to find the right form to have it load your driver:

Section "InputClass"
    Identifier "kobo multitouch"
    MatchIsTouchscreen "on"
    Driver "kobomultitouch"

After that you’ll want a utility to set the front-light and to control the (one) led.

Debian’s wireless networking scripts work out of the box with the brcmfmac driver, but you need to load sdio_wifi_pwr to turn on the power to the wifi chip.

auto wlan0
iface wlan0 inet dhcp
        pre-up modprobe sdio_wifi_pwr && sleep 2
        pre-up iptables-restore < /etc/network/iptables-rules
        post-up iwconfig wlan0 power off
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
        post-down sleep 2 && rmmod brcmfmac && rmmod sdio_wifi_pwr || true

With that the system boots and connects to wireless, and the xserver works (don’t forget to remove -nolisten tcp from the xserver startup options if you want to use X over the network).

The last thing to do is to get the the original kobo software running on top of Debian, after quite a lot of fiddling that turns out not to be too hard:

Obviously the update procedure isn’t going to work very well so you should probably go ahead and do that on (a copy of) the original SD card first.

kobo’s original software expects to mount the content partition at /mnt/onboard, but doesn’t particularly check for errors. If you want a dos partition and usb connectivity then you’ll need to replicate their three partition layout. I didn’t.

The kobo firmware starts up everything from /etc/init.d/rcS which eventually launches a program called nickel which is the kobo’s main UI.

I copied the filesystem from the first parition of their SD card into the directory /kobo on my debian SD card, then I made my own startup script which runs their code in a chroot.

All the utilities mentioned here are available in the kobo-tools git repository.