This is a followup to my original article about using a general-purpose Linux distro on the Zipit Z2 messenger. In this post, I’ll discuss my experience installing Debian (specifically, Emdebian Grip) on the Zipit. This is a significant improvement over the previous process, as it means you can automatically upgrade and install new packages from an extensive repository of pre-compiled software. You can just “apt-get install whatever” instead of having to create a cross-development environment and compile everything yourself. Details after the jump.
Once again, most of the good clues I found came courtesy of Hunter Davis over at his eponymous website. That’s good useful stuff, without which I probably never would have gotten off the ground. However, there are a few reasons I didn’t just stop at saying “go look at this site over here” and call it a day:
- The directions assume you’re using a Windows host. In 2009? Really?
- They use canned SD card images for 1GB or 2GB cards. Mine is 8GB, and I wanted to use the whole thing.
- The whole and entire tutorial for getting on the ‘net is the four words “configure the wireless settings.” I didn’t find doing that to be self-evident (probably because I’m a Debian noob).
So, I’m going to try to give you a step-by-step process that’ll serve people that have the same blind spots I had a week ago. (As with the previous post, this’ll probably get lots of updates. Once again, I’m suspending the usual policy of marking each one, unless there’s a good reason.)
Stuff you’ll need:
- Zipit Z2 (with charged batteries)
- mini-SD card (or micro card with micro-to-mini adapter) of at least 1GB capacity
- 802.11b/g network leading to the ‘net, compatible with wpa_supplicant
- Linux PC able to read/write your mini-SD card, and with a ‘net connection
- These instructions, an hour or two to follow them, and a supply of patience
- Format your mini-SD card with a single FAT16 partition as big as you can make it. (Don’t worry; this is temporary.) Mount it.
- Get the autoflasher package from http://sourceforge.net/projects/openzipit/files/autoflasher/r2/AutoFlasher-r2.zip/download
- Unpack the autoflasher at the root of your SD card.
- Get Aliosa’s package from http://aliosa27.net/projects/zipit2/zipit2-audio+x+mouse.gz
- Extract this package in a temporary directory. From it, copy the /boot/linux-2.6.29 to kernel.bin at the root of your SD card.
- Sync and umount the SD card.
- Double-check the files and make sure your Zipit is fully charged (or on wall power). If you mess up, you can brick the device in a way that requires soldering to correct.
- Put the SD card in the Zipit and power on. (If you are using the original factory software load, you may need to do a settings -> reset to default. I have not seen this in person.)
- You should see a Linux logo and then some lines of text as the autoflasher does its work. Don’t touch anything; it will take a few minutes. When the autoflasher is done, it should power down the Zipit and you’ll see a black screen.
- Remove the SD card from the Zipit and re-mount it on your PC. You should see three new files: the original kernel (which you probably don’t need, but what the heck) and a couple of Wifi firmware files: gspi8686.bin and helper_gspi.bin. Copy these to somewhere safe (not on your SD card).
Making the root FS:
- umount the SD card if you still have it mounted from the previous process. Use your favorite partition editor (fdisk or gparted) to re-partition into a big Linux partition and a decent-sized Linux swap partition. (On my Acer Aspire One using the built-in card reader, the SD card whole-disk block device was /dev/mmcblk0. If you’re using a USB card reader, it will likely be /dev/sd[a-z].) Update: Make the Linux partition the first primary partition, and the swap the second primary partition. Be sure to set the bootable flag on the Linux partition — it won’t boot otherwise.
- Make an ext2fs filesystem on the Linux partition. If you don’t want the Zipit to check the fs every so many boots, do a tune2fs -c 0 -i 0 /dev/myblockdevice
- Run mkswap on your swap partition.
- Get the Zipit Debian root filesystem archive from http://openzipit.svn.sourceforge.net/viewvc/openzipit/debian/Debian-Z2.tgz?revision=33
- Mount your SD card ext2fs partition and extract the root filesystem archive to it.
- Copy the gspi8686.bin file you saved earlier to the SD filesystem /lib/firmware/libertas/. Likewise copy the helper_gspi.bin, but rename it to gspi8686_hlp.bin.
- Grab the Debian grip armel libpcsclite, adduser and wpasupplicant packages, and save them under /root in your SD filesystem. (If this post is old, you may want to check for newer versions than the specific ones I linked…) Note: as of 2010 May 25, using the above-linked packages will result in lots of broken dependencies when you later try to use apt. Use a temporary open wireless network if you can, and see “additional notes” below.
- Create an /etc/wpa_supplicant.conf on your SD filesystem. Use my example as a starting point, or just copy the one from another working system.
- Sync and umount your SD card filesystem. Remove the card from your PC.
- Insert the SD card in your Zipit and power the Zipit on. It should boot into Debian.
- Log in as user root, password debian (both all lower case). Type “clear” at the prompt to remove the logo graphic and make scrolling work right.
- Do an iwconfig and verify you have a wireless interface. If not, check dmesg — there is likely a problem with your firmware files. (Did you rename helper_gspi.bin to gspi868_hlp.bin?)
- Install the adduser package: dpkg -i adduser_3.111em1_all.deb
- Likewise install libpcsclite and wpasupplicant.
wpa_supplicant -Dwext -ieth1 -c/etc/wpa_supplicant.conf
- Run dhclient eth1
- You should now be connected to the network; try pinging something to check. If it isn’t working, troubleshoot before proceeding. (At this point, the only editor you have is… pico. Not kidding; sorry. If you need to do any serious typing, shut it down, mount the SD card on the PC and do it there.)
- Set the time to something non-pathological, just to avoid a bunch of warnings about timestamps in the future. Command reminder: for 2144hrs on 06 November 2009, use date 110621442009
- apt-get update
- apt-get install apt-utils
- apt-get upgrade
- apt-get autoremove
If you have access to an open or WEP-encrypted wireless network, you can skip manually copying the .deb packages and using “dpkg -i”, and instead do an “apt-get install wpasupplicant”. If all your wireless networks are WPA or WPA2 — and they should be — there’s a bit of a chicken-and-egg problem.
Some useful packages to install include ssh and nvi. If you “apt-get install ssh” you also get an SSH server. Now you can use the grown-up screen and keyboard of your PC to hack on the Zipit.
See my original article for hints about keyboard mapping and video playback. The keyboard mapping under X11 is different, though…
To get X11 working, just type startx at the prompt. The cursor pad does work as a mouse, but you have to hold down the escape (smiley-face) key for it to do so. (Direction pad presses without escape are interpreted as cursor keys.) The button in the center of the cursor pad is LMB. The stop button (square logo, just left of cursor pad) is RMB.
Gripes / possible future projects:
- If you’re at the text console and you use the up-arrow key to scroll back through the command history, it seems to take forever to re-draw the screen. I have no clue why this would be.
- Booting is slowwwwww. There were some good ideas for speeding up embedded system boot times in the December 2009 Linux Journal (issue 188). Among those that sound like they’d help: Pare kernel config down to the minimum needed. Use an uncompressed kernel. Pre-define the delay loop calibration instead of figuring it out at boot. Eliminate the initramfs. Use cramfs for non-changing stuff instead of a heavyweight filesystem.
- No microphone input, but I think the underlying hardware support is there. If so, the Zipit would be a rockin’ packet radio TNC and terminal to go with the mighty VX-7R. (In alsamixer, I saw a “jack is: headphone / headset / microphone / line in” toggle. Promising!)
[Edited 2009-12-29 by dhenke to add note about marking the Linux partition bootable. Thanks to Shamil in the comments for catching this.]
[Edited 2010-02-10 by dhenke to remove Amazon links. See explanatory post.]
[Edited 2010-04-23 by dhenke to correct the interface name in the wpa_supplicant step from eth0 to eth1. Thanks to XavierBlak in the comments for pointing this out.]
[Edited 2010-05-25 by dhenke to point out dependency problems with manually-installed packages. Thanks to Heater in the comments for the heads-up.]