Skip to main content

Posts

Showing posts from April, 2009

The Linux Foundation Free Training Program at linuxfoundation

The Linux Foundation Training Program is: * For the Community, by the Community. The Linux Foundation is
building the program with its Technical Advisory Board to ensure the
content, instructors and classes are the top quality available.
* Technically the most advanced. Since the Linux Foundation works
directly with community developers, it can cover features and advances
in Linux before commercial companies.
* Connected. The Linux Foundation has unfettered access to the
leading developers and companies in the Linux ecosystem and will use
these connections to best position attendees for success. For example,
attendees can attend the exclusive, invite-only Collaboration Summit
where they can forge connections beneficial to their career.
* Real World. The Linux Foundation training courses all have hands
on components and a highly rigorous curriculum of programming or
administration exercises. Graduates will be well equipped to master
Linux programming and system administration tasksThe…

Configure udhcpc for Setting IP netmask and Gateway

How to Configure udhcpc for Setting IP netmask and Gateway?
Tell udhcpc client to run on eht1 interface with -i option.
Also use -s option to tell udhcpc client to use script from specified path.
/sbin/udhcpc -i eth1 -p /var/run/dhcpClient-wifi.pid -s /usr/share/udhcpc-wifi/default.script &

default.script directs the udhcpc to executes one by one scripts from specified folder ie /usr/share/udhcpc-wifi/
else default folder location for udhcpc script is /usr/share/udhcpc/

For directing IP address to temp file obtained using udhcpc client or for DHCP, do little
modification in sample.bound file.
Here is Sample udhcpc renew script, which will update the ip address, netmask and gatway obtained
by boradcasting. The new values will be updataed in /var/dhcpfile.

#!/bin/sh
# Sample udhcpc renew script

RESOLV_CONF="/etc/resolv.conf"

[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet

echo $ip >…

Use Of Bootloader In SoC Design Life Cycle

Use of bootloader, in SoC design.
SoC in simple terms is collection of required blocks, like USB, MAC, PCI, surrounded to the CPU (generally RISC CPU, ARM).
As a part of SoC development each hardware block is validated for its functionality.
Validation is done register level. Example if we want to test functionality provided by MAC block in our SoC, then these functionality are validated by writing test cases in bootloader (u-boot-1.1.6).
Bootloader will create an environment for the test cases. The test cases are added as commands for each block with different subtests for each block to touch the corner conditions.
To start with U-boot provides generic block test cases, like I2C and many more are getting added day by day.
Format of bootloader commands

int do_hello (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
printf("Hello World\n");
}


U_BOOT_CMD(
hello, 5, 0, do_hello,
" hello - Prints hello world\n",
" hell…

UDP Traffic Generator Client Side C code

Learning Networking basics using C programs, to start with here is simple UDP client side code,
Why to start with UDP because its simple, no need of connection handshake like TCP.
This code sends continues UDP traffic over network, depending on the payload (ie send_buf) and delay between each transfer, rate at which data is pumped over network is calculated. Example: this client program is sending constant length 0f 1400 (in sendto function), so if you keep delay as 1s then data transfer rate will be 1400 per sec, decrease the delay to pump traffic at high rate.
You need UDP server side code for running this client.
udp client

#include
#include
#include
#include
#include
#include
#include
#include /* memset() */
#include /* select() */

#define REMOTE_SERVER_PORT 1500
#define MAX_MSG 1600


int main() {

int sd, rc, i;
struct sockaddr_in cliAddr, remoteServAddr;
struct hostent *h;
char *send_buf;
unsigned int count=0;
int reply;

send_buf= (char *) malloc(1600);

UDP Traffic Generator Server Side C code

Learning Networking basics using C programs, to start with here is simple UDP server side code,
Why to start with UDP because its simple, no need of connection handshake like TCP.

udp server

#include <sys/types.h>;
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>/* close() */
#include <string.h> /* memset() */

#define LOCAL_SERVER_PORT 1500
#define MAX_MSG 1500

int main() {

int sd, rc, n, cliLen;
struct sockaddr_in cliAddr, servAddr;
char msg[MAX_MSG];
int count;
int prev_count=0;
/* socket creation */
sd=socket(AF_INET, SOCK_DGRAM, 0); //create unix socket
if(sd<0)>
printf("cannot open socket \n");
exit(-1);
}

/* bind local server port */
servAddr.sin_family = AF_INET;
servAddr.sin_addr.s_addr = inet_addr("1.168.3.100"); //using fixed IP for simplicity
servAddr.sin_port = htons(LOCAL…