All of the integrated environments of the Intel Edison will copy your executable from your development PC to the Intel Edison. If you want to develop outside of these environments, however, you will have to copy the code over yourself. Here are several solutions that don't involve creating a custom flash image.
This gist assumes that you are able to, at minimum, access the Edison console through USB. Some methods require additional connectivity. There are two basic approaches. Network methods are for when you have access to Edison over wifi, and the sneaker net methods are for when you don't.
If you have wifi configured, there are other ways of getting your files onto the Edison. None of these methods require the installation of any other software onto the Edison. If you can SSH into the Edison over wifi, then these methods will work.
###SCP###
SCP
, or secure copy, is probably the simplest method to move files to the Edison. If you are on Linux or OS X, it's as simple as opening a command prompt and typing
scp <file spec> <user@ip_address:destination-path>
For example if I'm in my home directory and I want to copy all .js
files to root's home directory on my Edison at 192.168.0.5
, then I would type:
daryl@host ~ $ scp *.js [email protected]:/home/root
You will be prompted for root's, or whatever user you are using, password on the Edison.
On windows you can use the exact same syntax if you have cygwin
installed, which is highly recommended for this kind of work. Or, if you prefer a more graphical interface that will allow you to drag and drop files then there are other clients such was WinSCP
.
###SSHFS###
For me, the best option is SSHFS
. SSHFS
mounts the remote directory structure in a local user space file system. SSHF
S allows you to view the remote file system using your local tools. For example, you can simple use cp
and mv
to copy and move files around in the local directory and SSHFS
will mirror those moves remotely for you using SCP
transparently.
Again, you only need ssh
access on the remote system. Only the host/desktop system needs to have sshfs
installed.
Most linux systems have this as part of their package management so to install it's a simple matter of calling the package manager such as apt-get
or yum
and installing the package.
apt-get install sshfs
On macs, it's also available in several of the package management systems, or, you can just download the packages from osxfuse, which might be simpler if you don't already have a package manager installed.
Once installed the packages work essentially the same in both Linux and OS X. The syntax is very similar to SCP
:
sshfs <user@ip_address:path> <local_path>
If my Edison is configured as above and I want to mount the root home file system on Edison into a local directory called fsroot
on my host machine, I would use the following commands.
daryl@host ~ $ mkdir fsroot
daryl@host ~ $ sshfs [email protected]:/home/root fsroot
That's it! The Edison files are now available in my home directory under fsroot. I can open them with an editor, write to them, save them, cross compile them, and they will be ready to execute on the Edison.
SSHFS
is available for windows, although, the package as a very low version number and is currently on hiatus, so, I really can't report on how stable it is. However, I can report that it does work. There isn't a command line option, you have a gui which allows you to assign a drive letter to the remote system. Other than that, the operation is identical. When you install the package it will ask you to install several DLLs including one that is named Dokan. Don't be alarmed, Dokan is an open source package that provides similar user space file system functionality as FUSE, which is what the OS X and Linux packages are based on.
These methods do not make use of the network to move files to the Edison. They will work, however, if for some reason you cannot connect to the Edison via wifi.
This seems that is should be a reasonable idea. Drag your files from your desktop over to the USB mounted flash drive on the Edison, then move over to the Edison, mount the partition, and copy them where they need to go.
So first, you can do it, second, it's a bit of a pain and there are better methods. The caveat is that the partition cannot be mounted both by your host computer and by the Edison, so you have to eject the drive from your desktop before you try to mount it on the Edison.
Over on the Intel forums, David J. Hunt describes a method which has you run multiple commands in order to mount and unmount the partition. This method did not work for me and resulted in the Edison rebooting. I've referenced it here for completeness, use at your own risk. In that same thread, however, mhahn states that a mount offset of 8192 should also work. His method worked for me, so here it is with a bit more detail:
Step by step:
- Copy the files on your host machine to the flash drive on the edison. I put them in a subdirectory to keep things neat but that's not strictly necessary.
- Eject the flash storage from you desktop and then unplug the USB cable that is connected to the flash storage connector. If you are connecting with a USB terminal, then obviously you need to keep the other USB cable plugged in.
- From your Edison console, you are going to mount the flash partition in some folder, the location doesn't matter, I created a folder called
flash
in the home directory. - Mount the flash partition
mmcblk0p9
under the directory that you just created - Copy the files from the mounted directory to their final destination.
- Unmount the flash partition.
Here are the commands for creating the directory and mounting the partition.
root@edison:~#mkdir flash
root@edison:~#mount -o offset=8192 /dev/mmcblk0p9 flash
Once you've moved the files then unmount the partition so that you don't run into problems when you reconnect your host machine.
root@edison:~#umount flash
It isn't necessary to delete the directory, but you might want to if you know that you won't use it again.
If you have the arduino board then you can simply mount a USB thumb drive in the rightmost USB port on the Edison. Copy your files to the USB drive on your host machine and then eject as above. Now, with the small switch pointing to the standard USB port, plug in your thumb drive and execute the following commands. Note: I'm using the same flash directory as above.
root@edison:~#mkdir flash
root@edison:~#mount /dev/sda1 flash
This assumes that the first partition on your thumbdrive is the one that you want, and, that the drive is assigned to /dev/sda
. For most people, this is probably the case. If you have other memory devices or multiple partitions this may not be true and you will need to reference the correct device. You can easily see which device your drive is assigned to by typing the dmesg
command and looking for the references to your USB drive. The output should look something like this:
[ 3168.237191] scsi2 : usb-storage 1-1:1.0
[ 3169.232119] scsi 2:0:0:0: Direct-Access PNY USB 2.0 FD 0.00 PQ: 0 ANSI: 4
[ 3169.234113] sd 2:0:0:0: Attached scsi generic sg0 type 0
[ 3169.235161] sd 2:0:0:0: [sda] 62529536 512-byte logical blocks: (32.0 GB/29.8 GiB)
[ 3169.236140] sd 2:0:0:0: [sda] Write Protect is off
[ 3169.236170] sd 2:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 3169.237037] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 3169.247055] sda: sda1 sda2 < sda5 > sda3
[ 3169.270967] sd 2:0:0:0: [sda] Attached SCSI removable disk
This output tells me that my device is on /dev/sda
and the second to last line tells me that I have four partitions. Most USB drives will probably only have a single partition, if you have more than one, just mount and unmount them in turn until you find the partition that has your files.
Don't forget to unmount the device before removing it from the Edison.
root@edison:~#umount flash
SSHFS
is my goto solution for this problem but I don't mind using SCP
if I just need to copy a few files. If I have to rely on sneaker net methods then I prefer using a USB drive. They are ubiquitous and I'd rather not monkey around too much with the flash system that Edison relies on to install new operating systems.
If you have comments, or, you need clarification, please use the comment system below.
Hi,
I have a question, I want to mount a Hard drive(2 TB) on intel edison. Is that possible?