Pre

I got a Palm Pre because I want a Linux smartphone that is not locked down (like the G1), on which I can play with Debian and even my own kernel. But I also want one that seems likely to be widely viable going forward, and there I have my doubts about OpenMoko, sadly.

(Or, I got a Palm Pre because I dreamt last night that I got one, and decided my subconcious must have made a decision after dithering for years. And because Madduck rules.)

Debian chroot on Palm Pre

This is a quick installation of a Debian chroot on the Palm Pre phone. Similar methods are explained at the Pre Dev Wiki. But they have you download a prebuilt Debian image and modify the Palm webOS system to install ssh; I preferred to use debootstrap and keep webOS changes to a minimum.

Also, since the Pre uses LVM, its media partition can be resized on the fly. That allows for a larger Debian filesystem, and I think is a nicer method than the loopback filesystem approach documented elsewhere, but do read the warnings about Palm, LVM, and upgrades here.

On the Pre:

  1. Enable dev mode by opening the Pre's Launcher and typing the following into it: upupdowndownleftrightleftrightbastart
  2. Plug the Pre into your laptop, tell it to charge via USB, while doing the following on the laptop.

On a Linux laptop:

  1. Run debootstrap to build an armel chroot: sudo debootstrap --foreign --arch=armel sid /tmp/debian
  2. Download novacom, cd to it, and build it: sudo apt-get install libusb-dev; make
  3. Transfer the armel chroot from the laptop to the Pre: (cd /tmp; sudo tar czv debian) | sudo ./novacom put file:///tmp/debian.tar.gz
  4. Run sudo ./novacom to get root shell on the Pre.
  5. In that shell, use LVM to resize the existing /media/internal volume down to 1 GB, and create a new 6 GB one for Debian:
     cp -a /media/internal /opt
     umount /media/internal
     lvresize -L 1G /dev/mapper/store-media
     mkdosfs -F 32 /dev/mapper/store-media
     mount /media/internal
     mv /opt/internal/ /opt/internal/. /media/internal
     rmdir /opt/internal
     lvcreate -l 100%FREE -n debian store
     mkfs.ext3 /dev/store/debian
     mkdir /media/debian
     echo "/dev/mapper/store-debian /media/debian auto noatime 0 0" >> /etc/fstab
     mount /media/debian
  6. Then in the Pre's root shell, you can unpack Debian, set up some bind mounts to allow accessing the Pre's filesystems from inside Debian, and chroot in to finish debootstrap:
     cd /media
     tar zxvf /tmp/debian.tar.gz
     mkdir /media/debian/media/pre-root /media/debian/media/internal
     echo "/ /media/debian/media/pre-root bind defaults,bind 0 0" >> /etc/fstab
     echo "/var /media/debian/media/pre-root/var bind defaults,bind 0 0" >> /etc/fstab
     echo "/var/log /media/debian/media/pre-root/var/log bind defaults,bind 0 0" >> /etc/fstab
     echo "/tmp /media/debian/tmp bind defaults,bind 0 0" >> /etc/fstab
     echo "/proc /media/debian/proc bind defaults,bind 0 0" >> /etc/fstab
     echo "/dev /media/debian/dev bind defaults,bind 0 0" >> /etc/fstab
     echo "/dev/pts /media/debian/dev/pts bind defaults,bind 0 0" >> /etc/fstab
     echo "/sys /media/debian/sys bind defaults,bind 0 0" >> /etc/fstab
     echo "/media/internal /media/debian/media/internal bind defaults,bind 0 0" >> /etc/fstab
     mount -a
     chroot debian
     /debootstrap/debootstrap --second-stage
     ln -sf /proc/mounts /etc/mtab
     ln -sf /media/pre-root/etc/resolv.conf /etc/resolv.conf
     apt-get clean
  7. Now customise the Debian chroot as usual.

How this could be made easier:

  • Make a debian package of novacom.
  • Installation script? debcoexist? d-i?

TODO:

  • Install openssh in Debian and configure it to start at boot.
  • Set up VNC, install VNC app in webOS to allow accessing a Debian desktop.