Archive for May, 2013

Cross compiling OpenWRT for the Zipit Z2

Here is a quick rundown for getting OpenWRT-Zipit cross compiled on a 64 bit Intel i7 machine with Ubuntu Server 12.10.

Steps:

  • sudo apt-get update
  • sudo apt-get build-essential git-core gawk pngcrush libpng-dev flex
  • sudo adduser openwrt
  • su openwrt
  • cd ~
  • git clone git@github.com:openwrt-zipit/openwrt-zipit.git
  • git clone git@github.com:openwrt-zipit/openwrt-zipit-packages.git
  • git clone git@github.com:openwrt-zipit/openwrt-packages.git
  • cd openwrt-zipit
  • echo “src-link zipitpackages $HOME/openwrt-zipit-packages” > feeds.conf
  • echo “src-link packages $HOME/openwrt-packages” > feeds.conf
  • wget https://github.com/downloads/anarsoul/openwrt-zipit/.config
  • make package/symlinks

After this you can run:

  • make menuconfig
  • make 
For debugging the make process (in case anything goes wrong), run 
  • make V=99
For compiling individual packages, run
  • make package/<packagename>

And everything should compile. If it doesn’t it’s probably a package fault which should be fixed.

10th of may ’13: Currently broken:

PyGame

Fix;

  • ln -s `pwd`/staging_dir/target-arm_v5te_uClibc-0.9.33.2_eabi/usr/include/videodev.h `pwd`/staging_dir/target-arm_v5te_uClibc-0.9.33.2_eabi/usr/include/linux/
  • Open openwrt-zipit-packages/pygame/Makefile and change the DEPENDS to :  DEPENDS:=+python-mini +libsdl +libpng +libjpeg +libsdl-image +libsdl-mixer +libsdl-ttf +libv4l

A usable Linux OpenWRT on Zipit Z2 with bad Mini->Micro SD adapters

I recently got a batch of Zipit Z2 devices (to add to my small collection of small devices like my Zaurus  SL-C860 and OpenPandora). Like the other devices, they all run Linux and can have custom versions of Linux.

I did a lot of research upfront on the web and got a stack of Mini->Micro SD adapter (contrary to some websites and Youtube videos which say the Zipit has a micro SD card; it doesn’t ; it has a mini. These are very rare and I only found them in China…) and downloaded Ubuntu for Zipit Z2, Debian SidX, Debian, U-boot and some other stuff you need.

I used z2uFlashtock_v0.2_gmenu-jffs2-rc22.zip from Mozzwald. Although no-one really tells how to use it, it’s simple;

  • Format an mini or micro (if you have a adapter) SD Fat(16)
  • Unzip the Flashstock zip on the card in the root 
  • If the Zipit is on with the original software pull the plug from the Zipit and take the battery out 
  • Put in the Mini SD card 
  • (If the battery / plug are out put them BOTH back)
  • Switch on the device

I tried this on all 10 Zipits I have with different micro SD cards and different brand adapters  this worked flawless every time.

Now it is possible to boot any Zipit prepared Linux like the ones names above. In theory…

I formatted the SD card with Ext2 and untarred sidX from Mozzwald on it (Find it here). Stuck it into a Zipit, reboot and got greeted with very scary:

mmcblk0: error -84 transferring data, sector 264, nr 8, cmd response 0x900, card status 0x0

I ruled out errors on the card itself by checking it my Linux machines and I tried different cards and different adapters  all had the same issue. On #zipit IRC I found out this is a known issue and most adapter cards have this issue. It is ONLY on write though, not read.

Also it appears than when using kernel 2.6.29 the issue was not there yet; it came after that. Searching the web shows that the issue seems to have been introduced within a kernel around 2.6.31. One of my two goals for this summer is to figure out why and ‘fix it’. There are patches on the internet from that time which fix it for some card readers, making it easier to tackle the issue. But more on that later.

The problem I had now was that I had 10 U-boot flashed Zipits but no OS I could boot from it except the one which is built into the Flashstock which is OpenWRT. So how to make that version usable without reflashing? Note; If you didn’t flash your Zipit yet, note that there is a very good alternative here (iz2jffs) which is still being developed. It allows you to use the stock SD card driver (which does work as it’s an old kernel) to read/write to the SD without the above issue.

Because reading is fine but writing is not, why not store everything on the SD (OS, music, movies, games) and only write small files (game save data, source code etc) to the internal flash and tmp data to, well, /tmp?

That would make a usable device, with a few meg storage space. The way to do it is simple:

  • Download all packages you want from here
  • Format an mini/micro sd card with Ext2 
  • Run this script in the root of the card with as argument the directory in which the packages are (you need Linux for that), for instance ./unpack /tmp/ipkgs
  • Add this to the /etc/config/fstab of your Zipit 
  • Create a file /etc/profile.d/zipit-mmc.sh on your Zipit with this contents
  • Insert the card into your Zipit and open a new terminal 

You now can do things like;

cd /mnt/mmcblk0p1/usr/games/sdlquake; sdlquake

and Quake should run fine!

You can remove stuff from the internal flash now.

Note: there is an ‘overlay’ package which is used to do this normally, however I couldn’t get that to work without being able to write to the SD card while mounted in the Zipit. This seems to work like a charm anyway.

Todo:

  • Add all the packages to the gmenu2x
  • Make a list/script to remove double packages from the internal flash
  • Get openmsx to run 
  • Fix the kernel so we can write to crappy SD cards