Search by Tags

Linux Terminal and Basic Usage

 
 

Overview

In this how-to section, you will access the Linux terminal through the debug UART interface and learn basic useful Linux commands. In this module you will:

  • Power on your Computer on Module.
  • Use a serial terminal to communicate with the embedded system.
  • Be introduced to the Linux command-line interface.

Note: We will access the module using the Serial Terminal, therefore the USB keyboard and video interface connected to the module will not be used in this section.

Step 1

Open a terminal in the host machine:


  • Host terminal

    Host terminal

Step 2

Install a serial terminal emulator application in your host computer:

sudo apt-get install minicom

Step 3

To find out what is the serial port device that you must use, you can execute the command below:

ls -l /dev/serial/by-id

  • Serial devices available to the user space

    Serial devices available to the user space

Alternatively, use the command below. If in doubt: unplug the USB-Serial adapter --> execute the command --> plug the USB-Serial adapter --> execute the command again and find the new device listed.

ls -l /dev/tty*

  • System serial devices listed

    System serial devices listed

The new device listed, in this case /dev/ttyUSB0 is the USB-serial adapter. It will be required when you start the serial application.

Step 4

To start the serial application, the parameters must be correctly set. The table below presents them:

Parameter Value
Baud rate 115200
Data bits 8
Parity none
Stop bits 1

For instance, to use minicom you only need to adjust the serial port - the other parameters are correctly set by default. You might need to have administrator privilege to access the hardware. See the following steps to learn how to configure minicom.

Step 5

Start minicom configuration menu:

sudo minicom -s

You will see a menu such as in the figure below:


  • Serial terminal emulator configuration

    Serial terminal emulator configuration

Step 6

Press the "a" key from your keyboard to edit the Serial Device field. Use the device found in step 3 for your system. Press "Enter" to apply the configuration. Since many customers do not use hardware flow control, you might want to disable it by pressing the "f" key.


  • Serial terminal emulator configuration

    Serial terminal emulator configuration

Press "Enter" until you return to the previous menu.

Step 7

Save the setup as default:


  • Serial terminal emulator save setup

    Serial terminal emulator save setup

Step 8

Choose the "Exit" option and the terminal will be ready:


  • Serial terminal emulator configured

    Serial terminal emulator configured


  • Serial terminal emulator ready

    Serial terminal emulator ready

Note: To exit Minicom, press "ctrl+a" and then press "x".

Step 9

Power-on the embedded system. Messages will immediately start to be printed in the serial terminal. When the messages stop, a login prompt will be the last content printed to the terminal. You can press Enter to refresh the login prompt if any message is printed after it. To login, the default username is root and no password is required:


  • Login prompt

    Login prompt

Some modules will get a kernel panic error while updating from an image 2.7b3 or older to 2.74b4 or newer, it occurs because images 2.7b3 and older use EXT-3 for mouting the root file system, and starting with image 2.7b4, the root file system is mounted using EXT-4, to solve this problem, power-cycle the system and enter U-Boot command line by pressing any key, then reload the default U-Boot environment and save it, as presented in the commands below:

env default -a
saveenv
boot

Warning: If you have custom U-Boot variables set, please make sure to copy them before proceeding, since this will erase any custom variables.

Step 10

If you are new to Linux or the command-line interface and want to learn some basic commands, please read this article