Wednesday, December 16, 2009

Restoring your Zipit Z2 to Defaults

A while back I bought my daughter a Z2 for Christmas. We got it off of eBay and my wife asked that I test it to make sure it works. About ten minutes later I realized that I had registered the device with Zipit Wireless using a nickname of my choosing. In effect, I just made this Zipit my own. But what if I wanted to "gift" this Zipit or sell it?

Quite simply, all you need to do to make a Zipit Z2 new again is to remove a few configuration files. You can do this using either my IZ2S, or even the vanilla Z2 Shell.

Boot up with your shell, and then do a "cd /mnt/ffs" and an "ls" to list the files there. You will see something like this ...

-rwxr-xr-x 1 root root 657 Dec 16 01:58 411.xml
-rwxr-xr-x 1 root root 112342 Dec 16 01:58 NeonGlow.jpg
-rwxr-xr-x 1 root root 1519952 Dec 16 01:58 Resources.arl
-rwxr-xr-x 1 root root 3578680 Dec 16 01:58 Zipit2
-rwxr-xr-x 1 root root 1921 Dec 16 01:58 properties.txt
-rwxr-xr-x 1 root root 4644 Dec 16 01:58 serversettings.xml
-rwxr-xr-x 1 root root 4644 Dec 16 01:58 serverstationz.xml
-rwxr-xr-x 1 root root 510 Dec 16 01:58 start.sh
drwxr-xr-x 2 root root 4096 Dec 16 01:58 wpa_supplicant


Only a few of these files are really required, and the rest are files that get downloaded from Zipit Wireless when your Z2 connects up to their servers through the wireless network.

You can safely remove these files:
NeonGlow.jpg - This is my chosen background wallpaper. Whatever you picked will have a .jpg extension. You can delete any .jpg file here.
properties.txt - This file contains your device ID (serial number), your username, and some other important settings. Deleting this file removes your Zipit Wireless account association.
serversettings.xml - This file contains a record of your messaging limit(s), your chosen wallpaper, and some radio station data.
serverstationz.xml - This file seems to contain the same data as "serversettings.xml". Both files can be deleted and would be recreated when you connect with your Zipit Wireless account.

DO NOT REMOVE (or alter) THESE FILES!
Resources.arl - This is some sort of archive which likely contains data for your theme. Although it's compressed, and I don't know how. Leave it alone.
Zipit2 - This is the core application for the Z2. Do not alter this file, or your Z2 will no longer be any fun.
start.sh - This short and simple script is what allows for you to run a shell, as it looks for an OS on your SD card at boot time. It also runs the Zipit2 application. Leave this alone!
wpa_supplicant - This directory contains an executable of the same name. This is what connects the Z2 to your wireless network. Leave this alone too!

Just to recap ...
If you want to make your Zipit "new again", you should delete your settings files so that your /mnt/ffs directory looks something like this ...

-rwxr-xr-x 1 root root 1519952 Jan 1 1970 Resources.arl
-rwxr-xr-x 1 root root 3578680 Jan 1 1970 Zipit2
-rwxr-xr-x 1 root root 510 Sep 17 2007 start.sh
drwxrwxr-x 2 root root 0 Sep 17 2007 wpa_supplicant


The next time you boot your Z2 (without the SD card inserted) you will get the "first time wizard". By the way, in case you forgot - one of your options in this wizard is to enter the credentials for your existing account.

Tuesday, December 15, 2009

Links2 (Graphical Web Browser) for the Zipit Z2

This is links2 compiled along with directfb to provide a graphical web browser to the Zipit Z2 Shell.

You can download it here: http://oddree.com/zipit/links2-zipitz2.zip

Note that if you get the latest IZ2S image from this site - you will not need this program because it is all ready included by default. This is just provided for folks who want to experiment with the Z2 Shell in it's unadulterated, and naked form.


Here is the included README ...
** Links2 built with graphical directfb support **
** for the Zipit Z2 Wireless device **
** by Ray Dios Haque **

