Skip to main content

Posts

Showing posts with the label Embedded linux

Creating & Working On a CVS Branch Example Usage

Example usage OF Creating & Working On a CVS Branch Tried working hard on CVs commands, here is simple example for working in branch using CVS, CVS is becoming nomore use with everyone opting for SVN, still CVS usages is wide as it is old, Lets start with CVS commands to create a branch This is done with two commands, cvs tag -b release-1 //create branch cvs update -j release-1 //merge the changes in main tot Lets see with simple example Creating and working on a branch for the existing kernel source. #cvs co kernel/linux-2.6.26 #cd kernel/linux-2.6.26/ #cvs tag -b release-1 First we created a branch to the kernel source, as we are doing first release. Continue your development work for second release. After some time, reported a problem in the first release. So you need to Get the kernel source code of first release. #cvs co -r release-1 kernel/linux-2.6.24 and fix the problems Now If you want to merge these changes in to main trunk. #cvs update -j release-1 And you are done with ...

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

C Traps & Pitfalls Book PDF Online by Andrew Koenig

C Traps & Pitfalls Book PDF Online by Andrew Koenig C Traps and Pitfalls is a slim computer programming book by former AT&T researcher and programmer Andrew Koenig, its first edition still in print in 2005, which outlines the many ways in which beginners and even sometimes quite experienced C programmers can write poor, malfunctioning and dangerous source code. It evolved from an earlier technical report published internally at Bell Labs, but is now available online in pdf form. <br> Happy coding.

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

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

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

NFS Based ROOTFS Mounting From NFS

How to boot from NFS? Network File System (NFS) is a Network file system protocol allowing a user on a client computer to access files over a network as easily as if the network devices were attached to its local disks. All kernels after 2.2 support NFS over TCP. Mounting the root file system from NFS steps. 1) Go to kernel source directory and type "make menuconfig". 2) In order to configure root NFS support in the kernel, it is first necessary to enable "IP Autoconfiguration". This setting is accessed by selecting "Network" and then "Networking Options" in the menu. On the Network options screen select "IP: kernel level autoconfiguration". type / to search config options from make menucnfig. 3) Main menu select "File Systems" select "Network File Systems". On the Network File Systems page select the "NFS file system support" as built-in (select as *). Then scroll down and select "Root File system...

Steps For Booting Linux Kernel From USB Pen Drive

Boot Linux kernel from USB: Here are the steps for Booting Linux kernel from USB pen drive. If you have kernel image in pen drive then use these steps to boot from pen drive. 1) Create ext2 file system on USB. 2) Copy the kernel image to USB. 3) Connect the USB to embedded board. 4) From u-boot: Execute following commands. 5) “usb start” :– This will probe for usb mass storage devices. 6) “usb storage”:- shows the details of mass storage device. 7) “ext2ls usb o” :- lists the files in the USB. 8) “ext2load usb 0 7fc0 scp_zimage “ :- copies the embedded linux kernel file from usb and stores it in RAM 7fc0 9) Then do “bootm” to boot Linux.

What is Boot loader in embedded System Init Steps

Lets talk about Boot loader in embedded system and its basics. What is Boot loader in embedded System and its initialization steps? What happens on power on? What does bootloader do on power on? Read on for answers to these question . Boot loader is a program which will execute on power-on in an embedded system. The main functionality of the boot loader is to initialize the hardware and make a platform for, and load the Operating system. Hardware initialization includes the CPU, memory controller, UART, etc. As system is up the CPU will be initialized then the memory controller (i.e. DDR controller, Flash controller) will be initialized. The Boot loader code will itself relocate to the RAM and do further hardware initialization like UART, MAC, PCI etc. The very first initialization code should be from a non-volatile memory on board, which will have the capability of XIP (execute in place). IF you have serial Flash as boot code holder, which cannot be used for XIP, then other options a...

ntfsprogs and Fuse Compilation errors and Solution here

Got some luck to compile ntfsprogs. Ntfsprogs are a collection of utilities for doing stuff with NTFS volumes. Steps to compile ntfsprogs . 1. get the FUSE and compile it. $ tar xvzf fuse-2.7.4.tar.gz $ ./configure --disable-kernel-module $ make getting error while compiling examples dir. libtool: link: gcc -Wall -W -Wno-sign-compare -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -g -O2 -fno-strict-aliasing -o .libs/fusexmp fusexmp.o -pthread -pthread ../lib/.libs/libfuse.so -ldl ../lib/.libs/libfuse.so: undefined reference to `clock_gettime' make[1]: Leaving directory `/home/bhagwat/fuse-2.7.4/example' Solution is $ cd examples open Makefile go to line no 205 change the option from -ldl to -lrt $ cd ../make $ make install FUSE will be installed in default dir ie /usr/local/lib Get the ntfsprogs from linux-ntfs. untar ntfsprograms $ tar xvzf ntfsprogs-2.0.0.tar.gz $ ./configure --enable-ntfsmount still getting same error smount ntfsmount-ntfsmount.o ntfsmount-ut...

It's a Bigger World than Java and C++

