Faster Install Ubilinux on Edison

Posted on Wednesday, March 9, 2016


 

Back in August did a write up on how to install Ubilinux on the Intel Edison on a Windows 7 box http://www.whiteboardcoder.com/2015/08/install-ubilinux-on-intel-edison.html [1].   I focused on using Cygwin to do this, as I feel if you are going to be fiddling with the Intel Edison you need to get your Linux shell on.

I also made a video on how to do it https://www.youtube.com/watch?v=9fYetzNLTnU [2] which turned into a 90 minute monster.  

The biggest pain point was trying to show how to install Cygwin to those who may never have installed it.  I think I have a better, and much faster, way to do it now.




Recently I had to redo my Cygwin installation and found a few tools that make life much easier to set it up.  I am going to use what I learned there to make this a much quicker tutorial (which I will hopefully turn into a much quicker video).  Also I am going to be using Sparkfun Intel Edison block instead of the Arduino Breakout Kit.





Edison Set up


I purchased an Intel Edison and a 'Base'  SparkFun Intel Block https://www.sparkfun.com/products/13045 .



I also bought a 'GPIO' SparkFun Intel Edison Block https://www.sparkfun.com/products/13038 .  So Can connect it up and blink a light J








Cygwin


What is Cygwin? 
It's a Unix like command -line interface for windows.  It's maintained by the good people at RedHat.   It's not pure Linux but it's as good as we get on the Windows platform currently.



Installing Cygwin

How do you install and set up Cygwin for the first time?
Head over to https://www.cygwin.com/ [3] to download Cygwin.



Click Install Cygwin





Click on setup-x86_64.exe To download the program.





After it downloads click and run the program.





If you get this warning just click Run.




Click Next





Select Install from Internet
Click Next





I leave the Root Directory as default.
Click Next.





Click Next.





Click Next





Select a Mirror site and Click next




It starts to download.





Don't bother with additional packages just click Next.





Click Next




Let it download





Checkbox Create icon on Desktop and Click Finish






Other Libraries


Now we need to install some other tools in Cygwin.  You could open the Cygwin Package manager and find each one you need and checkbox it and install them all, but that takes a long, long time.   That is what I did last time and it took up a lot of the time.

Here is a list of tools you need/are nice to have.

  • autoconf                            
  • automake                              
  • bzip2                                                              
  • crypt                                  
  • curl                                    
  • diffutils                              
  • gcc-core                                
  • gcc-fortran                             
  • gcc-g++                                
  • git                                     
  • git-completion    
  • less                                    
  • libusb1.0 / libusb1.0-devel                                                  
  • lynx                                   
  • make    
  • nano 
  • ncurses                                 
  • openssh   
  • perl                                    
  • pkg-config  
  • ping                       
  • python                                 
  • rsync                                  
  • run                                    
  • screen                                                                                                            
  • tree                                    
  • unzip                                   
  • vim 
  • wget          
  • zip     


                               
This list of tools is more than the minimum list you need to install Ubilinux. It includes several tools you will probably find you need in the future as you play around with the Intel Edison.

It is possible to install all of these in one shot using the DOS prompt to run the Cygwin setup you tool you downloaded.



Open a DOS prompt





Right click on the Start icon and search for "cmd"  then run cmd.exe


Assuming the setup-x86_63.exe is in your Downloads folder run this command from you DOS prompt (copy and paste it in)


> %HOMEPATH%\Downloads\setup-x86_64.exe -q -P autoconf,autoconf2.1,autoconf2.5,automake,automake1.15,bzip2,crypt,curl,diffutils,gcc-core,gcc-fortran,gcc-g++,git,git-completion,less,libusb1.0,libusb1.0-devel,lynx,make,nano,ncurses,openssh,perl,pkg-config,ping,python,rsync,run,screen,tree,unzip,vim,vim-common,wget,zip










It starts to install all the libraries you listed  (this may take a while)

 





When it is done you should see this message









Start Cygwin





You should have a Cygwin Shortcut on your Desktop.
Double Click it to open it.





And it's running.
If the font is too small to read (for me it is).  Here is how to adjust it.






Right click on the window bar and click Options.






Select Text and click Select





Select a bigger font and click OK.
I use a the Lucida Sans Typewriter font at 22.






Click Save





Now I can read it J







Drivers and Software


Head over to

(This page could move or be re-directed, the main idea is to find the USB drivers for Edison)



