11 Replies Latest reply on Jan 21, 2014 9:55 AM by IRCAnonymous IRCAnonymous

    How to test Linux installation

    Aditya.A

      Hi,

      I just bought Intel Galileo and inserted SD card with Little linux. How do I test whether Linux is installed on the board?

        • 1. Re: How to test Linux installation
          tnw513

          Simply upload a sketch normally (ex. blink).

          Later, unplug usb and power supply. If when you replug power supply sketch working fine, Linux from SD working fine.

          Please note that boot from SD can be slow (1 minute).

          • 2. Re: How to test Linux installation
            Aditya.A

            Hi tnw513,

            Thank you for the reply.

            How to test it by Linux commands?

            Is it Ok if I don't run step 12 in the Getting Started Guide?

            • 3. Re: How to test Linux installation
              tnw513

              If you have already update board firmware in step 6 you're ok. No need to update again manually.

               

              You can also upload a sketch and when unplug/replug power supply (and usb if you need) verify if in /sketch folder in the Galileo board  there is:

              "sketch.elf" and"sketch.elf.old"

              if there are both, linux from SD working good.

              But again, you can simply test if blink "survive" after unplug power source.

               

              I don't know if there are other methods, but probably yes.

               

              MOD: Wait, I'm probably wrong. You mean Little Linux for update? In that case that's for update firmware. If you have already update with Arduino IDE you don't need it.

               

              In addition: If you want to know if the Galileo board boot effectively from SD you can simply see if SD led (near SD slot and power on led) blink frequently for about 40 sec. If that led blink for 1 or 3 seconds probably Galileo doesn't boot from SD.

               

              PS: sorry for bad english

              • 4. Re: How to test Linux installation
                Aditya.A

                Hi tnw513,

                Thanks for the reply!

                The SD led is blinking fine. So, my board's Linux is working fine.

                 

                How to test it using Linux commands? Like, "$ who" or "echo "Hi"" stuff like that.

                 

                Thank you!

                • 5. Re: How to test Linux installation
                  tnw513

                  Those commands works with and without SD, so isn't a good idea to test a working SD image with that method.

                   

                  However hope I've help you.

                  • 6. Re: How to test Linux installation
                    rmm200

                    Once you have a linux command line, enter the command "df" to show file system sizes.

                     

                    In my case, I set up a 3gb ext4 file system, so one of my df lines shows:

                    /dev/mmcblk0p1 31149056 615368 24995488 20% /media/realroot

                     

                    Yours will vary, but it will be obvious if you are running off SD.

                    1 of 1 people found this helpful
                    • 7. Re: How to test Linux installation
                      Aditya.A

                      Hi rmm200,

                       

                      I ran the code,

                      But, the Serial Monitor is showing,

                       

                       

                      What to do?

                       

                      Thank you!

                      • 8. Re: How to test Linux installation
                        Thomas_Faust_(Intel)

                        Hi Aditya.A

                         

                        Here is a snipped fromt the manual for fgets():

                        char * fgets ( char * str, int num, FILE * stream );

                        Get string from stream

                        Reads characters from stream and stores them as a C string into str until (num-1) characters have been read or either a newline or the end-of-file is reached, whichever happens first.

                         

                        In your case, the end-of-lines comes first after "Mounted on".

                        You need to do fgets()/Serial.println() in a while loop until you don't receive any bytes from the file anymore. (Don’t' forget to move the fclose() out of the loop ;))

                        1 of 1 people found this helpful
                        • 9. Re: How to test Linux installation
                          rmm200

                          OK...  One thing I never anticipated was using the Arduino IDE to show output from the Linux console.

                           

                          In my case, I made up a serial cable (see Sergey's blog) fed into PuTTY. It is like running a native Linux system.

                          Also, if you use the Arduino IDE to configure the Ethernet port, that would work also with just a standard

                          ethernet cable to PuTTY. That is covered in another post.

                          Mostly though, I run my Galileo as a stand-alone WiFi enabled system, which I access through SSH and PuTTY.

                          That requires an SD image though.

                           

                          PuTTY is free, and kind of a must-have.

                           

                          In your specific case, it looks like your fgets is returning everything in your log file, up to the first new line.

                          That just displays the header line.

                          Try putting a loop count in to read multiple lines. You would have to move the buffer pointer yourself.

                           

                          You will be happier though if you give yourself a real console using one of the cable options above.

                          • 10. Re: How to test Linux installation
                            Aditya.A

                            Hi All,

                            I have created a sketch as below.

                             

                             

                            It worked. It displayed all the directories. It also displayed the directories in the root.

                            Thank you!

                            • 11. Re: How to test Linux installation
                              Rod_H

                              If you change the Fileread to:

                               

                              void Fileread(FILE *fp) {

                                while( fgets(output, 1000, fp) != NULL ) {

                                  Serial.println(output);

                                }

                              }

                               

                              it will read till the end of the file log.txt then fgets return NULL and it will exit the while loop.

                              • 12. Re: How to test Linux installation
                                IRCAnonymous IRCAnonymous

                                Running Linux shell commands through the IDE and "system" API is fine, but if you have the updated SD Card Linux installation running, you should be able to SSH to the device on your network, if you know the IP address, and then execute the Linux shell commands directly.

                                 

                                As far as determining if you are on the SDCard or the SPI-Flash Linux installation, there are options. I've been asking similar questions here :

                                Linux install without access to Python

                                 

                                You've now asked how to "test" your Linux installation. What do you mean by testing ? What is it that you're looking for which will make you comfortable with the quality of the installation ?