1 2 Previous Next 27 Replies Latest reply on Feb 16, 2016 5:03 AM by garsim

    Running full-fat linux distro on Galileo board.

    Bruce_Richardson

      As a software guy not used to playing much with hardware, I decided this weekend to try and set up the galileo so that I could do coding directly on the board - since it is a x86 PC after all. Therefore I decided to see about installing a "regular", "full-fat" linux distribution on the board, so I could use regular make and gcc on the board, and choose from a wide variety of precompiled packages.

       

      Given the instruction set support of the galileo, the options for distro to use are limited since many 32-bit distributions assume an i686. :-( My initial choice was slackware, but after some thought I decided that having apt-get was just too useful to miss out on, so went with debian. Given the issues already described in other discussions on this forum of trying to boot arbitrary kernels from the galileo grub menu, I decided that the easy way to try and get things working was to use the existing yocto image and kernel and just replace the root filesystem. Here is roughly what I did.

       

      1. Got the clanton sd-card image from the galileo site up and running, with console displayed over serial port
      2. Set up a simple vm in virtualbox, and installed a minimal debian linux image in it.
      3. Then on the sd card with my clanton image created a 4GB empty file, and ran mkfs.ext3 on it to create a filesystem
      4. Then I mounted that filesystem in loopback mode and rsynced the root filesystem from the vm into there. Some cleanup was then needed, e.g. delete and create new empty /sys and /proc directories.
      5. Mounted the image-clanton-full.ext3 file from the sd card also as a loopback filesystem and copied over from there the /lib/modules/<kernel-version> folder so that the kernel modules would be accessible.
      6. Unmounted both loopback filesystems, and moved the clanton image file to a ".bak" file and renamed the new debian root filesystem to take its place.
      7. Put SD card into galileo and boot.

       

      At that point, things mostly worked ok. Was missing a couple of directories that I had to create on the filesystem that were needed for mount points, e.g. the "realroot" mount point. Debian didn't output a console to serial line by default so had to connect in via ssh as root (thankfully I had installed ssh in the vm before copying the disk image!), but a quick edit of /etc/inittab fixed that - once I realised it was ttyS1 rather than ttyS0 I needed.

       

      In summary. The good:

      1. Galileo runs debian.
      2. apt-get
      3. "apt-get install build-essential" just works. Doesn't take excessively long either.
      4. apt-get!
      5. Running vim, gcc and make then seems to work fine for the couple of basic pieces of C code I tried writing. Building a slightly larger software package didn't seem excessively slow either.
      6. did I mention apt-get?

       

      The issues:

      1 Certain packages/binaries have seg-faults in libpthread. No idea what is causing this as haven't had a chance to investigate yet. This has caused the following problems for me:

                     * I can't ssh to the galileo as a non-root user. Connecting as root works fine, and connecting as a regular user over serial works ok though

                     * some startup server daemons fail to run, e.g. ntpd, which is ok so long as they aren't ones I really want.

      2 No kernel headers installed so compiling kernel modules against the yocto kernel image is not yet possible.

       

      So, anyone else tried getting a grown-up linux distro onto the galileo board, and seen any similar or other issues?

       

      /Bruce

        • 1. Re: Running full-fat linux distro on Galileo board.
          Len

          Hi Bruce,

           

          Excellent work, could you post a zipped image of your debian? My board hasen't arrived yet, but I definately want to run a full featured linux on it.

           

          Thanks,

          Len

          • 2. Re: Running full-fat linux distro on Galileo board.
            Bruce_Richardson

            Hi Len,

             

            unfortunately the root filesystem image I created is pretty big, and is not really suitable for posting. However, it really doesn't take long to create one yourself, and hopefully the instructions above are enough to enable you to do so.

            One extra note I would make is to try and ensure that you have a fast e.g. class 10, micro sd card. Apt-get will run very slowly using a slow sd card, as it will take a long time to read the package lists it has cached every time you run it.

             

            Thanks,

            /Bruce

            • 3. Re: Running full-fat linux distro on Galileo board.
              AlexT_Intel

              On a side note, one can have package management in the Galileo Linux too, by means of what's called "package feeds" feature of Yocto (www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#package-feeds-dev-environment).

               

              I'm new to that and just learning the system, but as far as I can see, standard BSP-provided Yocto layers actually compile a lot of packages in the ipkg format, so one would just need to make them available through the network to the board to use them even right away. Yocto also supports rpm and deb formats, so theoretically a "normal' apt-get is also within reach (you'd just need to host the apt repo somewhere).

              • 4. Re: Running full-fat linux distro on Galileo board.
                cconnaker

                Hi Bruce - Thanks so much for the info on running Debian. I've tried to follow what you've done and boot Debian on my Galileo but it won't boot. I don't have a serial cable yet so I don't know what's wrong. The devices isn't getting an IP so I can't SSH to it either.

                 

                Are there any glaring details or little tidbits of info you didn't include in your instructions that may be hanging me up?

                 

                Here is what I'm doing.

                 

                create blank file using dd

                format the file using mkfs.ext3

                mount it with -o loop

                rsync -aAXv /* /mnt/the-blank-file

                copy modules from Intel's ext3 file to the new blank file I created that now contains the rsync'd data.

                 

                 

                 

                A couple questions I have.

                 

                1. You mention, "Given the instruction set support of the galileo, the options for distro to use are limited since many 32-bit distributions assume an i686." I am using the Debian 7.3 netinst.iso to install Debian on my VM. It appears to install either 486 or 686 depending on if I use VirtualBox or Parallels. Is this OK?

                 

                2. Can I create the empty file anywhere and just copy it to the SD card when finished, or must I create it on the SD card from the beginning?

                 

                3. I deleted the sys and proc folders and recreated them after the rsync. Is there any other cleanup that needs to be done?

                 

                4. You mention "image-clanton-full.ext3" but the Intel file is named "image-full-clanton.ext3". I've tried both names with no luck. Does this matter?


                5. What do you mean by this, "Was missing a couple of directories that I had to create on the filesystem that were needed for mount points, e.g. the "realroot" mount point." Can you let me know what you did?


                Thanks so much. I think I'm close to getting this to work, but need a bit more help.


                • 5. Re: Running full-fat linux distro on Galileo board.
                  cconnaker

                  I finally got the serial cable and figured out most of the issues. I have Debian 7.3 running on the Galileo.

                  • 6. Re: Running full-fat linux distro on Galileo board.
                    MarcIII

                    Bruce,

                     

                      A lot of multithreaded code is buggy; sometimes the bugs have just not been observed yet. It's either buggy because concurrency is very hard to wrap one's head around, or because C and C++ did not even have a proper memory model until a couple of years ago ( ! ) Here is one random reference among very many on this topic:

                    http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/boehm-accu.pdf

                     

                    Generally speaking trust shared memory software even less than other software.

                    • 7. Re: Running full-fat linux distro on Galileo board.
                      rmm200

                      As I find myself doing quite often, i recommend checking out Sergey's blog:

                      http://www.malinov.com/Home/sergey-s-blog

                       

                      I built his Linux LSB image using clanton-full as the distro. You can add about anything you want in there.

                      Nice thing about the yocto package is that it does include Galileo specifics.

                      He set up a new image called image-sdk; I was reluctant to do that since I found recipes that referred to image-full.

                      I just modified image-full directly. Works great - and I added an NTP client. WiFi and NTP - life is good.

                      • 8. Re: Running full-fat linux distro on Galileo board.
                        zrubciu

                        Maybe that's because Quark is single-threaded and the application is trying to spawn more than one thread?

                         

                        Quark SoC X1000 (16K Cache, 400 MHz)

                        • 9. Re: Running full-fat linux distro on Galileo board.
                          Thomas_Faust_(Intel)

                          Hi Bruce,

                           

                          I tried to set-up a debian on my board as well, and I did it with debootstrap.

                          Build debian Linux distribution for Galileo board with debootstrap

                          To bad, I have the same issue with seg-faults in libpthread.

                          I will keep on it.

                          But thank you very much for this post.

                          • 10. Re: Running full-fat linux distro on Galileo board.
                            Patrick_Sit

                            Hi,

                             

                            I'm doing the same things as you. and also get the same issue.

                             

                            I think that is due to the original debian is SMP.

                            However the yocto kernel should be for single thread?

                             

                            Bruce, Did you do anything for makes the root is able to ssh?

                            Becuase the ssh is also doesn't work for my root account. it also become seg fault.

                            • 11. Re: Running full-fat linux distro on Galileo board.
                              mdelgert

                              Patrick please see reply to Thomas on step 3 and let me know if this helps solve your issue?

                               

                              Build debian Linux distribution for Galileo board with debootstrap

                               

                              Thomas the Galileo clock by default will be wrong for example my board was set to year 2000. Time stamps being off was causing me many issues. Below is rough documentation how I built Debian on Galileo please see step 3 to see if that solves your current issue.

                               

                              I agree with Thomas and would rather run "Debian" not "Yocto". Several articles in Galileo forums support several developers would appreciate running a popular linux flavor "Debian". After going through Yocto documentation "opkg" is not as straight forward to me as "apt-get". Yocto documentation requires building an additional Linux server to maintain to add one package? Also this option does not seem justifiable for small start up projects.

                               

                              May Intel provide one simple example with a working repository like "opkg install nano"? Other than building our own Yocto server and downloading all repositories? Or may Intel provide one public Yocto repository we may point "opkg" at?

                               

                              Preferably would really appreciate simple instructions how to install and enable "gpio" and "start-clloader.sh" without using Yocto. I don't want to tear apart the current provided Linux image in download section and guess at the changes made to that linux image for on board Arduino.


                              Would it be possible Intel or someone else in this forum will provide simple instructions how to install Galileodependencies on a fresh Linux install?

                               

                              Below is rough draft script of instructions I started the last step is getting "gpio" and "start-clloader.sh" I'm very close and would like to use the on board Arduino board. Otherwise I'm going to continue connect an additional Arduino board via USB and forget about the on board Arduino board on Galieleo so I have control over Debian linux 7 installed not having to learn Yocto long linux build process.

                               

                              Yocto is a neat concept and great for large projects and enabling many embedded devices please provide us with simple Linux scripts and dependencies to install on Debian.

                               

                              Arduino originally was so simple to code for "apt-get install arduino" one line that was it and we were completely up and running on Debian or Ubuntu.

                               

                              /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

                              # echo " Author: Matthew David Elgert"

                              #

                              # echo " Authored date: 1/24/2014"

                              #

                              # echo "Modified date: 1/24/2014"

                               

                              # echo "Step 1. Build a Debian-7.3.0-i386-netinst.iso virtual machine."

                              # echo "Note: Virtualbox machine with 256 MB memory, 1 CPU, 3.8 GB HDD (Galileo SD card fat32 4GB limit) removed printers, sound card and CDROM after install."

                              # echo "Note: Add secound 20 GB HDD to dump and build disk image."

                              # echo 'Note: Users created "root" & "scott" password "tiger"'

                              # echo "Note: Software installed SSH server."

                               

                              # echo "Step 2. Test SSH and update."

                              # echo "Note: Login on console as root."

                              # ifconfig

                              # echo "Note: SSH into VM using putty http://www.putty.org/."

                              # echo "Note: This VM uses DHCP to get IP address SSH default port 22."

                              # apt-get update

                              # apt-get upgrade

                               

                              # echo "Step 3. Setup ntp to fetch time from internet. (Galileo has a onboard clock that reset when power is pulled unless a battery is installed.)"

                              # echo "Note: Url reference - https://wiki.debian.org/DateTime"

                              # echo "Note: Get current date time."

                              # date

                              # apt-get install ntpdate

                              # ntpdate pool.ntp.org

                               

                              # echo "Step 4. Add secound 20 GB drive, create and mount partition."

                              # echo "Note: List current disks."

                              # fdisk -l

                              # fdisk /dev/sdb

                              # n

                              # p

                              # echo "Note: (pressed enter 3 times)"

                              # w

                              # mkfs.ext3 /dev/sdb

                              # y

                              # cd /

                              # mkdir sdb

                              # mount -t ext3 /dev/sdb /sdb

                              # e2label /dev/sdb /sdb

                              # df -h

                              # cd sdb

                              # ls

                              # echo "Note: Directory lost+found when mounted."

                               

                              # echo "Step 5. Download and mount Intel Galileo linux original image."

                              # cd /sdb

                              # wget http://downloadmirror.intel.com/23171/eng/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5.7z

                              # echo "Note: Debian default does not have 7zip installed."

                              # apt-get install p7zip

                              # p7zip -h

                              # p7zip -d LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5.7z

                              # cd /sdb/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5

                              # echo "Note: Verify files extracted."

                              # ls

                              # cd /sdb

                              # mv /sdb/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5/image-full-clanton.ext3 /sdb/image-full-clanton_original.ext3

                              # mkdir /sdb/image-full-clanton_original

                              # mount -t ext3 /sdb/image-full-clanton_original.ext3 /sdb/image-full-clanton_original

                              # cd /sdb/image-full-clanton_original

                              # echo "Note: Verify mount point directory has files"

                              # ls

                               

                              # echo "Step 6. Modify Debian directory structure to match Intel Galileo image."

                              # cd /media

                              # mkdir /media/card

                              # mkdir /media/cf

                              # mkdir /media/hdd

                              # mkdir /media/mmc1

                              # mkdir /media/net

                              # mkdir /media/ram

                              # mkdir /media/realroot

                              # mkdir /media/union

                              # mkdir /sketch

                              # cp -avr /sdb/image-full-clanton_original/lib/modules/3.8.7-yocto-standard/ /lib/modules/3.8.7-yocto-standard

                              # cd /lib/modules/3.8.7-yocto-standard

                              # echo "Note: Verify files copied."

                              # ls

                              # cp -avr /sdb/image-full-clanton_original/opt/cln/ /opt/cln

                              # cd /opt/cln/galileo

                              # echo "Note: Verify files copied."

                              # ls

                              # echo "Note: **** May need to revisit and verify this step *** Had a issue with first boot not runing apt-get install Arduino *** dialout permissions did not transfer"

                               

                              # echo "Step 7. Enable Debian to output to a console."

                              # nano /etc/inittab

                              # echo "Note: Add the following line to EOF"

                              # echo "s0:2345:respawn:/sbin/getty -L 115200 ttyS1 vt102"

                              # echo "Note: See project file inittab for full example."

                               

                              # echo "Step 8. Dump Linux OS image to a file."

                              # cd /sdb

                              # echo "Note: Dump full system this step might be better during a cold or recovery boot so far it works with out any documented issues."

                              # fdisk -l

                              # echo "Note: Notice the block size of /dev/sda1 in output my virtual machine is 3766272."

                              # dd if=/dev/sda1 of=/sdb/image-full-clanton.ext3 bs=3766272 conv=sync,noerror

                              # mkdir /sdb/image-full-clanton

                              # mount -t ext3 /sdb/image-full-clanton.ext3 /sdb/image-full-clanton

                              # echo "Note: If disk won't mount had to dump again or reboot. This step may be better while system is cold or in recovery mode."

                              # cd /sdb/image-full-clanton

                              # echo "Note: Verify file structure."

                              # ls

                               

                              # echo "Step 9. Setup disk image."

                              # rm -rf /sdb/image-full-clanton/sys

                              # rm -rf /sdb/image-full-clanton/proc

                              # mkdir /sdb/image-full-clanton/sys

                              # mkdir /sdb/image-full-clanton/proc

                              # cd /sdb

                              # umount -l /sdb/image-full-clanton

                              # mv /sdb/image-full-clanton.ext3 /sdb/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5/image-full-clanton.ext3

                              # cd /sdb/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5

                              # echo "Note: Verify file copy image-full-clanton.ext3"

                              # ls

                               

                              # echo "Step 10. Setup Galileo MicroSD card -https://communities.intel.com/servlet/JiveServlet/previewBody/22204-102-1-25429/Galileo_GettingStarted_329685_005.pdf

                              # echo "From a Windows machine after SD card is installed run command prompt as Administrator."

                              # echo "Run diskpart.exe"

                              # echo "DISKPART> list disk"

                              # echo "DISKPART> select vol <a>; (where <a> = the drive letter of the SD card) (example select Disk 3)"

                              # echo "DISKPART> clean"

                              # echo "DISKPART> create part primary"

                              # echo "DISKPART> active"

                              # echo 'DISKPART> format quick label="BOOTME"'

                              # echo "Note: May want a full format to verify a good SD card this takes a long time."

                              # echo 'DISKPART> format label="BOOTME"'

                              # echo "DISKPART> exit"

                               

                              # echo "Step 11. Boot new image-full-clanton.ext3"

                              # echo "Note: If you reboot will need to remount /sdb."

                              # mount -t ext3 /dev/sdb /sdb

                              # echo "Note: Use sftp client such as free WinSCP to copy all files from /sdb/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5 to root directory of new SD card"

                               

                              * ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

                              • 12. Re: Running full-fat linux distro on Galileo board.
                                jfstepha

                                Hi @mdelgert, can you SSH to the Galileo from another machine?  I followed your script and still get the seg faults described by other users above.

                                 

                                -Jon


                                • 13. Re: Running full-fat linux distro on Galileo board.
                                  jfstepha

                                  FYI - Telnet does work.  It's not a great permanent solution, but it can help debug the ssh problem without having to sit physically next to the router.

                                   

                                  Some more thoughts on the segfaults:

                                  - Could they be due to not having an swap space?  And we only have 256M of RAM?

                                  - Could they be due to Debian being built for i386, and some of the kernel modules copied from the yocto build being built for i586?

                                  - Could it have something to do with glibc?  (The yocto build uses eglibc, I assume Debian uses glibc)

                                   

                                  -Jon

                                  • 14. Re: Running full-fat linux distro on Galileo board.
                                    mdelgert

                                    jfstepha please look at # nano /etc/network/interfaces.

                                     

                                    I had an issue one time need to specify eth0.

                                     

                                    Are you able from the console ping google.com or your gateway?

                                    1 2 Previous Next