===================
Set up Linux  development system
===================
- Ubuntu, Fedora

Virtual Machine (VMWare Fusion on Mac)

- download Ubuntu (12.04 LTS) desktop iso 
	- http://www.ubuntu.com/download/desktop/thank-you?distro=desktop&release=lts&bits=32

	- 701 MB

- burn to CD (use DiskUtility)
	- insert blank CD-R
	- drag iso to lower left pane
	- right click and select burn to disk (or choose Burn form menu bar)
	- enable verify contents
	- click burn

- Install virtual machine guest
	- start VMWare
	- File>New...
	- continue w/o disc
	- create custom virtual machine
	- Insert CD
	- Use operating system installation disc or image
		- choose CD drive
	- Choose operating system (should show Linux, Ubuntu)
	- Select "Use Easy Install"
	- enter account name and password
	- Select "Make home folder accessible to virtual machine" 
	- Select read/write permissions
	- Download VMWare tools for Linux guest if prompted
	- Select finish or customize settings 
		- default 1 GB RAM, 20 GB HDD
	- shows Ubuntu VMWare guest window; select Play symbol icon
	- Automatically installs Ubuntu from CD...(Control-Command to release mouse)
	- Reboots to desktop login screen
	- Allow update manager to update 
	- /mnt/hgfs mounts shared Mac User home directory

===================
Install ELDK
===================
- create directory structure:
	•	/home/_user_/projects/eldk42
	•	/home/_user_/projects/lpc32x0
	•	/home/_user_/projects/lpc32x0/uboot
	•	/home/_user_/projects/lpc32x0/kernel
	•	/home/_user_/projects/lpc32x0/temp_dir
	•	/home/_user_/projects/lpc32x0/downloads

- follow instructions here 
	http://www.lpclinux.com/LPC32xx/LPC32x0GettingstartedELDK

- use Firefox or other browser in Ubuntu to download ELDK iso image

- move ELDK iso to projects
- mount the iso image
$ cd projects/lpc32x0
$ mkdir temp_dir
$ sudo mount -o loop downloads/arm-2008-11-24.iso temp_dir

- run install script ()
- run (as root) ELDK_FIXOWNER
	- (see ftp://ftp.denx.de/pub/eldk/4.2/arm-linux-x86/distribution/README.html#Section_1.6.)
	- user@ubuntu:~/projects/eldk42$ sudo ../lpc32x0/temp_dir/ELDK_FIXOWNER -a arm 
	- takes a couple of minutes

===================
Build U-boot
===================
	•	Get the u-boot-2009.03.tar.bz2 source code from ftp://ftp.denx.de/pub/u-boot/u-boot-2009.03.tar.bz2 site.
	•	Untar the u-boot the sources.
$ cd ../uboot
$ tar -xjf ../downloads/u-boot-2009.03.tar.bz2

	•	Get the latest u-boot-2009.03 patch from the (lpclinux.com) downloads tab and place it in the patches directory. Note the u-boot patch filename may be different than shown here.
	•	Untar the patch and apply the LPC32x0 uboot patch to the source code.
$ cd ../downloads
$ tar xf u-boot-lpc313x-2009.03.patch.tar.bz2
$ cd ../u-boot/u-boot-2009.03
$ patch -p1 < ../../downloads/u-boot-lpc32x0-2009.03.patch

	•	Prior to building u-boot, add the ELDK tool binaries to your path. From the bash shell:
$ cd ../../../
$ source eldk42/eldk_init arm

	•	Build u-boot
$ cd projects/u-boot/u-boot-2009.03
$ make phy3250_config (or use ea3250_config for Embedded Artists boards, or fdi3250_config for Future Designs boards)
Configuring for FIXME board...
$ make

	•	You can also build u-boot using the following command without modifying the environment.
$ make ARCH=arm CROSS_COMPILE=<Toolchain path>/arm-linux-gnu distclean
$ make phy3250_config
$ make ARCH=arm CROSS_COMPILE=<Toolchain pat>/arm-linux-gnu-

	•	Once the build completes, the u-boot binary image for deployment can be found at uboot/u-boot-2009.03/u-boot.bin
	•	

===================
Install minicom
===================
- use Ubuntu software installer or equivalent

===================
Install Keyspan USA19H USB Serial Converter
===================
- Start linux VM 
- plug in Keyspan USA19H
- MacOS prompts whether to connect to Mac, Linux (or other VMs)
- select linux
- show up /dev/ttyUSBn
	- n is a number that varies according to what's been plugged in

===================
Set up raw binary transfers for minicom
===================
[Note, you need to disable the text output - I added a -q (quiet) option]
Minicom is the defacto standard serial communication program for Linux, modeled after the old DOS program Telix.  While Minicom isn’t as advanced as Telix, it does offer quite a bit of functionality that satisfies most common needs.  Unfortunately, it doesn’t include a binary upload option.

While not commonly used, once in a while, you just need it.  Fortunately, Minicom does allow you to define your own file transfer utilities.  So here’s a simple little script you can use that will give you a “binary upload” option in Minicom.  To make things a little prettier, I used a little utility called ‘pv’ so that you can get a progress bar while it transfers your file.
If you don’t already have it, you should be able to find it easily within your Linux distribution:
On RPM-based systems, just type:
sudo yum install pv
On Debian-based systems, type:
sudo apt-get install pv
Now create this script, and place it in your ~/bin/ directory as (for example) bin-xfr.'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36	#!/bin/sh
INFILE=/dev/null
OUTFILE=/dev/null
 
while [ $# -gt 0 ]; do
 case "$1" in
 -i)
 shift
 INFILE="$1"
 ;;
 -o)
 shift
 OUTFILE="$1"
 ;;
 -h|--help)
 echo "$0 -i infile -o outfile"
 ;;
 *)
 INFILE="$1"
 esac
 shift