ABOUT
This is links2 built with graphical support for
all of the popular image types (png, jpeg, gif).
It utilizes directfb as a graphical driver, and so
there is no need for X11! This tooks weeks to get
running correctly. So I hope you enjoy it. :-)

Remember - this is a very basic web browser. While
you can do fun things like read blogs and check your
email, watching videos and running Flash is just out
of the question!

INSTALL
Copy everything in the bin folder, to the bin folder
on your SD card. That's it. Keep in mind that this
package is now part of the "Improved Z2 Shell" which
is available from www.oddree.com.

USING LINKS2
To start links2 in graphical mode, just run 'links2'
inside of terminal. This will actually run a script
which launches links2 along with some special and
required parameters (such as the screen rotator).

To visit a web page, press the letter "g" and then
enter a URL. To move around on the page, you can
hold down ALT and SHIFT (white up arrow next to ALT)
and then use your arrow/navigational keys to move
around the page. When running links, you are using
a special keymap that aliosa27 created. When you
exit links, your original keymap is reloaded.

NOTE: You can still run links in text mode, simply
by running 'links' (without the 2).

ALSA driver and utilities for the Zipit Z2

A little more than a year ago, our friend GPSFan was able to get ALSA sound and it's utilities running on the Zipit Z2. This was quite an accomplishment, as it meant that you could now use all sorts of other programs that rely on ALSA sound. However, the tools could not run on the stock Z2 Shell because they were not built "statically". And so - I made it my personal mission to rebuild these tools in a static form and give the Z2 Shell the sound it deserved.

It took many late nights (and some serious help from GPSFan) but I was eventually able to recreate the environment that GPSFan used to create his modules, and then change it slightly to get things compiled in a static form. Then it was just a matter of getting the tools to cooperate with the Z2. There are quite a few tricks involved in loading things properly, and so I wrote an included script which does everything.

You can download it here: http://www.oddree.com/zipit/alsa-zipitz2.zip

Note that if you get the latest IZ2S image from this site - you will not need these drivers because they are all ready included and loaded by default. This is just provided for folks who want to experiment with the Z2 Shell in it's unadulterated, and naked form.

Here is the included README notes:
ABOUT
alsa-lib/utils-20091113 (snapshot) built for the
Zipit Z2 Shell by Ray Dios Haque on 11/24/2009.

These tools should allow you to use GPSFan's
Z2_Rec modules (playback/recording) on the Z2
Shell, or Rays's Improved Z2 Shell (IZ2S).

More information available on: oddree.com.

For information on how the modules were built,
please see ./orig-notes/readme.

INSTALL
There is a lot going on with this script, and I
wanted to keep it really simple for the purpose
of testing or simply screwing around with your
Zipit. Note that if you are running this every
time you boot your zipit, this is probably a
pretty bad practice and you should consider
giving all of these items a permanent home on
your Z2. Or - just get the latest version of
Ray's Improved Z2 Shell from oddree.com which
will include all of this stuff.

That said, simply run ./loadsound.sh from this
directory to install and activate sound.

The script will remove the native sound driver,
create a few new directories for configuration
files, copy over the needed configuration files,
insert modules into your running system, and
finally will run a command to load up the sound
state from a successful instance of ALSA.

You will need to copy everything in the bin
directory to the bin folder on your SD card.

Now you can play your MP3's. In fact, I have
included a build of mpg123 in the bin directory.

Adjust volume and other things with alsamixer.

THANKS
Many, many, thanks to my friends GPSFan and
rkdavis from #zipit on irc.freenode.net. We put
in a few late nights to get this going.

Saturday, December 05, 2009

Version 2.03 IZ2S Release - SOUND and SHARED LIBRARIES!

I am probably more excited about this release than any other, because it has opened up the possibilities for some things that just weren't possible before. We now have the ability to run applications using shared libraries. And the first application I decided to port over was "cmus". Cmus is a "small and fast text mode music player" which runs in a console. It's been built to support wav's, mp3's, and even vorbis ogg files. And best of all, it can play streams (that means streaming radio!).

