2 Replies Latest reply on Oct 21, 2014 4:52 AM by FlavioM

    Compiling python libraries from scratch

    FlavioM

      I have obtained some results that I would like to share with you. I don't know if I am following the most efficient steps, so any feedback is welcome .

       

      My problem was fairly simple:

      take the lastest Edison Linux distribution "as is" and install non-native python libraries (such as python-bluez, python-numpy, etc...)

       

      State of art:

      There are several solution that should be taken into account in order to write code for Edison; you could use the Arduino IDE, Eclipse IDE (I have written a post regarding this) for C/C++, Python (but there are few libraries by default). You should also choose the "development environment": on a classical omputer or on board.

       

      Here a non-exhaustive options list:

      • Install a package repository for opkg manager (non only for mraa/upm libraries).
      • Recompile the Yocto linux from scratch with proper libraries (I do not know a lot of this topic )
      • Install in a chroot environment a full linux distro

       

      My first solution:


      My host is an Ubuntu Linux 14.04.

      My Edison board firmware is the edison-image-ww36-14


      1. Dowload the Yocto Linux SDK from the Intel Software Download Center
      2. Install the SDK
      3. Open a terminal (terminal 1) and do the chroot on the proper directory (e.g. /opt/poky-edison/1.6/sysroots/core2-32-poky-linux)
      4. Dowload the python library source code of interest (e.g. python-bluez)
      5. On an another terminal (terminal 2), copy the source code in the chrooted home directory (e.g. /opt/poky-edison/1.6/sysroots/core2-32-poky-linux/home/root)
      6. If necessary on terminal 2, mount the dev directory for the chrooted environment (/opt/poky-edison/1.6/sysroots/core2-32-poky-linux/dev) using the command mount dev /opt/poky-edison/1.6/sysroots/core2-32-poky-linux/dev -t devtmpfs (e.g. for python-numpy library)
      7. On terminal 1, go in the source directory (remember, we are in the chroot env) and use the python setup.py bdist command
      8. The source code directory will contain a bdist directory with (in my case) a tar.gz package. It contains the compiled python library
      9. Upload it on Edison board (I have used sshfs)
      10. Log into Edison on terminal 2 (through ssh or /dev/ttyUSB0) and execute the following command: tar -x -v - C / -f package.tar.gz

       

       

      What's next:

      I am trying to write a script for automatize the upload of both "firmware" (i.e. python libraries of specific version) and "software" (i.e. the production code)

       

      Again, any feedback is welcome

      Flavio