Difference between revisions of "Quick Reference"

From wiki.emacinc.com
Jump to: navigation, search
Line 2: Line 2:
 
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.
 
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 ==
 
== Working With the Terminal ==
Use <code>minicom</code> to bring up a serial terminal.  To configure the serial console, run <code>minicom -s</code>. Select, <code>Save as dfl</code>, to save the settings you have configured to be the default settings whenever you run <code>minicom</code>.  Use <code>minicom -o</code> to start <code>minicom</code> more quickly; the <code>-o</code> option tells <code>minicom</code> to start without sending <code>AT</code> commands to initialize a modem.
+
Use <code>minicom</code> to bring up a serial terminal.  To configure the serial console, run <code>sudo minicom -s</code>. The settings needed for configuring <code>minicom</code> can be found [[EMAC_OE_Getting_Started_Guide|on this page]]. Select, <code>Save as dfl</code>, to save the settings you have configured to be the default settings whenever you run <code>minicom</code>.  Use <code>minicom -o</code> to start <code>minicom</code> more quickly; the <code>-o</code> option tells <code>minicom</code> to start without sending <code>AT</code> commands to initialize a modem.
 +
 
  
The settings needed for configuring <code>minicom</code> can be found [[EMAC_OE_Getting_Started_Guide|on this page]].
 
  
 
== Making Changes To The Target Machine's Fileystem ==
 
== 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:
 
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:
  
<syntaxhighlight lang=bash>
+
<syntaxhighlight lang=console>
 
root@emac-oe:~# mount -o remount,rw /</syntaxhighlight>
 
root@emac-oe:~# mount -o remount,rw /</syntaxhighlight>
  
 
To mount the filesystem as read-only again (without rebooting), type:
 
To mount the filesystem as read-only again (without rebooting), type:
  
<syntaxhighlight lang=bash>
+
<syntaxhighlight lang=console>
 
root@emac-oe:~# mount -o remount,ro /</syntaxhighlight>
 
root@emac-oe:~# mount -o remount,ro /</syntaxhighlight>
  
Line 33: Line 33:
 
1. Insert the SD, CF or microSD card or plug in the USB flash device to your EMAC OE machine.
 
1. Insert the SD, CF or microSD card or plug in the USB flash device to your EMAC OE machine.
 
* Wait a few seconds for the device to settle and be recognized by the OS.
 
* Wait a few seconds for the device to settle and be recognized by the OS.
* Run this command at at shell on your EMAC OE machine: <br clear=all> <syntaxhighlight lang=bash>root@emac-oe:~# dmesg | tail -n 15</syntaxhighlight>
+
* Run this command at at shell on your EMAC OE machine: <br clear=all> <syntaxhighlight lang=console>root@emac-oe:~# dmesg | tail -n 15</syntaxhighlight>
 
* Inspect the output. The output should look similar to the following:
 
* Inspect the output. The output should look similar to the following:
  
Line 68: Line 68:
 
Create a directory to use for the mountpoint:
 
Create a directory to use for the mountpoint:
  
<syntaxhighlight lang=bash>root@emac-oe:~# mkdir /mnt/myflash</syntaxhighlight>
+
<syntaxhighlight lang=console>root@emac-oe:~# mkdir /mnt/myflash</syntaxhighlight>
  
 
Alternatively, you can pick another place in the filesystem to use.  Just make sure you have permission to create a directory in that location.  If the directory contains files, it will still be used as the mountpoint when the ''mount'' command is issued; however, the files contained in the directory will be hidden for as long as the directory is in use as a mountpoint.  This could create a great deal of confusion, so beware this potential pitfall.
 
Alternatively, you can pick another place in the filesystem to use.  Just make sure you have permission to create a directory in that location.  If the directory contains files, it will still be used as the mountpoint when the ''mount'' command is issued; however, the files contained in the directory will be hidden for as long as the directory is in use as a mountpoint.  This could create a great deal of confusion, so beware this potential pitfall.
Line 77: Line 77:
 
Now that ''sda1'' has been determined to be the partition to mount and ''/mnt/myflash'' has been created to be used as the mountpoint, we can mount our flash device with the following command:
 
Now that ''sda1'' has been determined to be the partition to mount and ''/mnt/myflash'' has been created to be used as the mountpoint, we can mount our flash device with the following command:
  
<syntaxhighlight lang=bash>root@emac-oe:~# mount /dev/sda1 /mnt/myflash</syntaxhighlight>
+
<syntaxhighlight lang=console>root@emac-oe:~# mount /dev/sda1 /mnt/myflash</syntaxhighlight>
  
 
If no message is returned from the above command, then it succeeded.  To verify this, try the following command
 
If no message is returned from the above command, then it succeeded.  To verify this, try the following command
  
<syntaxhighlight lang=bash>root@emac-oe:~# mount | grep sda1</syntaxhighlight>
+
<syntaxhighlight lang=console>root@emac-oe:~# mount | grep sda1</syntaxhighlight>
  
 
You should see your device listed in the output of the above command.  If it is listed more than once, it may have been mounted automatically by the OS.  If so, inspection of the output should show you where it was mounted.
 
