← Back to HW choice

1. Introduction

In this section you will find all the intructions required to download, deploy and customize Open Enea Linux on Freescale’s TWR-P1025. You will start by downloading the OEL images and transferring then to a 2GB SD memory card. Once that is done, you will set up a serial connection so that you can talk to the board, and then you are going to start the Boot Loader from the NOR flash and then load Open Enea Linux Kernel and Device Tree. After that you are going to mount the File System that you have previously deployed in the SD card and then boot OEL on target. Once booted, you will configure OEL Package Manager, so that it points at OEL server, making hundreds of packages available to you, just one command away.

Once you have completed this section, move on to Develop, where you will find a set of videos and instructions that will take you from downloading OEL development tools to debugging your application on target.
 

2. Download OEL

Open a terminal and download Open Enea Linux images from our repositories:

$ mkdir ~/OpenEneaLinux/
$ cd ~/OpenEneaLinux
$ wget http://openenealinux.org/repo/images/p1025twr/uImage
$ wget http://openenealinux.org/repo/images/p1025twr/uImage-p1025twr_32b.dtb

 

3. DeployOEL

Time to deploy Open Enea Linux on target. We start from the beginning:
 

3.1 SD Card Partitioning

You will start by identifying the location of your SD card. Then you will create 2 partitions and format them to ext2. The first partition will contain the Kernel and Device Tree, and you will mount the file system in the second. Beware that we are using a 2GB SD card for this, if you are using a different size, you will need to adjust slightly some of the following instructions.

Connect your sd card to your computer using an SD adapter or a memory card reader. Find out the location of you SD card:

$ dmesg

[12163.585486] sd 9:0:0:4: [sdf] 3813376 512-byte logical blocks: (1.95 GB/1.81 GiB)
[12163.586796] sd 9:0:0:4: [sdf] No Caching mode page present
[12163.586807] sd 9:0:0:4: [sdf] Assuming drive cache: write through
[12163.588855] sd 9:0:0:4: [sdf] No Caching mode page present
[12163.588865] sd 9:0:0:4: [sdf] Assuming drive cache: write through
[12163.591533]  sdf: sdf1 sdf2
[12163.907520] EXT2-fs (sdf1): warning: mounting unchecked fs, running e2fsck is recommended
[12164.072498] EXT2-fs (sdf2): warning: mounting unchecked fs, running e2fsck is recommended

In our case it is in /dev/sdf.

Let’s open fdisk for command line disk partitioning functionality (command m for help):

$ sudo fdisk /dev/sdf
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Print (command p) existing partitions:

Command (m for help): p

Disk /dev/sdf: 1952 MB, 1952448512 bytes
61 heads, 62 sectors/track, 1008 cylinders, total 3813376 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00072d5b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1            2048      104447       51200   83  Linux
/dev/sdf2          104448     3813375     1854464   83  Linux

Now delete (command d) all existing partitions (in our case we have 2, so we delete them both):

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2

Double check that all partitions are deleted:

Command (m for help): p

Disk /dev/sdf: 1952 MB, 1952448512 bytes
61 heads, 62 sectors/track, 1008 cylinders, total 3813376 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00072d5b

   Device Boot      Start         End      Blocks   Id  System

Create (command n) 2 new partitions:

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
Using default value 1
First sector (2048-3813375, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3813375, default 3813375): +50M

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (1-4, default 2): 
Using default value 2
First sector (104448-3813375, default 104448): 
Using default value 104448
Last sector, +sectors or +size{K,M,G} (104448-3813375, default 3813375): 
Using default value 3813375

Double check partitions have been created correctly:

Command (m for help): p    
Disk /dev/sdf: 1952 MB, 1952448512 bytes
61 heads, 62 sectors/track, 1008 cylinders, total 3813376 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00072d5b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1            2048      104447       51200   83  Linux
/dev/sdf2          104448     3813375     1854464   83  Linux

Write table to disk (command w) and exit:

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Unmount before formatting the partitions (Note unique names created by Fdisk):

$ sudo umount /media/[fdisk_partition_id1]
$ sudo umount /media/[fdisk_partition_id2]

Format both partitions to ext2:

$ sudo mkfs.ext2 /dev/sdf1
$ sudo mkfs.ext2 /dev/sdf2

 

3.2 Image Transfer

Mount Partition 1:

$ sudo mount /dev/sdf1 /mnt/

Copy Kernel and Device Tree to Partition 1:

$ cd ~/OpenEneaLinux
$ sudo cp uImage /mnt
$ sudo cp uImage-p1025twr_32b.dtb /mnt/uImage.dtb

Do not forget to sync and unmount:

$ sync
$ sudo umount /mnt

Now copy File System image to Partition 2 (/dev/sdf2). Be patient, it takes a while:

