Skip to main content

Posts

Showing posts with the label my notes

Linux SMB write performance With Simple Tips

SMB write performance can be increased by Tuning the buffer cache. The secret to good performance is to keep as much of the data in memory for as long as is possible. Writing to the disk is the slowest part of any filesystem. If you know that the filesystem will be heavily used, then you can tune this process for Linux Samba. writing out dirty blocks to the disk until the filesystem buffer cache is 80 percent full (80). default is 40%, source = http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap29sec287.html by writing echo 80 > /proc/sys/vm/dirty_ratio I am getting around 2MB increase while write operation, tested in Xp. I have tried with this single option, as the ref source is for linux 2.2 and we are using 2.6 kernel. we can try out Linux General Optimization suggested at http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/gen-optim.html Tried with smb.conf, I am getting around 1MB gain while read and write. socket options = TCP_NODELAY I...

CROSS COMPILING X11 FOR ARM Board

STEPS FOR CROSS COMPILING X11 FOR ARM Go to /usr/X11R6/lib in my linux PC. 1) install ARM toolchain, If not installed 2) Get x11 source from http://www.x.org/ 3) extract all the tar files, using tar -xvzf 4) edit cross.def and host.def files, in cross.def set the paths of tool chain in host.def file set crossCompile to YES and DoLoadableServer to NO 5) make shadow directory "build" and link to xc "lndir ../xc" 6) run Make World error: linux_vm86.c 281 impossible constraint in 'asm' 268 res might be used uninitialized in this function. fix:comment line 281, set res=0 error: implicit decleration of function 'SET_FLAG' fix: comment line 111 in programs/Xserver/hw/xfree86/os-support/linux/int10/helper_exec.c error:Undefined reference to XF86VidModeQueryVersion in glxinfo And glxgears Undefined reference to XF86VidModeQueryVersion in xdriinfo fix:download libXxf86vm.so.1.0 into our armtoolchain lib path and make softlinks ln -s libXxf86vm.so.1.0 li...

Get HyperSCSI for SAN - Storage Area Network

Get HyperSCSI for SAN - Storage Area Network SCSI (Small Computer Systems Interface) family of protocols. HyperSCSI can allow one to connect to and use SCSI and SCSI-based devices (like IDE, USB, Fibre Channel) over a network as if it was directly attached locally. Why HyperSCSI over iSCSI? The main advantage of HSCSI compared to iSCSI is especially a lower network load as well as an end system (server and client) load. TCP/IP SAN performance is still not good enough without hardware acceleration FC-based SANs cannot do Storage Wide-Area Networks Fully functional software implementation of both client and server so HSCSI can be used for a solution built on commonly available hardware, no expensive and specialized hardware is needed. Therefore, HSCSI can be used for building small and cheap SANs. HSCSI main disadvantage is this protocol has no official standard like iSCSI nd so it is unsupported in any way by manufacturers developing hardware data storage solutions. Two modes of oper...

Create File Of Any Size in Linux Using DD Command

How do I create a file of any given size on Linux? using the dd command. $ dd if=/dev/zero of=testss bs=1024 count=1048576 This will create a file of size 1024 * 1048576 bytes (or 1 GB). where if - input file of - output file or the file to be created bs - block size in bytes count - # of blocks of size bs Easiest and fasted way to create file of 250GB using DD command $ dd if=/dev/zero of=tests bs=1 count=0 seek=250G read dd(1) - Linux man page

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 $subn...

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", ...

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= (c...

From Windows Vista Home Edition Access SMBD ver 2.2.12

How to Access NAS Box From Windows Vista Home Edition? Access NAS box windows vista (Ultimate editions), If you NAS box contains SMBD/ SAMBA version less than or equals 2.2.12 Steps to access NAS box from Windows Vista Home Edition 1. In the Windows taskbar, click Start and select Run. In Run window type “regedit” and press OK. 2. This will open User Account control window, here click continue. 3. Double click on the “HKEY_LOCAL_MACHINE” , “SYSTEM”, “Current Control Set” and “Control”. 4. Then click on “Lsa” then you will get some parameters in the right windowpane. 5. Find for “LMCompatibilityLevel” and double click on this item. 6. In the edit window change the “Value data” to 1 from 3. 7. Press OK then Close the Registry Editor (regedit). your Vista PC ready to access the NAS box.

Access NAS Box From Windows Vista Ultimate Edition

How to Access NAS Box From Windows Vista Ultimate Edition? Access NAS box windows vista (Ultimate editions), If you NAS box contains SMBD/ SAMBA version less than or equals 2.2.12 Steps to access NAS box from Windows Vista Ultimate Edition 1. In the Windows taskbar, click Start and select Run. In Run window type “secpol.msc” and press OK. 2. This will open User Account control window, here click continue. 3. Now double click on the “Local Policies” and click on “Security Options”. 4. Find “Network Security: LAN Manager authentication level” in right windowpane and double click on this policy. 5. Now change Local Security Setting “Send NTLMv2 response only” to “Send LM & NTLM –use NTLMv2 session security if negotiated”. 6. click “apply” and then “OK”. Now your Vista PC ready to access the NAS box. Share your tricks also.

How To Compile Tool Chain For Bootloader

For compiling Uboot 3.4.4 tool chain is required. Steps to check and change tool chain correspondingly 1) At the bash prompt of your Linux PC, execute the following command. $ tar -zxvf arm-tools.tar.gz Now you will have the "arm-tools" folder created in your current directory. 2) Copy the "arm-tools" directory to your home directory (or wherever you prefer to) $ cp -rf arm-tools ~/ 3) Modify the .bash_profile file in the home directory, by using the following steps. (Add the following lines in .bash_profile) $ vi ~/.bash_profile This will open the file for editing. Make the following changes in the file export HOME=$HOME/arm-tools PATH=$PATH:$HOME/bin:$HOME/arm-tools/arm-linux/bin:$HOME/arm- tools/image_tools/:$HOME/arm-tools/image_tools/bin export PATH Close the ".bash_profile" file. 4) Then execute the command $ source .bash_profile 5) To check whether arm-tools environment has been properly set or not type the...

