8 Replies Latest reply on Aug 20, 2014 10:26 AM by SpiderKenny

    Developing native linux apps on Galileo

    SpiderKenny

      We all know you can create and run Arduino Sketches on Galileo, with minimal fuss.

      Under the hood the Arduino IDE is creating a Linux ELF file and placing it in the sketches folder, in the tiny linux image that runs on Galileo.

       

      Many of us, though, would like to develop and run our own native linux apps on Galileo.

      As far as I can see there are two options for doing this.

       

      1. Use Alex_T's v1.0.0 Linux image which includes a set of dev tools. This runs on the Galileo board, all make, debug and install happens on the board.

      2. Use Intel's IoT ADT. [Internet Of Things, Application Development Toolkit]. This runs a debug server on the Galileo and runs the development tools (Eclipse IDE etc) on a PC or Laptop connected to Galileo with a serial cable. The nice thing about this approach is that it is officially supported, and gives you a full IDE on a powerful workstation.

       

      However, there are some issues with both approaches...

      The linux image with included dev tools is not (yet?) officially supported and takes a bit of knowhow to get it running. You don't get an IDE.

      The IoT ADT is not available to purchase anywhere that I can find, so you have to download large binary images and burn them yourself to an SD Card and a USB Flash drive. There are only sketchy instructions for doing this. By spending a whole weekend experimenting I finally got my laptop to boot from the USB Flash drive, and Galileo to boot from the SD Card, but it was hard work.

       

      Here's the rub for me..

      I already use Eclipse extensively in my day job, and I have a Windows Laptop and a big fast Apple iMac for doing development on.

      On my Mac I already have VMWare Fusion, and there I have a few Ubuntu VMs for various tasks (not related to Galileo).

      To develop for Galileo I have to shut all that down and boot from a USB Flashdrive with an old 32 bit version of Debian, meaning I can't use my laptop for Office or Outlook at the same time....

       

      I found some instructions on making the flag drive image bootable using VirtualBox on mac, and I followed the instructions carefully but they did not work.

       

      Is there someway of using the Board Support Packages (BSP) to build a cross compiler environment on my Mac or PC without having to boot from USB?

        • 1. Re: Developing native linux apps on Galileo
          rmm200

          I have to put in a plug for "Do it all on the Galileo".

          I run Sergey's modified image-dev, and my Galileo has literally been up months, 24/7, running a Ruby on Rails web server (compiled from source on the Galileo). Someday it will do something useful.

          When I power up my PC (daily), I connect to the Galileo using SSH through PuTTY.

          Nano is a very acceptable editor (compiled from source on the Galileo), and I compile my own programs using g++,

          as well as sketch source copied from my PC. WinSCP is great for file copies...

          1 of 1 people found this helpful
          • 2. Re: Developing native linux apps on Galileo
            SpiderKenny

            Aye, and that's perfectly valid.

            If however like me you like a nice IDE then it's not easy, (other than the Arduino sketch IDE).

            • 3. Re: Developing native linux apps on Galileo
              AlexT_Intel

              As far as I can see the IoT ADT image is mainly Yocto ADT + Intel's ICC compiler as a bonus.

               

              Yocto ADT is cross-toolchain+respective sysroot+Eclipse plugin+qemu.

               

              You can generate the first two things for OSX by following instructions in the BSP Build Guide, there's a section on generating and installing the toolchain (which includes sysroot).

               

              Eclipse plugin installation is described in this part of the Yocto ADT User Guide: Yocto Project Application Developer's Guide

               

              QEMU is probably irrelevant.

               

              So in theory :-) you should be able to create your environment following the instructions referenced above. You could try it out and shatre your progress/ask for help in this thread and I'm sure when you're done that would be of a huge interest for the whole community.

              • 4. Re: Developing native linux apps on Galileo
                SpiderKenny

                I finally achieved my Goal - eclipse running in a VM on the Mac, with remote deploy and debug to Galileo over the network. It's al as per the IoT ADT, except that the Live USB image is running in a VM rather than booting a laptop.

                • 5. Re: Developing native linux apps on Galileo
                  mdelgert

                  SpiderKenny I had the same exact issues and you for serveral months.

                   

                  I wanted to run mono and C# on the Galileo.

                   

                  The solution for me was this. Build a VM any flavor of linux you like and install all developer tools you like etc.

                   

                  Then pushed the ext3 full image clone of your linux installation from VM copy to Galileo sd card.

                   

                  When Galileo boots up a script runs to "chroot" into the custom flavor of Linux I made from the VM.

                   

                  This works great I don't have to mess with Intel version of linux and lose any support. I get the best of both worlds support Intels flash and have the flavor of linux and tools I wanted. Below is an article that goes into details of installing Debian. You could run other flavors and tools like Ubuntu and Eclipes etc.

                   

                  From a performances perspective my VM using "chroot" inside the Galileo runs super fast because I'm just running a few services like Apache web server.

                   

                  Yocto is great but tools and recipes I need for my project were not available. Hope this helps.

                   

                  Re: Build debian Linux distribution for Galileo board with debootstrap

                   

                  chroot - Wikipedia, the free encyclopedia

                   

                  A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally not access) files outside the designated directory tree. The term "chroot" may refer to the chroot(2) system call or the chroot(8) wrapper program. The modified environment is called a "chroot jail".

                  • 6. Re: Developing native linux apps on Galileo
                    SpiderKenny

                    Mono and C# are just not for me.

                     

                    I just don't understand running heavyweight VM based languages to develop for whats essentially a light-weight processor. Native c/c++ for me all the way please! They get compiled to actual code that runs on the actual processor, no man-in-the-middle VM or interpreter using up memory and resources unnecessarily.

                    • 7. Re: Developing native linux apps on Galileo
                      xthunderheartx

                      So Kenny, can you point us to whatever documentation you used to get this going?  I'd like to get the tool chain running natively on a Ubuntu install with Eclipse and the plug-in.  I gather the first thing to do is run the Yocto ADT install script and I have that tarball on my development box.  The install guide is good but of course it's generic in nature.  Did you have to build the cross-platform tool chain and create a file system etc or did you just figure a way to get the Debian Live image running in a VM.

                       

                      There really need to be a guide for doing this.  The Arduino IDE is fine for plinking but I need to get a serious DE going for heavier weight application development.

                       

                      Any guidance would be appreciated.  To be more specific I am trying to get the same functionality you describe but running on a native Ubuntu 14.04 LTS install.

                       

                      Thanx

                      • 8. Re: Developing native linux apps on Galileo
                        SpiderKenny

                        Hi xthunderheartx

                        I originally got this going by following the Setup guide on Intel's IoT ADK Pages. However I believe that those pages no longer exist in the same format.

                        That got me a Ubuntu desktop running on my PC and a linux distro running on Galileo, you could use Netbeans in Ubuntu to write the code, and then upload it to Galileo.

                         

                        However I have since ditched that idea, and now I run a Linux distro with dev tools on galileo. I write my code using any text or code editor that I happen to have (in my case I use Xcode on a Mac) and then  FTP or SCP the files to Galileo, where I 'make' and run the programs.

                         

                        The linux distro I use was built following the instructions form intel here. If you don't want to spend hours doing the build yourself you can download an SD Card image from my blog. See here and here.

                         

                        I hope this helps!