$ sudo mount /dev/sdf2 /mnt/
$ wget http://openenealinux.org/repo/images/p1025twr/core-image-minimal-p1025twr.tar.gz
$ sudo tar xzvf core-image-minimal-p1025twr.tar.gz -C /mnt

Sync and unmount again:

$ sync
$ sudo umount /mnt

 

3.3 Serial Connection

We will use Minicom (text-based serial port communications program) to talk to our TWR-P1025. Install it first (alternatively you can get it via the Synaptic Package Manager):

$ sudo apt-get install minicom

Connect the target to the host via the mini-B USB connection (the board comes with a USB-A to Mini-B cable for this purpose). In order to find the name of your port(s) enter this command in terminal:

$ dmesg | grep tty

And the output should be something like this:

[   22.587279] console [tty0] enabled
[   24.186230] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[   24.186860] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[   51.598012] audit(1243322582.732:2): type=1503 operation="inode_permission"
requested_mask="a::" denied_mask="a::" name="/dev/tty" pid=5705 profile="/usr
/sbin/cupsd" namespace="default"

What we are interested in is the name of the serial port, in this case ttyS0, which we will need in order to use Minicom. Start Minicom configuration:

$ sudo minicom -s

‘-s’ is for setup and we need to set up port speed, parity and a few other items. This may edit the system-wide defaults in /etc/mini‐com/minirc.dfl with this option. A menu will now be displayed:

+-----[configuration]------+
| Filenames and paths      |
| File transfer protocols  |
| Serial port setup        |
| Modem and dialing        |
| Screen and keyboard      |
| Save setup as dfl        |
| Save setup as..          |
| Exit                     |
| Exit from Minicom        |
+--------------------------+

Configure the following:
-Serial Setup: Select correct serial device (in this case ttyS0); Hardware & Software Flow control = No; Bps = 115200
-Modem & dialing: Delete text for the following: Init String, Reset String, Hang-up String, No flow control

Leave Minicom open, since you are going to need it for the next step (to exit Minicom when in terminal mode press ‘Ctrl-A’ to get a message bar at the bottom of the terminal window and then press ‘X’).
 

3.4 Boot Loader

Now you are going to start u-boot from the NOR flash and then load Open Enea Linux Kernel and Device Tree. After that you are going to mount the File System that you have previously deployed in the SD card.

Power on board and see the console prompt in Minicom. Get to u-boot command prompt by interrumpting the initial boot process (follow verbouse instructions).


...

PCIe1: Root Complex of mini PCIe SLOT, no link, regs @ 0xffe0a000
PCIe1: Bus 00 - 00
PCIe2: Root Complex of TWR-ELEV PCIe SLOT, no link, regs @ 0xffe09000
PCIe2: Bus 01 - 01
In:    serial
Out:   serial
Err:   serial
Net:   eTSEC1 [PRIME], eTSEC3
Hit any key to stop autoboot:  0
=>

Once in there do the following (loading uImage takes a couple of minutes):

=> mmc part
=> ext2load mmc 0:1 0x1000000 uImage
=> ext2load mmc 0:1 0x800000 uImage.dtb
=> setenv bootargs root=/dev/mmcblk0p2 rootfstype=ext2 rw init=/sbin/init rootdelay=3 console=ttyS0,115200

If you are certain you want your u-boot to always use this set up, go ahead and run “saveenv“. However, we recommend you to take that step only if you know what you are doing.

Time to boot Open Enea Linux!

=> bootm 0x1000000 - 0x800000

Once it’s booted, loin as root and do not forget to change your password:

oel login: root
# passwd

 

3.5 Network Interface

Connect the board to the network using a standard Ethernet cable (if you want to connect the TWR-P1025 directly to your computer you will need an Ethernet Crossover cable). The following instructions assume that the Ethernet cable is plugged into eth1 (the bottom ethernet port):

# ifconfig eth1 up 
# dhclient -v eth1
# ifconfig

 

3.6 Package Manager

Now it is time to customize your board with the packages you need. Let’s start by setting up the Package Manager and make it point to Open Enea Linux repository:

# smart channel -y --add all type=rpm-md baseurl=http://www.openenealinux.org/repo/rpm/all
# smart channel -y --add ppce500v2 type=rpm-md baseurl=http://www.openenealinux.org/repo/rpm/ppce500v2
# smart channel -y --add p1025twr type=rpm-md baseurl=http://www.openenealinux.org/repo/rpm/p1025twr

Now update Package Manager metadata using this command:

# smart update

You are all set! Ready to choose and pick what you need for your development!

Search through hundreds of packages:

# smart search '*'

Not familiar with Smart? Find out more about this package manager here.
 

3.7 Customize your Distro

Let’s say you need to be able to ssh you board. It is this simple!

# smart install openssh

 

4. Develop

Go to Develop and find out how you can use Open Enea Linux set of Open Source tools to develop and debug your application!

→ Go to Develop
↑ Go up