Download "Windows Standalone Driver 1.2.1"





After it downloads click on the installer.





If you happen to get this prompt, click Run.



 

Click Next




 

Agree to License


 



Click Next


 


Click Install





Install starts




 

click Install


 

Click Install




 

Click Install

 


Click Install


 


And it's done click OK.



 


Click Finish








Plug it in




Plug the Edison into the Sparkfun Base block and plug a USB cord in the OTG side and plug it into your computer.

If the Edison has Yocto Linux Installed, the default Linux, you should see an extra drive get mounted.





There it is on mine.  It shows up as a drive named Edison.  Yocto Linux allows the Edison to act as a USB thumb drive as well as be Linux.  Ubilinux does not have this feature.





Installing dfu-util


Open up a Cygwin terminal
Run the following commands to install the dfu-util tool



   > git clone git://git.code.sf.net/p/dfu-util/dfu-util
   > cd dfu-util
   > ./autogen.sh
   > ./configure
   > make
   > make install



Then to test run


   > dfu-util -l




Wahoo it's working!





Install Ubilinux











Right click on "Ubilinux for Intel Edison" And select Copy Link Address.

In my case I copied


Note: 150309 translates into 03/09/2015.   This is the latest version as of 3/8/2016 a few details about this release can be found at http://www.emutexlabs.com/blog/225-new-ubilinux-for-intel-edison-released [6]  Looks like they added git and mraa J


 

Open up a cgywin terminal




I am going to create a folder called Ubilinux go into that directory and download the Ubilinux file from the link I copied earlier using the wget command.


   > mkdir ubilinux
   > cd Ubilinux
   > wget http://www.emutexlabs.com/files/ubilinux/ubilinux-edison-150309.tar.gz


The download may take 15-30+ minutes.




It may take a while to download depending on their server speed.  Several months ago it took 15+ minutes… 
For some reason today it took  21+ Minutes to download




Extract the contents of the file by running the following command.


    > tar -xvf ubilinux-edison-150309.tar.gz





This will extract all the files in a folder called toFlash.






Unplug the Edison.

Cd into the toFlash directory and run ./flashall.sh


    > cd toFlash
    > ./flashall.sh



When you get this message, plug the USB cord back into the intel Edison.

(If you happen to get an error stop the flashall.sh ctrl+c and run it again)







It will start installing Ubilinux
Once it's done leave it plugged in and alone for at least 2 minutes…







Connect to it using picocom


There are two ways to connect to the Intel Edison with Ubilinux (when it is first installed… I will fix it to a simpler way later on). 

1. You can use Ethernet over USB and ssh to IP address 192.168.2.15.
 I found this to be a real pain to get working with the Win-7 + Cygwin combo. 

2. The other method is to connect to it via serial console.   To do that you need to download some software on Cygwin.   (As a side note, the linux 'screen' command should be able to do it, but I could not get it to work correctly in cygwin.  Instead I am using picocom)




Download and set up picocom



Switch to your home directory and download piccom directly.  Untar the download.


    > cd
    > wget https://github.com/npat-efault/picocom/archive/2.1.tar.gz
    > tar -xvf 2.1.tar.gz







Cd into the picocom folder and run make


    > cd picocom-2.1
    > make


See if picocom.exe is there


    > ls -alh


You should now have a file called picocom.exe





Create a folder to put picocom into. And cd into it.


    > mkdir /usr/local/picocom
    > cd /usr/local/picocom
    > cp ~/picocom-1.7/picocom.exe .
    > ls


 





Create a symlink (shortcut) to this program.  This will make it easier to use this command in the future.


    > ln -s /usr/local/picocom/picocom.exe /usr/bin/picocom


To test if the symlink is working you can use the which command.


    > which picocom




Perfect it gives back the location of the symlink.

You should now be able to run picocom from any directory



Use Picocom


Plug the USB cord into the console port on the Sparkfun Base Block.



Cygwin lists USB connection points in the /dev folder. Run this command to find the connection point.


    > ls -alh /dev/tt*


If you don't see it you may need to give it a minute to mount.  Just run it again…  You may even need to unplug the USB and plug it in again.



There it is.  In my case its /dev/ttyS17, yours may have a different number.

Use this number to login to the Edison.  (Change ttyS17 to what your usb connection point)


    > picocom -b 115200 /dev/ttyS17






Terminal starts up.


Press the return button!   If you don't you will be staring at a screen doing nothing for a long … long time!