This represents a lot of work on the part of myself, and my friends from #zipit on irc.freenode.net. GPSFan was nice enough to share some of his dark secrets with me pertaining to buildroot and ALSA. From there I was able to get the ALSA-utils built, and then rebuilt statically.

You can download version v2.03 here: http://www.oddree.com/zipit/Z2S-v203.zip

Here is a quick video demonstration of the new feature(s):


As always - here is the README file which is also included in the Zip file.

IZS - The "Improved Z2 Shell" (aka Shell with Benefits) v2.03

ABOUT
This collection was built by Ray Dios Haque out of sheer necessity. I wanted something that I could play with that would not effect the stock software that comes on the Z2. The easiest way to do that was to take the Z2 Shell that was built by rossimo from Zipit Wireless and expand upon it. I take no credit for the work of the Zipit community. If I don't claim to have built it - it's because I didn't. Thanks to all of you for your contributions over the years. I hope you enjoy my additions!

INSTALL (borrowed from the original README)
Format your SD card as a FAT or a FAT16 file system. Copy everything from this zip file onto the root of the card (preserving all paths/directories). Insert your SD card into the Zipit and boot it up. Note that you can only boot this image if you are running the Stock OS that came with your Zipit. If you have installed OpenEmbedded or Debian, then you have probably replaced the stock operating system which included a routine to look for the z2script.sh script. For legal purposes, I cannot provide you this stock operating system. Some of the smarter people in the Zipit community might be able to help you restore this OS (see CHAT below).

CHAT
Come chat with us! There is a thriving (?) community of the worlds best Zipit hackers who hang out in #zipit on irc.freenode.net. You can fire up 'irc' from this very image and come hang out.

