Wednesday, June 29, 2005

Bering-ulibc installed on WRAP

Phew, after hours upon hours, I finally succeed in installing Bering-uLibC on the WRAP board!!!

First off, I couldn't just install and run it as I did with WISP ... Bering-ulibc is a different animal altogether.

There's a ton of documentation at this page: LEAF for the pcengines WRAP but some of it might need to be tweaked for your needs. What I did was basically as follows (on Windows XP machine with CF card reader):
  1. Popped the CF into memory card reader.
  2. Formatted using WinXP DOS format (format d: /FS:FAT)
    Note: CF needs to be formatted as FAT12 or FAT16, otherwise it won't boot. And don't worry about having to make a DOS 6.22 boot diskette; WinXP DOS's format works just fine - just make sure to specify /FS:FAT to format it as FAT16.
  3. Download syslinux (http://syslinux.zytor.com/) and unzip the latest version on your drive.
  4. Run syslinux -s d:
  5. You should have already downloaded the latest Bering-ulibc package from the download website of the LEAF website.
  6. Unzip the image and use WinImage to open the .imz file.
    Note: I wasn't able to unzip their .imz files using any software other than WinImage.
  7. Unzip the Bering files to a local directory.
  8. (All following instructions use the same directory.)
  9. Download any additional packages and put them in the same directory
  10. Edit leaf.cfg in this directory and make following changes:
    • Change /dev/fdxx to /dev/hda
      Note: The documentation says /dev/hda1, but I spent many hours trying to get that to work ... so when I changed it to /dev/hda, it finally worked. Perhaps WRAP uses /dev/hda because there is only one CF without partitions.
    • Append the additional packages to the LRP list so that they also boot up.
  11. Edit syslinux.cfg and make the following changes:
    • Change /dev/fdxx to /dev/hda
  12. Download the kernel with patch for WRAP that does not require a keyboard controller. Delete the old "linux" file and rename the newly downloaded "linux-2.4.x-xx.tux" to "linux".
  13. Download the initrd-ide-cd file that will allow you to boot from the CF rather than a floppy. Delete the old "initrd" file and rename your "initrd-ide-cd" to "initrd".
  14. Copy all your files to the CF.
    Note: You will notice you have an ldlinux.xx on your local directory as well as the CF. Leave the one on the CF intact - it was created by syslinux and you need that to boot the CF.
Remove the CF (after unmounting it first if needed), pop it into the WRAP board, and watch WRAP boot up with Bering-ulibc and your required packages!

Edit [July 14, 2005]: One step I missed mentioning here is that you have to make the serial port the primary means of input/output for communicating with the device. Here's some information from the LEAF documentation on how to use a serial port with LEAF.

In short, you have to edit syslinux.cfg (use 9600 baud, I had some trouble at higher speeds) and /etc/inittab. The /etc/inittab is the toughie, as you have to unpack the etc.lrp package, edit the file, repackage the LRP and copy it back to your CF.

Tuesday, June 28, 2005

India trip; Mozilla search

Today I have had to virtually cancel my India trip due to a lot of reasons. :( I don't expect to be going this year ... hopefully next year.

For the 7DS project, I have had to look at seeing how Mozilla's toolbar search works. It looks like it has to be built as a plugin for Mycroft. (Don't be scared by the word plugin - looks like simple "plugins" can be built using XML files.)

Another interesting thing is the keyword search from the address bar! Sounds interesting...

Other updates: WRAP is now going to use Bering-uclibc instead of WISP, since the Bering kernel is more recent than the WISP kernel, and also includes the wd1100.o driver by default, which should turn off the "keyboard jammed" messages.

I've had some trouble getting the Bering image to boot off my CF, but I think it's just a problem of not reading the documentation...

I'm sure there are other updates related to 7DS over the last week or so, but I've plain forgotten...

Tuesday, June 07, 2005

Getting the hang of LEAF

Whew, I am finally beginning to get the hang of LEAF, how to install packages, etc (at least theoritically.)

A lesson: for best documentation on open source projects, refer to the mailing lists, not the official website or documentation!

An aside: I've been looking at BREW and J2ME for porting our 7DS project to cell phones ... but it appears that J2ME beats BREW hands down? More on this to come.

Friday, June 03, 2005

sqlite time and date, garbage collection

Phew, I _finally_ managed to figure out how to garbage collect old values in a sqlite database.

There wasn't much documentation on the date/time functions in sqlite, so I had to do quite a bit of reading on that, strftime() as well as locale times (because that heavily influences the strftime () values.)

Anyway, here is the magic code I used:
DELETE FROM queries WHERE (strftime('%s', time_created) + keepalive*60 - strftime('%s','now', 'localtime') < 0)

where my table 'queries' has columns 'query', 'time_created' and 'keepalive' (in minutes).

The formula is obvious:
if (time_created + keepalive - current_time < 0) {
delete the query;
}

and that's what that SQL does.