Linux on Zipit: Debian

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:

  1. Zipit Z2 (with charged batteries)
  2. mini-SD card (or micro card with micro-to-mini adapter) of at least 1GB capacity
  3. 802.11b/g network leading to the ‘net, compatible with wpa_supplicant
  4. Linux PC able to read/write your mini-SD card, and with a ‘net connection
  5. These instructions, an hour or two to follow them, and a supply of patience

OS Flash:

  1. 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.
  2. Get the autoflasher package from http://sourceforge.net/projects/openzipit/files/autoflasher/r2/AutoFlasher-r2.zip/download
  3. Unpack the autoflasher at the root of your SD card.
  4. Get Aliosa’s package from http://aliosa27.net/projects/zipit2/zipit2-audio+x+mouse.gz
  5. 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.
  6. Sync and umount the SD card.
  7. 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.
  8. 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.)
  9. 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.
  10. 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:

  1. 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.
  2. 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
  3. Run mkswap on your swap partition.
  4. Get the Zipit Debian root filesystem archive from http://openzipit.svn.sourceforge.net/viewvc/openzipit/debian/Debian-Z2.tgz?revision=33
  5. Mount your SD card ext2fs partition and extract the root filesystem archive to it.
  6. 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.
  7. 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.
  8. 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.
  9. Sync and umount your SD card filesystem. Remove the card from your PC.

Network setup:

  1. Insert the SD card in your Zipit and power the Zipit on. It should boot into Debian.
  2. 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.
  3. 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?)
  4. Install the adduser package: dpkg -i adduser_3.111em1_all.deb
  5. Likewise install libpcsclite and wpasupplicant.
  6. Run wpa_supplicant -Dwext -ieth1 -c/etc/wpa_supplicant.conf
  7. Run dhclient eth1
  8. 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.)
  9. 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
  10. apt-get update
  11. apt-get install apt-utils
  12. apt-get upgrade
  13. apt-get autoremove

Additional Notes:

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.]

By dhenke

Email: dhenke@mythopoeic.org

