Monday, February 20, 2012

NSLU Optware for Android

Yes, there was kind of attempt at that already, but:
  • It's no longer available at the link announced and spread over the Internet (yep, it's available at another, but why so ... complicated?)
  • It ships binary blobs of unknown origin. Yup, maybe one could trace their origins, but who'd bother, and telepaths are on vacation as usual. It should be described stringently where they are from, if not scripted to be collected in user's build directory from known good sources, so users can actually trust them.
  • It is marketed as supporting only something called "Nook Color". What's that, I thought it was Optware for Android? Could I have Optware specifically for my HP nx9420 notebook, serial number XYZZY, 3Gb of RAM? Just make sure it's different from the Optware for the same notebook, but with 4Gb of RAM, and from any other Optwares in the world!
  • It goes as far as patching rootfs ramdisk. That may work on Nook Color or may brick it. That may work on next firmware upgrade of Nook Color or may brick. That may work on another device or may brick. The talk is not about this, it's about the fact that it's two big differences - to be able to install and run bash and to have sshd started automatically after the boot. I definitely want first, but I will do good consideration if/when I need second. So, I don't want setup for those 2 stages to mixed and done without myself being ready for stage 2.
  • It still appears to rely on presence of some other 3rd party stuff (look at that #!/bin/sh line, there's no such thing on pristine Android device, only #!/system/bin/sh)
So well, I decided to take my turn on hacking up an Optware bootstrap script for pure Android (root and adb access are the only prereqs). It's hosted here: https://github.com/pfalcon/optware-android and intended to be run on a Linux hosts. It starts by downloading CodeSourcery toolchain for libc and ipkg and immediate dependencies from http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable to bootstrap ipkg on device. Yep, it's being tested on Nook Tablet so far, but at least it is called Optware for Android and I have that aim ;-). So, bugreports and patches are welcome. And I have few more devices to test it on, just steal me some time...

7 comments:

Eric Work said...

Nice work!!! Tested on my Transformer Prime. I attempted to do it first myself and I missed a step somewhere and couldn't get ipkg to update the repo. I think my environment was messed up compared to your start.sh. I would recommend installing libgcc_s.so.1 for nmap.

Eric Work said...

You should proably install all of libc from code sourcery. You need libnsl and libgcrypt in order to use ssh.

Eric Work said...

You need to create a link to /home in your start script and you remove in your uninstall function You also need to create passwd and group I think to use opnssh,

pfalcon said...

Glad it worked for you - I spent out quite a few install/uninstall iterations to hammer out issues ;-).

Yeah, I was thinking about just installing all system libs, but was kinda lazy and curious to see what actually uses them. Plus, there're concerns of devices which may have really small free space on builtin flash. I'll look into that some time, in the meantime I added libs you suggested. Note that nmap appears to miss dependency on lua (optware problem, I posted about that to nslu2-linux maillist), so you need to install that manually.

I'll look into /etc/passwd and friends too.

Btw, feel free to report these as bugs to https://github.com/pfalcon/optware-android/issues or https://sourceforge.net/p/optware-android/tickets/

Eric Work said...

I forked your project on github and made a few enhancements such as adding the rest of libc and creating /etc/passwd and /etc/group so ls is normal and /home/* works. I'll send a pull request once I finish testing them all out. I noticed the nmap issue with lua but didn't know where to report it. I have a number of other patches for various optware packages such as vpnc and samba 2 that I've been meaning to ship upstream. There are still some missing pieces I think for openssh to install properly but if we get that to work we really have a full working linux userspace.

Eric Work said...

I got the openssh package to install without issues and the client working. I'm not sure how deep things go for the server (such as shadow file or PAM). There are other solutions for SSH server or maybe someone will figure out the issues and write a post install script. If you can send me a message on github (zeroepoch) then we can communicate through email which will be much easier. I sent a pull request will all the necessary changes to get openssh going and a proper user system.

pfalcon said...

It seems I can't message you either - somehow github appears to tie that to public email being set or something. Anyway, I'm pmiscml at gmail.

Thanks for the pull request, I commented on few commits. The reason for that is that I'd like optware setup to stick to some requirements, main being generic support for all Android devices and KISS.

I understand the desire to have full-fledged Linux-like env on Android device, but the matter is that Optware wasn't designed to be such in the first place. So, I'd like to do as little as possible changes to the underlying Android (file)system. That doesn't mean that particular changes can't be done - I'd just like it to be explicitly understood, discussed, and recorded in commit messages.

As for full-fledged env, I guess running well-established distro in a chroot is more scalable approach. I have complimentary project for that - http://sf.net/p/chdistro-droid . (Note that it's much more adhoc and needs lot of work to be able to run on arbitrary device, exactly experience based on which I try to be thorough with optware installer).