This is a very quick summary on how to get GNU on a smartphone. I don't mean as a side chroot, or an emulator. This is GNU running native on your phone.

This will work on those phones where the bootloader loads from a partition using an Android image, one which is supported by http://git.cascardo.info/?p=cascardo/bootimg.git;a=summary. You will also need a rooted phone, where you can get into a root shell, and read from and write to this partition.

Find the recovery partition on /dev/. On my phone, that was /dev/block/platform/msm_sdcc.1/by-name/recovery. dd from it to a file which you could copy to your GNU system. Extract kernel and initrd from that using bootimg, giving only that file as a parameter. It will write kernel and initrd files.

Replace initrd with a GNU system. For me, it worked to extract armhf deb files from Debian. I used the following list of packages:

  • bash_4.3-4_armhf.deb
  • coreutils_8.21-1.1_armhf.deb
  • libacl1_2.2.52-1_armhf.deb
  • libattr1_2.4.47-1_armhf.deb
  • libc6_2.18-4_armhf.deb
  • libpcre3_8.31-2_armhf.deb
  • libselinux1_2.2.2-1_armhf.deb
  • libtinfo5_5.9+20140118-1_armhf.deb

I removed some documentation and some other files, packaged that into a initrd using cpio, and into the boot image, by giving an extra parameter (anything will do) to bootimg. That replaced the initrd into the recovery file.

I wrote a /init bash script to run a simple program to write to the framebuffer before generating my initrd.

Write that back into recovery partition, then boot into recovery, by pressing home, volume up and power.

That's it: you now have GNU on a smartphone.