Difference between revisions of "Development Environment HowTo (NELK)"

From DAVE Developer's Wiki
Jump to: navigation, search
(Build a custom application)
(Build/configure U-Boot only)
Line 200: Line 200:
  
  
 +
=== Build the graphic components ===
  
 
=== Boot the system ===
 
=== Boot the system ===

Revision as of 13:38, 25 May 2012

Info Box
Naon am387x-dm814x.png Applies to Naon


Introduction[edit | edit source]

In this HowTo we'll take a first look of Naon Embedded Linux Kit (NELK) development environment.

To allow fast development startup, NELK is provided as DVDK virtual appliance, in this way user can setup its development environment in minutes and get productive as soon as the virtual machine starts.

Build the whole kit[edit | edit source]

Building the whole kit means:

  • build Linux kernel with default configuration
  • build u-boot with default configuration
  • build gstreamer and all the required libriaries
  • install the binaries into the root file system

After starting the DVDK, log in by using the default user and start a terminal. Then:

  • enter the EZSDK_INSTALL_DIR directory: cd /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-x.xx.xx.xx
    • where the x should be substituted with the current release which NELK is based (e.g. /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15)
  • run make all command
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make all
make -C /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/board-support/linux-2.6.37-psp04.01.00.06.patch2 ARCH=arm CROSS_COMPILE=/home/shared/devel/dave/naon-DAA/sw/linux/sdk/arm-2009q1//bin/arm-none-linux-gnueabi- uImage
make[1]: Entering directory `/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/board-support/linux-omap3.git'

[snip..]

max_DM81XX_RELEASE_0_03'
make[2]: Leaving directory `/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/component-sources/gst-openmax_DM81XX_RELEASE_0_03'
make[1]: Leaving directory `/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/component-sources/gst-openmax_DM81XX_RELEASE_0_03'
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$
  • after the build finish (which may take a while, depending on user's PC power), user can install the binaries with sudo make install (sudo is required due file permission restriction on the root file system)
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ sudo make install
[sudo] password for nelk: 
install -d /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/../rfs/nelk/boot
install  /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/board-support/linux-2.6.37-psp04.01.00.06.patch2/arch/arm/boot/uImage /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/../rfs/nelk/boot
install  /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/board-support/linux-2.6.37-psp04.01.00.06.patch2/vmlinux /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/../rfs/nelk/boot
install  /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/board-support/linux-2.6.37-psp04.01.00.06.patch2/System.map /home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/../rfs/nelk/boot

[snip..]

make[3]: Entering directory `/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/component-sources/gst-openmax_DM81XX_RELEASE_0_03'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/component-sources/gst-openmax_DM81XX_RELEASE_0_03'
make[2]: Leaving directory `/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/component-sources/gst-openmax_DM81XX_RELEASE_0_03'
make[1]: Leaving directory `/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/component-sources/gst-openmax_DM81XX_RELEASE_0_03'
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ 
  • when the install process finishes all the binaries are installed

Build a custom application[edit | edit source]

Please refer to the dedicated section on the EZSDK Developers Guide

The following instructions allow to build and check a simple "hello world" C application:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk$ mkdir workdir

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk$ cd workdir/

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$ gedit helloworld.c

Insert the following source code:

#include <stdio.h>
 
 int main()
 {
     printf("Hello World!\n");
 }
 
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$ gedit Makefile

Insert the following instructions:

# Import the variables from the EZSDK so that you can find the EZSDK components
 include ${EZSDK}/Rules.make
 
 helloworld:
 # Make sure that you use a tab below
     $(CSTOOL_PREFIX)gcc -o helloworld helloworld.c 

Take care that the gap before $(CSTOOL_PREFIX)gcc corresponds to a tab.

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$ export EZSDK=/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15/

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$ make helloworld
/home/shared/devel/dave/naon-DAA/sw/linux/sdk/arm-2009q1//bin/arm-none-linux-gnueabi-gcc -o helloworld helloworld.c

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$ file helloworld
helloworld: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$

Once you have the compiled binary, you can copy it to the root file system:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$ cp helloworld /home/shared/devel/dave/naon-DAA/sw/linux/sdk/rfs/nelk/home/root/
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/workdir$

and execute it:

root@naon:~# ./helloworld
Hello World!

Build/configure Linux kernel only[edit | edit source]

If needed, user can configure and build only the Linux kernel (this is useful, for example, if you are a kernel driver developer).

Linux kernel source are available inside EZSDK_INSTALL_DIR/board-support/linux-omap3.git.

The configuration name is specified inside $EZSDK_INSTALL_DIR/Rules.make into the variable DEFAULT_LINUXKERNEL_CONFIG

Enter the $EZSDK_INSTALL_DIR and type:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make linux_defconfig

in order to configure the kernel. This will create a

.config

file into the EZSDK_INSTALL_DIR/board-support/linux-omap3.git.

To build the Linux uImage (suitable for U-Boot) and modules, please enter the following command:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make linux


200px-Emblem-important.svg.png
The
make linux
command will fail complaining about a missing .config file if launched before preparing the kernel configuration as described above


To manually change the default configuration, execute:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make linux_menuconfig

This will open the usual Linux curses configuration interface to allow configuration changes.

To clean the build, type:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make clean

To revert to the default configuration, type:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make linux_defconfig


Two additional target are provided:

nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make linux_install

Copy the binaries (uImage and modules) inside the root file system (see EXEC_DIR variable inside $EZSDK_INSTALL_DIR/Rules.make), under the directory:

  • $EXEC_DIR/boot: for uImage
  • $EXEC_DIR/lib/modules/$KERNEL_VERSION: for the modules


Info-icon.png Please note that, on DVDK, $EXEC_DIR/boot is inside the TFTP root directory, thanks to the symbolic link: /srv/tftp/naon -> $EXEC_DIR/boot.

So requesting naon/uImage to DVDK's TFTP server will return $EXEC_DIR/boot/uImage

Info-icon.png


Info-icon.png Please note that, after running make linux_install, the user should run the command depmod from the target shell
root@naon:~# depmod
Info-icon.png


Info-icon.png Please note that sudo make linux_install delete all other installed linux kernel modules. For this reason, after this command the user should also run
sudo make syslink_install sgx-driver_install
Info-icon.png

Build/configure U-Boot only[edit | edit source]

Build the graphic components[edit | edit source]

Boot the system[edit | edit source]

Please refer to Booting Linux Kernel for general information about the kernel boot process.

In order to boot the system, please check that the DVDK network is properly configured and that the NFS service is working. Please check NFS for more information on how Network File System works.

From the U-boot shell, please check the following parameters and set them accordingly with your host and target configuration:

  1. serverip - IP address of the host machine running the tftp/nfs server
  2. ipaddress - IP address of the target
  3. ethaddr - MAC address of the target
  4. netmask - Netmask of the target
  5. gatewayip - IP address of the gateway
  6. netdev - Ethernet device name
  7. rootpath - Path to the NFS-exported directory
  8. u-boot - Path to the u-boot binary image on the tftp server
  9. bootfile - Path to the kernel binary image on the tftp server
  10. nfsargs - Kernel command line with parameters for loading the root file system through NFS


Info-icon.png Please note that, on DVDK, $EXEC_DIR/boot is inside the TFTP root directory, thanks to the symbolic link: /srv/tftp/naon -> $EXEC_DIR/boot. The root file system is, by default, stored in the $EXEC_DIR directory and NFS-exported. Info-icon.png

To boot the system, please type the following command:

run net_nfs

from the u-boot console.