done
cat << EOF
binary-xfer utility for minicom
Sending file ${INFILE} to ${OUTFILE}
EOF
 
/usr/bin/pv --force -i 0.25 -B 128  ${INFILE}  2>&1 > ${OUTFILE}
# Use the line below if you don't have pv!
 
# /bin/cat ${INFILE} > ${OUTFILE}
cat << EOF
 
File transfer complete
EOF
sleep 1	
Now go over to minicom and go to the configuration menu (via ESC-O), then “File transfer protocols”. You can add a section there called “binary”, point it at your file, and specify:
	•	Name: Binary
	•	Program: /home/MYUSERNAME/bin/bin-xfer -o %l
	•	Name: Y
	•	U/D:  U
	•	FullScr: Y
	•	IO-Red: N
	•	Multi:N
Then leave the menu and save your options.  Next time you send a file (via ESC-S), you should see “Binary” listed as an option.
[my alternative version]
#!/bin/sh
INFILE=/dev/null
OUTFILE=/dev/null
VERBOSE="TRUE"
 
while [ $# -gt 0 ]; do
 case "$1" in
 -i)
 shift
 INFILE="$1"
 ;;
 -o)
 shift
 OUTFILE="$1"
 ;;
 -q)
 VERBOSE="FALSE"
 ;;
 -h|--help)
 echo "$0 [-q] -i infile -o outfile"
 ;;
 *)
 INFILE="$1"
 esac
 shift
done

if [ ${VERBOSE} == "TRUE" ]
then
 cat << EOF
 binary-xfer utility for minicom
 Sending file ${INFILE} to ${OUTFILE}
EOF
fi
 
#/usr/bin/pv --force -i 0.25 -B 128  ${INFILE}  2>&1 > ${OUTFILE}
# Use the line below if you don't have pv!
 
 /bin/cat ${INFILE} > ${OUTFILE}

#cat << EOF
 
if [ ${VERBOSE} == "TRUE" ]
then
 File transfer complete
 EOF
fi

sleep 1

===================
Install TFTP server
[to install kernel]
===================

1. Install tftpd and related packages.

$ sudo apt-get install xinetd tftpd tftp
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

$ sudo mkdir /tftpboot
$ sudo chmod -R 777 /tftpboot
$ sudo chown -R nobody /tftpboot
4. Start tftpd through xinetd

$ sudo /etc/init.d/xinetd start
5. Testing. Tranfering file hda.txt from 192.168.1.100 (Client using tftp) to 192.168.1.100 (Server 192.168.1.100). Get an example file to transfer (eg. hda.txt)

$ touch /tftpboot/hda.txt
$ chmod 777 /tftpboot/hda.txt
$ ls -l /tftpboot/
total 0
-rwxrwxrwx  1 davids davids 0 2006-03-27 23:04 hda.txt
$ tftp 192.168.1.100 
tftp> put hda.txt
Sent 722 bytes in 0.0 seconds
tftp> quit
$ ls -l /tftpboot/
total 4
-rwxrwxrwx  1 davids davids 707 2006-03-27 23:07 hda.txt

[copy kernel and rootfs images to tftp directory]
headley@ubuntu:~$ cp projects/eldk42/arm/images/
ramdisk_image.gz  uRamdisk          
headley@ubuntu:~$ cp projects/eldk42/arm/images/uRamdisk /tftpboot/

[set uboot for dhcp]
Setup the EVM IP address. You have two ways of doing it
Use DHCP
U-Boot> setenv autoload no
U-Boot> dhcp
Use static IP address
U-Boot> setenv ipaddr <static ip address>
Get the IP address of your host Linux workstation as follows. Look for the IP address associated with the eth0 ethernet port.
host /sbin/ifconfig
Set the IP address of the server from what was obtained above (Note that this may also be obtained from DHCP)
U-Boot> setenv serverip <ip addr of server>
Set the name of the image to be downloaded (this may also be obtained from DHCP)
U-Boot> setenv bootfile <Linux kernel image file name>

[set ]

===================
Install LTIB 
===================
- install cvs 
 	sudo apt-get install cvs
	sudo apt-get install g++ 
	sudo apt-get install tcl8.5
sudo apt-get install zlib1g-dev
 rpm 
rpm-build 
ncurses-dev 
m4 
bison
perl -MCPAN -e 'install HTTP::Request::Common'
sudo cpan
cpan> install LWP::UserAgent
perl -MCPAN -e 'install LWP::UserAgent'

- install LTIB via CVS
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/ltib co -P ltib
$ cd ltib
$ ./ltib