CHANGES/ADDITIONS
RELEASE 2.03 (ALL NEW!) - December 2009
We have sound!! Thanks GPSFan! (alsaconf, alsamixer, alsactl, amidi, aplay, gawk, getopt, iecset), SHARED Library support (ldd, ldconfig, readelf), cmus (a wicked MP3 Player), matrix (ncmatrix), mpg123, mplayer-10rc2, ntpdate, gzip (gzip, gunzip, gzexe, zcat, zcmp, zdiff, zegrep, zforce, zless, zmore, znew), zz (script to run after ssh'ing in - use . zz (dot space zz))

RELEASE 2.02 - November 2009
cls (clear screen), centerim (ncurses instant messenger with AIM, Yahoo, ICQ support), irssi (ncurses irc client), links (ncurses), links2 (graphical browser!), sed (for scripting), tar, bzip2 (bzip2, bz2recover), coreutils (10MB's of binaries)

RELEASE 2.01 - Initial Release
wget, ircii-20090520 (irc), wireless-tools (ifrename, iwconfig, iwevent, iwgetid, iwlist, iwpriv, iwspy), ftp (ftp, /etc/services), unzip (unzipsfx, unzip, funzip), nmap (nmap, *new* ncat), wpa_passphrase, less (lessecho, lesskey), grep

LIBS CHANGES
Removed the worthless ncurses static libs to make way for all of the *shared* libs. Not listing all of them here. Just look for yourself.

STARTUP SCRIPT MODIFICATION(S)
REV 2.03
- Stopped audio_pxa from loading, and then run /mnt/sd0/modules/alsa/loadsound.sh for ALSA sound modules.
- Added ntp protocol to /etc/services file.
- Added a line which will fix the time and date if there is a network connection available, and then display that time/date to you.
- From here on out, all libs will go into /mnt/sd0/lib which will be linked to both /lib and /usr/lib/.
- Hid all the gory details of wpa_supplicant, while adding some other stuff for verbosity.
REV 2.02
- Modified the PATH statement so that coreutils and /mnt/sd0/bin binaries will override the busybox stuff.
- Created a home directory for the root user which exists on the SD card. It holds your stuff.
- Added a routine that change your MAC address to something random the first time you boot up. This should prevent duplicate MAC problems if you own multiple Z2 devices.
- Added a /var directory that exists on your SD card. Some things (like dropbear) expect to find it. Had to fix a script error in the BETA (thanks rkdavis).
- Added an /etc/issue file which is displayed at logon time and to ssh connections.
REV 2.01
- Added a routine asking if you would like to configure your wireless card. This was not possible before as there was no scanning routine and the image lacked the wpa_passphrase utility. You can now scan for and configure your wireless settings entirely from the zipit (wording updated in 2.02).
- Added "cp /mnt/sd0/etc/services /etc/services" which gives the ftp command the port numbers it needs to function.
- Added "cp -R /mnt/sd0/etc/terminfo /etc", "export TERM=vt102", "export TERMINFO=/etc/terminfo" to help irc understand the screen layout.
- Added "ln -s /mnt/sd0/lib/* /lib" to make ncurses libraries usable, and any future libraries that you or I might add.
- Added "ln -s /mnt/sd0/share /share" for nmap and anything else that might require a "share" directory to be present to function.

OTHER MODIFICATION(S)
- Replaced the stock keyboard driver in /modules with one that was created by GPSFan (Ken) from the Zipit Yahoo Group. This removed all of the problems with keys not working, or repeating while typing. The original drivers remain, but have been renamed to *.orig.

COMING SOON?
- A better mp3player or a front-end for mpg123.
- A script to download and install "packages" (zip files) using wget, unzip, and a "binary repository" on www.oddree.com. A similar system could provide updates when I provide them.
- I still want to get an image viewer working. DFBSee 'almost' works.

IFAQ (InFrequently Asked Questions)
Q. Why are you wasting your time on this? The Z2 Shell is dead!
A. It may be 10x more work to get simple things built for it - the Z2 is very lean, and still very useful.

Q. Why does nmap (or some other binary) run so slow?
A. Because everything has to be built "static" to run on the Z2. That means that where you might normally have hundreds of shared libraries on a linux machine, the Z2 Shell must embed the libraries into each running binary. It makes for some bloated inefficient stuff. But, it works. If you want a better system - start writing it! Otherwise, try to limit the actions of what you are doing. For instance, use an address range or port range with nmap. Don't start long running scans on entire networks. This is a Z2 we're talking about. The resources are pretty lean.

Q. How can I add my own binary/package?
A. There are several ways to go about this. The method I have used to compile everything is "scratchbox". Scratchbox is a program which let's you cross-compile applications. That means that you can build stuff for an ARM platform, even though you have a regular x86 machine. It can be tricky and complicated. Try reading up on what I have posted at http://www.oddree.com.

Q. Why did you *insert snarky comment here*?
A. If you find that I did something stupid and inefficient, do let me know. I don't claim to have any expertise in the area of building software. If you have some suggestions on how to improve things or would like to help with the next release of this improved Z2 Shell, email me at ray@oddree.com. I would love to collaborate with some folks who might be more talented than myself.

Q. Will you build *insert package name here* for me?
A. Probably. Unless you are asking me to build something that has an endless list of dependencies. In which case I will probably tell you to install OpenEmbedded or full fledged Debian. They all ready have all of these packages. I am only expanding upon the old Z2 Shell because I find it lean and useful.


Happy hacking! Next release ... keyboard backlight support? It's hard to chat in the dark. :-( I am seeking help from the Z2-Zen master, aliosa27 for that project.

About The "Improved Z2 Shell?" (IZ2S)

QUICK ABOUT
The Improved Z2 Shell (IZ2S) is an expansion upon the Z2 Shell that Zipit Wireless released for general experimentation.

WHY USE IZ2S?
I built IZ2S out of necessity because the hardware was perfect for what I needed, and the stock OS had some limitations. I started by building add-ons, but some of them were a bit complicated and so it turned into full standing releases. There are lots of reasons to use the IZ2S, but here are a few highlights ...

  • IZ2S loads from an SD card just by having it inserted, as this is how the folks at Zipit Wireless intended you to use their shell. You do *NOT* need to flash anything, hook up and special hardware, or perform any activities that might otherwise :brick: your Z2. You can return to the stock OS at any time simply by ejecting the SD card and rebooting.
  • IZ2S contains most of the features that you find in the stock OS, but improves upon them (such as a much better keyboard driver and the ability to pick your own radio stations).
  • IZ2S is very lean. It boots in 4 seconds and running multiple applications at once is perfectly fine. You can effectively chat on IRC in one window, instant message your buddies in another, and be listening to your favorite streaming radio station in a third window (thanks to the magic of 'screen').
  • IZ2S offers applications that are not available for the stock OS, such as a graphical web browser (links2).
  • Ray is building and releasing new applications all the time, and installing them can be done on the device itself - or by copying files onto your SD card from within MS Windows.


LIMITATIONS
  • IZ2S is "text based" meaning that everything happens from a terminal console. If that is not your cup of tea, you might consider installing Debian or OpenEmbedded. Keep in mind though - that those installations have their own kernels which will require that you remove the stock OS.
  • IZ2S has an instant messenger, but it will not offer you cellular texting. For that, you need to return to the stock OS so that you can be connected to your paid Zipit Wireless account.
  • IZ2S does not yet have any controls over the display brightness/contrast, or the keyboard lights. We are hoping to have these features included soon thanks to the work of the Z2 community.
  • IZ2S has an "idle screen sleeper" that looks like a bricked device. This seems to be the result of the kernel trying to put a display to sleep, and the display driver doesn't respond correctly. It's a problem that we inherited from the Z2 Shell from Zipit Wireless, and we haven't been able to fix it yet.


WHERE CAN I GET IT?
You can download the Improved Z2 Shell by following links from this very site. This site is actually a great big Blog, and I always tag IZ2S releases with the tag "IZ2S". Therefore, you can always find the latest release with this link: http://rayhaque.blogspot.com/search/label/IZ2S. The newest/latest release should always be the first thing that shows up.

Friday, December 04, 2009

New IZ2S Shell - Coming Soon

I am probably days away from releasing another version of my Improved Z2 Shell. Since getting the ALSA sound package working, I have been working on getting a good MP3 player to use. I found that there are quite a few console (ncurses based) MP3 players to chose from - but they all shared a common problem ... *SHARED* libraries and plugins.

I have never really challenged the restriction that comes with the Z2 Shell which is "your binaries must be static". I assumed that this had something to do with the way that the kernel was built - and I was partially right. Since working with GPSFan on getting ALSA going, I have been getting familiar with "buildroot" which makes building the Z2 kernel really easy. Not that I am interested in replacing the kernel (because I don't want to harm my stock OS) but I *am interested* in re-creating the kernel. In that process that builds the kernel, you are given a chance to turn enable options, add modules, and then build software against the final product. I found that uClibc had some issues with "pre-loading shared libraries". This pre-loading process typically also contains a cache which is created at boot time, or on demand (such as after building and adding new libraries). So caching and pre-loading are broken. But ... the ldconfig, and ldd tool could still be built. That means that shared libraries can still be used provided that "ldconfig" has been run before the application that needs the libraries.

With that, I went to work on building cmus for the Z2. I had spent the previous couple of days trying to work the plugin files into "static binaries" which was quite a contradiction being that they were created in the form of .so files. Now, I could drop all that nonsense and build the application as the developers intended. With the binaries built, I began the process of getting libraries copied over and putting the shared libraries where they belonged. To my absolute delight - it worked!

And so, in the coming days I will be releasing the latest and greatest Z2 Shell which includes the highly anticipated ALSA sound modules, and a new line of applications that previously were not possible.

I am also trying to figure out how we can get the keyboard backlight working, but I will definitely need some help with that. Your friend and mine, aliosa27 has offered his assistance and so I am much more confident that we can come up with something now. You may have heard that sweetlilmre' has been successful in getting this working with the latest kernel source, but it will be tricky trying to apply his same tactics to an older kernel version. Additionally, we will have to do the whole process with modules and daemons (without touching the core kernel).

So check back soon folks. In the mean time, I will be BETA testing all this stuff I have thrown together latetly. If you aren't all ready doing so - get into #zipit on irc.freenode.net and join the discussion.