We hear a lot about Java and C++, but that doesn't mean they're the only languages developers are using. Tokeneer was developed for the U.S. National Security Agency (NSA), an outfit known for keeping things secret. Which makes it even more surprising that not only did the NSA acknowledge Tokeneer's existence, but they released it as open source software. In a nutshell, Tokeneer is a proof-of-concept of what's called "high-assurance software engineering." Secure software, in other words. Software you can trust. Software that must work correctly or else the consequences could be calamitous. And software that's written in Ada—yes, Ada—and developed using Praxis High Integrity Systems ( www.praxis-his.com ) Correctness-by-Construction (CbyC) methodology, the SPARK Ada language ( www.sparkada.com ), and AdaCore's GNAT Pro environment ( www.adacore.com ). The project demonstrates how to meet or exceed all those things that are necessary to achieve hig...

Scratchbox Cross-compiling Made Easy

Often Getting problems with corss compiling here is the perfect solution, read on. Scratchbox is a configuration and compilation environment for building Linux software and entire Linux distributions. The basic idea of Scratchbox is to offer developers an environment that works and looks like the target environment before the target environment is available. The Scratchbox is an environment that you log into like you would log into some machine. However, the Scratchbox tools can be used either inside or outside of Scratchbox download scratchbox-core http://www.scratchbox.org/download/files/sbox-releases/1.0/tarball/scratchbox-core-1.0.1-i386.tar.gz scratchbox-libs http://www.scratchbox.org/download/files/sbox-releases/1.0/tarball/scratchbox-libs-1.0.1-i386.tar.gz scratchbox-toolchain-arm-glibc http://www.scratchbox.org/download/files/sbox-releases/1.0/tarball/scratchbox-toolchain-arm-gcc3.3-glibc2.3-1.0.1-i386.tar.gz untar all tar ball using tar -xzf command then run $/scratchbox/run_m...

UDEV Simple Rules For Events In Linux

How to execute external program upon certain events occurred in linux? This is quite wide requirement if you are running embedded linux on target board. Well The answer could be varied as question is more general. Lets limit the scope of question to USB devices. Running external programs upon certain events to be specific want to run a program on USB device connection and on USB device removal. Well I am going to do it with UDEV, For the beginners/novices about UDEV and howto write UDEV rules the howto is pretty nice and easy to apply. One can do it with signals also, but I like this way. To start with, I have written simple udev rules file and kept in /etc/udev/rules.d/90-local.rules (off course you can give any name but with ext .rules and start with some no like 90 here); My udev rules are in 50-udev.rules files which defines the way to mount on USB connection and unmount on USB device disconnect. I can't believe myself that with simple two lines rule placed in 90-local.rules ...

About NTFS Tools and Library ntfsprogs Download

NTFS file system one can make use of it from ARM-Linux using below two methods one is install and down load user space modules and other approach is install and download kernel space drivers. ntfsmount is part of ntfsprogs package. It relies on libntfs, thus it has more features than kernel driver. ntfsmount supports file overwrite with changes to file size, has limited file and directory creation/deletion support, can operate with named data streams and supports special Interix files (symlinks, block and character devices, FIFOs and sockets). Requires FUSE- Filesystem in userspace download FUSE http://fuse.sourceforge.net/ Download NTFS Tools and Library for ntfsprogs The ntfsprogs package contains userspace tools: mkntfs, ntfscat, ntfsclone, ntfscluster, ntfscp, ntfsfix, ntfsinfo, ntfslabel, ntfsls, ntfsresize, ntfsundelete, etc and a shared NTFS library. This package does not require nor contain the NTFS kernel driver. http://www.linux-ntfs.org/doku.php?id=downloads for Kernel driv...

Howto Build For x86 Host With Arm-Linux Target

How to Build For x86 Host With Arm-Linux Target? I need to build the source code for ARM-Linux target board, I just taken the source code untar it and executed make, just to check it compiles or not. Now Need to compile it for ARM target, so I was using $ ./configure --host=arm-linux-gcc --build=i686 --target=arm-linux-gcc and $ make but it was not compiling for arm-linux-gcc as while compiling it compiles with gcc option and not with arm-linux-gcc so You need to export the arm-gcc path before running ./configure. For example: $export CC=${arm-compiler-path}/arm-gcc $configure --target=arm-linux $make Still no luck to get the arm compiled binary. As I compiled using make initially and that time it created ./config.cache file This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. You need to delete this file ./config.cache and run again $./configure --host=arm-linux-gcc --build=i...

Useful C #define Functions - set clear bit

There are many useful C #define function, as an embedded software engineer, one need to know about some handy #define function. Below is list of some of the #defines which are being used 1. clear bit #define clear_bit(val, bit) (val &= (~(1 2. set bit #define set_bit(val, bit) (val |= (1 3. Error handling #define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0) Usage: if opening a file is failed like if ((fd = open ("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL;

Virtual Kernel Memory Layout on ARM Linux

Kernel Memory Layout on ARM Linux Russell King November 17, 2005 (2.6.15) This document describes the virtual memory layout which the Linux kernel uses for ARM processors. It indicates which regions are free for platforms to use, and which are used by generic code. The ARM CPU is capable of addressing a maximum of 4GB virtual memory space, and this must be shared between user space processes, the kernel, and hardware devices. As the ARM architecture matures, it becomes necessary to reserve certain regions of VM space for use for new facilities; therefore this document may reserve more VM space over time. Start End Use -------------------------------------------------------------------------- ffff8000 ffffffff copy_user_page / clear_user_page use. For SA11xx and Xscale, this is used to setup a minicache mapping. ffff1000 ffff7fff Reserved. Platforms must not use this address range. ffff0000 ffff0fff CPU vector page. The CPU vectors are mapped here if the CPU supports...