Adding Network Printer in MS windows Simplest Way

yes you can add Network Printer in MS windows in very Simplest Way . I was allocated a new windows Xp PC, I was waiting for network printer to configure on my new machine. I just tried this simplest way, rather to wait for network admin. My friend also asked me about configuration for network printer and i told him same way, which is worked for him also. Here is simplest way to configure your new printer. go to start->settings-> Printers and Faxes Here you can see the default printer name. Just ask your friend about the name of network printer, and all you have to do is rename your default printer with network printer name, your printer is on. check out this trick works for you also. Sometimes you need to select the driver for the same, from printer properties-> advanced option. comment on your tricks also.

Loop Unrolling or Loop unwinding in C

What is Loop Unrolling or Loop unwinding in C? Loop unwinding, also known as loop unrolling , is a loop transformation technique that attempts optimize a program's execution speed at the expense of its size. The goal of loop unwinding is to increase the program's speed by reducing (or eliminating) the "end of loop" test on each iteration. Loops can be re-written as a sequence of independent statements which eliminates the loop controller overhead. The major side effects of loop unrolling is The increased register usage in a single iteration to store temporary variables (though much will depend on possible optimizations), which may hurt performance. The code size expansion after the unrolling, which is undesirable for embedded applications and for purposes of code readability. Large code can also cause an increase in instruction cache misses, which may adversely affect performance. A simple example A procedure in a computer program is to delete 100 items from a collec...

Access Samba Using Dos Commands List Here

I was searching for accessing samba using DOS command, Finally I managed it by own; here is list of useful command. To mount or to map the SAMBA folder to local machine. eg; to map public folder from and copy test.txt use :- net use z: \\computer\folder Map the Z: drive to the network path //computer/folder. net use z: \\2.168.4.500\public enter user-name (if connecting first time) enter password To copy the data to this drive ie to put file copy test.txt \\2.168.4.500\public to get the file copy \\2.168.4.500\public\test.txt To delete the connection use net use z: /del /yes

Useful Vi Editor Trick

Here is yet another Vi editor trick. At the Vi editor, we can edit multiple files by switching between them (With out opening another terminal) $vi ex1.c ex2.c ex3.c To switch one file to another use :n, :#e (With out exiting and opening the file) like $vi ex1.c ex2.c ex3.c :n Move forward to next file is the file list :e# Toggle between the last two edited files :rew Rewind file list and reopen first file in the list

Useful VI Commands For Linux Beginners Read on

useful vi commands for Linux beginners 1) To open two files in single window of vi editor a) vi a.c b) give the following command in vi editor to open b.c file :sp b.c c) Now vi editor contain two files in each half screen. TO switch between two files use ctrl+ww. 2)Replacing a text a) vi a.c b) In a.c file, replace printf with printk using follwing command :%s/printf/printk This will replace only first occurrence of printf in each line. :%s/printf/printk/g The above command will replace all printf words in entire file with printk. :%s/printf/printk/gc The above command will ask confirmation. :s/printf/printk This commamnd will replace in current line. 3)setting auto indentation: In home directory create .exrc file add the following commands :set nu :set cindent :set cindent will do indentation in C 4) To open a man page of a system call from vi editor a) vi a.c put the cursor at s...

