Difference between revisions of "Hawkboard/BeginnersGuide"

From eLinux.org
Jump to: navigation, search
(cleaning up grammar and spelling)
 
(47 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category: Hawkboard]]
 
[[File:Hawkboard hw.jpg |right]]
 
[[File:Hawkboard hw.jpg |right]]
 +
<div style="margin:0; margin-top:10px; margin-right:10px; border:1px solid #dfdfdf; padding:0 1em 1em 1em; background-color:#fff1dc; align:right; ">
 +
Access Beginners Guide to Programming on Hawkboard http://elinux.org/Hawkboard/Programming_Guide_-Linux(ARM)
 +
</div>
 
==Introduction==
 
==Introduction==
Hawkboard is a [http://en.wikipedia.org/wiki/Open-source_hardware open-hardware] project which uses Texas Instrument's (TI)  
+
Hawkboard is an [http://en.wikipedia.org/wiki/Open-source_hardware open-hardware] project which uses Texas Instrument's (TI)  
OMAP Processor(OMAPL-L138) (Which contains both DSP and ARM Processor)
+
OMAP(open multimedia application platform) Processor(OMAPL-L138). It has both a DSP and an ARM Processor.
 +
 
 +
*[http://en.wikipedia.org/wiki/ARM_architecture ARM]-This normally runs an OS such as Linux \ Android etc. ARM in OMAPL-138 ,is ARMV5/ARM926
 +
*[http://en.wikipedia.org/wiki/Digital_signal_processor DSP]- This is a specialized processor  for performing Image,Audio and Video encoding/Decoding. These type of processor are  specifically designed to perform these operations faster. DSP in OMAPL-138 ,is C674x Floating Point DSP.
  
*[http://en.wikipedia.org/wiki/ARM_architecture ARM]-This Normally runs Operating System Such as Linux or Android etc.ARM in OMAPL-138 ,is ARMV5/ARM926
+
Mix of ARM & DSP (OMAP) gives high performance and low power computing platform,Which are normally used in embedded and mobile Devices.
*[http://en.wikipedia.org/wiki/Digital_signal_processor DSP]-This is normally used to perform Audio/Video encoding and Decoding as it is specifically  designed to perform these operations faster.DSP in OMAPL-138 ,is C674x Floating Point DSP.
 
  
Mix of ARM & DSP (OMAP) gives high performance and low power computing platform,Which are normally used in embedded Devices
 
Like Mobile etc.
 
  
A Similar kind and very popular Open-hardware platform  is  [http://beagleboard.org/ beagleboard] that uses Faster OMAP from TI.
+
A Similar kind and a very popular Open-hardware platform  is  [http://beagleboard.org/ beagleboard] that uses Faster OMAP from TI.
  
=== Command prompts in this guide ===
+
=== Command usage in this guide ===
 
In this guide, commands are preceded by prompts that indicate the
 
In this guide, commands are preceded by prompts that indicate the
 
environment where the command is to be typed. For example:
 
environment where the command is to be typed. For example:
Line 28: Line 32:
 
1. Hawkboard
 
1. Hawkboard
  
2. 5V 1Ampere Power Supply (Higher than 1A recommended)
+
2. 5V 1Ampere Power Supply  
 +
''(Atleast 700mA recommended ,As long as volatage is 5V a higher ratings like 1A,2A even more can be used)''
  
 
3. USB Hub (Hub that provides external power supply is recommended)
 
3. USB Hub (Hub that provides external power supply is recommended)
Since in future you might want to connect multiple peripherals like Keyboard,mouse ,USB Storage  
+
A USB Hub is highly recommended As you might want to connect multiple peripherals like Keyboard,mouse ,USB Storage  
devices.A USB Hub is highly recommended.
+
devices.
  
 
4. Cross Cable DB-9 Female at both ends  
 
4. Cross Cable DB-9 Female at both ends  
Line 46: Line 51:
 
8.System Running Linux either on Real Machine or Vmware/VirtualBOX
 
8.System Running Linux either on Real Machine or Vmware/VirtualBOX
  
{{Note|This guide assume ,that Linux is Ubuntu Jaunty (9.10)}}
+
{{Note|This guide assume ,that Development Host System is Ubuntu Jaunty (9.10)}}
 
 
  
 
===Preparing Hawkboard===
 
===Preparing Hawkboard===
Line 63: Line 67:
  
 
'''d)''' Further Also check whether you are receiving the Data from Hawkboard UART/Serial port to PC/Laptop Serial port.
 
'''d)''' Further Also check whether you are receiving the Data from Hawkboard UART/Serial port to PC/Laptop Serial port.
Serial port will be used to tell bootloader(u-boot) where the Kernel image & File-system
+
Serial port will be used to send parameters to bootloader(u-boot).
(Rootfile system) is present.
 
  
For this Connect UART/serial port of Hawkboard on to PC by NULL cable which has DB-9 Female at both ends  
+
Connect UART/serial port of Hawkboard on to PC by NULL cable which has DB-9 Female at both ends  
& It must be crossed i.e and 2 & 3 .
+
& It must be crossed i.e and 2 & 3 Interchanged at both ends.
  
 
Below is Wiring Diagram
 
Below is Wiring Diagram
Line 73: Line 76:
 
[[File:NULL_CABLE_HB.jpg | 360px ]]
 
[[File:NULL_CABLE_HB.jpg | 360px ]]
  
'''e)''' Once cable has been connected open following software depending  
+
'''e)''' Once cable has been connected use following software depending  
 
on your system.
 
on your system.
  
 
*Hyperterminal or Teraterm -if you are using windows.
 
*Hyperterminal or Teraterm -if you are using windows.
 
*Cutecom or minicom -if you are using Linux
 
*Cutecom or minicom -if you are using Linux
 
*Using Cutecom (Linux)
 
  apt-get install cutecom
 
  cutecom &
 
 
  ScreenShot below 
 
  /dev/ttyS0 -COM1
 
  /dev/ttyUSB0 -USB RS232
 
 
* Using Hypertermincal (Windows)
 
Start->Run->hypertrm
 
or  Start-All program-Accessories-Communication-Hyper
 
terminal select appropriate Comport
 
 
  
 
& Set following parameters to see uboot messages
 
& Set following parameters to see uboot messages
Line 100: Line 89:
 
: Flow Control: None
 
: Flow Control: None
 
: Transmit delay: 0 msec/char, 10 msec/line (Optional)
 
: Transmit delay: 0 msec/char, 10 msec/line (Optional)
 +
 +
*Using Cutecom (Linux)
 +
  '''host$''' apt-get install cutecom
 +
  '''host$''' cutecom &
 +
 +
Set comport
 +
#If you are directly using PC/Laptop that has comport then it will be probably /dev/ttyS0 -COM1 or /dev/ttyS1 if COM2
 +
#If you are USB RS232 converter than comport will be something /dev/ttyUSB0
 +
 +
Cutecom ScreenShot below
 +
 +
[[File:Cutecom.jpg | 480px| Centre ]]
 +
 
 +
 +
* Using Hypertermincal (Windows)
 +
Start->Run->hypertrm  or  Start-All program-Accessories-Communication-Hyper terminal
 +
select appropriate Comport
  
 
As shown below screenshot of Hyperterminal settings  
 
As shown below screenshot of Hyperterminal settings  
Line 109: Line 115:
 
[[File:Hawk_uboot_msg.JPG | 480px |center]]
 
[[File:Hawk_uboot_msg.JPG | 480px |center]]
  
Pressing enter will again give a new "Hawkboard.org>" .
+
Pressing enter will again give a new '''Hawkboard.org>''' Prompt .
  
 
This shows that serial port is working to send and receive messages to/from hawkboard
 
This shows that serial port is working to send and receive messages to/from hawkboard
Line 117: Line 123:
 
serial port (one for RS232 transmit & one for RS232 receive).  
 
serial port (one for RS232 transmit & one for RS232 receive).  
 
One of them blinks while the board boots. Showing that is transmitting data to the serial ports.  
 
One of them blinks while the board boots. Showing that is transmitting data to the serial ports.  
If that Led is blinking then either your cross cable should have a problem or it should be loose connection.}}
+
If that Led is blinking then either your cross cable should have a problem or it should be loose connection.
 +
 
 +
If you are not getting anything on VGA Monitor or COM Port Follow:
 +
'''[http://alokprasad.spaces.live.com/blog/cns!48CAA8345A2495B1!374.entry Recovering U-Boot on Hawkboard]'''
  
 
==Introduction to uImage ,uBoot & File-system ==
 
==Introduction to uImage ,uBoot & File-system ==
As a normal system needs kernel and various application to be useful ,Similar and embedded devices too need a  
+
A Desktop system needs kernel and various application for it to be useful.  Similarly, embedded devices also need a Kernel that manages/allocates resources & Schedule task & Set of Applications to perform user task.
Kernel that manages/allocates resources & Schedule task & Set of Applications to perform user task.
 
  
 
The components here are:
 
The components here are:
  
*'''uImage''' :- uImage is a Linux Kernel (2.6.x) that Bootloader(Uboot) Loads which then finally mounts the Filesytem present
+
*'''uImage''' :- uImage is a Linux Kernel (2.6.x) that Bootloader (Uboot) Loads which then finally mounts the (RootFS) Filesytem.  The filesystem can be either on SD Card / USB Drive or on Another Network PC through NFS (Network File System) Protocol.
can be either on SD Card / USB Drive or on Another Network PC through NFS Protocol.
+
This is similar to Vmlinuz (Linux Kernel that grub loads) that exists in Normal Desktop Environment usually in /boot folder.
  
*'''RootFS''' :-Kernel itself is manager of resource and dose nothing ,you need a filesystem for Kernel to manage and you to work upon.
+
*'''RootFS''' :-Kernel itself is A manager of resource and does nothing useful to user,you need a filesystem for Kernel to manage and you to work upon and provide apps to user.
 
Filesystem is also known as Root Filesystem ,It basically contains all the application  (ls,cat,vi etc ),directory structure
 
Filesystem is also known as Root Filesystem ,It basically contains all the application  (ls,cat,vi etc ),directory structure
/dev, /proc, /bin, /etc, /lib, /usr, /tmp & necessary scripts (rc, inittab, fstab etc) etc.
+
/dev, /proc, /bin, /etc, /lib, /usr, /tmp & necessary scripts (rc, inittab, fstab etc).
  
*'''U-boot ''' :- There is third component Known as Bootloader that actually initially Loads Kernel in RAM
+
*'''U-boot ''' :- The  third component Known as Bootloader actually Loads Kernel in RAM.
preloaded Bootloader in Hawkboard is '''U-boot'''.Similar to Like GRUB for Linux and NTLDR for Windows
+
Preloaded Bootloader in Hawkboard is '''U-boot'''.Similar to Like GRUB for Linux and NTLDR for Windows
  
 
==Download Kernel & Root FS==
 
==Download Kernel & Root FS==
Download the Sample uImage & Root Filesystem(RootFS) from The Link
+
Download the Sample uImage & Root Filesystem(RootFS) from The Link below
  
 
* '''uImage''' :- Kernel Image ''http://hawktool.googlecode.com/files/uImage_v1''   
 
* '''uImage''' :- Kernel Image ''http://hawktool.googlecode.com/files/uImage_v1''   
 
Kernel will loaded through TFTP Server.Though u-boot can load this image from USB/SD Card but  
 
Kernel will loaded through TFTP Server.Though u-boot can load this image from USB/SD Card but  
 
the Preloaded (Uboot) that comes with Hawkboard cant access  USB/SD Card hence cant access &   
 
the Preloaded (Uboot) that comes with Hawkboard cant access  USB/SD Card hence cant access &   
load uImage.Once the uImage is loaded it can then Access SD/MMC to load Root Filesystem as kernel
+
load uImage.Once the uImage is loaded it can then Access SD/MMC to load Root Filesystem .
as Driver to access them.
 
  
 +
(NB:Newer kernel image [http://hawktool.googlecode.com/files/uImage_v3 uImage_v3] contains support
 +
for 800x600 resolution and dsplink)
 
                        
 
                        
* '''RootFS''' :- Filesystem ''http://hawktool.googlecode.com/files/hawktool_v1.tar.bz2''  
+
* '''RootFS''' :- Filesystem ''http://hawktool.googlecode.com/files/RootFS_v1.tar.bz2''  
Filesystem will loaded through NFS ((Faster to make changes on system )or SD/USB Drive once
+
 
uImage is loaded.
+
Filesystem can be loaded through NFS or SD/USB Drive once uImage is loaded and executed.
  
 
The Sample RootFS contains Ubuntu Jaunty Non-Graphical distribution ,which contains ''' gcc,ssh'''  
 
The Sample RootFS contains Ubuntu Jaunty Non-Graphical distribution ,which contains ''' gcc,ssh'''  
Line 155: Line 164:
 
For installing new packages you can also use "apt-get install <package_name>"
 
For installing new packages you can also use "apt-get install <package_name>"
  
==Installing and setting TFTPD on PC((Needed for uImage Transfer to Board)==
+
==Installing and setting TFTPD on PC(Needed for uImage Transfer to Board)==
 
Since TFTP Server is required on Host System to Transfer uImage to Hawkboard ,Install TFTP Server
 
Since TFTP Server is required on Host System to Transfer uImage to Hawkboard ,Install TFTP Server
 
by following steps below:
 
by following steps below:
Line 187: Line 196:
 
5.Place uImage_v1 in /tftpboot dir
 
5.Place uImage_v1 in /tftpboot dir
  
 +
==Preparation for transferring Root Filesystem==
 +
RootFilesytem can be loaded to Hawkboard either using SD/MMC or NFS.
 +
 +
If you want to use SD Card or USB Pendrive for loading the RootFS ,you can skip this section
 +
and proceed to SD/USB Drive Booting section.Also in case you are facing difficulty setting up
 +
NFS Server ,Following [http://elinux.org/Hawkboard/BeginnersGuide#Using_SD_Card_or_USB_Card_Method Using SD Card or USB Card Method]is recommended.
 +
 +
===Using NFS Server Method ===
  
==Installing and configuring NFS Server (Needed for loading RootFS  to Board)==
+
In NFS Boot method Root Filesystem remains on host PC & is shared using NFS Server.
In This method Root Filesystem remains on host PC and is remotely mounted on hawkboard,
+
uImage mounts this NFS Shared folder as its root-file system.
So files can be accessed from Hawkboard else-well as Host Machine,any changes is  
+
Since its shared files can be accessed from Hawkboard else-well as Host Machine,any changes is  
 
reflected on both.This method do not require you to Copy RootFS on SD Card/USB Drive.
 
reflected on both.This method do not require you to Copy RootFS on SD Card/USB Drive.
 
Development is faster since u can directly copy files from Host machine to NFS Folder
 
Development is faster since u can directly copy files from Host machine to NFS Folder
 
and it will reflected back on Hawkboard.
 
and it will reflected back on Hawkboard.
  
In case you dont want to boot over Network and want to USB/SD Card to store
+
Follow these steps to configure NFS Server
 +
1. Install NFS Server
 +
'''host$''' sudo apt-get install portmap nfs-kernel-server
 +
 
 +
2. Share the Folder containing extracted RootFS (e.g /nfsroot contains RootFS)
 +
 
 +
Edit /etc/exports and add the shares:
 +
 
 +
/nfsroot <NETWROK_IP><SUBNET_MASK>(rw,sync,no_subtree_check,no_root_squash)
 +
 
 +
e.g, /nfsroot 192.168.0.0/255.255.255.0(rw,sync,no_subtree_check,no_root_squash)
 +
 
 +
Assuming your network is is 192.168.0.0
 +
 
 +
 
 +
3.After setting up /etc/exports, export the shares:
 +
 
 +
  '''host$''' sudo exportfs -ra
 +
 
 +
restart the nfs-server if required
 +
 +
  '''host$''' sudo /etc/init.d/nfs-kernel-server restart
 +
 
 +
4.cp RootFS_v1.tar.bz2 to /nfsroot
 +
and extract files using
 +
  '''host$''' sudo tar xvf RootFS_v1.tar.bz2
 +
 
 +
===Using SD Card or USB Card Method===
 +
Follow these steps only if you are not using NFS Method or Skip to Next Section.
 +
 
 +
This requires you to copy Root Filesystem to SD Card or USB Pendrive,
 +
Drive should have a ext2/ext3 partition and file should be copied on that system.
 +
To create ext2/ext3 partition you can use '''gparted'''.
 +
 
 +
1.Install Gparted using
 +
apt-get install gparted
 +
2.Now create ext2 partition using
 +
gparted /dev/sdb&
 +
Note:Here /dev/sdb is USB PenDrive
 +
create aroud 2GB or more Ext2 partition
 +
 
 +
[[file:GParted.jpg]]
 +
 
 +
3.Copy RootFS_v1.tar.bz2 to this partition
 +
Extract using
 +
tar xvf RootFS_v1.tar.bz2
 +
rm -f RootFS_v1.tar.bz2
 +
sync
 +
 
 +
and remove the SD Card or USB Drive
 +
 
 +
 
 +
== Booting Linux ==
 +
Once TFTP Server has been setup and uImage has been placed in /tftpboot folder
 +
& Also RootFS has been put in either NFS Folder(/nfsroot) or on SD/USB Card,Next
 +
Step is to load the kernel and RootFS.
 +
 
 +
1.Open Cutecom or HyperTerminal from HOST Machine
 +
 
 +
2. Enter following command to Load uimage through tftp ( as usual)
 +
  '''hawkboard.org>''' setenv serverip <PC IP>
 +
  '''hawkboard.org>''' setenv ipaddr <BOARD IP>
 +
  '''hawkboard.org>''' tftp c0700000 uImage_v1
 +
 
 +
#PC_IP ->is IP address of your Host Linux machine.
 +
#BOARD IP ->is IP address if your board you want to setup(you can any address but make sure its on same network)
 +
#tftp c0700000 uImage_v1 ->Tells Bootloader to Load uImage from PC_IP to Hawkboard's RAM
 +
at location c0700000
 +
Below shows a Screenshot about how to enter these commands in cutecom
 +
 
 +
[[File:Uboot_para.jpg]]
 +
 
 +
2.Set Bootargs
 +
'''Bootargs''' is the parameter/Variable that is send to uImage telling the Location of RootFS.
 +
Once the uImage is executed ,it then read bootargs and mount the RootFS from the location described in Bootargs.
 +
 
 +
Set one of the Following ''Bootargs'' depending  where your RootFS is located.
  
 +
'''a)If USB Drive'''
 +
  '''hawkboard.org>''' setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/sda1 rootwait rw init=/sbin/init
  
 +
Here
 +
#root=/dev/sda1 Tells that RootFS is locaed on  USB Drive on first ext2 partition
 +
#console=ttyS2,115200n8 tells where to put booting Message,Its basically UART3 of Hawkboard.
 +
#init=/sbin/init tells which program to run first after mounting rootFS (Leave this as it is)
  
 
   
 
   
Using NFS as option to load RootFS on hawkboard  
+
'''b)if SD Card '''
 +
 
 +
'''hawkboard.org>''' setenv bootargs console=ttyS2,115200n8 console=tty1 noinitrd root=/dev/mmcblk0p1 rootwait rw
  
If you want to use SD Card or USB Pendrive for loading the RootFS ,you can skip this section
+
or  
and
 
  
 +
'''hawkboard.org>''' setenv bootargs console=ttyS2,115200n8 console=tty1 noinitrd root=/dev/mmcblk0p1 rootdelay = 2 rootfstype = ext2 rw
  
 +
Here p1 in mmcblk0p1 says that Rootfs is present in first partition of SD Card.
  
 +
'''c) If NFS Boot'''
  
 +
c.1)If Board uses Static IP
  
==Getting Started==
+
''hawkboard.org>'' setenv bootargs 'console=ttyS2,115200n8 noinitrd rw ip=<HawkboardIP>:<server-ip>:<gateway-ip>:<netmask>::eth0: root=/dev/nfs nfsroot=<NFS Server ipaddress>:/nfsroot'
1.'''Powering the Device''': Hawkboard can be powered through USB OTG port(mini USB) or Separate 5V Source. Since the USB port of  a PC/laptop or hub are often limited to 500 mA, it is advisable to use a separate power supply of 5VDC that supplies at least 1.5 A of current.
 
<div style="margin:0; margin-top:10px; margin-right:10px; border:1px solid #dfdfdf; padding:0 1em 1em 1em; background-color:#00f1cc; align:right; ">
 
'''Note: It is recommended to use a separate 5VDC Power supply with at least a 1.5 Amps current rating instead of USB Power for Normal Operation of the Board'''
 
</div>
 
  
2.'''Connecting VGA Monitor''': Once the power supply has been attached, Hawkboard boots to Uboot Bootloader and will show Hawkboard Logo on Screen.
+
e.g
 +
  ''hawkboard.org>'' setenv bootargs 'console=ttyS2,115200n8 noinitrd rw ip=192.168.0.125:192.168.0.1:192.168.0.1:255.255.255.0::eth0: root=/dev/nfs nfsroot=<NFS Server ipaddress>:/nfsroot'
  
3.'''Connecting UART''': To transfer images to Hawkboard and to set other parameters, the UART/serial cable needs to be attached to Hawkboard and PC. A NULL Modem(Crossed Cable i.e 2 and 3 Crossed) is needed for that.
+
where 192.168.0.125 is board IP & 192.168.0.1 is gateway IP& Router IP.
Run a terminal session (such as Minicom on Linux or TeraTerm on Windows) on the Host PC and configure it to connect to that serial port with the following characteristics:
 
: Bits per Second: 115200
 
: Data Bits: 8
 
: Parity: None
 
: Stop Bits: 1
 
: Flow Control: None
 
: Transmit delay: 0 msec/char, 10 msec/line
 
  
[[File:Hawk_Serial_Set.JPG]]
 
  
After powering the device you should be able to see the following:
+
c.2)if Board uses DHCP
 
   
 
   
[[File:Hawk_uboot_msg.JPG | 480px ]]
+
  ''hawkboard.org>'' setenv bootargs "mem=128M console=ttyS2,115200n8 root=/dev/nfs nfsroot=<Server ipaddress>:/nfsroot ip=dhcp"
[[File:Hawk_vga_logo.jpg | 480px ]]
+
 
 +
#nfsroot= location of rootfs
 +
#root=/dev/nfs tells that root filesystem is located on different PC on a NFS rather on SD/USB Card.
 +
 
 +
3.Run the Kernel & Mouting of Filesystem
 +
  '''hawkboard.org>''' bootm c0700000
 +
Tells Uboot to run image located at location c0700000 ,in this case its uImage i.e Kernel
 +
 
 +
 
 +
[[File:Uimage_load.jpg]]
  
 +
==Explaining Booting Process ==
 +
After entering the ''bootm'' command the kernel starts executing from RAM.  The kernel reads the '''bootargs''' argument that was passed as an environment variable earlier.  Bootargs describe the location of the root filesystem.  Reading this information uImage mounts the RootFS and runs /sbin/init (which typically shows you a login prompt).
  
* On Hyperterminal (Any other Serial Console) (Left) On VGA Monitor you will see HawkBoard Logo (Right)
+
Sample rootFS present as download above is configured for following user and password
 +
user:'''hawk'''
 +
password:'''password'''

Latest revision as of 08:40, 9 November 2010

Hawkboard hw.jpg

Access Beginners Guide to Programming on Hawkboard http://elinux.org/Hawkboard/Programming_Guide_-Linux(ARM)

Introduction

Hawkboard is an open-hardware project which uses Texas Instrument's (TI) OMAP(open multimedia application platform) Processor(OMAPL-L138). It has both a DSP and an ARM Processor.

  • ARM-This normally runs an OS such as Linux \ Android etc. ARM in OMAPL-138 ,is ARMV5/ARM926
  • DSP- This is a specialized processor for performing Image,Audio and Video encoding/Decoding. These type of processor are specifically designed to perform these operations faster. DSP in OMAPL-138 ,is C674x Floating Point DSP.

Mix of ARM & DSP (OMAP) gives high performance and low power computing platform,Which are normally used in embedded and mobile Devices.


A Similar kind and a very popular Open-hardware platform is beagleboard that uses Faster OMAP from TI.

Command usage in this guide

In this guide, commands are preceded by prompts that indicate the environment where the command is to be typed. For example:

  • host$
Indicates command to be typed into the shell window of the host Linux workstation.
  • Hawkboard.org>
Indicates commands to be typed into the U-Boot shell in a console window connected to the Hawkboard's serial port.
  • target$
Indicates commands to be typed into the Linux shell in the terminal window connected to the Hawkboard's serial port or TTY..

Getting Started

Things you will need

1. Hawkboard

2. 5V 1Ampere Power Supply (Atleast 700mA recommended ,As long as volatage is 5V a higher ratings like 1A,2A even more can be used)

3. USB Hub (Hub that provides external power supply is recommended) A USB Hub is highly recommended As you might want to connect multiple peripherals like Keyboard,mouse ,USB Storage devices.

4. Cross Cable DB-9 Female at both ends See wiring diagram below how to make one.

5. SD Card or USB Pendrive (1GB Minimal)

6. Ethernet Cable

7. Ethernet HUB or Switch If you PC/laptop/Router has only one LAN Port which is already in use ,Then might consider purchasing it.

8.System Running Linux either on Real Machine or Vmware/VirtualBOX

<templatestyles src="Note/styles.css" />

This guide assume ,that Development Host System is Ubuntu Jaunty (9.10)

Preparing Hawkboard

Before all first thing is to check that the board is properly working or not.

a) Connect a 5V and 1A Power supply (Inner Pin +Ve and Outer GND)

<templatestyles src="Note/styles.css" />

mini-USB(USB OTG) port provided on board can also be used to power the device ,but since USB port of PC/Laptop doesn't provide enough current,Hawkboard will not function properly

b) Connect VGA monitor cable to Hawkboard VGA Port

c) Power on the Device ,you will see Hawkboard Logo on the monitor as below ,this is due to Bootloader (U-boot) present in the Hawkboard. Hawk vga logo.jpg

d) Further Also check whether you are receiving the Data from Hawkboard UART/Serial port to PC/Laptop Serial port. Serial port will be used to send parameters to bootloader(u-boot).

Connect UART/serial port of Hawkboard on to PC by NULL cable which has DB-9 Female at both ends & It must be crossed i.e and 2 & 3 Interchanged at both ends.

Below is Wiring Diagram

NULL CABLE HB.jpg

e) Once cable has been connected use following software depending on your system.

  • Hyperterminal or Teraterm -if you are using windows.
  • Cutecom or minicom -if you are using Linux

& Set following parameters to see uboot messages

Bits per Second: 115200
Data Bits: 8
Parity: None
Stop Bits: 1
Flow Control: None
Transmit delay: 0 msec/char, 10 msec/line (Optional)
  • Using Cutecom (Linux)
  host$ apt-get install cutecom
  host$ cutecom &

Set comport

  1. If you are directly using PC/Laptop that has comport then it will be probably /dev/ttyS0 -COM1 or /dev/ttyS1 if COM2
  2. If you are USB RS232 converter than comport will be something /dev/ttyUSB0

Cutecom ScreenShot below

Centre


  • Using Hypertermincal (Windows)

Start->Run->hypertrm or Start-All program-Accessories-Communication-Hyper terminal select appropriate Comport

As shown below screenshot of Hyperterminal settings

Hawk Serial Set.JPG


Now power on the Device you should see some text message on Serial Console (Hyperterminal or minicom etc)

Hawk uboot msg.JPG

Pressing enter will again give a new Hawkboard.org> Prompt .

This shows that serial port is working to send and receive messages to/from hawkboard


{{Note | If you don't see above screen There are two LEDs situated near the serial port (one for RS232 transmit & one for RS232 receive). One of them blinks while the board boots. Showing that is transmitting data to the serial ports. If that Led is blinking then either your cross cable should have a problem or it should be loose connection.

If you are not getting anything on VGA Monitor or COM Port Follow: Recovering U-Boot on Hawkboard

Introduction to uImage ,uBoot & File-system

A Desktop system needs kernel and various application for it to be useful. Similarly, embedded devices also need a Kernel that manages/allocates resources & Schedule task & Set of Applications to perform user task.

The components here are:

  • uImage :- uImage is a Linux Kernel (2.6.x) that Bootloader (Uboot) Loads which then finally mounts the (RootFS) Filesytem. The filesystem can be either on SD Card / USB Drive or on Another Network PC through NFS (Network File System) Protocol.

This is similar to Vmlinuz (Linux Kernel that grub loads) that exists in Normal Desktop Environment usually in /boot folder.

  • RootFS :-Kernel itself is A manager of resource and does nothing useful to user,you need a filesystem for Kernel to manage and you to work upon and provide apps to user.

Filesystem is also known as Root Filesystem ,It basically contains all the application (ls,cat,vi etc ),directory structure /dev, /proc, /bin, /etc, /lib, /usr, /tmp & necessary scripts (rc, inittab, fstab etc).

  • U-boot  :- The third component Known as Bootloader actually Loads Kernel in RAM.

Preloaded Bootloader in Hawkboard is U-boot.Similar to Like GRUB for Linux and NTLDR for Windows

Download Kernel & Root FS

Download the Sample uImage & Root Filesystem(RootFS) from The Link below

Kernel will loaded through TFTP Server.Though u-boot can load this image from USB/SD Card but the Preloaded (Uboot) that comes with Hawkboard cant access USB/SD Card hence cant access & load uImage.Once the uImage is loaded it can then Access SD/MMC to load Root Filesystem .

(NB:Newer kernel image uImage_v3 contains support for 800x600 resolution and dsplink)

Filesystem can be loaded through NFS or SD/USB Drive once uImage is loaded and executed.

The Sample RootFS contains Ubuntu Jaunty Non-Graphical distribution ,which contains gcc,ssh vi editor and lot more . With gcc you can do native development on Hawkboard itself & No cross compiler needed.

For installing new packages you can also use "apt-get install <package_name>"

Installing and setting TFTPD on PC(Needed for uImage Transfer to Board)

Since TFTP Server is required on Host System to Transfer uImage to Hawkboard ,Install TFTP Server by following steps below:

1. Install tftpd and related packages.

host$ sudo apt-get install xinetd tftpd

2. Create /etc/xinetd.d/tftp and put this entry:

 service tftp
 {
 protocol        = udp
 port            = 69
 socket_type     = dgram
 wait            = yes
 user            = nobody
 server          = /usr/sbin/in.tftpd
 server_args     = /tftpboot
 disable         = no
 }

3. Make /tftpboot directory

host$ sudo mkdir /tftpboot
host$ sudo chmod -R 777 /tftpboot
host$ sudo chown -R nobody /tftpboot

4. Start tftpd through xinetd

host$ sudo /etc/init.d/xinetd restart

5.Place uImage_v1 in /tftpboot dir

Preparation for transferring Root Filesystem

RootFilesytem can be loaded to Hawkboard either using SD/MMC or NFS.

If you want to use SD Card or USB Pendrive for loading the RootFS ,you can skip this section and proceed to SD/USB Drive Booting section.Also in case you are facing difficulty setting up NFS Server ,Following Using SD Card or USB Card Methodis recommended.

Using NFS Server Method

In NFS Boot method Root Filesystem remains on host PC & is shared using NFS Server. uImage mounts this NFS Shared folder as its root-file system. Since its shared files can be accessed from Hawkboard else-well as Host Machine,any changes is reflected on both.This method do not require you to Copy RootFS on SD Card/USB Drive. Development is faster since u can directly copy files from Host machine to NFS Folder and it will reflected back on Hawkboard.

Follow these steps to configure NFS Server 1. Install NFS Server

host$ sudo apt-get install portmap nfs-kernel-server

2. Share the Folder containing extracted RootFS (e.g /nfsroot contains RootFS)

Edit /etc/exports and add the shares:

/nfsroot <NETWROK_IP><SUBNET_MASK>(rw,sync,no_subtree_check,no_root_squash)

e.g, /nfsroot 192.168.0.0/255.255.255.0(rw,sync,no_subtree_check,no_root_squash)

Assuming your network is is 192.168.0.0


3.After setting up /etc/exports, export the shares:

 host$ sudo exportfs -ra

restart the nfs-server if required

 host$ sudo /etc/init.d/nfs-kernel-server restart

4.cp RootFS_v1.tar.bz2 to /nfsroot and extract files using

 host$ sudo tar xvf RootFS_v1.tar.bz2

Using SD Card or USB Card Method

Follow these steps only if you are not using NFS Method or Skip to Next Section.

This requires you to copy Root Filesystem to SD Card or USB Pendrive, Drive should have a ext2/ext3 partition and file should be copied on that system. To create ext2/ext3 partition you can use gparted.

1.Install Gparted using

apt-get install gparted

2.Now create ext2 partition using

gparted /dev/sdb&
Note:Here /dev/sdb is USB PenDrive

create aroud 2GB or more Ext2 partition

GParted.jpg

3.Copy RootFS_v1.tar.bz2 to this partition Extract using

tar xvf RootFS_v1.tar.bz2
rm -f RootFS_v1.tar.bz2
sync

and remove the SD Card or USB Drive


Booting Linux

Once TFTP Server has been setup and uImage has been placed in /tftpboot folder & Also RootFS has been put in either NFS Folder(/nfsroot) or on SD/USB Card,Next Step is to load the kernel and RootFS.

1.Open Cutecom or HyperTerminal from HOST Machine

2. Enter following command to Load uimage through tftp ( as usual)

 hawkboard.org> setenv serverip <PC IP>
 hawkboard.org> setenv ipaddr <BOARD IP>
 hawkboard.org> tftp c0700000 uImage_v1
#PC_IP ->is IP address of your Host Linux machine.
#BOARD IP ->is IP address if your board you want to setup(you can any address but make sure its on same network)
#tftp c0700000 uImage_v1 ->Tells Bootloader to Load uImage from PC_IP to Hawkboard's RAM 
at location c0700000

Below shows a Screenshot about how to enter these commands in cutecom

Uboot para.jpg

2.Set Bootargs Bootargs is the parameter/Variable that is send to uImage telling the Location of RootFS. Once the uImage is executed ,it then read bootargs and mount the RootFS from the location described in Bootargs.

Set one of the Following Bootargs depending where your RootFS is located.

a)If USB Drive

 hawkboard.org> setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/sda1 rootwait rw init=/sbin/init

Here

  1. root=/dev/sda1 Tells that RootFS is locaed on USB Drive on first ext2 partition
  2. console=ttyS2,115200n8 tells where to put booting Message,Its basically UART3 of Hawkboard.
  3. init=/sbin/init tells which program to run first after mounting rootFS (Leave this as it is)


b)if SD Card

hawkboard.org> setenv bootargs console=ttyS2,115200n8 console=tty1 noinitrd root=/dev/mmcblk0p1 rootwait rw

or

hawkboard.org> setenv bootargs console=ttyS2,115200n8 console=tty1 noinitrd root=/dev/mmcblk0p1 rootdelay = 2 rootfstype = ext2 rw

Here p1 in mmcblk0p1 says that Rootfs is present in first partition of SD Card.

c) If NFS Boot

c.1)If Board uses Static IP

hawkboard.org> setenv bootargs 'console=ttyS2,115200n8 noinitrd rw ip=<HawkboardIP>:<server-ip>:<gateway-ip>:<netmask>::eth0: root=/dev/nfs nfsroot=<NFS Server ipaddress>:/nfsroot'

e.g

 hawkboard.org> setenv bootargs 'console=ttyS2,115200n8 noinitrd rw ip=192.168.0.125:192.168.0.1:192.168.0.1:255.255.255.0::eth0: root=/dev/nfs nfsroot=<NFS Server ipaddress>:/nfsroot'

where 192.168.0.125 is board IP & 192.168.0.1 is gateway IP& Router IP.


c.2)if Board uses DHCP

 hawkboard.org> setenv bootargs "mem=128M console=ttyS2,115200n8 root=/dev/nfs nfsroot=<Server ipaddress>:/nfsroot ip=dhcp"
  1. nfsroot= location of rootfs
  2. root=/dev/nfs tells that root filesystem is located on different PC on a NFS rather on SD/USB Card.

3.Run the Kernel & Mouting of Filesystem

 hawkboard.org> bootm c0700000

Tells Uboot to run image located at location c0700000 ,in this case its uImage i.e Kernel


Uimage load.jpg

Explaining Booting Process

After entering the bootm command the kernel starts executing from RAM. The kernel reads the bootargs argument that was passed as an environment variable earlier. Bootargs describe the location of the root filesystem. Reading this information uImage mounts the RootFS and runs /sbin/init (which typically shows you a login prompt).

Sample rootFS present as download above is configured for following user and password user:hawk password:password