28 comments

  1. Thank you for providing some clear instructions. I didn’t know how to setup anything other than the 1 or 2 gb images and i have a 4g sd card.

    As well as the keyboard mapping, thx a bunch on that. Now i can get some swap, know all of the keys, and take advantage of all of the capacity.

    Alternatively i could just create a swap file with the 1gb or 2gb images, modify fstab, and pop in the sd card in another computer with gparted to resize the big partition to utilize the full 4gb’s of my card. But, resizing a root partition just sounds like it may steer towards trouble.

  2. Also, you think perhaps boot time would be increased with ext4. People will say that’ll kill the sd card. Not if you turn journaling off it wont. You can even turn off journaling in ext3. But, i’ll deal with ext2 for now.

  3. Shmail @#3, #4, #5: I’m glad you found that helpful. I’ve never had any problems resizing partitions, but I have the same instinct that doing so is courting trouble, and in this case it’s easy enough to avoid.

    I’m not sure how big an effect different filesystem choices have on performance on a system like the Zipit. Journaling is almost certainly the wrong choice (unless you use multiple partitions and journal only one containing low-write-rate, high-value stuff like home directories).

    Flash memory does have a limited lifetime in terms of write cycles per cell, but modern devices (like SD variants) give you load leveling in hardware, and are a lot more robust in general than older flash types (XD, SmartMedia).

    It’s probably worth mentioning also that not all MicroSD cards are created equal. Different vendors’ cards have radically different speeds. Buying “Class 6” cards can help, but actual testing in a live system means a lot more than marketing claims.

    In my copious free time, I might have a go at booting with some different filesystems. I don’t expect more than a few percent difference, though. A little voice in my head is telling me: “Profile! If you can’t measure it, you can’t optimize it.”

  4. This is why i mention using ext4 with journaling turned off. Journaling doesn’t add any extra performance difference even in real hard drives anyway (it does, but it’s so nilch). The only place where journaling is really necessary is servers.

    But, yes, my recommendation is to turn off journaling in ext4 and try it if possible. Journaling in ext4 is primarily not what makes ext4 fast in the whole outlook.

  5. Sorry to bother you again here.Having trouble with somewhere in the procedure. My z2 has already been successfully flashed and i was able to use it with the old debian 2g image .

    I have followed your instructions 3 times to see if i did anything wrong, and i’m unable to spot why i can’t get this working. First, on the sd card i made an ext2 partition ran the tune2fs command. Then on the very end of the alloted space i made a 256mb swap space with the mkswap command.

    I then extracted debian-z2.tgz to the ext2 partition. I made a wpa_supplicant.conf and put it in etc. I grabbed those deb files and put them in the root folder for later installation. By now it gets umounted and shoved inside my z2 for booting debian. Instead my z2 turns on, 5 seconds later the blinking text cursor at the top of the openzipit logo screen stops blinking, and it just sits there not doing a thing.

    What did i miss or do wrong? Another thing is what about the keymap file and z2mouse-option?

  6. Shamil @#8: I’m not sure what’s stopping your installation from working. I guess I’d start with checking the partition table — are the partition types set right? Is the root partition the first partition? Is it primary rather than extended? Is the bootable flag set?

    Mine takes 48s from power-on to login prompt, but the cursor flashes the whole time… However, if I take the SD card out and try to boot, I get exactly the symptoms you see. That makes me suspect it’s not recognizing the card, or not able to mount the root fs or something like that.

    Do you have another card you can try?

    After that I’m afraid I’m out of suggestions, other than maybe try it with the old image that worked before, re-flash the kernel and/or hack up a serial console to see some details about what’s going wrong.

  7. I tried the easiest suggestion you had to offer. And i made it bootable. Now it works. Thx for the help. New fan of your blog.

  8. Shamil @#10: Awesome! That was just a wild guess on my part; I’m really happy it turned out to be right (and even more so that it was the first thing you tried).

    Happy hacking.

  9. How can i go back to the old kernel, i’ve tried the auto flasher but it seem to only work on the original kernel, i’ve googled alot but with no result

  10. JWorks @#12: After the very first time you ran the autoflasher, you should have gotten three new files on your flash card: gspi8686.bin, helper_gspi.bin and a copy of the factory kernel. (Unfortunately, I don’t remember the filename of the kernel off the top of my head.)

    Hopefully you made a copy of those files somewhere other than on your flash card. (If you ran the autoflasher again, they’d get overwritten.)

    If you still have the factory kernel, you should be able to put the unit back in an as-shipped state by making an autoflasher card with the factory kernel as kernel.bin. (Theory only; I have not tried this!)

    If you don’t have the old kernel, you may be able to find a copy on the ‘net someplace. (I have neither the original kernel nor a link to it; sorry.)

  11. Just a quick typo catch step 6 of the network setup should be:
    wpa_supplicant -Dwext -ieth1 -c/etc/wpa_supplicant.conf

    Also with steps 4 and 5. I didn’t have to do either them. I didn’t follow you instructions from start to finish so maybe something was different. I started with the instructions from http://quantumlime.com/zipit and then found this post when I was looking for wpa setup help.

    Anyway cool post. Always good to find new posts to keep up to date on projects that evolve and always ending up leaving old documentation behind.

  12. XavierBlak @#14: You are indeed correct about the interface name being eth1 and not eth0.

    The quantumlime site is a good find; thanks for linking it.

    I think the next time I get an itch for messing with the Zipit, I’ll consider trying the userland from http://zipit.rootnexus.org/ for a change.

  13. I just down loaded zipit2-audio+x+mouse.gz
    There is no linux-2.6.29 in it’s boot directory but rather a zImage-2.6.29.
    What to do? Can I use that?

  14. I just down loaded zipit2-audio+x+mouse.gz There is no linux-2.6.29 in it’s boot directory but rather a zImage-2.6.29. What to do?

    I think that’s the right file, but I’m nowhere near the stuff I’d need to test it right now. (And, honestly, I’m not sure if file with the kernel in it has changed names in the archive I originally used vs. the one you have, or if I just typed the wrong name in my post. I suspect the latter.)

    You could try running “file zImage-2.6.29” on it, to make sure it says it’s a kernel image. But I’d say just try it.

  15. OK zImage.bla.bla are compressed linux kernel images. I just wondered if this would work with compressed images. I tried and YES it does.

  16. I messed things badly by trying to install wpasupplicant as suggested.

    Of course newer versions of the debs were required. But then there seemed to be more and more dependencies and more debs required.

    I gave up and set up an open wireless link hoping to do:
    apt-get update
    apt-get upgrade
    apt-get install wpasupplicant

    Well that totally refused with all kinds of dependency problems.

    OK back the the original image. No messing with dpkg. Get the wireless up and then to the apt-* stuff. BINGO it all works fine. Even has sshd up now.

    Thanks, for the great instructions!

  17. Heater @#19: I’m sorry you ran into trouble getting wpa_supplicant installed. The directions worked when I posted them (in November 2009), but I suspect the standalone packages I linked to no longer match up with the current versions of things in the repositories used by apt.

    At this point, using a temporary open wireless network and sticking with apt is probably the safest course. (Use good judgment with the open wireless, though.) I’ll pop a note in the original post to warn folks of the potential problem. Thanks for pointing it out.

  18. I found a better way to set up wireless, firstly forget about installing the packages with dpkg. Just get an open wireless link temporarily and start a net connection:

    # iwconfig eth1 essid myssid
    # dhclient

    You will find the wireless interface keeps going down at this point. Just restart it as above if it does.

    Then update the system:

    # apt-get update
    # apt-get upgrade

    Then install wpasupplicant

    # apt-get install wpa-supplicant

    At this point I installed openssh-server and could therefore work via ssh from my PC.

    # apt-get install open-sshserver

    Now I suggest a different way to get a WPA connection. Edit the file /etc/network/interfaces on the zipit

    # chmod 0600 /etc/network/interfaces
    # pico /etc/network/interfaces

    and add this to it:

    auto eth1
    iface eth1 inet dhcp
    wpa-ssid myssid
    wpa-psk mypskphrase

    With that in place one can reconfigure your wireless router to use WPA with the matching mypskphrase.

    To start the wireless interface on the zipit just use:

    # ifup eth1

    This is the preferred way to do it in Debian now a days I believe. And now the wireless interface stays up.

    See here
    http://wiki.debian.org/WiFi/HowToUse

    If you want to set up roaming or just have more info see here:
    http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/branches/unstable/debian/README.Debian?op=file&rev=0&sc=0

    So, no need to apologise This all works a treat thanks to your instructions and I’ve learned a few things about Debian along the way.

  19. hi,if I follow the instructions above ,will I still have my blob bootloader on my zipit?

    btw VERY GOOD TUTORIAL, THANKS A LOT!!!

  20. hackeras32 @#22: I’m not completely sure what you mean by the “blob bootloader”.

    The on-chip bootloader that knows how to boot linux off the SD card will still be there.

    The autoflasher you run in the first step will make backups of the original kernel and the WiFi firmware (gspi8686.bin and helper_gspi.bin) for you.

    Assume that absolutely everything else on the Zipit will be lost.

  21. Is there a working archive or download link for the zipit debian root filesystem? Just picked one up and i’d love to get linux running on the box, but I need a working link to download the image. all i’m getting is 404 pages…

  22. Yeah, it’s been a while since I did anything with the ZipIt. I’m finding what are probably the same broken links you’re looking at. I didn’t find anything useful in a quick search, which is all I have time for right now. But if you do find anything that still works, please drop a note here. I’d be willing to host a root FS image if you dig up one that’s functional.

  23. Are there a finished image file of the Mini-SD card? I ask because some links are broken. Or are there better options to install Linux today on a Zipit Z2?

  24. It’s been years since I’ve done anything with the ZipIt. I don’t know of anywhere you can download a working image. (That doesn’t mean there isn’t one somewhere — I just haven’t gone looking in a long time.) Sorry.

Leave a comment

Your email address will not be published. Required fields are marked *