Linux Command Line Most Used Shortcuts

Just sharing some of the command line shortcuts that I used and learnt; please share yours also. 1. To search in history or run previous commands This is my most used shortcut. Hit Control-R and begin to type a string. For example, type the following and hit Enter . grep root /etc/passwd Then hit Control-R and begin to type 'grep'. Control-R (reverse-i-search)`gre': grep root /etc/passwd When you see the original command listed, hit Enter to execute it. Alternatively, you can also hit the Right-Arrow to edit the command before running it. Use -> ctrl + r and type the command, to go one more level back again hit ctrl + r, to edit the command before you execute use right key arrow. 2. To clear the present screen use -> ctrl + l (My discovery works on board also). 3. To edit previous command using vi commands -> set -o vi Now you can use the Vi cw command to change the word in command. 4. Use of alias alias ll='ls -l' alias gohome='cd; ls' If...

Effective Linux Kernel Search Trick here

I was wondering how to search a big kernel source for my specific keywords. Here I found out some of the combination. Also there may be lot of ways to do the same things, that's the beauty of Linux. Here we go 1. looking for MCS8142_SPI_FLASH in kernel use find . -name "*.c" | xargs grep "MCS8142_SPI_FLASH" | more And here is the output. ./drivers/mtd/devices/mcs8142.c: mtd = mtd_concat_create(mtd_con,NO_OF_BANKS,"MCS8142 _SPI_FLASH"); similar way you can grep for a particular struct from kernel source; eg; find . -name "*.c" | xargs grep "struct jffs_node" | more 2. looking for MTD flag is set from .config file here is the command grep MTD .config | grep =y output CONFIG_MTD=y CONFIG_MTD_DEBUG=y CONFIG_MTD_PARTITIONS=y CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y CONFIG_MTD_MAP_BANK_WIDTH_1=y CONFIG_MTD_MAP_BANK_WIDTH_2=y CONFIG_MTD_MAP_BANK_WIDTH_4=y CONFIG_MTD_CFI_I1=y CONFIG_MTD_CFI_I2=y CONFIG_MTD_MCS8142_SPI_FLASH=y E...

Kernel Programming Five Things to Keep in Mind before you start

Things to keep in mind for kernel programming If you want to hack Linux kernel and do some programs, before you start keep some points in mind First and very basic point to make you feel relax with linux kernel , as, kernel is nothing but a program as like other programs, which includes memory management, process scheduling, system management and all you need to work in. 1. In kernel space you do not have leisure of GLIBc library, ie you can not use printf also you have printk in kernel space. 2. Limited stack - you have limited stack space in kernel so do not make unnecessary variables declared, as tomorrow you may be going to add some new features. In user space you have almost unlimited stack so you will be little worried about how many variables you are using. 3. In kernel space no memory protection is there, as in user space if some memory corruption occurs kernel will trap and send signal. In kernel space there is no-one to trap memory corruption, it is like you are directly ...

Building Kernel for Embedded Linux with ARM board

I am giving general steps for building embedded linux for ARM board. Building kernel for embedded linux 1. Download kernel untar it using bz2 format is more compressed than gz ;bz2 - tar -xvjx linux-x.x.x GNU zip fromat gz - tar -xvzf linux-x.x.x 2. Configure kernel Before you make build the kernel configure it. Linux kernel provides lot of features and almost all driver support. All the features are not required for our embedded application. Select the required features, like processor type if your board have USB support select the USB support. If your board have SATA support select the requried module. one can configure linux kernel using make config - text based configuration make menuconfig - menu based configuration make xconfig - x11 based configuration make gconfig - gtk+ based configuration If you are new to configuration you can start with make defconfig - creates default configuration and kept in root folder as .config file. The flags which are set in this file are with CONF...

CVS Short Notes And Useful Commands For Daily Usage

CVS Short Notes And Useful Commands For Daily Usage Creating a directory tree from a number of files When you begin using CVS, you will probably already have several projects that can be put under CVS control. In these cases the easiest way is to use the import command. An example is probably the easiest way to explain how to use it. If the files you want to install in CVS reside in ‘wdir’, and you want them to appear in the repository as ‘$CVSROOT/yoyodyne/rdir’, you can do this: $ cd wdir $ cvs import -m "Imported sources" yoyodyne/rdir yoyo start Unless you supply a log message with the ‘-m’ flag, CVS starts an editor and prompts for a message. The string ‘yoyo’ is a vendor tag, and ‘start’ is a release tag. They may fill no purpose in this context, but since CVS requires them they must be present Adding files and folder to CVS individually To add a folder or file to CVS repository in some existing path, follow these steps. For example, you want to create a folder “nuport”...