Getting Started Guide for DM8168 Z3 RPS: Difference between revisions

From RidgeRun Developer Wiki
No edit summary
(31 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= Introduction =
= Introduction =
On this page you are going to find all the necessary information to start from scratch to use the RidgeRun SDK on your DM8168 Z3 module. In the following sections we assume that you have already downloaded the [http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/5_05_01_04/index_FDS.html EZSDK] version 5.05.01.04 and that you have installed the [https://www.ridgerun.com/developer/wiki/index.php/Code_Sourcery_ARM_toolchain_2009q1-203  toolchain 2009q1-203] from [http://www.codesourcery.com/sgpp/lite/arm/portal/package4573/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi.bin codesourcery] as well as your DM8168 SDK following the steps on [[RidgeRun 2011Q2 SDK User Guide#Installation | The RidgeRun installation guide]].


The first section of this guide shows you how to install the EZSDK for DM8168 on your computer and how to configure a TFTP and NFS server. Subsequently, the second section contains instructions about how to configure the RidgeRun's SDK to create a SD card with all software components (uboot, kernel and filesystem) needed to boot to Linux Shell in your Z3 hardware. Using this SD card in the third and fourth section of this guide, you will be able to install on NAND images created by the SDK for kernel, uboot as well as your filesystem (JFFS2, UBI, NFS are available). Using the SD card created on the second section to flash the SDK in your module is just an option because you could try to use the installer of the RidgeRun's SDK with the uboot version that is running by default in a new Z3 module, however, we cannot guaranty that it will work as we expect, hence, we recommend to use the SD card instead. Additionally, how to run opemax demos to encode and decode 1080p/h264 videos and some usefult pipelines using gstreamer + openMax to do live view, take snapshots and RTSP streaming are shown. The last section of this page contains useful information about two new commands added by RidgeRun in uboot in order to handle tarballs and do copies from NAND to NAND.
On this page you are going to find all the necessary information to start from scratch to use the RidgeRun SDK on your DM8168 Z3 module. In the following sections we assume that you have already downloaded the [http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/5_05_02_00/index_FDS.html EZSDK] version 5.05.02.00 and that you have installed the [https://www.ridgerun.com/developer/wiki/index.php/Code_Sourcery_ARM_toolchain_2009q1-203 toolchain 2009q1-203] from [http://www.codesourcery.com/sgpp/lite/arm/portal/package4573/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi.bin codesourcery] as well as your DM8168 SDK following the steps on [[RidgeRun 2011Q2 SDK User Guide#Installation|The RidgeRun installation guide]].  


On the rest of this document, we refer as $(DEVDIR) to the path where the RidgeRun SDK for DM8168 is installed
The first section of this guide shows you how to install the EZSDK for DM8168 on your computer and how to configure a TFTP and NFS server. Subsequently, the second section contains instructions about how to configure the RidgeRun's SDK to create a SD card with all software components (uboot, kernel and filesystem) needed to boot to Linux Shell in your Z3 hardware. Using this SD card in the third and fourth section of this guide, you will be able to install on NAND images created by the SDK for kernel, uboot as well as your filesystem (JFFS2, UBI, NFS are available). Using the SD card created on the second section to flash the SDK in your module is just an option because you could try to use the installer of the RidgeRun's SDK with the uboot version that is running by default in a new Z3 module, however, we cannot guaranty that it will work as we expect, hence, we recommend to use the SD card instead. Furthermore we describe how to enable the Graphics SDK support on the Professional SDK. Additionally, how to run opemax demos to encode and decode 1080p/h264 videos and some usefult pipelines using gstreamer + openMax to do live view, take snapshots and RTSP streaming are shown. The last section of this page contains useful information about two new commands added by RidgeRun in uboot in order to handle tarballs and do copies from NAND to NAND.


= Basic preliminary work =
On the rest of this document, we refer as $(DEVDIR) to the path where the RidgeRun SDK for DM8168 is installed
== Installing the EZSDK ==
 
1. Set the ezsdk binary as executable and set correct permissions  
= Basic preliminary work =
<pre style="background:#d6e4f1">
 
sudo chmod 777 ezsdk_dm816x-evm_5_05_01_04_setuplinux
== Installing the EZSDK ==
</pre>
 
2. Install EZSDK. For ubuntu versions different than Ubuntu 11.04 64-bit you will need to add the --forcehost argument to install it:
1. Set the ezsdk binary as executable and set correct permissions, by default the EZSDK is used in its default patch (your home directory), optionally you can install it /usr/local/
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1"> sudo chmod 777 ezsdk_dm816x-evm_5_05_02_00_setuplinux
./ezsdk_dm816x-evm_5_05_01_04_setuplinux --forcehost
</pre>  
</pre>
2. Install EZSDK. For ubuntu versions different than Ubuntu 11.04 64-bit you will need to add the --forcehost argument to install it:  
'''note:''' During the EZSDK installation process you will be asked for the toolchain's path, assuming that you installed it on /opt, the path that you need to provide is /opt/codesourcery/arm-2009q1/bin/
<pre style="background:#d6e4f1"> ./ezsdk_dm816x-evm_5_05_02_00_setuplinux --forcehost
</pre>  
'''note:''' During the EZSDK installation process you will be asked for the toolchain's path, assuming that you installed it on /opt, the path that you need to provide is /opt/codesourcery/arm-2009q1/bin/  


==Setting up serial access to the Linux console==
== Configuring the bsp/mach symbolic link for Eval-SDK  ==
You use the serial port to control u-boot and Linux.  The picocom terminal emulator work well for this purpose.
::[[Setting up Picocom - Ubuntu]]


==Setting up a TFTP server==
The evaluation SDK for DM8168 supports Z3 and EVM platforms into the same SDK, so for choose one of them is necessary to run the next lines.
If you are planning to use the SDK's installer to install images generated by the SDK in NAND, installing a TFTP server you will speed up downloads to the target hardware by using TFTP.
<pre> # For an totally clean SDK #
::[[Setting Up A Tftp Service]]
    make config
    make coreconfig
    make
</pre>
The coreconfig target will show the following option where you have to choice the mach-dm8168-z3:  


==Setting up an NFS server==
    Selecting machine/board:
For application development, it is convenient to use root NFS mount file system for the target hardware. This allows you to rebuild your application on the host and immediately run the application on the target hardware with no interveining steps.  You host PC needs to be configured as a NFS server for this in order to work properly.  
    1. mach-dm8168-z3
::[[Setting Up A NFS Service]]
    2. mach-dm8168-tievm


= Booting from a SD card =
== OPTIONAL: Installing AAC encoder and MP3 Decoder  ==
== Setting up your Z3 module to boot from SD card ==
In order to boot from a SD card you need to set the MMC as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the header called J20 in your Z3 module (see Fig. 1)
[[Image:Z3SDboot.jpg|400px|thumb|center|Figure 1. Header to control boot mode (SD card)‎]]


<div style="text-align: center; ">'''Figure 1'''. Header to control boot mode (SD card)</div>
The DM81xx platforms have the ability to encode AAC-LC and decode MP3 on the DSP using openMax+gstreamer, however, these codecs are not in the EZSDK by default. The Ridgerun SDK for the DM8148/DM8168 has internal logic to integrate these codecs and generate a new DSP firmware if these codecs are installed properly in your host computer. This new DSP firmware will be automatically loaded by into the DSP during boot time.


<pre>
1. Download the AAC-LC encoder from TI Web page, this is called [http://software-dl.ti.com/dsps/dsps_public_sw/codecs/C674X_Audio_Codecs/01_00_001/index_FDS.html AAC LC Encoder, Version 01.00.01.00]
1   |  2  |  3  |  4  |  5  |  6  |  7  |  8  |
|short | open | open | open | open | open | open | open |
</pre>


== Configuring SDK to deploy firmware to a SD card==
2. Download the MP3 decoder from TI Web page, this is called [http://software-dl.ti.com/dsps/dsps_public_sw/codecs/C674X_Audio_Codecs/01_00_001/index_FDS.html MP3 Decoder, Version 1.41.00.00]
This section describes how to configure the DM8168's SDK to deploy all basic firmware components (kernel, uboot and MLO) into a bootable SD card. The RidgeRun SDK support several filesystem types (JFFS2, UBIFS, NFS, etc) however in this case we are going to use it on the SD card as well.


1. Set your environment variables
3. Install the AAC-LC encoder inside of your EZSDK directory, i.e, your destination directory must be something like /home/&lt;user&gt;/ti-ezsdk_dm816x-evm_5_05_02_00/component-sources/c674x_aaclcenc_01_00_01_00_elf
<pre style="background:#d6e4f1">
<pre style="background: none repeat scroll 0% 0% rgb(214, 228, 241);"> sudo chmod 777 c674x_aaclcenc_01_00_01_00_elf.bin
  cd $(DEVDIR)
./c674x_aaclcenc_01_00_01_00_elf.bin
`make env`
</pre>
</pre>
4. Install the MP3 decoder inside of your EZSDK directory, i.e, your destination directory must be something like /home/&lt;user&gt;/ti-ezsdk_dm816x-evm_5_05_02_00/component-sources/c674x_mp3dec_01_41_00_00_elf
<pre style="background: none repeat scroll 0% 0% rgb(214, 228, 241);"> sudo chmod 777 c674x_mp3dec_01_41_00_00_elf.bin
./c674x_mp3dec_01_41_00_00_elf.bin
</pre>
5. Open a make config menu and select the '''Support external AAC and MP3 audio codecs option''' over the '''Proprietary software category.'''
<pre style="background: none repeat scroll 0% 0% rgb(214, 228, 241);"> cd &lt;pathOfYourDevdir&gt;
`make env`
make config
</pre>  
[[Image:DM81xxAudio.png|thumb|center|400px]]
<div style="text-align: center;">Optional selection of external AAC and MP3 audio codecs support </div>
''note'': If you built your SDK before to enable the audio support you need to remove the EZSDK tarball that were generated by the SDK in /opt/ridgerun/downloads thus the SDK will generate a new one including the audio codecs.


2. Open a make config menu
== Setting up serial access to the Linux console ==
<pre style="background:#d6e4f1">
  make config
</pre>


running make config your SDK is going to download all basic packages needed by the SDK build system.
You use the serial port to control u-boot and Linux. The picocom terminal emulator work well for this purpose.  


'''note:''' If your SDK has problems downloading some package please [http://www.ridgerun.com/index.php/contact-us.html contact us]
::[[Setting up Picocom - Ubuntu]]


3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.2
== Setting up a TFTP server  ==
[[Image:InstallerMenuDM8168.png|400px|thumb|center|Figure 2. Installer configuration to deploy firmware to an SD card‎]]


<div style="text-align: center; ">'''Figure 2'''. Installer configuration to deploy firmware to an SD card</div>
If you are planning to use the SDK's installer to install images generated by the SDK in NAND, installing a TFTP server you will speed up downloads to the target hardware by using TFTP.


Using the ''Firmware deployment mode'' submenu you can set how to deploy your kernel, uboot and filesystem image into your target board. There are three options in this submenu: ''Attached board on communication port'', ''Deploy all the firmware to an SD card'' and ''Create an SD card installer for flash memory''.
::[[Setting Up A Tftp Service]]
*'''Attached board on communication port''' will allow you to send images to your target board using a serial port or a TFTP server, more details about this option are explained in the next section.
*'''Deploy all the firmware to an SD card''' tells to the installer that it must create the needed partitions on a SD card located in ''SD device on Linux host'' (please be sure that the option called '' Flash SD card image into loopback file instead of real SD'' is not selected) and that it have to install there the software's images generated by the SDK.
*'''Create an SD card installer for flash memory''' is going to create and SD card with all the logic and software's images needed to flash your NAND from the SD card.


== Setting up an NFS server  ==


4. Go to File System Configuration submenu and configure your filesystem as is shown in Fig.3
For application development, it is convenient to use root NFS mount file system for the target hardware. This allows you to rebuild your application on the host and immediately run the application on the target hardware with no interveining steps. You host PC needs to be configured as a NFS server for this in order to work properly.  
[[Image:FSC.png|400px|thumb|center|Figure 3. File system configuration to use it on the SD‎]]


<div style="text-align: center; ">'''Figure 3'''. File system configuration to use it on the SD‎</div>
::[[Setting Up A NFS Service]]


5. Compile your SDK
= Booting from a SD card =
<pre style="background:#d6e4f1">
  make
</pre>


== Installing SDK's firmware to a SD card ==
== Setting up your Z3 module to boot from SD card ==
Once you have built your SDK, you need to install it on the SD card running make install, but before to issue this command you need to unmount your SD card, otherwise the SDK won't let you install it (in order to avoid to erase information in some of your hard disks). Let's suppose that the environment variable called $(SDNAME) contains your mount point's name.


<pre style="background:#d6e4f1">
In order to boot from a SD card you need to set the MMC as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the header called J20 in your Z3 module (see Fig. 1) [[Image:Z3SDboot.jpg|thumb|center|400px|Z3SDboot.jpg]]
umount /media/$(SDNAME)
<div style="text-align: center;">'''Figure 1'''. Header to control boot mode (SD card)</div> <pre>|  1  |  2  |  3  |  4  |  5  |  6  |  7  | 8  |
  cd $(DEVDIR)
|short | open | open | open | open | open | open | open |
make install
</pre>
</pre>


you will be asked to confirm the device that you are going to partition and format, please enter ''yes'' if it is correct. After this, the SDK will start to create a bootable SD card
'''Note''': Some micro SD cards used with adapters may not work, we advise to use a regular SD card instead.


Now you are ready to test your SDK booting from a SD card. Two partitions were created by the SDK: ''boot partition'' which contains the kernel, uboot and MLO image and the ''rootfs partition'' with your file system. It's important to notice that the environment of uboot is located in a *.txt file in the partition called ''boot'', which allows you to modify it easily.
== Configuring SDK to deploy firmware to a SD card ==


= Booting from NAND =
This section describes how to configure the DM8168's SDK to deploy all basic firmware components (kernel, uboot and MLO) into a bootable SD card. The RidgeRun SDK support several filesystem types (JFFS2, UBIFS, NFS, etc) however in this case we are going to use it on the SD card as well.  
This section describes how to configure the DM8168's SDK to install the SDK's firmware in NAND as well as how to set up your Z3 module to boot from NAND. First, we are going to start flashing uboot in NAND using the SD card created in the above section, once uboot is running properly from NAND, we can start installing the kernel and finally your filesystem.


== Configuring SDK to install firmware in NAND ==
1. Set your environment variables
<pre style="background:#d6e4f1">  cd $DEVDIR
`make env`
</pre>
2. Open a make config menu
<pre style="background:#d6e4f1"> make config
</pre>
running make config your SDK is going to download all basic packages needed by the SDK build system.


1. Set your environment variables
'''note:''' If your SDK has problems downloading some package please [http://www.ridgerun.com/index.php/contact-us.html contact us]
<pre style="background:#d6e4f1">
cd $(DEVDIR)
`make env`
</pre>


2. Open a make config menu
3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.2 [[Image:InstallerMenuDM8168.png|thumb|center|400px|InstallerMenuDM8168.png]]
<pre style="background:#d6e4f1">
<div style="text-align: center;">'''Figure 2'''. Installer configuration to deploy firmware to an SD card</div>  
make config
Using the ''Firmware deployment mode'' submenu you can set how to deploy your kernel, uboot and filesystem image into your target board. There are three options in this submenu: ''Attached board on communication port'', ''Deploy all the firmware to an SD card'' and ''Create an SD card installer for flash memory''.
</pre>


3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.4
*'''Attached board on communication port''' will allow you to send images to your target board using a serial port or a TFTP server, more details about this option are explained in the next section.  
[[Image:InstallerMenuAttachedMethod.png|400px|thumb|center|Figure 4. Installer configuration to deploy firmware in NAND‎]]
*'''Deploy all the firmware to an SD card''' tells to the installer that it must create the needed partitions on a SD card located in ''SD device on Linux host'' (please be sure that the option called ''Flash SD card image into loopback file instead of real SD'' is not selected) and that it have to install there the software's images generated by the SDK.  
*'''Create an SD card installer for flash memory''' is going to create and SD card with all the logic and software's images needed to flash your NAND from the SD card.


<div style="text-align: center; ">'''Figure 4'''. Installer configuration to deploy firmware in NAND</div>
<br> 4. Go to File System Configuration submenu and configure your filesystem as is shown in Fig.3 [[Image:FSC.png|thumb|center|400px|FSC.png]]
<div style="text-align: center;">'''Figure 3'''. File system configuration to use it on the SD‎</div>  
5. Compile your SDK
<pre style="background:#d6e4f1"> make
</pre>
== Installing SDK's firmware to a SD card  ==


Once you have built your SDK, you need to install it on the SD card running make install, but before to issue this command you need to unmount your SD card, otherwise the SDK won't let you install it (in order to avoid to erase information in some of your hard disks). Let's suppose that the environment variable called $SDNAME contains your mount point's name (Normally if you press tab after umount /media/ it will complete it with you SD card name, if you have problems to find the name you can use commands like "df" or "mount" to verify it).
<pre style="background:#d6e4f1"> umount /media/$(SDNAME)
cd $(DEVDIR)
make install
</pre>
you will be asked to confirm the device that you are going to partition and format, please enter ''yes'' if it is correct. After this, the SDK will start to create a bootable SD card


In this case, you must use the ''Attached board on communication port'' method, this will allow you to install all your firmware directly in nand by means of a serial port or by ethernet using a TFTP server. Here we are going to use a TFTP server and telnet as our communication method with the target board.  
Now you are ready to test your SDK booting from a SD card. Two partitions were created by the SDK: ''boot partition'' which contains the kernel, uboot and MLO image and the ''rootfs partition'' with your file system. It's important to notice that the environment of uboot is located in a *.txt file in the partition called ''boot'', which allows you to modify it easily.  


= Booting from NAND  =


3.1 Go to the ''Communication method with the target board'' and select ''Telnet-serial adaptor''
This section describes how to configure the DM8168's SDK to install the SDK's firmware in NAND as well as how to set up your Z3 module to boot from NAND. First, we are going to start flashing uboot in NAND using the SD card created in the above section, once uboot is running properly from NAND, we can start installing the kernel and finally your filesystem.


3.2 Configure the protocol to transfer images as TFTP
== Configuring SDK to install firmware in NAND  ==


3.3 Set the IP address of your host machine in ''IP address of telnet-serial adaptor''
1. Set your environment variables
<pre style="background:#d6e4f1"> cd $(DEVDIR)
`make env`
</pre>
2. Open a make config menu
<pre style="background:#d6e4f1"> make config
</pre>
3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.4 [[Image:InstallerMenuAttachedMethod.png|thumb|center|400px|InstallerMenuAttachedMethod.png]]
<div style="text-align: center;">'''Figure 4'''. Installer configuration to deploy firmware in NAND</div>
<br> In this case, you must use the ''Attached board on communication port'' method, this will allow you to install all your firmware directly in nand by means of a serial port or by ethernet using a TFTP server. Here we are going to use a TFTP server and telnet as our communication method with the target board.


3.4 Set the port number that you assigned in the telnet configuration file to the serial port where your Z3 module is connected in ''Network port of telnet-serial adaptor''
<br> 3.1 Go to the ''Communication method with the target board'' and select ''Telnet-serial adaptor''  


4. Close the make config menu and save your changes.
3.2 Configure the protocol to transfer images as TFTP


== Configuring your Filesystem type ==
3.3 Set the IP address of your host machine in ''IP address of telnet-serial adaptor''


The RidgeRun SDK for DM8168 Z3 RPS supports different filesystem types: UBI, JFFS, NFS and also as we mentioned before you can use it in your SD card as well. In this tutorial we are going to use UBI as our default filesystem.
3.4 Set the port number that you assigned in the telnet configuration file to the serial port where your Z3 module is connected in ''Network port of telnet-serial adaptor''


1. Set your environment variables
4. Close the make config menu and save your changes.
<pre style="background:#d6e4f1">
cd $(DEVDIR)
`make env`
</pre>


2. Open a make config menu
== Configuring your Filesystem type ==
<pre style="background:#d6e4f1">
  make config
</pre>


3. Go to the ''File System Configuration->File system image target'' and choose UBIFS volume. Please be sure that UBIFS sub-page size is set to 512.
The RidgeRun SDK for DM8168 Z3 RPS supports different filesystem types: UBIFS, JFFS, NFS and also as we mentioned before you can use it in your SD card as well. In this tutorial we are going to use UBI as our default filesystem.  


4. Save your changes and compile your SDK
1. Set your environment variables
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1"> cd $(DEVDIR)
  make
  `make env`
</pre>
</pre>
2. Open a make config menu
<pre style="background:#d6e4f1"> make config
</pre>  
3. Go to the ''File System Configuration-&gt;File system image target'' and choose UBIFS volume. Please be sure that UBIFS sub-page size is set to 512.


==Flashing uboot, kernel and filesystem in NAND==
4. Save your changes and compile your SDK
<pre style="background:#d6e4f1"> make
</pre>
== Flashing uboot, kernel and filesystem in NAND ==


1.Boot the RidgeRun SDK using the SD card created in the [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168#Booting_from_a_SD_card first section] of this guide and stop the uboot countdown. Close your Picocom, minicom or telnet session.
1.Boot the RidgeRun SDK using the SD card created in the [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168#Booting_from_a_SD_card first section] of this guide and stop the uboot countdown. Close your Picocom, minicom or telnet session.  
<pre style="background:#FFFFC0">
<pre style="background:#FFFFC0">U-Boot 2010.06-dirty (Nov 20 2012 - 15:57:54)
U-Boot 2010.06 (Oct 05 2011 - 13:19:40)


DRAM:  1 GiB
DRAM:  1 GiB
Line 161: Line 178:


Hit any key to stop autoboot:  0  
Hit any key to stop autoboot:  0  
mmc1 is available
mmc0 is available
reading u-boot.bin
reading u-boot.bin


181324 bytes read
181500 bytes read
## Starting application at 0x80800000 ...
## Starting application at 0x80800000 ...




U-Boot 2010.06 (Oct 05 2011 - 13:20:03)
U-Boot 2010.06-dirty (Nov 20 2012 - 16:14:20)


TI8168-GP rev 1.1
TI8168-GP rev 2.0


ARM clk: 987MHz
ARM clk: 987MHz
Line 177: Line 194:
I2C:  ready
I2C:  ready
DRAM:  1 GiB
DRAM:  1 GiB
NAND:  256 MiB
NAND:  HW ECC BCH8 Selected
256 MiB
*** Warning - booting from SD, using default environment
*** Warning - booting from SD, using default environment


Net:  <ethaddr> not set. Reading from E-fuse
Net:  &lt;ethaddr&gt; not set. Reading from E-fuse
Detected MACID:64:7b:d4:62:e2:22
Detected MACID:40:5f:c2:69:c7:5c
Ethernet PHY: GENERIC (x001cc914) @ 0x01
Ethernet PHY: GENERIC (x001cc914) @ 0x01
DaVinci EMAC
DaVinci EMAC
Hit any key to stop autoboot:  0  
Hit any key to stop autoboot:  0  
Z3-DM8168-MOD#
Z3-DM8168-MOD#  


</pre>
2.Run make installbootloader to install uboot in NAND
<pre style="background:#d6e4f1">
make installbootloader
</pre>


There is a known issue running the make installbootloader command when your Z3 module is initially running uboot from a SD card, in this case you will see the following error once the installer has flashed your uboot in NAND:
</pre>
<pre style="background:#FFFFC0">
2.Run make installbootloader to install uboot in NAND
  Ridgerun Linux SDK
<pre style="background:#d6e4f1"> make installbootloader
</pre>
There is a known issue running the make installbootloader command when your Z3 module is initially running uboot from a SD card, in this case you will see the following error once the installer has flashed your uboot in NAND:  
<pre style="background:#FFFFC0"> Ridgerun Linux SDK
   Board configuration: DM8168 Z3 Module
   Board configuration: DM8168 Z3 Module
   Multi-core machine, using 6 out of 8 cores for building
   Multi-core machine, using 6 out of 8 cores for building
   
   
   Installation system of uboot images over TFTP for host <yourIPaddress>
   Installation system of uboot images over TFTP for host &lt;yourIPaddress&gt;
   Be sure u-boot is running on <yourIpAddress>:<yourTelnetPort> and no process (like termnet) is using it
   Be sure u-boot is running on &lt;yourIpAddress&gt;:&lt;yourTelnetPort&gt; and no process (like termnet) is using it
   Press return to continue...
   Press return to continue...


Line 209: Line 225:


   Loading upgrade bootloader...
   Loading upgrade bootloader...
     Uboot <= setenv bootcmd
     Uboot &lt;= setenv bootcmd
     Uboot <= saveenv
     Uboot &lt;= saveenv
   Configuring the network...
   Configuring the network...
     Uboot <= setenv autoload no
     Uboot &lt;= setenv autoload no
     Uboot <= dhcp
     Uboot &lt;= dhcp
     Uboot <= setenv serverip <yourTFTPServerIP>
     Uboot &lt;= setenv serverip &lt;yourTFTPServerIP&gt;
     Uboot <= setenv autostart no
     Uboot &lt;= setenv autostart no
     cp -f $(DEVDIR)/images/bootloader /srv/tftp/bootloader.$(USER).$(DEVDIRNAME).dm8168
     cp -f $(DEVDIR)/images/bootloader /srv/tftp/bootloader.$(USER).$(DEVDIRNAME).dm8168
     Uboot <= tftp 0x82000000 bootloader.$(USER).$(DEVDIRNAME).dm8168
     Uboot &lt;= tftp 0x82000000 bootloader.$(USER).$(DEVDIRNAME).dm8168
   Running upgrade bootloader...
   Running upgrade bootloader...
     Uboot <= icache off
     Uboot &lt;= icache off
     Uboot => go 0x82000000
     Uboot =&gt; go 0x82000000


   Performing handshake with u-boot...
   Performing handshake with u-boot...


   Restoring previous bootcmd value
   Restoring previous bootcmd value
     Uboot <= setenv bootcmd 'if mmc init 0; then if run loadbootenv ; then run importbootenv ; if test -n ${uenvcmd} ; then run uenvcmd; fi ;fi ;else run nandboot;fi'
     Uboot &lt;= setenv bootcmd 'if mmc init 0; then if run loadbootenv&nbsp;; then run importbootenv&nbsp;; if test -n ${uenvcmd}&nbsp;; then run uenvcmd; fi&nbsp;;fi&nbsp;;else run nandboot;fi'
     Uboot <= saveenv
     Uboot &lt;= saveenv
   Building UBOOT_MIN image for flash...
   Building UBOOT_MIN image for flash...
   Building U-boot image for flash...
   Building U-boot image for flash...
   Loading UBOOT_MIN
   Loading UBOOT_MIN
   Configuring the network...
   Configuring the network...
     Uboot <= setenv autoload no
     Uboot &lt;= setenv autoload no
     Uboot <= dhcp
     Uboot &lt;= dhcp
     Uboot <= setenv serverip <yourTFTPServerIP>
     Uboot &lt;= setenv serverip &lt;yourTFTPServerIP&gt;
     Uboot <= setenv autostart no
     Uboot &lt;= setenv autostart no
     cp -f $(DEVDIR)/images/u-boot.noxip.bin /srv/tftp/u-boot.noxip.bin.$(USER).$(DEVDIRNAME).dm8168
     cp -f $(DEVDIR)/images/u-boot.noxip.bin /srv/tftp/u-boot.noxip.bin.$(USER).$(DEVDIRNAME).dm8168
     Uboot <= tftp 0x82000000 u-boot.noxip.bin.$(USER).$(DEVDIRNAME).dm8168
     Uboot &lt;= tftp 0x82000000 u-boot.noxip.bin.$(USER).$(DEVDIRNAME).dm8168
   Erasing UBOOT_MIN flash space...
   Erasing UBOOT_MIN flash space...
     Uboot <= nand erase 0x0 0x40000
     Uboot &lt;= nand erase 0x0 0x40000
     Uboot <= nandecc hw 2
     Uboot &lt;= nandecc hw 2
     Uboot <= nand write 0x82000000 0x0 0x40000
     Uboot &lt;= nand write 0x82000000 0x0 0x40000
     Uboot <= nandecc sw
     Uboot &lt;= nandecc sw
   Loading U-Boot
   Loading U-Boot
   Configuring the network...
   Configuring the network...
     Uboot <= setenv autoload no
     Uboot &lt;= setenv autoload no
     Uboot <= dhcp
     Uboot &lt;= dhcp
     Uboot <= setenv serverip <yourTFTPServerIP>
     Uboot &lt;= setenv serverip &lt;yourTFTPServerIP&gt;
     Uboot <= setenv autostart no
     Uboot &lt;= setenv autostart no
     cp -f $(DEVDIR)/images/bootloader.nandbin /srv/tftp/bootloader.nandbin.$(USER).$(DEVDIRNAME).dm8168
     cp -f $(DEVDIR)/images/bootloader.nandbin /srv/tftp/bootloader.nandbin.$(USER).$(DEVDIRNAME).dm8168
     Uboot <= tftp 0x82000000 bootloader.nandbin.$(USER).$(DEVDIRNAME).dm8168
     Uboot &lt;= tftp 0x82000000 bootloader.nandbin.$(USER).$(DEVDIRNAME).dm8168
   Erasing U-Boot flash space...
   Erasing U-Boot flash space...
     Uboot <= nand erase 0x40000 0x40000
     Uboot &lt;= nand erase 0x40000 0x40000
     Uboot <= nand write 0x82000000 0x40000 0x40000
     Uboot &lt;= nand write 0x82000000 0x40000 0x40000
   Restarting u-boot
   Restarting u-boot


Line 259: Line 275:
make: *** [installbootloader] Error 255
make: *** [installbootloader] Error 255


</pre>
</pre>  
However, uboot is flashed in nand properly. Please ignore this error, this will be fixed in the next release.
 
3.Turn off your Z3 module and configure it to boot from NAND (please see [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168_Z3_RPS#Setting_up_your_Z3_module_to_boot_from_NAND Setting up your Z3 module to boot from NAND]). Turn on your module and repeat step 1.
 
4. Now, to install your kernel and filesytem run make install
<pre style="background:#d6e4f1"> make install
</pre>
Now you have installed all the SDK components in your DM8168 Z3 module and you should be able to boot to Linux shell and see the logo of RigeRun on the HDMI output. The RidgeRun SDK for DM8168 Z3 module loads automatically all the firmware and kernel modules needed to use the video processor subsystem.
 
== Setting up your Z3 module to boot from NAND  ==
 
In order to boot from a NAND you need to set it as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the header called J20 in your Z3 module (see Fig. 5) [[Image:Z3NANDboot.jpg|thumb|center|400px|Z3NANDboot.jpg]]
<div style="text-align: center;">'''Figure 5'''. Header to control boot mode (NAND)</div> <pre>|  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |
| open | open | short | open | short | open | open | short |
</pre>
== Introduction to NAND memories  ==
 
If you are more interested on NAND concepts and what is supported on the DM816x please read [https://www.ridgerun.com/developer/wiki/index.php/Introduction_to_Nand_Memories Introduction to NAND memories]
 
= BOOTP Protocol Recovery Procedure  =
 
There is likely the case where the developer finds itself with a Z3 module with no carrier board or custom hardware part with a SD card slot available to perform a regular recovery procedure through SD card booting. In such case, it is possible to perform a recovery procedure through the Bootstrap Protocol (BOOTP) which is the basis for a more advanced network manager protocol, the Dynamic Host Configuration Protocol (DHCP).
 
For further information, please read&nbsp;[[DM8168_Z3_BOOTP_recovery_procedure]]
 
&nbsp;
 
= Graphics SDK - OpenGL - Qt  =


However, uboot is flashed in nand properly. Please ignore this error, this will be fixed in the next release.
The Professional Ridgerun SDK includes Graphics SDK 4.04.00.02 completely integrated, supporting the SGX530 3D Graphics Engine through the PowerVR driver. It also includes support to use Qt to render through the PowerVR kernel module.  


3.Turn off your Z3 module and configure it to boot from NAND (please see [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168_Z3_RPS#Setting_up_your_Z3_module_to_boot_from_NAND Setting up your Z3 module to boot from NAND]). Turn on your module and repeat step 1.
1. In order to enable the Graphics SDK in your SDK, please download and install in your home directory the [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/4_04_00_02/index_FDS.html Graphics SDK 4.04.00.02] from the TI web page
<pre style="background:#d6e4f1">sudo chmod 777 Graphics_SDK_setuplinux_4_04_00_02.bin
./Graphics_SDK_setuplinux_4_04_00_02.bin
</pre>
2.Then open a make config menu
<pre style="background:#d6e4f1">cd $DEVDIR
make config
</pre>
3. Go to the Proprietary software and enable the graphics SDK. [[Image:GraphicsSDKMenu.png|thumb|center|400px|GraphicsSDKMenu.png]]
<div style="text-align: center;">'''Figure 6'''. SDK boot log after enable the Graphics SDK</div>
4. Go to File System Configuration -&gt; Select target's file system software -&gt; qt-4.7.2 and select Support openGL and its demo. Finally disable the option called Make QT as compact as possible.  


4. Now, to install your kernel and filesytem run make install
5. Close the menu, save your configuration and build your SDK.
<pre style="background:#d6e4f1">
<pre style="background:#d6e4f1">cd $DEVDIR
make install
make  
</pre>
</pre>
6. Install your SDK in your board
<pre style="background:#d6e4f1">make install
</pre>  
7. Boot your board, you will see the following message
<pre style="background:#FFFFC0">Starting System
done.
Welcome to
__________ .__    .___              __________               
\______  \|__|  __| _/  ____    ____ \______  \ __ __  ____ 
|      _/|  | / __ |  / ___\ _/ __ \ |      _/|  |  \ /    \
|    |  \|  |/ /_/ | / /_/  &gt;\  ___/ |    |  \|  |  /|  |  \
|____|_  /|__|\____ | \___  /  \___  &gt;|____|_  /|____/ |___|  /
        \/          \//_____/      \/        \/            \/
         
    Embedded Linux Solutions
For further information see:
http://www.ridgerun.com
Build host: dsoto-Latitude-E5430-non-vPro
Built by: dsoto
Build date: Thu, 02 May 2013 16:47:40 -0600
Build tag: dm8168-z3
Configuring network interfaces
SGX revision:  0x10205
Build type:  release6.x
Loaded PowerVR consumer services.


Now you have installed all the SDK components in your DM8168 Z3 module and you should be able to boot to Linux shell and see the logo of RigeRun on the HDMI output. The RidgeRun SDK for DM8168 Z3 module loads automatically all the firmware and kernel modules needed to use the video processor subsystem.
Please press Enter to activate this console.
</pre>
8. Finally run one of the openGL demos or one of the qt + openGL demos
<pre style="background:#FFFFC0">export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
export QWS_DISPLAY="powervr"
export QT_PLUGIN_PATH=/usr/plugins
export QT_QWS_FONTDIR=/usr/lib/fonts


== Setting up your Z3 module to boot from NAND ==
cd /opt/gxzsdkdemos/ogles2/
In order to boot from a NAND you need to set it as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the header called J20 in your Z3 module (see Fig. 5)
/opt/gfxsdkdemos/ogles2 # ./OGLES2Skybox2
[[Image:Z3NANDboot.jpg|400px|thumb|center|Figure 5. Header to control boot mode (NAND)‎]]
PVRShell: EGL 1.4 initialized


<div style="text-align: center; ">'''Figure 5'''. Header to control boot mode (NAND)</div>


<pre>
cd /examples/opengl/hellogl_es2
|  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |
./hellogl_es2
| open | open | short | open | short | open | open | short |
</pre>


= OpenMax Demos =
</pre>
= OpenMax Demos =


To run the openMax's demos that are located by default in your filesystem in a directory called ''omx'' you need to run first the following commands in your Z3 module
To run the openMax's demos that are located by default in your filesystem in a directory called ''omx'' you need to run first the following commands in your Z3 module  
=== Video initialization ===
<pre style="background:#FFFFC0">
echo 0 > /sys/devices/platform/vpss/graphics0/enabled
echo 0 > /sys/devices/platform/vpss/graphics1/enabled
echo 0 > /sys/devices/platform/vpss/graphics2/enabled
</pre>


=== Video initialization  ===
<pre style="background:#FFFFC0">echo 0 &gt; /sys/devices/platform/vpss/graphics0/enabled
echo 0 &gt; /sys/devices/platform/vpss/graphics1/enabled
echo 0 &gt; /sys/devices/platform/vpss/graphics2/enabled
</pre>
'''note''': To run the decode display/encode demo with a 1080p video we recommend to use your filesystem by NFS due to the size of the input and output file.  
'''note''': To run the decode display/encode demo with a 1080p video we recommend to use your filesystem by NFS due to the size of the input and output file.  


==Decode display demo==
== Decode display demo ==
This demo is the decode-display demo included in the EZSDK. It takes an input file encoded in H264, decodes the stream and sends the output to the HDMI output
<pre style="background:#FFFFC0">
./omx/decode_display_a8host_debug.xv5T -i inputFile.h264 -w 1920 -h 1080 -f 60 -g 0
</pre>


= Using Gstreamer =
This demo is the decode-display demo included in the EZSDK. It takes an input file encoded in H264, decodes the stream and sends the output to the HDMI output
<pre style="background:#FFFFC0">./omx/decode_display_a8host_debug.xv5T -i inputFile.h264 -w 1920 -h 1080 -f 60 -g 0
</pre>
= Using Gstreamer =


Some examples of use of GStreamer to implement basic multimedia pipelines can be found at [[DM81xx GStreamer Pipelines - SDK 2011Q2]]. Please be aware that in order to display video you need to do the [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168#Video_initialization Video initialization]
Some examples of use of GStreamer to implement basic multimedia pipelines can be found at [[Gstreamer pipelines for DM816x and DM814x]]. Please be aware that in order to display video you need to do the [https://www.ridgerun.com/developer/wiki/index.php/Getting_Started_Guide_for_DM8168#Video_initialization Video initialization]  


= Additional uboot commands =
'''note:''' If you are not using the Ridgerun SDK and you are trying to use the TAG 00_06_00_00 provided by TI you will need to apply the following patch to make V4L2src and omxbufferalloc work.
 
<pre>Index: gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c
These u-boot commands are not part of the evaluation or professional SDK, but can be added to the professional SDK if requested.
===================================================================
--- gst-openmax-dm81xx.orig/src/omx/gstomxbufferalloc.c 2012-11-14 16:15:41.392143697 -0600
+++ gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c 2012-11-14 16:17:40.760145714 -0600
@@ -190,6 +190,7 @@
  gst_element_add_pad (GST_ELEMENT (filter), filter-&gt;sinkpad);
  gst_element_add_pad (GST_ELEMENT (filter), filter-&gt;srcpad);
+  filter-&gt;out_port.portptr = gst_omxportptr_new(&amp;filter-&gt;out_port);
  filter-&gt;silent = FALSE;
  filter-&gt;out_port.num_buffers = 10;
  filter-&gt;out_port.always_copy = FALSE;
</pre>
= Additional uboot commands  =


== Description ==
These u-boot commands are not part of the evaluation or professional SDK, but can be added to the professional SDK if requested.


RidgeRun extended uboot with additional commands for the DM816x platform. The new functionality includes:
== Description ==


1. Copy a block of data from NAND to NAND and decompress the data (gz or bz) on the fly if that is specified in the command. The size of the data being copied can be larger than the available RAM.
RidgeRun extended uboot with additional commands for the DM816x platform. The new functionality includes:


<pre>
1. Copy a block of data from NAND to NAND and decompress the data (gz or bz) on the fly if that is specified in the command. The size of the data being copied can be larger than the available RAM.
nand copy dest src size [gz|bz] - Read data from one section of flash, optionally decompress it, and write it to another section of flash
<pre>nand copy dest src size [gz|bz] - Read data from one section of flash, optionally decompress it, and write it to another section of flash
           dest - destination flash address, must be even sector boundary
           dest - destination flash address, must be even sector boundary
           src  - source flash address, must be even sector boundary.  If data is compressed, then all header data will be stored here, as in the beginning of a bz2 archive
           src  - source flash address, must be even sector boundary.  If data is compressed, then all header data will be stored here, as in the beginning of a bz2 archive
Line 323: Line 417:
                     gz: MIME type application/x-gzip
                     gz: MIME type application/x-gzip
                     bz: MIME type application/x-bzip2
                     bz: MIME type application/x-bzip2
</pre>
</pre>  
 
Furthermore, RidgeRun added a nand md5sum command that can be used to verify the integrity of the data that was copied in nand.  
Furthermore, RidgeRun added a nand md5sum command that can be used to verify the integrity of the data that was copied in nand.
<pre>nand md5sum src size [gz|bz] - Calculate the md5 sum for a region of flash, optionally decompressing the data
 
</pre>  
<pre>
2. Add the ability to extract contents from tarballs, include: list the content of the tarball, cat a desired file that is contained in the tarball, computes the md5sum of the desired tarball or load the tarball from a SD or USB drive, decompress it, take the desired file and write it to NAND. Currently in these commands just gz decompression algorithm is supported and soon we are going to add bz.  
nand md5sum src size [gz|bz] - Calculate the md5 sum for a region of flash, optionally decompressing the data
<pre>tar - tar archive
</pre>
 
2. Add the ability to extract contents from tarballs, include: list the content of the tarball, cat a desired file that is contained in the tarball, computes the md5sum of the desired tarball or load the tarball from a SD or USB drive, decompress it, take the desired file and write it to NAND. Currently in these commands just gz decompression algorithm is supported and soon we are going to add bz.
 
<pre>
tar - tar archive
    
    
     Usage:
     Usage:
     tar list fat <interface> <dev[:part]> <tarfilename> [<alg>]
     tar list fat &lt;interface&gt; &lt;dev[:part]&gt; &lt;tarfilename&gt; [&lt;alg&gt;]
     tar cat fat <interface> <dev[:part]> <tarfilename> <filename> [<alg>]
     tar cat fat &lt;interface&gt; &lt;dev[:part]&gt; &lt;tarfilename&gt; &lt;filename&gt; [&lt;alg&gt;]
     tar md5sum fat <interface> <dev[:part]> <tarfilename> <filename> [<alg>]
     tar md5sum fat &lt;interface&gt; &lt;dev[:part]&gt; &lt;tarfilename&gt; &lt;filename&gt; [&lt;alg&gt;]
     tar write_nand fat <interface> <dev[:part]> <tarfilename> <filename> <off> [<alg>]   
     tar write_nand fat &lt;interface&gt; &lt;dev[:part]&gt; &lt;tarfilename&gt; &lt;filename&gt; &lt;off&gt; [&lt;alg&gt;]   
     Parameters:
     Parameters:
             <interface:== file system interface name
             &lt;interface&gt;  &nbsp;:== file system interface name
             <dev[:part]:== file system device and partition number
             &lt;dev[:part]&gt; &nbsp;:== file system device and partition number
             <tarfilename> :== name of tarball file on the specified storage media
             &lt;tarfilename&gt;&nbsp;:== name of tarball file on the specified storage media
             <filename>    :== name of file of interest which is contained in the tarball
             &lt;filename&gt;  &nbsp;:== name of file of interest which is contained in the tarball
             <off>        :== destination NAND address
             &lt;off&gt;        &nbsp;:== destination NAND address
             <alg>        :== [gz] - decompression algorithm
             &lt;alg&gt;        &nbsp;:== [gz] - decompression algorithm
                               gz: MIME type application/x-gzip
                               gz: MIME type application/x-gzip
</pre>
</pre>  
== Configuring SDK to use tar commands  ==


== Configuring SDK to use tar commands ==
Due to [http://processors.wiki.ti.com/index.php/DM816x_AM389x_PSP_U-Boot limitations in the DM8168], the size of uboot cannot exceed 255KB. When the tar commands is included in uboot, the executable increases to ~300KB. Due to the hardware limitation RidgeRun implemented a boot model based in two stages to handle a large uboot executable. First, the SDK creates a uboot.min (&lt;255KB) which doesn't have the tar command The small uboot is loaded by the ROM code in the DM8186 as normal, initializating of the board. Subsequently, The small uboot.min loads a second uboot (~300KB) which contains all the logic to implement the tar command. The two stage boot process adds around one second to the overall boot time.


Due to [http://processors.wiki.ti.com/index.php/DM816x_AM389x_PSP_U-Boot limitations in the DM8168], the size of uboot cannot exceed 255KB. When the tar commands is included in uboot, the executable increases to ~300KB.  Due to the hardware limitation RidgeRun implemented a boot model based in two stages to handle a large uboot executable. First, the SDK creates a uboot.min (<255KB) which doesn't have the tar command The small uboot is loaded by the ROM code in the DM8186 as normal, initializating of the board. Subsequently, The small uboot.min loads a second uboot (~300KB) which contains all the logic to implement the tar command. The two stage boot process adds around one second to the overall boot time.
The Ridgerun SDK has logic to handle this approach based in two stages (including the installation process), in order to enabled the two stage model please follow this steps:


The Ridgerun SDK has logic to handle this approach based in two stages (including the installation process), in order to enabled the two stage model please follow this steps:
1. Open the make config menu  
 
<pre>cd $DEVDIR
1. Open the make config menu
<pre>
cd $DEVDIR
make config
make config
</pre>
</pre>  
 
2. Enable two stages model  
2. Enable two stages model


Location:                                                                                      
Location: │  
      -> Bootloader Configuration
        [*] Enable two stages model for uboot


3. Close the make config menu and save your changes
      -&gt; Bootloader Configuration
    [*] Enable two stages model for uboot


== NAND layout ==
3. Close the make config menu and save your changes


Before to start testing the uboot commands it is important to keep in mind the NAND layout used by your SDK. The following layout was detected using UBIFS ~61MB
== NAND layout ==


<pre>
Before to start testing the uboot commands it is important to keep in mind the NAND layout used by your SDK. The following layout was detected using UBIFS ~61MB
  +------------+--->0x00000000-> U-Boot min start
<pre> +------------+---&gt;0x00000000-&gt; U-Boot min start
  | |
  | |
  | |-->0x0003FFFF-> U-Boot min end
  | |--&gt;0x0003FFFF-&gt; U-Boot min end
  | |-->0x00040000-> U-Boot start  
  | |--&gt;0x00040000-&gt; U-Boot start  
  | |
  | |
  | |-->0x0025FFFF-> U-Boot end
  | |--&gt;0x0025FFFF-&gt; U-Boot end
  | |-->0x00260000-> ENV start
  | |--&gt;0x00260000-&gt; ENV start
  | |
  | |
  | |
  | |
  | |-->0x0027FFFF-> ENV end
  | |--&gt;0x0027FFFF-&gt; ENV end
  | |-->0x00280000-> Linux Kernel start
  | |--&gt;0x00280000-&gt; Linux Kernel start
  | |
  | |
  | |
  | |
  | |
  | |
  | |
  | |
  | |-->0x006BFFFF-> Linux Kernel end
  | |--&gt;0x006BFFFF-&gt; Linux Kernel end
  | |-->0x006C0000-> Filesystem start
  | |--&gt;0x006C0000-&gt; Filesystem start
  | |
  | |
  | |
  | |
Line 402: Line 486:
  | |
  | |
  | |
  | |
  | |-->0x0435FFFF-> Filesystem end
  | |--&gt;0x0435FFFF-&gt; Filesystem end
  | |-->0x04360000-> Free start
  | |--&gt;0x04360000-&gt; Free start
  | |
  | |
  | |
  | |
  | |
  | |
  +------------+-->0x10000000-> NAND end (Free end)
  +------------+--&gt;0x10000000-&gt; NAND end (Free end)


</pre>
</pre>  
 
== Examples ==
== Examples ==


In this section you are going to find examples about how to use the additional commands provided by RidgeRun.  
In this section you are going to find examples about how to use the additional commands provided by RidgeRun.  


Please notice that the tar commands can be used to load files from a SD card or from a USB drive, it is important to mention that if you want to load the tarball from the SD card you need to initialize the SD card running the following command:
Please notice that the tar commands can be used to load files from a SD card or from a USB drive, it is important to mention that if you want to load the tarball from the SD card you need to initialize the SD card running the following command:  
<pre>
<pre>Z3-DM8168-MOD# mmc init 0
Z3-DM8168-MOD# mmc init 0
mmc0 is available
mmc0 is available
</pre>
</pre>  
Moreover, if you want to use a USB drive you need to initialize it with:
Moreover, if you want to use a USB drive you need to initialize it with:  
<pre>
<pre>Z3-DM8168-MOD# usb reset
Z3-DM8168-MOD# usb reset
(Re)start USB...
(Re)start USB...
USB:  scanning bus for devices... 1 USB Device(s) found
USB:  scanning bus for devices... 1 USB Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found
</pre>
</pre>  
 
=== Nand copy and nand md5sum ===
=== Nand copy and nand md5sum ===


Please create the following files to test the uboot commands
Please create the following files to test the uboot commands  


Create 16MB file  
Create 16MB file  
Line 437: Line 517:
bzip2 file.img  
bzip2 file.img  
</pre>  
</pre>  
Compute md5sum  
Compute md5sum  
<pre style="color:green">md5sum file.img  
<pre style="color:green">md5sum file.img  
2c7ab85a893283e98c931e9511add182  file.img
2c7ab85a893283e98c931e9511add182  file.img
</pre>
</pre> <pre style="color:blue">md5sum file.img.gz


<pre style="color:blue">md5sum file.img.gz
79ec220244e0c90cfa03764d13a46634  file.img.gz
79ec220244e0c90cfa03764d13a46634  file.img.gz
</pre>


<pre style="color:red">
</pre> <pre style="color:red">md5sum file.img.bz2  
md5sum file.img.bz2  
 
4119aca17186852b10fce74a2aad5fdf  file.img.bz2
4119aca17186852b10fce74a2aad5fdf  file.img.bz2
</pre>  
</pre>  
Please copy these files to your tftp server directory  
Please copy these files to your tftp server directory  
<pre>cp file.img /srv/tftp/
<pre>cp file.img /srv/tftp/
Line 457: Line 534:
cp file.img.bz2 /srv/tftp/
cp file.img.bz2 /srv/tftp/
</pre>  
</pre>  
Create 32MB file  
Create 32MB file  
<pre>sudo dd count=1 bs=32M if=/dev/zero of=file32.img
<pre>sudo dd count=1 bs=32M if=/dev/zero of=file32.img
Line 465: Line 541:
<pre style="color:green">md5sum file32.img  
<pre style="color:green">md5sum file32.img  
58f06dd588d8ffb3beb46ada6309436b  file32.img
58f06dd588d8ffb3beb46ada6309436b  file32.img
</pre>
</pre> <pre style="color:blue">md5sum file32.img.gz


<pre style="color:blue">md5sum file32.img.gz
2da9ef91a744699aa483754bfefffaed  file32.img.gz
2da9ef91a744699aa483754bfefffaed  file32.img.gz
</pre>


</pre>
Copy files to the tftp server directory  
Copy files to the tftp server directory  
<pre>cp file32.img /srv/tftp/
<pre>cp file32.img /srv/tftp/
cp file32.img.gz /srv/tftp/
cp file32.img.gz /srv/tftp/
</pre>  
</pre>  
 
<br> 1. '''nand copy command (without decompress)'''  
 
1. '''nand copy command (without decompress)'''  


In order to test if the nand copy command (without decompress) is working properly the following commands were run in uboot  
In order to test if the nand copy command (without decompress) is working properly the following commands were run in uboot  
Line 507: Line 580:
#Show the data written by nand copy
#Show the data written by nand copy
nand dump 0x6C1000
nand dump 0x6C1000
</pre>
</pre>  
 
=== Compressed files &lt; 16K (one chunk) ===
===Compressed files < 16K (one chunk) ===


2. '''nand md5sum command (without decompress)'''  
2. '''nand md5sum command (without decompress)'''  
Line 515: Line 587:
Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 534: Line 606:
2c7ab85a893283e98c931e9511add182
2c7ab85a893283e98c931e9511add182
</pre>  
</pre>  
3. '''nand md5sum command (gz decompress)'''  
3. '''nand md5sum command (gz decompress)'''  


Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 558: Line 629:
2c7ab85a893283e98c931e9511add182
2c7ab85a893283e98c931e9511add182
</pre>  
</pre>  
4. '''nand md5sum command (bz decompress)'''  
4. '''nand md5sum command (bz decompress)'''  


Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 578: Line 648:
nand write 0x82000000 0x04380000 4000
nand write 0x82000000 0x04380000 4000
</pre>  
</pre>  
Decompress bz file and compute the md5sum  
Decompress bz file and compute the md5sum  
<pre style="color:green">#Decompress bz file and compute the md5sum
<pre style="color:green">#Decompress bz file and compute the md5sum
Line 584: Line 653:
2c7ab85a893283e98c931e9511add182
2c7ab85a893283e98c931e9511add182
</pre>  
</pre>  
5. '''nand copy command with gz decompress'''  
5. '''nand copy command with gz decompress'''  


Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 606: Line 674:
nand copy 0x043A0000 0x04380000 0x3fb8 gz
nand copy 0x043A0000 0x04380000 0x3fb8 gz
</pre>  
</pre>  
 
Compute md5sum of the copy  
Compute md5sum of the copy
<pre style="color:green">#Decompress gz file and compute the md5sum
<pre style="color:green">#Decompress gz file and compute the md5sum
nand md5sum 0x043A0000 1000000
nand md5sum 0x043A0000 1000000
2c7ab85a893283e98c931e9511add182
2c7ab85a893283e98c931e9511add182
</pre>  
</pre>  
6. '''nand copy command with bz2 decompress'''  
6. '''nand copy command with bz2 decompress'''  


Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 635: Line 701:
nand copy 0x043A0000 0x04380000 0x2d bz
nand copy 0x043A0000 0x04380000 0x2d bz
</pre>  
</pre>  
 
Compute md5sum of the copy  
Compute md5sum of the copy
<pre style="color:green">#Decompress bz2 file and compute the md5sum
<pre style="color:green">#Decompress bz2 file and compute the md5sum
nand md5sum 0x043A0000 1000000
nand md5sum 0x043A0000 1000000
2c7ab85a893283e98c931e9511add182
2c7ab85a893283e98c931e9511add182
</pre>
</pre>  
=== Compressed files &gt; 16K (one chunk)  ===


===Compressed files > 16K (one chunk) ===
7. '''nand md5sum command (without decompress)'''  
7. '''nand md5sum command (without decompress)'''  


Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 667: Line 731:
58f06dd588d8ffb3beb46ada6309436b
58f06dd588d8ffb3beb46ada6309436b
</pre>  
</pre>  
8. '''nand md5sum command (gz decompress)'''  
8. '''nand md5sum command (gz decompress)'''  


Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 691: Line 754:
58f06dd588d8ffb3beb46ada6309436b
58f06dd588d8ffb3beb46ada6309436b
</pre>  
</pre>  
9. '''nand copy command with gz decompress'''  
9. '''nand copy command with gz decompress'''  


Load file to uboot using TFTP server  
Load file to uboot using TFTP server  
<pre>#Set TFTP server IP address
<pre>#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>
setenv serverip &lt;IPaddressTFTPServer&gt;


#Don't start after load the file
#Don't start after load the file
Line 713: Line 775:
nand copy 0x043A0000 0x04380000 0x7f54 gz
nand copy 0x043A0000 0x04380000 0x7f54 gz
</pre>  
</pre>  
 
Compute md5sum of the copy  
Compute md5sum of the copy
<pre style="color:green">#Decompress gz file and compute the md5sum
<pre style="color:green">#Decompress gz file and compute the md5sum
nand md5sum 0x043A0000 2000000
nand md5sum 0x043A0000 2000000
58f06dd588d8ffb3beb46ada6309436b
58f06dd588d8ffb3beb46ada6309436b
</pre>
</pre>  
 
=== Tar commands  ===
=== Tar commands  ===


In order to implement these commands we are using libarchive, you can find a useful web page about it [http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=archive_read_support_compression_none here]. Furthermore, it is important to mention that in the DM8168 uboot has a size limitation, '''where 255KB is the maximum size''' that uboot can have. When we include the libarchive library we overcome that limit, so uboot will not work if you try to use it by default in your NAND memory for instance, instead you need to use a model based in two stages, please configure your SDK.
In order to implement these commands we are using libarchive, you can find a useful web page about it [http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=archive_read_support_compression_none here]. Furthermore, it is important to mention that in the DM8168 uboot has a size limitation, '''where 255KB is the maximum size''' that uboot can have. When we include the libarchive library we overcome that limit, so uboot will not work if you try to use it by default in your NAND memory for instance, instead you need to use a model based in two stages, please configure your SDK.  


==== Create tarballs for the test ====
==== Create tarballs for the test ====
Simple tarball


<pre>
Simple tarball
TARDIR=`pwd`/tmp
<pre>TARDIR=`pwd`/tmp
mkdir -p $TARDIR
mkdir -p $TARDIR
echo "1" > $TARDIR/1.txt
echo "1" &gt; $TARDIR/1.txt
echo "2" > $TARDIR/2.txt
echo "2" &gt; $TARDIR/2.txt
echo "3" > $TARDIR/3.txt
echo "3" &gt; $TARDIR/3.txt
( cd $TARDIR ; ln -s 3.txt 3.lnk.txt )
( cd $TARDIR&nbsp;; ln -s 3.txt 3.lnk.txt )
mkdir $TARDIR/newdir
mkdir $TARDIR/newdir
sudo dd count=1 bs=256K if=/dev/zero of=zeros.txt
sudo dd count=1 bs=256K if=/dev/zero of=zeros.txt
dd if=/dev/zero bs=1M count=4 | tr '\0' '\377' > ones.txt
dd if=/dev/zero bs=1M count=4 | tr '\0' '\377' &gt; ones.txt
sudo chown $USER:ridgerun *
sudo chown $USER:ridgerun *
sudo cat ones.txt >> zeros.txt
sudo cat ones.txt &gt;&gt; zeros.txt
mv zeros.txt tmp/log.txt; rm ones.txt
mv zeros.txt tmp/log.txt; rm ones.txt
tar cf uboot-tarball.tar tmp
tar cf uboot-tarball.tar tmp
</pre>
</pre>  
 
In order to test the tar gz decompression algorithm  
In order to test the tar gz decompression algorithm
<pre>tar -czf uboot-tarball.tar.gz tmp
 
</pre>  
<pre>
<br> Please save the tarballs to a USB thumb drive or an SD card and be aware that you need to initialize the device before to use it:
tar -czf uboot-tarball.tar.gz tmp
</pre>


''USB''
<pre>usb reset
</pre>
''SD card''
<pre>mmc init 0
</pre>
=== tar ls command  ===


Please save the tarballs to a USB thumb drive or an SD card and be aware that you need to initialize the device before to use it:
Lists the files in a tar archive


''USB''
'''Test using the USB drive'''  
<pre>
usb reset
</pre>


''SD card''
1. tar list command  
<pre>
<pre>Z3-DM8168-MOD# tar list fat usb 0 uboot-tarball.tar
mmc init 0
</pre>
 
=== tar ls command ===
 
Lists the files in a tar archive
 
'''Test using the USB drive'''
 
1. tar list command
<pre>
Z3-DM8168-MOD# tar list fat usb 0 uboot-tarball.tar
  directory: tmp/
  directory: tmp/
  directory: tmp/newdir/
  directory: tmp/newdir/
Line 778: Line 827:
   regular: tmp/3.txt
   regular: tmp/3.txt
   regular: tmp/2.txt
   regular: tmp/2.txt
</pre>
</pre>  
=== tar cat command  ===


=== tar cat command ===
Cat a file in a tar archive


Cat a file in a tar archive
'''Testing using USB drive - no decompression algorithm'''  
 
<pre>Z3-DM8168-MOD# tar cat fat usb 0 uboot-tarball.tar tmp/log.txt             
'''Testing using USB drive - no decompression algorithm'''
<pre>
Z3-DM8168-MOD# tar cat fat usb 0 uboot-tarball.tar tmp/log.txt             
File found
File found
address: 00000000
address: 00000000
Line 873: Line 920:
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
Size :4456448 bytes
Size&nbsp;:4456448 bytes
</pre>
</pre>  
 
'''Testing using USB - gz decompression algorithm'''  
'''Testing using USB - gz decompression algorithm'''
 
It is important to mention that we added a 4.3MB file called log.txt which is filled with 0x00 and 0XFF in order to test the ability to read and decompress chunks. We need to include the full path in order to cat the desired file, for instance, if you want to cat 1.txt you need to specify tar/1.txt as the file to cat.


<pre>
It is important to mention that we added a 4.3MB file called log.txt which is filled with 0x00 and 0XFF in order to test the ability to read and decompress chunks. We need to include the full path in order to cat the desired file, for instance, if you want to cat 1.txt you need to specify tar/1.txt as the file to cat.
Z3-DM8168-MOD# tar cat fat usb 0 uboot-tarball.tar.gz tmp/log.txt gz
<pre>Z3-DM8168-MOD# tar cat fat usb 0 uboot-tarball.tar.gz tmp/log.txt gz
File found
File found
address: 00000000
address: 00000000
Line 968: Line 1,012:
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
Size :4456448 bytes
Size&nbsp;:4456448 bytes
</pre>
</pre>  
 
=== tar md5sum command ===
=== tar md5sum command ===


Computes the MD5sum of a desired file that is located in a tarball
Computes the MD5sum of a desired file that is located in a tarball  


'''Testing using USB - no decompression algorithm'''
'''Testing using USB - no decompression algorithm'''  


Compute the md5sum of the desired file in your computer
Compute the md5sum of the desired file in your computer  
<pre>
<pre>md5sum tmp/log.txt  
md5sum tmp/log.txt  
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
</pre>
</pre>  
 
Run tar md5sum in uboot  
Run tar md5sum in uboot
<pre>Z3-DM8168-MOD#  tar md5sum fat usb 0 uboot-tarball.tar tmp/log.txt  
<pre>
Z3-DM8168-MOD#  tar md5sum fat usb 0 uboot-tarball.tar tmp/log.txt  
File found
File found
Size :4456448 bytes
Size&nbsp;:4456448 bytes
893abfd4f775da3065291a8a0b9dbaf8
893abfd4f775da3065291a8a0b9dbaf8
</pre>
</pre>  
'''Testing using USB - gz decompression algorithm'''


'''Testing using USB - gz decompression algorithm'''
Compute the md5sum of the desired file in your computer  
 
<pre>md5sum tmp/log.txt  
Compute the md5sum of the desired file in your computer
<pre>
md5sum tmp/log.txt  
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
</pre>
</pre>  
 
Run tar md5sum in uboot  
Run tar md5sum in uboot
<pre>Z3-DM8168-MOD# tar md5sum fat usb 0 uboot-tarball.tar.gz tmp/log.txt gz
<pre>
Z3-DM8168-MOD# tar md5sum fat usb 0 uboot-tarball.tar.gz tmp/log.txt gz
File found
File found
Size :4456448 bytes
Size&nbsp;:4456448 bytes
893abfd4f775da3065291a8a0b9dbaf8
893abfd4f775da3065291a8a0b9dbaf8
</pre>
</pre>  
=== tar write_nand command  ===


=== tar write_nand command ===
Load a tarball from the FAT32 device, decompress it if it is needed, take the desired


Load a tarball from the FAT32 device, decompress it if it is needed, take the desired
'''Testing using USB - no decompression algorithm'''


'''Testing using USB - no decompression algorithm'''
Compute the md5sum of the desired file in your computer
<pre>md5sum tmp/log.txt
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
</pre>
Erase nand sector
<pre>nand erase 0x04380000 0x440000
</pre>
Run tar write_nand in uboot
<pre>Z3-DM8168-MOD# tar write_nand fat usb 0 uboot-tarball.tar tmp/log.txt 0x04380000
File found
</pre>
Compute the md5sum in nand in order to verify the integrity of the data
<pre>Z3-DM8168-MOD# nand md5sum 0x04380000 0x440000
893abfd4f775da3065291a8a0b9dbaf8
</pre>
'''Testing using USB - gz decompression algorithm'''  


Compute the md5sum of the desired file in your computer
Compute the md5sum of the desired file in your computer  
<pre>
<pre>md5sum tmp/log.txt  
md5sum tmp/log.txt  
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
</pre>
</pre>  
 
Erase nand sector  
Erase nand sector
<pre>nand erase 0x04380000 0x440000
<pre>
</pre>  
nand erase 0x04380000 0x440000
Run tar md5sum in uboot  
</pre>
<pre>Z3-DM8168-MOD# tar write_nand fat usb 0 uboot-tarball.tar.gz tmp/log.txt 0x04380000 gz
 
Run tar write_nand in uboot
<pre>
Z3-DM8168-MOD# tar write_nand fat usb 0 uboot-tarball.tar tmp/log.txt 0x04380000
File found
File found
</pre>
</pre>  
 
Compute the md5sum in nand in order to verify the integrity of the data  
Compute the md5sum in nand in order to verify the integrity of the data
<pre>Z3-DM8168-MOD# nand md5sum 0x04380000 0x440000
<pre>
Z3-DM8168-MOD# nand md5sum 0x04380000 0x440000
893abfd4f775da3065291a8a0b9dbaf8
893abfd4f775da3065291a8a0b9dbaf8
</pre>
</pre>  


'''Testing using USB - gz decompression algorithm'''
= Linux Performance =
 
Compute the md5sum of the desired file in your computer
<pre>
md5sum tmp/log.txt
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt
</pre>


Erase nand sector
There are performance issues that can be fixed tuning the Linux kernel. Here some interesting pages are listed with tuning solutions and tricks specially for memory lateness problems.
<pre>
nand erase 0x04380000 0x440000
</pre>


Run tar md5sum in uboot
* [[Linux Performance and Tuning Tricks | Linux Performance and Tuning Tricks]]
<pre>
* [[High performance SD card tuning using the EXT4 file system | High performance SD card tuning using the EXT4 file system]]
Z3-DM8168-MOD# tar write_nand fat usb 0 uboot-tarball.tar.gz tmp/log.txt 0x04380000 gz
File found
</pre>


Compute the md5sum in nand in order to verify the integrity of the data
= Articles related to this board  =
<pre>
Z3-DM8168-MOD# nand md5sum 0x04380000 0x440000
893abfd4f775da3065291a8a0b9dbaf8
</pre>


= Articles related to this board =
:[https://www.ridgerun.com/developer/wiki/index.php/RidgeRun_2011Q2_SDK_User_Guide RidgeRun 2011Q2 SDK User Guide]
:[https://www.ridgerun.com/developer/wiki/index.php/RidgeRun_2011Q2_SDK_User_Guide RidgeRun 2011Q2 SDK User Guide]
:[https://www.ridgerun.com/developer/wiki/index.php/RidgeRun_Turrialba_SDK_User_Guide RidgeRun Turrialba SDK User Guide]  
:[http://processors.wiki.ti.com/index.php/EZSDK_Memory_Map EZSDK Memory Map]
:[http://processors.wiki.ti.com/index.php/EZSDK_Memory_Map EZSDK Memory Map]  
:[http://processors.wiki.ti.com/index.php/OMX_EZSDK_Examples OMX EZSDK Examples]
:[http://processors.wiki.ti.com/index.php/OMX_EZSDK_Examples OMX EZSDK Examples]  
:[http://www.ti.com/lit/ds/symlink/tms320dm8168.pdf TMS320DM816x DaVinci Digital Media Processor]
:[http://www.ti.com/lit/ds/symlink/tms320dm8168.pdf TMS320DM816x DaVinci Digital Media Processor]  
:[http://www.ti.com/lit/ug/sprugx8/sprugx8.pdf Technical Reference Manual]
:[http://www.ti.com/lit/ug/sprugx8/sprugx8.pdf Technical Reference Manual]


[[Category:DM8168]] [[Category:GSG]]
[[Category:DM8168]] [[Category:GSG]]

Revision as of 18:24, 28 March 2014

Introduction

On this page you are going to find all the necessary information to start from scratch to use the RidgeRun SDK on your DM8168 Z3 module. In the following sections we assume that you have already downloaded the EZSDK version 5.05.02.00 and that you have installed the toolchain 2009q1-203 from codesourcery as well as your DM8168 SDK following the steps on The RidgeRun installation guide.

The first section of this guide shows you how to install the EZSDK for DM8168 on your computer and how to configure a TFTP and NFS server. Subsequently, the second section contains instructions about how to configure the RidgeRun's SDK to create a SD card with all software components (uboot, kernel and filesystem) needed to boot to Linux Shell in your Z3 hardware. Using this SD card in the third and fourth section of this guide, you will be able to install on NAND images created by the SDK for kernel, uboot as well as your filesystem (JFFS2, UBI, NFS are available). Using the SD card created on the second section to flash the SDK in your module is just an option because you could try to use the installer of the RidgeRun's SDK with the uboot version that is running by default in a new Z3 module, however, we cannot guaranty that it will work as we expect, hence, we recommend to use the SD card instead. Furthermore we describe how to enable the Graphics SDK support on the Professional SDK. Additionally, how to run opemax demos to encode and decode 1080p/h264 videos and some usefult pipelines using gstreamer + openMax to do live view, take snapshots and RTSP streaming are shown. The last section of this page contains useful information about two new commands added by RidgeRun in uboot in order to handle tarballs and do copies from NAND to NAND.

On the rest of this document, we refer as $(DEVDIR) to the path where the RidgeRun SDK for DM8168 is installed

Basic preliminary work

Installing the EZSDK

1. Set the ezsdk binary as executable and set correct permissions, by default the EZSDK is used in its default patch (your home directory), optionally you can install it /usr/local/

 sudo chmod 777 ezsdk_dm816x-evm_5_05_02_00_setuplinux

2. Install EZSDK. For ubuntu versions different than Ubuntu 11.04 64-bit you will need to add the --forcehost argument to install it:

 ./ezsdk_dm816x-evm_5_05_02_00_setuplinux --forcehost

note: During the EZSDK installation process you will be asked for the toolchain's path, assuming that you installed it on /opt, the path that you need to provide is /opt/codesourcery/arm-2009q1/bin/

Configuring the bsp/mach symbolic link for Eval-SDK

The evaluation SDK for DM8168 supports Z3 and EVM platforms into the same SDK, so for choose one of them is necessary to run the next lines.

 # For an totally clean SDK #
    make config
    make coreconfig
    make

The coreconfig target will show the following option where you have to choice the mach-dm8168-z3:

   Selecting machine/board:
   1. mach-dm8168-z3
   2. mach-dm8168-tievm

OPTIONAL: Installing AAC encoder and MP3 Decoder

The DM81xx platforms have the ability to encode AAC-LC and decode MP3 on the DSP using openMax+gstreamer, however, these codecs are not in the EZSDK by default. The Ridgerun SDK for the DM8148/DM8168 has internal logic to integrate these codecs and generate a new DSP firmware if these codecs are installed properly in your host computer. This new DSP firmware will be automatically loaded by into the DSP during boot time.

1. Download the AAC-LC encoder from TI Web page, this is called AAC LC Encoder, Version 01.00.01.00

2. Download the MP3 decoder from TI Web page, this is called MP3 Decoder, Version 1.41.00.00

3. Install the AAC-LC encoder inside of your EZSDK directory, i.e, your destination directory must be something like /home/<user>/ti-ezsdk_dm816x-evm_5_05_02_00/component-sources/c674x_aaclcenc_01_00_01_00_elf

 sudo chmod 777 c674x_aaclcenc_01_00_01_00_elf.bin
./c674x_aaclcenc_01_00_01_00_elf.bin

4. Install the MP3 decoder inside of your EZSDK directory, i.e, your destination directory must be something like /home/<user>/ti-ezsdk_dm816x-evm_5_05_02_00/component-sources/c674x_mp3dec_01_41_00_00_elf

 sudo chmod 777 c674x_mp3dec_01_41_00_00_elf.bin
./c674x_mp3dec_01_41_00_00_elf.bin

5. Open a make config menu and select the Support external AAC and MP3 audio codecs option over the Proprietary software category.

 cd <pathOfYourDevdir>
`make env`
make config
Optional selection of external AAC and MP3 audio codecs support

note: If you built your SDK before to enable the audio support you need to remove the EZSDK tarball that were generated by the SDK in /opt/ridgerun/downloads thus the SDK will generate a new one including the audio codecs.

Setting up serial access to the Linux console

You use the serial port to control u-boot and Linux. The picocom terminal emulator work well for this purpose.

Setting up Picocom - Ubuntu

Setting up a TFTP server

If you are planning to use the SDK's installer to install images generated by the SDK in NAND, installing a TFTP server you will speed up downloads to the target hardware by using TFTP.

Setting Up A Tftp Service

Setting up an NFS server

For application development, it is convenient to use root NFS mount file system for the target hardware. This allows you to rebuild your application on the host and immediately run the application on the target hardware with no interveining steps. You host PC needs to be configured as a NFS server for this in order to work properly.

Setting Up A NFS Service

Booting from a SD card

Setting up your Z3 module to boot from SD card

In order to boot from a SD card you need to set the MMC as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the header called J20 in your Z3 module (see Fig. 1)

Z3SDboot.jpg
Figure 1. Header to control boot mode (SD card)
|  1   |   2  |  3   |  4   |  5   |  6   |  7   |  8   |
|short | open | open | open | open | open | open | open |

Note: Some micro SD cards used with adapters may not work, we advise to use a regular SD card instead.

Configuring SDK to deploy firmware to a SD card

This section describes how to configure the DM8168's SDK to deploy all basic firmware components (kernel, uboot and MLO) into a bootable SD card. The RidgeRun SDK support several filesystem types (JFFS2, UBIFS, NFS, etc) however in this case we are going to use it on the SD card as well.

1. Set your environment variables

  cd $DEVDIR
 `make env`

2. Open a make config menu

 make config

running make config your SDK is going to download all basic packages needed by the SDK build system.

note: If your SDK has problems downloading some package please contact us

3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.2

InstallerMenuDM8168.png
Figure 2. Installer configuration to deploy firmware to an SD card

Using the Firmware deployment mode submenu you can set how to deploy your kernel, uboot and filesystem image into your target board. There are three options in this submenu: Attached board on communication port, Deploy all the firmware to an SD card and Create an SD card installer for flash memory.

  • Attached board on communication port will allow you to send images to your target board using a serial port or a TFTP server, more details about this option are explained in the next section.
  • Deploy all the firmware to an SD card tells to the installer that it must create the needed partitions on a SD card located in SD device on Linux host (please be sure that the option called Flash SD card image into loopback file instead of real SD is not selected) and that it have to install there the software's images generated by the SDK.
  • Create an SD card installer for flash memory is going to create and SD card with all the logic and software's images needed to flash your NAND from the SD card.


4. Go to File System Configuration submenu and configure your filesystem as is shown in Fig.3

FSC.png
Figure 3. File system configuration to use it on the SD‎

5. Compile your SDK

 make

Installing SDK's firmware to a SD card

Once you have built your SDK, you need to install it on the SD card running make install, but before to issue this command you need to unmount your SD card, otherwise the SDK won't let you install it (in order to avoid to erase information in some of your hard disks). Let's suppose that the environment variable called $SDNAME contains your mount point's name (Normally if you press tab after umount /media/ it will complete it with you SD card name, if you have problems to find the name you can use commands like "df" or "mount" to verify it).

 umount /media/$(SDNAME)
 cd $(DEVDIR)
 make install

you will be asked to confirm the device that you are going to partition and format, please enter yes if it is correct. After this, the SDK will start to create a bootable SD card

Now you are ready to test your SDK booting from a SD card. Two partitions were created by the SDK: boot partition which contains the kernel, uboot and MLO image and the rootfs partition with your file system. It's important to notice that the environment of uboot is located in a *.txt file in the partition called boot, which allows you to modify it easily.

Booting from NAND

This section describes how to configure the DM8168's SDK to install the SDK's firmware in NAND as well as how to set up your Z3 module to boot from NAND. First, we are going to start flashing uboot in NAND using the SD card created in the above section, once uboot is running properly from NAND, we can start installing the kernel and finally your filesystem.

Configuring SDK to install firmware in NAND

1. Set your environment variables

 cd $(DEVDIR)
 `make env`

2. Open a make config menu

 make config

3. Go to Installer Configuration submenu and configure your installer as is shown in Fig.4

InstallerMenuAttachedMethod.png
Figure 4. Installer configuration to deploy firmware in NAND


In this case, you must use the Attached board on communication port method, this will allow you to install all your firmware directly in nand by means of a serial port or by ethernet using a TFTP server. Here we are going to use a TFTP server and telnet as our communication method with the target board.


3.1 Go to the Communication method with the target board and select Telnet-serial adaptor

3.2 Configure the protocol to transfer images as TFTP

3.3 Set the IP address of your host machine in IP address of telnet-serial adaptor

3.4 Set the port number that you assigned in the telnet configuration file to the serial port where your Z3 module is connected in Network port of telnet-serial adaptor

4. Close the make config menu and save your changes.

Configuring your Filesystem type

The RidgeRun SDK for DM8168 Z3 RPS supports different filesystem types: UBIFS, JFFS, NFS and also as we mentioned before you can use it in your SD card as well. In this tutorial we are going to use UBI as our default filesystem.

1. Set your environment variables

 cd $(DEVDIR)
 `make env`

2. Open a make config menu

 make config

3. Go to the File System Configuration->File system image target and choose UBIFS volume. Please be sure that UBIFS sub-page size is set to 512.

4. Save your changes and compile your SDK

 make

Flashing uboot, kernel and filesystem in NAND

1.Boot the RidgeRun SDK using the SD card created in the first section of this guide and stop the uboot countdown. Close your Picocom, minicom or telnet session.

U-Boot 2010.06-dirty (Nov 20 2012 - 15:57:54)

DRAM:  1 GiB
Using default environment

Hit any key to stop autoboot:  0 
mmc0 is available
reading u-boot.bin

181500 bytes read
## Starting application at 0x80800000 ...


U-Boot 2010.06-dirty (Nov 20 2012 - 16:14:20)

TI8168-GP rev 2.0

ARM clk: 987MHz
DDR clk: 675MHz

I2C:   ready
DRAM:  1 GiB
NAND:  HW ECC BCH8 Selected
256 MiB
*** Warning - booting from SD, using default environment

Net:   <ethaddr> not set. Reading from E-fuse
Detected MACID:40:5f:c2:69:c7:5c
Ethernet PHY: GENERIC (x001cc914) @ 0x01
DaVinci EMAC
Hit any key to stop autoboot:  0 
Z3-DM8168-MOD# 


2.Run make installbootloader to install uboot in NAND

 make installbootloader

There is a known issue running the make installbootloader command when your Z3 module is initially running uboot from a SD card, in this case you will see the following error once the installer has flashed your uboot in NAND:

  Ridgerun Linux SDK
  Board configuration: DM8168 Z3 Module
  Multi-core machine, using 6 out of 8 cores for building
 
  Installation system of uboot images over TFTP for host <yourIPaddress>
  Be sure u-boot is running on <yourIpAddress>:<yourTelnetPort> and no process (like termnet) is using it
  Press return to continue...

  Performing handshake with u-boot...

  Trying to identify NAND block size... detected 0x20000
  Trying to identify NAND Page size... detected 2048

  Loading upgrade bootloader...
    Uboot <= setenv bootcmd
    Uboot <= saveenv
  Configuring the network...
    Uboot <= setenv autoload no
    Uboot <= dhcp
    Uboot <= setenv serverip <yourTFTPServerIP>
    Uboot <= setenv autostart no
     cp -f $(DEVDIR)/images/bootloader /srv/tftp/bootloader.$(USER).$(DEVDIRNAME).dm8168
    Uboot <= tftp 0x82000000 bootloader.$(USER).$(DEVDIRNAME).dm8168
  Running upgrade bootloader...
    Uboot <= icache off
    Uboot => go 0x82000000

  Performing handshake with u-boot...

  Restoring previous bootcmd value
    Uboot <= setenv bootcmd 'if mmc init 0; then if run loadbootenv ; then run importbootenv ; if test -n ${uenvcmd} ; then run uenvcmd; fi ;fi ;else run nandboot;fi'
    Uboot <= saveenv
  Building UBOOT_MIN image for flash...
  Building U-boot image for flash...
  Loading UBOOT_MIN
  Configuring the network...
    Uboot <= setenv autoload no
    Uboot <= dhcp
    Uboot <= setenv serverip <yourTFTPServerIP>
    Uboot <= setenv autostart no
     cp -f $(DEVDIR)/images/u-boot.noxip.bin /srv/tftp/u-boot.noxip.bin.$(USER).$(DEVDIRNAME).dm8168
    Uboot <= tftp 0x82000000 u-boot.noxip.bin.$(USER).$(DEVDIRNAME).dm8168
  Erasing UBOOT_MIN flash space...
    Uboot <= nand erase 0x0 0x40000
    Uboot <= nandecc hw 2
    Uboot <= nand write 0x82000000 0x0 0x40000
    Uboot <= nandecc sw
  Loading U-Boot
  Configuring the network...
    Uboot <= setenv autoload no
    Uboot <= dhcp
    Uboot <= setenv serverip <yourTFTPServerIP>
    Uboot <= setenv autostart no
     cp -f $(DEVDIR)/images/bootloader.nandbin /srv/tftp/bootloader.nandbin.$(USER).$(DEVDIRNAME).dm8168
    Uboot <= tftp 0x82000000 bootloader.nandbin.$(USER).$(DEVDIRNAME).dm8168
  Erasing U-Boot flash space...
    Uboot <= nand erase 0x40000 0x40000
    Uboot <= nand write 0x82000000 0x40000 0x40000
  Restarting u-boot

  Error: failed to detect u-boot restarting.                                                             

make: *** [installbootloader] Error 255

However, uboot is flashed in nand properly. Please ignore this error, this will be fixed in the next release.

3.Turn off your Z3 module and configure it to boot from NAND (please see Setting up your Z3 module to boot from NAND). Turn on your module and repeat step 1.

4. Now, to install your kernel and filesytem run make install

 make install

Now you have installed all the SDK components in your DM8168 Z3 module and you should be able to boot to Linux shell and see the logo of RigeRun on the HDMI output. The RidgeRun SDK for DM8168 Z3 module loads automatically all the firmware and kernel modules needed to use the video processor subsystem.

Setting up your Z3 module to boot from NAND

In order to boot from a NAND you need to set it as the first boot device to try in the DM8168 boot sequence, this can be done configuring a correct BTMODE through the header called J20 in your Z3 module (see Fig. 5)

Z3NANDboot.jpg
Figure 5. Header to control boot mode (NAND)
|  1   |   2  |   3   |  4   |   5   |  6   |  7   |   8   |
| open | open | short | open | short | open | open | short |

Introduction to NAND memories

If you are more interested on NAND concepts and what is supported on the DM816x please read Introduction to NAND memories

BOOTP Protocol Recovery Procedure

There is likely the case where the developer finds itself with a Z3 module with no carrier board or custom hardware part with a SD card slot available to perform a regular recovery procedure through SD card booting. In such case, it is possible to perform a recovery procedure through the Bootstrap Protocol (BOOTP) which is the basis for a more advanced network manager protocol, the Dynamic Host Configuration Protocol (DHCP).

For further information, please read DM8168_Z3_BOOTP_recovery_procedure

 

Graphics SDK - OpenGL - Qt

The Professional Ridgerun SDK includes Graphics SDK 4.04.00.02 completely integrated, supporting the SGX530 3D Graphics Engine through the PowerVR driver. It also includes support to use Qt to render through the PowerVR kernel module.

1. In order to enable the Graphics SDK in your SDK, please download and install in your home directory the Graphics SDK 4.04.00.02 from the TI web page

sudo chmod 777 Graphics_SDK_setuplinux_4_04_00_02.bin
./Graphics_SDK_setuplinux_4_04_00_02.bin 

2.Then open a make config menu

cd $DEVDIR
make config

3. Go to the Proprietary software and enable the graphics SDK.

GraphicsSDKMenu.png
Figure 6. SDK boot log after enable the Graphics SDK

4. Go to File System Configuration -> Select target's file system software -> qt-4.7.2 and select Support openGL and its demo. Finally disable the option called Make QT as compact as possible.

5. Close the menu, save your configuration and build your SDK.

cd $DEVDIR
make 

6. Install your SDK in your board

make install

7. Boot your board, you will see the following message

Starting System
done.
Welcome to
__________ .__     .___               __________                
\______   \|__|  __| _/  ____    ____ \______   \ __ __   ____  
 |       _/|  | / __ |  / ___\ _/ __ \ |       _/|  |  \ /    \ 
 |    |   \|  |/ /_/ | / /_/  >\  ___/ |    |   \|  |  /|   |  \
 |____|_  /|__|\____ | \___  /  \___  >|____|_  /|____/ |___|  /
        \/          \//_____/       \/        \/             \/ 
           
    Embedded Linux Solutions
 
For further information see:
http://www.ridgerun.com
Build host: dsoto-Latitude-E5430-non-vPro
Built by: dsoto
Build date: Thu, 02 May 2013 16:47:40 -0600
Build tag: dm8168-z3
Configuring network interfaces
SGX revision:  0x10205
Build type:  release6.x
Loaded PowerVR consumer services.

Please press Enter to activate this console. 

8. Finally run one of the openGL demos or one of the qt + openGL demos

export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
export QWS_DISPLAY="powervr" 
export QT_PLUGIN_PATH=/usr/plugins 
export QT_QWS_FONTDIR=/usr/lib/fonts

cd /opt/gxzsdkdemos/ogles2/
/opt/gfxsdkdemos/ogles2 # ./OGLES2Skybox2 
PVRShell: EGL 1.4 initialized


cd /examples/opengl/hellogl_es2
./hellogl_es2

OpenMax Demos

To run the openMax's demos that are located by default in your filesystem in a directory called omx you need to run first the following commands in your Z3 module

Video initialization

echo 0 > /sys/devices/platform/vpss/graphics0/enabled 
echo 0 > /sys/devices/platform/vpss/graphics1/enabled
echo 0 > /sys/devices/platform/vpss/graphics2/enabled

note: To run the decode display/encode demo with a 1080p video we recommend to use your filesystem by NFS due to the size of the input and output file.

Decode display demo

This demo is the decode-display demo included in the EZSDK. It takes an input file encoded in H264, decodes the stream and sends the output to the HDMI output

./omx/decode_display_a8host_debug.xv5T -i inputFile.h264 -w 1920 -h 1080 -f 60 -g 0

Using Gstreamer

Some examples of use of GStreamer to implement basic multimedia pipelines can be found at Gstreamer pipelines for DM816x and DM814x. Please be aware that in order to display video you need to do the Video initialization

note: If you are not using the Ridgerun SDK and you are trying to use the TAG 00_06_00_00 provided by TI you will need to apply the following patch to make V4L2src and omxbufferalloc work.

Index: gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c
===================================================================
--- gst-openmax-dm81xx.orig/src/omx/gstomxbufferalloc.c	2012-11-14 16:15:41.392143697 -0600
+++ gst-openmax-dm81xx/src/omx/gstomxbufferalloc.c	2012-11-14 16:17:40.760145714 -0600
@@ -190,6 +190,7 @@
 
   gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
   gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
+  filter->out_port.portptr = gst_omxportptr_new(&filter->out_port);
   filter->silent = FALSE;
   filter->out_port.num_buffers = 10;
   filter->out_port.always_copy = FALSE;

Additional uboot commands

These u-boot commands are not part of the evaluation or professional SDK, but can be added to the professional SDK if requested.

Description

RidgeRun extended uboot with additional commands for the DM816x platform. The new functionality includes:

1. Copy a block of data from NAND to NAND and decompress the data (gz or bz) on the fly if that is specified in the command. The size of the data being copied can be larger than the available RAM.

nand copy dest src size [gz|bz] - Read data from one section of flash, optionally decompress it, and write it to another section of flash
          dest - destination flash address, must be even sector boundary
          src  - source flash address, must be even sector boundary.  If data is compressed, then all header data will be stored here, as in the beginning of a bz2 archive
          size - number of source bytes to copy; does not have to be even sector boundary; destination size may be larger if source is compressed
          [gz|bz] - decompression algorithm
                    gz: MIME type application/x-gzip
                    bz: MIME type application/x-bzip2

Furthermore, RidgeRun added a nand md5sum command that can be used to verify the integrity of the data that was copied in nand.

nand md5sum src size [gz|bz] - Calculate the md5 sum for a region of flash, optionally decompressing the data

2. Add the ability to extract contents from tarballs, include: list the content of the tarball, cat a desired file that is contained in the tarball, computes the md5sum of the desired tarball or load the tarball from a SD or USB drive, decompress it, take the desired file and write it to NAND. Currently in these commands just gz decompression algorithm is supported and soon we are going to add bz.

tar - tar archive
   
    Usage:
    tar list fat <interface> <dev[:part]> <tarfilename> [<alg>]
    tar cat fat <interface> <dev[:part]> <tarfilename> <filename> [<alg>]
    tar md5sum fat <interface> <dev[:part]> <tarfilename> <filename> [<alg>]
    tar write_nand fat <interface> <dev[:part]> <tarfilename> <filename> <off> [<alg>]   
    Parameters:
            <interface>   :== file system interface name
            <dev[:part]>  :== file system device and partition number
            <tarfilename> :== name of tarball file on the specified storage media
            <filename>    :== name of file of interest which is contained in the tarball
            <off>         :== destination NAND address
            <alg>         :== [gz] - decompression algorithm
                              gz: MIME type application/x-gzip

Configuring SDK to use tar commands

Due to limitations in the DM8168, the size of uboot cannot exceed 255KB. When the tar commands is included in uboot, the executable increases to ~300KB. Due to the hardware limitation RidgeRun implemented a boot model based in two stages to handle a large uboot executable. First, the SDK creates a uboot.min (<255KB) which doesn't have the tar command The small uboot is loaded by the ROM code in the DM8186 as normal, initializating of the board. Subsequently, The small uboot.min loads a second uboot (~300KB) which contains all the logic to implement the tar command. The two stage boot process adds around one second to the overall boot time.

The Ridgerun SDK has logic to handle this approach based in two stages (including the installation process), in order to enabled the two stage model please follow this steps:

1. Open the make config menu

cd $DEVDIR
make config

2. Enable two stages model

Location: │

      -> Bootloader Configuration
    [*] Enable two stages model for uboot

3. Close the make config menu and save your changes

NAND layout

Before to start testing the uboot commands it is important to keep in mind the NAND layout used by your SDK. The following layout was detected using UBIFS ~61MB

  +------------+--->0x00000000-> U-Boot min start
 |		|
 |		|-->0x0003FFFF-> U-Boot min end
 |		|-->0x00040000-> U-Boot start 
 |		|
 |		|-->0x0025FFFF-> U-Boot end
 |		|-->0x00260000-> ENV start
 |		|
 |		|
 |		|-->0x0027FFFF-> ENV end
 |		|-->0x00280000-> Linux Kernel start
 |		|
 |		|
 |		|
 |		|
 |		|-->0x006BFFFF-> Linux Kernel end
 |		|-->0x006C0000-> Filesystem start
 |		|
 |		|
 |		|
 |		|
 |		|
 |		|
 |		|
 |		|
 |		|
 |		|-->0x0435FFFF-> Filesystem end
 |		|-->0x04360000-> Free start
 |		|
 |		|
 |		|
 +------------+-->0x10000000-> NAND end (Free end)

Examples

In this section you are going to find examples about how to use the additional commands provided by RidgeRun.

Please notice that the tar commands can be used to load files from a SD card or from a USB drive, it is important to mention that if you want to load the tarball from the SD card you need to initialize the SD card running the following command:

Z3-DM8168-MOD# mmc init 0
mmc0 is available

Moreover, if you want to use a USB drive you need to initialize it with:

Z3-DM8168-MOD# usb reset
(Re)start USB...
USB:   scanning bus for devices... 1 USB Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found

Nand copy and nand md5sum

Please create the following files to test the uboot commands

Create 16MB file

sudo dd count=1 bs=16M if=/dev/zero of=file.img
gzip file.img
bzip2 file.img 

Compute md5sum

md5sum file.img 
2c7ab85a893283e98c931e9511add182  file.img
md5sum file.img.gz 

79ec220244e0c90cfa03764d13a46634 file.img.gz

md5sum file.img.bz2 

4119aca17186852b10fce74a2aad5fdf file.img.bz2

Please copy these files to your tftp server directory

cp file.img /srv/tftp/
cp file.tar.gz /srv/tftp/
cp file.img.bz2 /srv/tftp/

Create 32MB file

sudo dd count=1 bs=32M if=/dev/zero of=file32.img
gzip file32.img

Compute md5sum

md5sum file32.img 
58f06dd588d8ffb3beb46ada6309436b  file32.img
md5sum file32.img.gz 

2da9ef91a744699aa483754bfefffaed file32.img.gz

Copy files to the tftp server directory

cp file32.img /srv/tftp/
cp file32.img.gz /srv/tftp/


1. nand copy command (without decompress)

In order to test if the nand copy command (without decompress) is working properly the following commands were run in uboot

#Erase the nand sectors where we are going to work
nand erase 0x6c0000 0x00020000

# Dump the memory content at 0x6c0000
nand dump 0x6c0000

#Write 0x1000 (4MB) of 0xaaaaaaaa starting at 0x82000000
mw.l 0x82000000 0xaaaaaaaa 0x1000

#Check that it was written properly in RAM
md 0x82000000

#Write 0x1000 (4MB) from RAM (0x82000000) to nand (0x6c0000)
nand write 0x82000000 0x6c0000 0x1000

#Dump the data just written 
nand dump 0x6c0000

#Now we are going to use the nand copy to move 4MB from 0x6c0000 to 6C1000
#Dump dest
nand dump 6C1000

#nand copy to move 4MB from 0x6c0000 to 6C1000
nand copy 0x6C1000 0x6c0000 0x1000

#Show the data written by nand copy
nand dump 0x6C1000

Compressed files < 16K (one chunk)

2. nand md5sum command (without decompress)

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file.img

#Erase nand block to use (16MB)
nand erase 0x04380000 0x1000000

#Write the file into nand 
nand write 0x82000000 0x04380000 0x1000000

Compute md5sum

#Compute md5sum
nand md5sum 0x04380000 0x1000000
2c7ab85a893283e98c931e9511add182

3. nand md5sum command (gz decompress)

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file.img.gz

#Erase nand block to use (16MB)
nand erase 0x04380000 0x1000000

#Write the file into nand 
nand write 0x82000000 0x04380000 4000

Decompress gz file and compute the md5sum

#Decompress gz file and compute the md5sum
nand md5sum 0x04380000 0x3fb8 gz
2c7ab85a893283e98c931e9511add182

4. nand md5sum command (bz decompress)

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file.img.bz2

#Erase nand block to use (16MB)
nand erase 0x04380000 0x1000000
nand erase 0x043A0000 0x1000000

#Write the file into nand 
nand write 0x82000000 0x04380000 4000

Decompress bz file and compute the md5sum

#Decompress bz file and compute the md5sum
nand md5sum 0x04380000 0x2d bz
2c7ab85a893283e98c931e9511add182

5. nand copy command with gz decompress

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file.img.gz

#Erase nand block to use (16MB)
nand erase 0x04380000 0x1000000

#Write the file into nand 
nand write 0x82000000 0x04380000 4000

#Nand copy and gz decompress
nand copy 0x043A0000 0x04380000 0x3fb8 gz

Compute md5sum of the copy

#Decompress gz file and compute the md5sum
nand md5sum 0x043A0000 1000000
2c7ab85a893283e98c931e9511add182

6. nand copy command with bz2 decompress

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file.img.bz2

#Erase nand block to use (16MB)
nand erase 0x04380000 0x1000000
nand erase 0x043A0000 0x1000000

#Write the file into nand 
nand write 0x82000000 0x04380000 4000

#Nand copy and bz2 decompress
nand copy 0x043A0000 0x04380000 0x2d bz

Compute md5sum of the copy

#Decompress bz2 file and compute the md5sum
nand md5sum 0x043A0000 1000000
2c7ab85a893283e98c931e9511add182

Compressed files > 16K (one chunk)

7. nand md5sum command (without decompress)

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file32.img

#Erase nand block to use (32MB)
nand erase 0x04380000 0x2000000

#Write the file into nand 
nand write 0x82000000 0x04380000 0x2000000

Compute md5sum

#Compute md5sum
nand md5sum 0x04380000 0x2000000
58f06dd588d8ffb3beb46ada6309436b

8. nand md5sum command (gz decompress)

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file32.img.gz

#Erase nand block to use (32MB)
nand erase 0x04380000 0x2000000

#Write the file into nand 
nand write 0x82000000 0x04380000 8000

Decompress gz file and compute the md5sum

#Decompress gz file and compute the md5sum
nand md5sum 0x04380000 0x7f54 gz
58f06dd588d8ffb3beb46ada6309436b

9. nand copy command with gz decompress

Load file to uboot using TFTP server

#Set TFTP server IP address
setenv serverip <IPaddressTFTPServer>

#Don't start after load the file
setenv autostart no

#TFTP the file
tftp 0x82000000 file32.img.gz

#Erase nand block to use (32MB)
nand erase 0x04380000 0x2000000

#Write the file into nand 
nand write 0x82000000 0x04380000 8000

#Nand copy and gz decompress
nand copy 0x043A0000 0x04380000 0x7f54 gz

Compute md5sum of the copy

#Decompress gz file and compute the md5sum
nand md5sum 0x043A0000 2000000
58f06dd588d8ffb3beb46ada6309436b

Tar commands

In order to implement these commands we are using libarchive, you can find a useful web page about it here. Furthermore, it is important to mention that in the DM8168 uboot has a size limitation, where 255KB is the maximum size that uboot can have. When we include the libarchive library we overcome that limit, so uboot will not work if you try to use it by default in your NAND memory for instance, instead you need to use a model based in two stages, please configure your SDK.

Create tarballs for the test

Simple tarball

TARDIR=`pwd`/tmp
mkdir -p $TARDIR
echo "1" > $TARDIR/1.txt
echo "2" > $TARDIR/2.txt
echo "3" > $TARDIR/3.txt
( cd $TARDIR ; ln -s 3.txt 3.lnk.txt )
mkdir $TARDIR/newdir
sudo dd count=1 bs=256K if=/dev/zero of=zeros.txt
dd if=/dev/zero bs=1M count=4 | tr '\0' '\377' > ones.txt
sudo chown $USER:ridgerun *
sudo cat ones.txt >> zeros.txt
mv zeros.txt tmp/log.txt; rm ones.txt
tar cf uboot-tarball.tar tmp

In order to test the tar gz decompression algorithm

tar -czf uboot-tarball.tar.gz tmp


Please save the tarballs to a USB thumb drive or an SD card and be aware that you need to initialize the device before to use it:

USB

usb reset

SD card

mmc init 0

tar ls command

Lists the files in a tar archive

Test using the USB drive

1. tar list command

Z3-DM8168-MOD# tar list fat usb 0 uboot-tarball.tar
 directory: tmp/
 directory: tmp/newdir/
   regular: tmp/log.txt
   regular: tmp/1.txt
   symlink: tmp/3.lnk.txt
   regular: tmp/3.txt
   regular: tmp/2.txt

tar cat command

Cat a file in a tar archive

Testing using USB drive - no decompression algorithm

Z3-DM8168-MOD# tar cat fat usb 0 uboot-tarball.tar tmp/log.txt            
File found
	 address: 00000000
0000: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
0020: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
0040: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
0060: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
	 address: 00040000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00080000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 000c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00100000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00140000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00180000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 001c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00200000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00240000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00280000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 002c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00300000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00340000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00380000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 003c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00400000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
Size :4456448 bytes

Testing using USB - gz decompression algorithm

It is important to mention that we added a 4.3MB file called log.txt which is filled with 0x00 and 0XFF in order to test the ability to read and decompress chunks. We need to include the full path in order to cat the desired file, for instance, if you want to cat 1.txt you need to specify tar/1.txt as the file to cat.

Z3-DM8168-MOD# tar cat fat usb 0 uboot-tarball.tar.gz tmp/log.txt gz
File found
	 address: 00000000
0000: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
0020: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
0040: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
0060: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
	 address: 00040000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00080000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 000c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00100000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00140000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00180000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 001c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00200000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00240000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00280000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 002c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00300000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00340000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00380000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 003c0000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
	 address: 00400000
0000: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0020: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0040: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
0060: ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
Size :4456448 bytes

tar md5sum command

Computes the MD5sum of a desired file that is located in a tarball

Testing using USB - no decompression algorithm

Compute the md5sum of the desired file in your computer

md5sum tmp/log.txt 
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt

Run tar md5sum in uboot

Z3-DM8168-MOD#  tar md5sum fat usb 0 uboot-tarball.tar tmp/log.txt 
File found
Size :4456448 bytes
893abfd4f775da3065291a8a0b9dbaf8

Testing using USB - gz decompression algorithm

Compute the md5sum of the desired file in your computer

md5sum tmp/log.txt 
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt

Run tar md5sum in uboot

Z3-DM8168-MOD# tar md5sum fat usb 0 uboot-tarball.tar.gz tmp/log.txt gz
File found
Size :4456448 bytes
893abfd4f775da3065291a8a0b9dbaf8

tar write_nand command

Load a tarball from the FAT32 device, decompress it if it is needed, take the desired

Testing using USB - no decompression algorithm

Compute the md5sum of the desired file in your computer

md5sum tmp/log.txt 
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt

Erase nand sector

nand erase 0x04380000 0x440000

Run tar write_nand in uboot

Z3-DM8168-MOD# tar write_nand fat usb 0 uboot-tarball.tar tmp/log.txt 0x04380000
File found

Compute the md5sum in nand in order to verify the integrity of the data

Z3-DM8168-MOD# nand md5sum 0x04380000 0x440000
893abfd4f775da3065291a8a0b9dbaf8

Testing using USB - gz decompression algorithm

Compute the md5sum of the desired file in your computer

md5sum tmp/log.txt 
893abfd4f775da3065291a8a0b9dbaf8  tmp/log.txt

Erase nand sector

nand erase 0x04380000 0x440000

Run tar md5sum in uboot

Z3-DM8168-MOD# tar write_nand fat usb 0 uboot-tarball.tar.gz tmp/log.txt 0x04380000 gz
File found

Compute the md5sum in nand in order to verify the integrity of the data

Z3-DM8168-MOD# nand md5sum 0x04380000 0x440000
893abfd4f775da3065291a8a0b9dbaf8

Linux Performance

There are performance issues that can be fixed tuning the Linux kernel. Here some interesting pages are listed with tuning solutions and tricks specially for memory lateness problems.

Articles related to this board

RidgeRun 2011Q2 SDK User Guide
RidgeRun Turrialba SDK User Guide
EZSDK Memory Map
OMX EZSDK Examples
TMS320DM816x DaVinci Digital Media Processor
Technical Reference Manual