Plugbox Linux on the Zipit Z2

2011-02-23 18:12
Plugbox Linux is a port of Arch Linux to the ARM platform. It is mainly targeted at those Plug computers. Since the Zipit Z2 uses a ARMv5 CPU just like most Plug computers do, running Plugbox Linux on the Z2 is possible.

Plugbox on Z2

Here I'll describe how to install Plugbox on a Zipit Z2.

If you want to try this yourself, you need a PC with a working card reader running some kind of Linux. Your Zipit Z2 needs to have U-Boot installed.
To install Plugbox Linux on the Z2 you need an SD card with at least 512 MB. I would highly recommend 1 GB or more, though. This card should be formatted with the ext2 file system. To do so, you can use the mkfs.ext2 command, e.g.:
$ su
# mkfs.ext2 /dev/sdX1
Make sure to use the right device, otherwise you might accidentally overwrite your harddisk. "dmesg" should help identify the sd card, if in doubt.

Once the SD card has been formatted, it needs to be mounted somewhere, e.g.:
# mount /dev/sdb1 /mnt/sdcard
Next you need to fetch the Plugbox rootfs as well as two packages, which will be needed later: wireless_tools-29-5-arm.pkg.tar.xz and wpa_supplicant-0.6.10-2-arm.pkg.tar.xz.

Now you need to extract the rootfs onto the sd card:
# cd /mnt/sdcard
# tar xfv /path/to/Plugbox-Linux-1.1-rootfs.tar.gz
As Plugbox Linux was meant to run on Sheevaplug devices, you need to use a different kernel, compiled for the Z2. Here I have been using a kernel compiled by anarsoul, that includes some additional patches. The uImage and uboot.script files need to be placed in the boot directory on the SD card (overwriting the existing kernel), while the modules directory named 2.6.37+ needs to be placed under lib/modules. To be able to use wlan you also need to place the libertas firmware under lib/firmware/libertas.

Please note that while "installing" the kernel this way works, the package manager does not know about it, which could result in the package manager overwriting the kernel when updating the system. To make the package manager aware of the installed kernel, a package for the kernel and its modules should be created and installed through pacman.

Next you need to edit the inittab file under etc on the SD card. Search for the line starting with "s0" and put a # sign in front of it, to comment it out. Then remove the # sign on the following line (the one starting with c1). This will disable the terminal on the serial port and enable the first virtual terminal. As Plug computers do not have a screen, there is no need for a virtual terminal, but on the Z2 you want to enable a least one of them.

To be able to type all the characters on the Z2's keyboard, you need to load a keymap matching the keyboard's layout. You can use my keymap file. Place it in the etc folder on the SD card. Then edit the rc.local file under etc to load the keymap on each boot and add a line containing:
loadkeys /etc/
Now you are almost done.

Before unmounting your SD card you should copy wireless_tools-29-5-arm.pkg.tar.xz and wpa_supplicant-0.6.10-2-arm.pkg.tar.xz files, that you have previously downloaded, somewhere onto the card, e.g. in the root directory.

You can then unmount the SD card and start the Z2 with the card inserted. If you've done everything correctly, you should see a login prompt after a short while.

You can login with username root and password root. You should probably change that password.

Now you should install the two packages with the pacman package manager:
# pacman -U wireless_tools-29-5-arm.pkg.tar.xz
# pacman -U wpa_supplicant-0.6.10-2-arm.pkg.tar.xz
Those packages are required to configure the wireless adaptor.

Once they are installed you can search for available wireless networks with "iwlist scan" and use wpa_supplicant to connect to you WPA2 protected wireless networks. Use wpa_passphrase to create a wpa_supplicant.conf:
# wpa_passphrase your_ssid your_passphrase >/etc/wpa_supplicant.conf
To run wpa_supplicant, execute:
# wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf &
You can then fetch an IP address from the DHCP server by running:
# dhcpcd
This is only temporary. Have a look at the Arch Linux documentation for information on configuring the network properly or simply add those lines to your /etc/rc.local file to have them executed on each boot.

You can install additional packages using pacman. If you want to try the Plugbox development branch, you can change the /etc/pacman.d/mirrorlist file to point to the development package repository by changing into . Beware though that things might break horribly when using development packages. ;)

Also keep in mind that some programs available in Plugbox Linux might not work correctly due to the limited amount of RAM. The Z2 has only 32 MB, while Plug computers have at least 128 MB and some even have 512 MB. Also, the CPU of the Z2 is much slower than the Sheeva ARM cpus found in Plug computers, so some things might run slowly.

To improve performance you should probably remove the man-db update from the daily cronjobs ( /etc/cron.daily/man-db ). It is useless to run it on a daily basis anyway (running it once after installing new/updating packages should be enough, right?) and it stresses the sd card.

UPDATE 2011-02-27

Plugbox Linux (which has now been renamed to PlugApps) has received a major update. You should follow the steps described in their wiki to update properly. Before doing so, you should copy your uImage to a safe place, e.g. /root as it might get replaced by a different kernel during the update. To prevent that you could remove the PlugApps kernel by running "pacman -R kernel26". Then pacman will no longer update the PlugApps kernel and leave the custom Z2 kernel alone.

Leave a comment