Custom Perl For Chumby

From Chumby Wiki
Jump to: navigation, search

The instructions for building Perl to work on the Chumby are found Here.

You will learn how to set up a development environment using Scratchbox, and compile your own Perl and applications.


Pre-compiled, ready-to-run Perl

Download here the Perl, the include libraries, and applications that can be installed on a Chumby USB key or in the Chumby ONE internal storage. They will get unpacked in "usr", which will appear on the Chumby as /mnt/usb/usr or as /mnt/storage/usr.

These files will be updated as necessary. They contain a baseline of applications useful when writing hacks for Chumby. Among them are the libwww, Mail::Sender, various XML and crypto packages; the whole list can be seen on the How-to page.

 http://files.chumby.com/resources/usr_arm_ext3_basicperl.tgz
 http://files.chumby.com/resources/usr_arm_ext3.tgz
 http://files.chumby.com/resources/usr_arm_fat32.tgz

The usr_arm_ext3_basicperl.tgz contains only basic things as:

Perl 5.10.0 with a lot of CPAN modules installed
id3v2
ImageMagick
vim

The other two contain all the applications listed on the How-to page, like:

GNU Debugger
Subversion
GNU Screen
tcpdump
GNU Netcat
NMap
Pipe Viewer
Lighttpd
Python

If you are unpacking this on a FAT/FAT32 USB key, you will have an issue with the symlink to perl - namely the usr/bin/perl.5.10.0 > perl, that will not be created on a FAT/FAT32. To remedy this, copy the perl binary to the expected name:

 cd /mnt/usb
 cp usr/bin/perl.5.10.0 /usr/bin/perl

You can also use a shell script to set your environment, create the proper symlink in /psp and correct the missing file:

#!/bin/sh
if [ ! -e /psp/usr ]; then
  if [ -e /mnt/storage/usr ]; then
    ln -s /mnt/storage/usr /psp/usr
  else
    if [ -e /mnt/usb/usr ]; then
      ln -s /mnt/usb/usr /psp/usr
    else
      echo "Could not find /mnt/storage/usr or /mnt/usb/usr"
      exit 1
    fi
  fi
fi
if [ ! -f /psp/usr/bin/perl ]; then
  if [ -f /psp/usr/bin/perl5.10.0 ]; then
    # We run this from the USB as FAT32 and Perl was not correctly unpacked
    echo "Making a working copy of Perl as /psp/usr/bin/perl"
    cp /psp/usr/bin/perl5.10.0 /psp/usr/bin/perl
    sync
  else
    echo "Could not find perl in /psp/usr/bin"
    exit 1
  fi
fi
if [ ! -e /tmp/home ]; then
  mkdir /tmp/home
fi
export HOME=/tmp/home
export PATH=/psp/usr/sbin:/psp/usr/bin:$PATH
export LD_LIBRARY_PATH=/psp/usr/lib:$LD_LIBRARY_PATH
export PS1="\[\e[36;1m\]\u\[\e[33;1m\]:\[\e[0m\]\w\[\e[32;1m\] > \[\e[0m\]"
export TERM='ansi'
export PERL_PATH=/psp/usr/bin/perl
if [ -e /psp/usr/vimrc ]; then
  cp /psp/usr/vimrc /tmp/home/.vimrc
fi

Save this as /mnt/usb/setdev, and invoke the following when you start your session:

source /mnt/usb/setdev