I decided to try a project with the Intel Edison, using it as a webserver, for my home weather station. The Davis Instruments Vantage VUE provides weather data via a USB port – so let’s try connecting it up to Edison!
I selected the smallest Edison, with the Breakout Board of 2 USB connectors. One for console, and one for attachment to the weather station.
Since I am more familiar with Debian, I decided to use Ubilinux. Using the distribution from Emutex labs, http://www.emutexlabs.com/ubilinux/29-ubilinux/21... , and the nice step by step installation from Sparkfun, http://www.emutexlabs.com/ubilinux/29-ubilinux/21...
Step 1: Discovering the USB Driver for Davis Was Not Present!
Logged in as root, plugging in my weather station to the non-console USB port on the Breakout Board, lsmod showed the expected USB driver had not loaded (I needed cp210x for the Davis). I see cp210x is missing from the Ubilinux distribution! After some searching, I found AlexT_Intel had created an expanded Yocto repo which contained the driver. AlexT advice here: https://communities.intel.com/thread/55692 .
But how to move the /lib/modules/…/cp210x driver to Ubilinux? Eventually I found the advice to a) install Yocto, b) add the missing driver from AlexT repo, then c) copy the Yocto kernel plus all USB modules, and d) substitute them into Ubilinux. Procedure follows.
Step 2: Pulling a USB Driver From Yocto to Ubilinux
1. Install Yocto normally. Enabling networking.
2. Wget the desired driver from repo.opkg.net,
opkg install kern-module-cp210x…ipk
Now plug in my weather station, lsusb, and see cp210x is loaded! Plus the /dev/ttyUSB0 is created.
3. Capture the kernel and all modules from Yocto:
cd /boot; tar cvf /tmp/boot.tar .
I’m using relative pathnames in tar, so I can extract wherever convenient later.
To capture all the loadable drivers, and capture the directory name associated with the kernel,
cd /lib/modules ; tar cvf /tmp/modules.tar 3.10.17-poky-edison+/extra 3.10.17-poky-edison+/kernel
In the above tar, I did not think it necessary to capture any of the files used to manage the module state.
4. To transfer these 2 tar files out of Yocto, I decided to move them via the MSDOS partition which Windows normally mounts from the Edison via the second USB port. For this we must avoid having Yocto and Windows both mounting the filesystem at the same time. So unplug the 2nd USB cable such that Windows is not mounting, then:
losetup –o 8192 /dev/loop0 /dev/disk/by-partlabel/update
mount /dev/loop0 /update
cd /tmp; md5sum boot.tar modules.tar > md5.txt ; cp boot.tar modules.tar md5.txt /update
After copying the two tar files and a record of their md5sum to the MSDOS partition, unmount it.
5. Reattach the 2nd USB cable to Windows. Windows mounts the Edison partition. In Windows filemanager, copy out the 2 tar files and md5.txt.
6. Now we are ready to reinstall Ubilinux and import this kernel and driver modules!
Install Ubilinux as the first time.
Enable the wifi network interface.
7. How shall we import the tar files? Ubilinux doesn’t seem to offer the same MSDOS partition to Windows. So I decided to move via ftp, since I have an ftp server.
Copy the 2 tar files and md5.txt to my ftp server, and logged in as root on Ubilinux:
sftp –P 990 email@example.com (I use sftp, with appropriate port, and user@IP).
8. Md5sum boot.tar modules.tar > checkmd5.txt
cmp md5.txt checkmd5.txt
9. Now we are ready to replace the Ubilinux kernel and all the loadable modules, which we have brought over from Yocto.
cd /boot; tar xvf /tmp/boot.tar
cd /lib/modules; tar xvf /tmp/modules.tar
Might as well clean up by removing the old modules directory:
rm –r 3.10.17-poky-edison-ww42+
Rebuild the modules info with,
10. Now we are ready to reboot and see if this kernel and modules will work.
shutdown –h now
remove and reattach power to Edison.
And the boot is successful!
I plug in my weather instrument, and lsmod now shows the cp210x loadable module is in the kernel!