You should see your device listed in the output of the above command.  If it is listed more than once, it may have been mounted automatically by the OS.  If so, inspection of the output should show you where it was mounted.
Line 91: Line 91:
 
Continuing on with the example above, the device mounted above would be unmounted with the following command:
 
Continuing on with the example above, the device mounted above would be unmounted with the following command:
  
<syntaxhighlight lang=bash>root@emac-oe:~# umount /mnt/myflash</syntaxhighlight>
+
<syntaxhighlight lang=console>root@emac-oe:~# umount /mnt/myflash</syntaxhighlight>
  
 
If it was automounted elsewhere, it will also need to be unmounted from that mountpoint before it will be safe to remove the device.  For instance, if the automounter mounted it on ''/media/sda1'', then issue the following command:
 
If it was automounted elsewhere, it will also need to be unmounted from that mountpoint before it will be safe to remove the device.  For instance, if the automounter mounted it on ''/media/sda1'', then issue the following command:
<syntaxhighlight lang=bash>root@emac-oe:~# umount /media/sda1</syntaxhighlight>
+
<syntaxhighlight lang=console>root@emac-oe:~# umount /media/sda1</syntaxhighlight>
  
 
<br clear=all>{{mbox | typ=notice | text='''TIP''': The <code>sync</code> command can also be handy for ensuring data written to a device is flushed to disk prior to performing some other activity with the device.}}<br clear=all>
 
<br clear=all>{{mbox | typ=notice | text='''TIP''': The <code>sync</code> command can also be handy for ensuring data written to a device is flushed to disk prior to performing some other activity with the device.}}<br clear=all>

Revision as of 14:52, 18 November 2013

TODO: {{#todo:Polish (11.15.13-12:35->KY)|Klint Youngmeyer|oe 4,oe 5,ky,inprogress}}

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.


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.

  2. Determine which partition to mount.

  3. Determine where to mount the device.

  4. Mount the device.



Determining the Device Node Assigned to the Flash Device

The easiest way to determine which device node is assigned to a particular flash device is to inspect the output of the dmesg command shortly after the device has been connected to your machine. Follow these steps to do so:

  1. Insert the SD, CF or microSD card or plug in the USB flash device to your EMAC OE machine.

  2. Wait a few seconds for the device to settle and be recognized by the OS.

  3. Run this command at at shell on your EMAC OE machine:
    root@emac-oe:~# dmesg | tail -n 15
    
  4. Inspect the output. The output should look similar to the following:

    usb 2-2: new full speed USB device using at91_ohci and address 2
    usb 2-2: not running at top speed; connect to a high speed hub
    usb 2-2: configuration #1 chosen from 1 choice
    scsi0 : SCSI emulation for USB Mass Storage devices
    usb-storage: device found at 2
    usb-storage: waiting for device to settle before scanning
    scsi 0:0:0:0: Direct-Access              Patriot Memory   PMAP PQ: 0 ANSI: 4
    usb-storage: device scan complete
    sd 0:0:0:0: [sda] 15634432 512-byte hardware sectors: (8.00 GB/7.45 GiB)
    sd 0:0:0:0: [sda] Write Protect is off
    sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
    sd 0:0:0:0: [sda] Assuming drive cache: write through
    sd 0:0:0:0: [sda] Assuming drive cache: write through 
    sda: sda1
    sd 0:0:0:0: [sda] Attached SCSI removable disk
    

    Inside square brackets, we see sda. This is the root device node assigned to our flash device.

Determine Which Partition to Mount

On a line by itself, we see:

sda: sda1

This means one partition was found on our device: sda1. This is the partition we will use.



Determine Where to Mount the Device

Now that we know what device node we are going to mount, we need to determine where to mount it. The /mnt directory is typically used for this (mnt is short for mount).

Create a directory to use for the mountpoint:

root@emac-oe:~# mkdir /mnt/myflash

Alternatively, you can pick another place in the filesystem to use. Just make sure you have permission to create a directory in that location. If the directory contains files, it will still be used as the mountpoint when the mount command is issued; however, the files contained in the directory will be hidden for as long as the directory is in use as a mountpoint. This could create a great deal of confusion, so beware this potential pitfall.



Mount the Device

Now that sda1 has been determined to be the partition to mount and /mnt/myflash has been created to be used as the mountpoint, we can mount our flash device with the following command:

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

If no message is returned from the above command, then it succeeded. To verify this, try the following command

root@emac-oe:~# mount | grep sda1

You should see your device listed in the output of the above command. If it is listed more than once, it may have been mounted automatically by the OS. If so, inspection of the output should show you where it was mounted.



Unmounting the Filesystem After Use

After you are finished using the flash device, you may wish to unmount it (similar to "Safely Removing" a device on other operating systems). The umount command is used for this purpose.

Continuing on with the example above, the device mounted above would be unmounted with the following command:

root@emac-oe:~# umount /mnt/myflash

If it was automounted elsewhere, it will also need to be unmounted from that mountpoint before it will be safe to remove the device. For instance, if the automounter mounted it on /media/sda1, then issue the following command:

root@emac-oe:~# umount /media/sda1



See Also