Hey look the login!





Login with the following credentials.

Username :    root
Password:      edison





I am in J
There is the Edison command line prompt!






Getting out of Picocom


Before I get too far…. How do you get out of picocom? 
The typical ctrl+c will not work.

Run exit to get back to the login screen.


    > exit







Then to get out press Ctrl+a+x  (all at same time)





Connect to your Wifi Network


You don't really want to be using picocom to login to Ubilinux.  It is much simpler to loging via ssh (Secure Shell).  The first step to be able to do this is the connect the Edison to your WiFi network.

Log back into the console using picocom


    > picocom -b 115200 /dev/ttyS17



There is a file located at /etc/network/interfaces.  This file defines how to set up your network.  The default settings have the Wi-Fi turned off, you need to turn it back on and give it the password to your  network. 

I am going to use a tool called nano to edit the text file.  I typically use vi, which I highly recommend, but if you are a beginner vi is a hard place to start.



Run this command to open the file in the nano editor.


    > nano /etc/network/interfaces






 



To move from line to line use the arrow keys also you will notice on the bottom a list of commands. ^ means control.   Control+X will exit (close the file)





Go to this line "Auto usb0"





Use your arrow keys to move around and add a '#' in front of auto usb0 (this comments it out, effectively turning the Ethernet over USB off)





Go to the #auto wlan0





Next scroll down to this line and remove the # from in front of it.  (effectively turning on the WiFi connection)






Assuming you're using WPA for your WiFi, which is typical, scroll down to this section For WPA





As an example if your WiFi was called rebelbase1 with a password of downwithvader this is how you would fill this section out.

Update the wpa-psk to the password of the Wi-Fi network.

 Before we save this file there is one last thing to note.




We are using dhcp (Dynamic Host Configuration Protocol)  Basically that means when we connect to the WiFi we don't care what IP address it gives us, just give us one.  There are ways to edit this file so that you get a static IP address so you always get the same IP address when you connect.  But typically on a small home network when you reconnect you get back the same IP address you had before the router "remembers" you and gives you the same IP address each time (if it can).




Save and close the file

To do this you need to first press

Control+x
Then  press  y
Then press enter



 The file should be saved and you should be back at the command prompt.






 Restart the networking service


Now you need to restart the network on the Edison.  To do this run the following commands


    > service networking stop
    > service networking start





Hopefully you are now connected and you now have an IP address from your WiFi network.



To check what your IP address is run the following command.


    > ifconfig -a | grep wlan0 -A 1





In the wlan0 section look for inet addr.  I have IP address 192.168.0.9.  Take note of your IP address.





Test Your Connection out!


From the edison see if you can ping google.com


    > ping www.google.com





It's working press ctrl+c to stop

 Open up another terminal in Cygwin.  And ping your Edison, use your ip address.


    > ping 192.168.0.9




 It is working!




Login via SSH


Exit out of the serial console.


    > exit


Then press ctr+a+x to exit out of picocom



Now, hopefully you never have to use picocom again J


Now it does not matter which USB port you are connected to as now you just need power.   Also if you have another power source… like Sparkfun battery module you could use that and not even have it plugged in via USB.





Point being… at this point your Edison does not need to be tethered to a computer at all.



Login via ssh!  (Use your IP address)


    > ssh root@192.168.0.9




When prompted to continue enter (yes).  Then when prompted for you password enter 'edison'

You are now logged in!



Exit it


    > exit




(no more need for ctrl+a+x)



That's it!  You are done!

You have Ubilinux installed and you have the Edison connected to your WiFi network which allows you to easily SSH into your Ubilinux Edison Server






References

[1]        (Older) Install Ubilinux on the Intel Edison
Accessed 3/2016
[2]       Install Ubilinux on the Intel Edison
                        https://www.youtube.com/watch?v=9fYetzNLTnU
Accessed 3/2016
[3]       Cygwin
                        https://www.cygwin.com/
Accessed 3/2016
[4]       Intel Edison Download page
                        https://www.cygwin.com/
Accessed 3/2016
[5]       Ubilinux Main page
                        http://www.emutexlabs.com/ubilinux
Accessed 3/2016
[6]       Ubilinux Release Notes
                        http://www.emutexlabs.com/blog/225-new-ubilinux-for-intel-edison-released
Accessed 3/2016
[7]       Picocom github home
                        https://github.com/npat-efault/picocom
Accessed 3/2016

No comments:

Post a Comment