Difference between revisions of "Quick Reference"

From wiki.emacinc.com
Jump to: navigation, search
m (Remote Access: Added tip.)
m (Added standard directory information.)
Line 117: Line 117:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
</cl>
 
</cl>
 +
 +
== Directories for Storing Files on a Machine==
 +
 +
'''Temporary Files:'''
 +
 +
The standard ramdisk on an EMAC OE machine, used for storing temporary files of any kind, is located in:
 +
 +
/var/volatile/
 +
 +
'''Executables:'''
 +
 +
There are two different directories commonly used for installing custom written software.  The directories listed here are given according to the Free Desktop Standard, which is a standard by which most Linux systems conform.
 +
 +
This first directory is the standard location for executables which were written for a specific, individual machine:
 +
 +
/usr/local/bin
 +
 +
The next directory is intended to be used for non-free (Company developed and owned) software:
 +
 +
/opt/''CompanyName''/bin
 +
 +
Since the ''CompanyName'' is specific to the company which produced the software, this directory will often also contain some other standard subdirectories:
 +
 +
/opt/''CompanyName''/etc/
 +
/opt/''CompanyName''/usr/
 +
/opt/''CompanyName''/lib/
 +
/opt/''CompanyName''/var/
 +
 +
'''Configuration Files:'''
 +
 +
Configuration files should either go in:
 +
 +
/etc/
 +
 +
Or, if a directory in <code>/opt/</code> was created, in:
 +
 +
/opt/''CompanyName''/etc/
 +
 +
'''Initialization Scripts:'''
 +
 +
Scripts which are used to automatically start a program on boot and, if needed, stop it on shutdown, should be located here:
 +
 +
/etc/init.d/
 +
 
==See Also==
 
==See Also==
  

Revision as of 01:00, 5 December 2013

TODO: {{#todo: Re-Review; Add More if Necessary (11.25.13-17:30->KY+);(11.26.13-21:25->MD+);(11.27.13-12:15->KY+)|Klint Youngmeyer|oe 4,oe 5,ky,review,md}}

This page is a quick reference guide or a "cheatsheet" to assist with the initial learning curve. Once full familiarity with the development environment is established, this quick reference will likely no longer be needed.

Working With the Terminal

Use minicom to bring up a serial terminal. To configure the serial console, run sudo minicom -s. The settings needed for configuring minicom can be found on this page. Select, Save as dfl, to save the settings you have configured to be the default settings whenever you run minicom. Use minicom -o to start minicom more quickly; the -o option tells minicom to start without sending AT commands to initialize a modem.

The dialout group, on many systems, will enable group members to use minicom without having to run it as root (without using sudo). To add your user account, such as employee, to the group, run this command as the root user:

$ adduser employee dialout

Editing a File

EMAC OE provides simple text editing capabilities for making changes to configuration files and scripts. Major editing tasks should be performed on a desktop system first, copying the desired files back to the target board. There are two text editors available on standard EMAC OE builds: vi and nano. vi is a very common text editor available on almost every Unix-like OS. nano is a more conventional text editor that can be easier to use for those not familiar with vi.

To edit a file with vi, run the command:

root@emac-oe:~# vi <filename>

To edit a file with nano, run the command:

root@emac-oe:~# nano <filename>

For a more detailed overview, see this page

Making Changes To The Target Machine's Fileystem

By default, the flash filesystem on most EMAC devices is mounted read-only. To make changes to the filesystem, it will have to be remounted as read-write. This can be done with the following command:

root@emac-oe:~# mount -o remount,rw /

To mount the filesystem as read-only again (without rebooting), type:

root@emac-oe:~# mount -o remount,ro /

Mounting a Flash Filesystem

There are four steps to mounting a flash filesystem on our EMAC OE machine:

  1. Determine which device node is assigned to the flash device.

    root@emac-oe:~# dmesg | tail -n 15
    
  2. Determine which partition to mount.

  3. Determine where to mount the device.

    root@emac-oe:~# mkdir /mnt/myflash
    
  4. Mount the device.

    root@emac-oe:~# mount /dev/sda1 /mnt/myflash
    



For detailed instructions, please see the Mounting a Flash Filesystem page.

Network Interfaces

The ifup and ifdown commands may be used to enable (or, respectively, disable) network interfaces based on interface definitions in the file /etc/network/interfaces.

An example of using the ifup command:

root@emac-oe:~# ifup eth0

An example of using the ifdown command:

root@emac-oe:~# ifdown eth0

To temporarily configure the eth0 interface to have a static IP address, 192.168.1.125, to use a DNS server at 192.168.1.25, and to use a gateway at 192.168.1.1:

root@emac-oe:~# ifconfig eth0 up 192.168.1.125 netmask 255.255.255.0
root@emac-oe:~# route add default gw 192.168.1.1
root@emac-oe:~# echo "nameserver 192.168.1.25" > /etc/resolv.conf

Remote Access

To access an EMAC product remotely, it is easiest to use ssh and scp for remote command execution and remote file transfer respectively.

To log into a system with the IP address 10.0.2.41, enter the following command:

developer@ldc:~# ssh root@10.0.2.41

To execute a command on a remote system without opening a shell on the remote system (in this example, ls -la):

developer@ldc:~# ssh root@10.0.2.41 'ls -la'

To send the file example.text to the /home directory of a system with the IP address 10.0.2.41, enter the following command:

developer@ldc:~# scp example.text root@10.0.2.41:/home

To send the file example.txt to the home directory of the user account you're using to connect to a remote machine located at machine.example.com, enter the following command:

developer@lds:~# scp example.txt root@machine.example.com:

Note the colon at the end with nothing following it. This also works with IP addresses.

Running a User Program

When a user program is uploaded, sometimes it does not have execute permissions. Use the following steps to ensure that your program functions properly.

  1. Navigate to the directory that the application was uploaded to (e.g. /tmp):

    root@emac-oe~:$ cd /tmp
    
  2. Make the application file executable:

    root@emac-oe~:$ chmod u+x <filename>
    
  3. Run the application:

    root@emac-oe~:$ ./<filename>
    

Directories for Storing Files on a Machine

Temporary Files:

The standard ramdisk on an EMAC OE machine, used for storing temporary files of any kind, is located in:

/var/volatile/

Executables:

There are two different directories commonly used for installing custom written software. The directories listed here are given according to the Free Desktop Standard, which is a standard by which most Linux systems conform.

This first directory is the standard location for executables which were written for a specific, individual machine:

/usr/local/bin

The next directory is intended to be used for non-free (Company developed and owned) software:

/opt/CompanyName/bin

Since the CompanyName is specific to the company which produced the software, this directory will often also contain some other standard subdirectories:

/opt/CompanyName/etc/
/opt/CompanyName/usr/
/opt/CompanyName/lib/
/opt/CompanyName/var/

Configuration Files:

Configuration files should either go in:

/etc/

Or, if a directory in /opt/ was created, in:

/opt/CompanyName/etc/

Initialization Scripts:

Scripts which are used to automatically start a program on boot and, if needed, stop it on shutdown, should be located here:

/etc/init.d/

See Also