Monday, September 14, 2009

Porting uClinux 2.6 on AX4510


This section is about porting uClinux on ARM 7 based S3c4510 samsung processor.




About AX4510
This is ARM7 Development Board based on Samsung S3C4510B Microcontroller
  • Dimensions: 177 x 130 mm
  • 5.0V DC or USB power supply
  • 4 M bytes Flash(2M x 16bit)
  • 16 M bytes SDRAM(2M x 32bit)
  • 2K x 8 EEPROM
  • 2x RS232
  • USB connecter
  • 10M/100M Ethernet interface connector(RJ45)
  • IDE44 port: for 2.5" hard disk
  • LCD port
  • 2 PS2 port
  • 4 key buttons
  • Reset button
  • 4 LEDS
  • Beeper
  • 20-pin JTAG interface connector
  • all the pins of CPU expand out


About uClinux
uClinux as an operating system includes Linux kernel releases for 2.0 2.4 and 2.6 as well as a collection of user applications, libraries and tool chains,it basically meant to support processor without Memory Management unit.


Essential Tools and Source for Download.
arm-elf-tools-20040427.sh
GCC 2.95.3 with linux 2.6 patch and binutil 2.14 based ARM-ELF toolchain which is made based linux 2.6.5-hsc2 is available for kernel and userland applications compile.It compiles the 2.4 kernel and applications.

uClinux-dist-20040218.tar.gz distribution, this is a full source package, containing kernel, libraries and application code.

linux-2.6.9 vanilla kernels and adds patches relevent to AX4510 http://www.kernel.org/pub/linux/kernel/2.6/linux-2.6.9.tar.bz2

uClinux patch for linux-2.6.9

http://www.uclinux.org/pub/uClinux/uClinux-2.6.x/linux-2.6.9-uc0.patch.gz

MMU less ARM patch -
Name: Hyoks patch
http://opensrc.sec.samsung.com/download/linux-2.6.9-uc0-hsc0.patch.gz


Steps to build the image and downloading to ram.
1.extract uClinux distribution and remove all the existing linux kernel versions.
  • tar -zxvf uClinux-dist-20040408.tar.gz
  • cd uClinux-dist-20040408
  • rm -rf linux-2.0.x linux-2.4.x linux-2.6.x
2. Extract these patches and apply them one after another.
  • gunzip -d linux-2.6.9-uc0.patch.gz
  • gunzip -d linux-2.6.9-uc0-hsc0.patch.gz
  • \linux-2.6.x> patch -p1 < ../linux-2.6.9-uc0.patch
  • \linux-2.6.x> patch -p1 < ../linux-2.6.9-uc0-hsc0.patch
3. Copy relevent configuration files in vendor directory
  • \uClinux-dist-20040408>cp linux-2.6.x/arch/armnommu/configs/espd_4510b_defconfig vendor/Samsung/4510B/config.linux-2.6.x
  • \uClinux-dist-20040408>cp vendor/Samsung/4510B/config.vendor-2.4.x vendor/Samsung/4510B/config.vendor-2.6.x
4. edit 'vendor/Samsung/4510B/rc' file in uClinux-dist directory, change '/dev/ram0' to '/dev/ram1'

5. Edit the Kernel linker file to include the ROMFS

edit file 'linux-2.6.x/arch/armnommu/arch/kernel/vmlinux-lds.S', Add the below lines

  • 81 *(.got) /* Global offset table */
  • 82
  • 83 romfs_start = .;
  • 84 romfs.o
  • 85 romfs_end = .;


6. Configure the kernel using menuconfig,
Block devices --->Default RAM disk size (kbytes) to 2100
General setup ---> (root=/dev/ram0 initrd=,2100k keepinitrd) Default kernel command string

Note:
start address of ramdisk can be determined only compilation of uclinux,
this information can retrieved from System. map file after it is build. so I needed to recompile the uClinux with the updated ramdisk start address.
  • make lib_only
  • make user_only
  • make romfs
  • make image
  • make all
7. image.ram is created in images folder of the distibution and this can be downloaded to ram using tftp.

  • \uClinux-dist-20040408>cd images/
  • \images>tftp 192.168.1.2
  • \images>put image.ram

Thursday, September 10, 2009

Configuring OPENSER as proxy

OpenSer is easily configurable and modular, the necessary configuration is done in openser.cfg. This take care of the incoming SIP messages and routing them to server address configured.The proxy also makes a few checks (and modifications) on the message and sends an error message if necessary.


Edit the Makefile, and at line 287 change this instruction:

Install: all mk-install-dirs install-cfg install-bin install-modules \
install-doc install-man

To

Install: openser mk-install-dirs install-cfg install-bin install-modules \
install-doc install-man

Now, making sure that you have super-user privileges, execute:

> make install
Setting up the OpenSER proxy
Edit openser.cfg

# ----------- global configuration parameters ------------------------

#Uncomment these lines to enter debugging mode
debug=9 # debug level
Fork=no
Log_stderror=yes


check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
listen= ip this pc will listen on
port=5060
children=4
fifo="/tmp/openser_fifo"
load modules and set parameters

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/openser/modules/mysql.so"

loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"

loadmodule "/usr/local/lib/openser/modules/registrar.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 0)

# -- rr params --
# add value to ;lr param to make some broken UAs happy

modparam("rr", "enable_full_lr", 1)
Changes in main routing logic
replace
if (method=="REGISTER") {..}
with
if (method=="ACK") {
route(1);
exit;
} if (method=="INVITE") {
route(3);
exit;
} else if (method=="REGISTER") {
route(2);
exit;
};


Add the route[2] and route[3] function for proxy behaviour in openser.cfg


route[2] {
#rewrinting the host allows the registrar to know that the message is destined for it
rewritehost("192.168.1.103"); # openser server ip address
if(!t_relay_to_udp("192.168.1.103","5060")) {
sl_reply_error();
};
exit;
}

route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
lookup("aliases");
if (uri!=myself) {
route(1);
exit;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
exit;
};


Now use this configuration script in 'usr/local/etc/openser/'