Difference between revisions of "Custom Perl For Chumby"

From Chumby Wiki
Jump to: navigation, search
(Pre-compiled, ready-to-run Perl)
Line 1: Line 1:
These are the instructions for building Perl to work on the Chumby.
+
The instructions for building Perl to work on the Chumby are found [[Scratchbox|Here]].  
  
Since cross-compiling it would be an extremely tedious task, we found a way to do it on an [http://wiki.chumby.com/mediawiki/index.php/Virtual_Dev_Environment_For_Chumby emulated ARM environment].
+
You will learn how to set up a development environment using Scratchbox, and compile your own Perl and applications.
  
Considering that you followed the instructions on the page linked above, and you have now a fully functional ARM emulator, you can build now Perl on it, then pack it and save it on an USB stick, ready to be used on a Chumby.
 
  
==Building Perl on the emulated ARM platform ==
+
==Pre-compiled, ready-to-run Perl==
  
For that, create a folder /mnt/usb. This will be the same as the base folder for applications that will run on the device. In that folder create the following full path:
+
Download here the Perl, the include libraries, and applications as they should be installed on a Chumby USB key. They will get unpacked in "usr", which will appear on the Chumby as /mnt/usb/usr.  
  
  /mnt/usb/usr/local/bin
 
 
The perl version that needs to be compiled for the Chumby is 5.10.0 or later. Get the Perl source from here:
 
 
  http://www.perl.com/download.csp
 
 
We have to use the 5.10, because the 5.8.8 threading is broken on ANY debian platform (i386, ARM, or otherwise). The error one gets is a version mismatch of threads.pm (with a required version of 16384), but the actual error is somewhere in the libpthreads system library. There is no workaround for this.
 
 
Even the 5.10 threading is broken on Debian i386, but for some reason it works fine on the ARM platform. If you are trying to run the automation script on a debian i386, you will get a Segfault exception the first time a socket is being opened in a thread. The error occurs on the manager, when the client is opening a connection.
 
 
This segfault does not occur on the emulated ARM platform. Chumby testing is pending, but it should work, since all other low-level perl tests that I have done between the Chumby and the ARM emulator returned similar results.
 
 
===Memory usage===
 
The Perl 5.10.0 should not use more memory than the 5.8.8 when tested on windows. From the initial tests run on the ARM emulator, the scripts did not use over 7MB of memory at any time.
 
 
It is expected that with a real life test payload, an extra MB or two would be used. When writing a test, if you expect to deal with large amounts of data, it is therefore recommended to persist the data to disk (flash), to minimize the RAM memory usage.
 
 
===Build parameters for Perl 5.10.0 (or later)===
 
In general you can use the defaults, but the following have to be entered as specified:
 
 
Hard defined installation path:
 
  By default, perl5 will be installed in .../../bin
 
  ...
 
  Installation prefix to use? (~name ok) [.../..] /mnt/usb/usr/local
 
 
Installation prefix for files:
 
  What installation prefix should I use for installing files? (~name ok)
 
  [/usr/local] /mnt/usb/usr/local
 
 
The perl 5.10 brings a few new things. Among them the relocatable @INC
 
  Would you like to build Perl so that the installation is relocatable
 
  ....
 
  Use relocatable @INC? [n] y
 
  Installation prefix to use? (~name ok) [.../..] /mnt/usb/usr/local
 
 
Build threading Perl:
 
  Perl can be built to take advantage of threads on some systems.
 
  ...
 
  Build a threading Perl? [n] y
 
 
Setting the path for public executables:
 
  Pathname where the public executables will reside? (~name ok)
 
  [/usr/local/bin] /mnt/usb/usr/local/bin
 
 
Extra modules:
 
  Install any extra modules (y or n)? [n] y
 
  Extras? Net::Daemon String::CRC32 File::Path File::Copy IO::Handle
 
 
Hard path to the perl installed on USB:
 
  What shall I put after the #! to start up perl ("none" to not use #!)?
 
  [none] /mnt/usb/usr/local/bin/perl
 
 
Other installation paths:
 
  Where do you keep publicly executable scripts? (~name ok)
 
  [.../] /mnt/usb/usr/share
 
 
  Pathname where the add-on public executables should be installed? (~name ok)
 
  [.../../bin] /mnt/usb/usr/bin
 
 
  Pathname where add-on public executable scripts should be installed? (~name ok)
 
  [.../../bin] /mnt/usb/usr/bin
 
 
  Pathname where the private library files will reside? (~name ok)
 
  [.../../lib/perl5/5.10.0]
 
 
  Installation prefix to use for add-on modules and utilities? (~name ok)
 
  [.../..]
 
 
  Pathname for the site-specific library files? (~name ok)
 
  [.../../lib/perl5/site_perl/5.10.0]
 
 
  Where do you want to put the public architecture-dependent libraries? (~name ok)
 
  [.../../lib/perl5/5.10.0/i686-linux-thread-multi]
 
 
===Extract the compiled Perl===
 
After running make, make test, and make install, you can pack the files under
 
 
  /mnt/usb/usr
 
 
This is all you need to run custom perl scripts on the chumby.
 
 
If you need any extra CPAN modules, you can install them before packing everything, calling perl with the full path to the executable:
 
 
  /mnt/usb/usr/local/bin/perl -MCPAN -e shell
 
 
This should allow you to compile and install any new CPAN modules directly in the /mnt/usb/usr/local/ path.
 
 
==Pre-compiled, ready-to-run Perl==
 
You can download here the Perl 5.10 compiled with threads suppport on the ARM emulator. This is the clean Perl install, with NO installed CPAN modules.
 
Currently threading is not completely compatible with the Chumby, since debian uses libc.2.3.6 and the Chumby uses libc.2.4, so avoid using threading, use forking instead.
 
  http://files.chumby.com/resources/Perl.5.10.threaded.arm.usb.working.tgz
 
 
Download here the Perl and the include libraries as they should be installed on a Chumby USB key. They will get unpacked in "usr", which will appear on the Chumby as /mnt/usb/usr.
 
 
This is the file that will get updated on a regular basis. This build contains some generic CPAN modules that can be useful when writing Perl scripts on the Chumby. Among them are the libwww package and the Mail::Sender package.
 
This is the file that will get updated on a regular basis. This build contains some generic CPAN modules that can be useful when writing Perl scripts on the Chumby. Among them are the libwww package and the Mail::Sender package.
 
   http://files.chumby.com/resources/Arm.usb.5.10.Chumby.tgz
 
   http://files.chumby.com/resources/Arm.usb.5.10.Chumby.tgz
 +
 +
All the applications listed on the [[Scratchbox|How-to page]] are included in this package.
  
 
If you are unpacking this on a FAT/FAT32 USB key, you will have an issue with the symlink to perl - namely the /mnt/usb/usr/local/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:
 
If you are unpacking this on a FAT/FAT32 USB key, you will have an issue with the symlink to perl - namely the /mnt/usb/usr/local/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:
Line 109: Line 17:
 
   cd /mnt/usb/usr/local/bin/
 
   cd /mnt/usb/usr/local/bin/
 
   cp perl.5.10.0 perl
 
   cp perl.5.10.0 perl
 
 
 
In case you need an include from the dev environment (perl doesn't need this), you can download here the packed /lib folder from the QEMU ARM environment.
 
  http://files.chumby.com/resources/QemuARMLibs.tgz
 

Revision as of 13:55, 8 May 2009

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 as they should be installed on a Chumby USB key. They will get unpacked in "usr", which will appear on the Chumby as /mnt/usb/usr.

This is the file that will get updated on a regular basis. This build contains some generic CPAN modules that can be useful when writing Perl scripts on the Chumby. Among them are the libwww package and the Mail::Sender package.

 http://files.chumby.com/resources/Arm.usb.5.10.Chumby.tgz

All the applications listed on the How-to page are included in this package.

If you are unpacking this on a FAT/FAT32 USB key, you will have an issue with the symlink to perl - namely the /mnt/usb/usr/local/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/usr/local/bin/
 cp perl.5.10.0 perl