Tuesday, January 8, 2013

Embedded Proxy Server(ARM9) -mini2440






Introductions:

Hello folks,welcome to  the another entry of  this MCU blog. It's almost  one semester that I did not write on this wall-busy with some tasks outside the cyber-world. Anyway, this new topic well get  you interested and I'm  so sure  about that ;its related to proxy programming  and cross compiling the code  from an intelx86(32-64 bit) to an ARM9 architecture. I urged myself to ease the pain of debugging   the "wcol proxy"  program that lasted  for   4(four)  weeks -awesome stuff.

I was just fascinated of the RFC 1919 which means "proxy" server and  RFC 1945 which is  HTTP/1.0 protocol,how proxy server came to work ,and I was challenged to port  the said intel  format source code in a tiny PC, the mini2440 .The source of this program was an inheritance of the wcol proxy development , with careful  tweaking  and debugging  the source code  ,it  eventually run in an ordinary PC ( with installed Linux OS). You  can recompile any proxy server source code available on the net and cross-compile it in a GCC-ARM compiler. But for your comfort I have given a sample proxy program that can be uploaded via our FB Group(Philippines Society of Computer Engineers), and don't your worry this is an open group.

Mini2440 as what you had seen in the main photo, is clocked to 500Mhz and it has 512MB /1GB RAM to functions well as proxy server- its my expectation that at-least there would 5 simultaneous http request  before   it will   have a noticeable processing delay.

Below are the details on how you folks can replicate my work, there I've attached video for a more vivid tutorials.Hope that you will learn things a little bit. By the way ,this was a previous assignment in our MIS class-client & server programming.So get it on...



Requirements:

Software:
1) Linux OS(Fedora 14)
2) arm-linux-gcc 4.3.2
3) gcc
4) minicom (serial monitor)
5) telnet

Hardware :
1) PC
2) SD card and adapter
3) mini2440
4) Other PC as another  client

Methodology:
Note:  you may choose files that are not installed yet.

1)Installations

root@locahost# yum install minicom-s
root@localhost # yum intall telnet*
root@localhost# yum install gcc
root@localhost#  yum install *httpd*


2) Downloads
download proxy server code at PSCoE FB group page
https://www.facebook.com/GIIIIRRRLIE#!/groups/256202857800280/

download arm-linux-gcc (4.3.2)
https://code.google.com/p/princess-alist/downloads/detail?name=arm-linux-gcc-4.3.2.tgz&can=2&q=

3) Untar and cross compile
root@localhost# mv  arm-linux-gcc-4.3.2.tgz ../
root@localhost# cd ../
root@localhost# tar -zxvf arm-linux-gcc-4.3.3.tgz
root@localhost# cd /usr/local/arm/4.3.2/bin
root@localhost# export PATH:PATH=/usr/local/arm/4.3.2/bin

Please copy "coballesIS238Proxy.c" in the "/usr/local/arm/4.3.2/bin"  with this cli command
Note: Try also to check if its bug free-using the basic gcc compiler!
root@localhost@ cp coballesIS238Proxy.c /usr/local/arm/4.3.2/bin

Now cross compile the source code
root@localhost# arm-linux-gcc -mcpu=arm9 -Wall -o coballesIS238Proxy IS238Proxy.c

A green text of file-name(coballesIS238Proxy) will appear as it was compiled already.

4) Copy the cross-compiled program(now in binary file) in the SD card
root@localhost# df -a

root@localhost# mkdir /mnt/SD
root@localhost#  mount /dev/sdb(?) /mnt/SD
root@localhost# cp "coballesIS238Proxy"  /mnt/SD


5)So you have cross-compiled the code and copied in the SD card .Next, copy the binary file from your sd card to the mini2440
root@localhost telnet  IP address of mini2440
[root@FriendlyArm] login
press enter ....see the mini2004 shell!
[root@FriendlyARM] 

6) Then insert the SD card in the mini2440
[root@FriendlyArm] df- a

create a directory in your mini2440 shell
[root@FriendlyArm] mkdir /mnt/sdcard
[root@FriendlyARM]  mount  /dev/mmcblk0  /mnt/sdcard

..then copy the code
[root@FriendlyArm] cd /mnt/sdcard
[root@FriendlyArm/sdcard] cp coballesIS238Proxy ../bin

7) Bingo! run the embedded server now..!
 [root@FriendlyArm/bin] ./coballesIS238Proxy -p 350



Details:

0) Downloading "arm-linux-gcc-4.3.2.tgz
 












1) recompiling  proxy source code
 











2) Checking SD mounting













3) Copying the binary files after SD card mounting















4) executing the cross compiled binary program in a mini2440 board!















5)Error message: " Unreachable host from this network"














6) Error mesage: " temporary problem with the DNS server"












7) embedded proxy server working  in mini2440




















Summary :



Conclusions:

I cracked the proxy code and embed it in mini2440, so I have now a working embedded proxy server