Zipit Wireless Z2 - Project Notes

Here's what I did to get my Zipit Wireless Z2 running a useful shell.  Everything is an information mover, in my eyes, so my focus is on getting a command-line system up and running that can run sshd, httpd and crond.  It should be able to fetch data from local and remote http sources.  Also, like any fun toy, it should be able to tweet.

First things first, I'll prepare an SD card with the "official" Z2 shell filesystem:
Next, configure it to look for my wifi setup, which uses WPA2:
  • open the SD card's /etc/wpa_supplicant.conf in a text editor
  • edit the 'ssid=' line, to supply the local wifi SSID in quotes
  • add a line after that, 'proto=RSN' to make it use WPA2
  • edit the 'psk=' line, to supply your WPA2 text password in quotes
My wpa_supplicant.conf file looks like this:
ctrl_interface=/tmp/wpa_ctrl
network={
        ssid="kyorghie"
        key_mgmt=WPA-PSK
        proto=RSN
        psk="smyorghy"
}

Now it's ready for use, here's the crazy dance it takes to boot into the shell:
  • pop the SD card into the zipit
  • push the reset button (left side pinhole) to clear the device
  • push the power button to boot into the built-in setup wizard
  • tell it my wifi settings (it won't continue without 'em)
  • tell it my zipit login (won't continue without)
  • skip IM account setup by pushing "next" for those
  • once it's setup, press the -Z- button to get its attention.
  • now you can press "home," select "tools," and then select "set defaults."
  • confirm that you wanna reset, and it reboots
  • and now it sees the SD card and boots into that.
  • (convoluted, I know.  gets me to a known-good state, at least...)
  • watch it go --first-run, it generates an ssh host keypair
  • if you don't get the # prompt in two or three minutes, start over.
So with basic shell functions verified, I want to try Ray Dios Haque's Improved Z2 Shell:
  • read his "about" page for IZ2S.
  • download version 2.04 from here.
  • as before, unzip the archive into a directory
  • erase my SD card
  • copy the archive contents to the root of the SD card
  • edit the SD card's /etc/wpa_supplicant.conf as before, for WPA2
  • (may not be necessary, as his boot script asks you for these settings)
  • pop the SD card into the Zipit and reset it with the pin
  • go through the boring bult-in setup wizard -- all so I can "set default" again
  • on reboot, the zipit sees the SD and boots into it
IZ2S runs sshd on startup, but I need a known root password:
  • run `cryptpw NEWPASSWORD root` on the zipit shell command line
  • the output is a crypt hash that can be substituted into /etc/passwd
  • absent better options, I snapped a cellfone picture of the hash output
  • i pulled out the SD card and put it back in my netbook, for easy editing
  • i edited the SD card's /etc/passwd and substituted my new hash in root's entry
  • i popped the SD card back in the zipit and issued a `reboot` command
  • that didn't work, so I had to push the reset pin, go through built-in setup again, and use "set default" again.  yeesh.  then, on reboot it booted into the shell
Alright, so I know the root password and sshd runs on startup, so let's connect to it from my netbook:
  • on the zipit shell, use `ifconfig eth0` to see what inet addr: I'm at
  • on my ubuntu netbook, in a terminal, ping the zipit's IP, for funzies
  • and then on the netbook, `ssh -l root ZIPITIPADDR` to connect to the zipit
  • accept the warnings about an unknown ssh host key
  • and when prompted for password, use the one I set previously
  • and now I'm logged in as root, to the zipit, over ssh.  w00t!
Lovely, now let's make it be a web server:
  • create a docroot on the zipit shell, with `mkdir /share/httpd`
  • start the web server with an explicit docroot, `httpd -h /share/httpd`
  • make a test file, with `echo "this is on the zipit." >> /share/httpd/index.txt`
  • and on my netbook, I can now view http://ZIPITIP/index.txt in a browser!
Okay, now how about some "dynamic" data on the web server:
  • `uptime > /share/httpd/uptime.txt`
  • `wget -O /share/httpd/fetchedpage.txt http://SOMEINTERNALDEVICE/`
  • `ifconfig eth0 > /share/httpd/ifconfig.txt`
  •  and so on ... maybe there's a cron job in the future.
And now to make it tweet:  (UPDATE:  Borked.  The new API says no.  Cross-compile twidge?)
  • `curl -u USERNAME:PASSWORD  http://twitter.com/account/verify_credentials.json` to make sure the API likes us
  • and then `curl -u USERNAME:PASSWORD -d status="My zipit can tweet from the command line." http://twitter.com/statuses/update.json`
  • So I actually got it working, see http://twitter.com/tweetazip w00!
I'm starting to get some interesting ideas, at this point.

If you need special characters when you're on the actual keyboard, here are the most useful ones I discovered:
  • control c : hold the "..." key and press "c"
  • escape : hold the "alt" key and press "space"
  • pipe : hold the "alt" key and press the smileyface key
  • braces : hold "alt" and shift key and press "j" or "k"
  • backtick : no fricken idea!  using a lot of pipes and redirects instead ;)
Also, I like it when my hosts have actual hostnames set, so I appended a `hostname` command to the bottom of the "z2script.sh" file in the root directory of the SD card.  I assume that's the place to start httpd and stuff, too.
  • `echo "hostname zipit" >> /mnt/sd0/z2script.sh` should work...
I just installed Russel Davis' Enhanced IZ2S shell.  It's an update to IZ2S 2.04 -- so it takes version number 2.05 beta.  I really like it!  sshd and httpd are still here, and work great.  There's a new "dialog" based wifi setup at bootup.  The console font is also better, and able to fit a bunch more columns on a page.  I recommend it!

Oh and here are some pages that ended up being constants in my browser's tabs:
Now, to get it to talk to an Arduino!  ;)