Saturday, December 22, 2012

Paint Brush

Flex Sensor Circuit - http://www.sparkfun.com/datasheets/Sensors/Flex/flex22.pdf
                                  http://sitemaker.umich.edu/me552f04/files/group3_circuit.pdf
                                  http://www.makingthings.com/teleo/teleo/cookbook/bendsensor.htm#diagram

Capacitance Touch - http://www.extremecircuits.net/2010/05/simple-capacitive-touch-sensor.html
                                  http://www.circuit-finder.com/categories/sensor/touch-sensor/page-1
                                  http://www.buildcircuit.com/modes-of-ne555-monostable-and-astable/
                                  http://www.siongboon.com/projects/2007-11-29_touch_sensor/index.htm

LED Shift Register - http://www.protostack.com/blog/2010/05/introduction-to-74hc595-shift-register-controlling-16-leds/
                                  http://www.instructables.com/id/LED-matrix-using-shift-registers/?ALLSTEPS
                                  http://www.radiolocman.com/shem/schematics.html?di=106943
                                  http://robots.freehostia.com/Software/ShiftRegister/ShiftRegister.html

                                 

Thursday, December 20, 2012

nice video collection

http://m.kunoku.com/?sk=video&vid=m2isActDQnw

Tuesday, December 18, 2012

About.com - Basic Sci & Updates


Chemistry Experiments -http://chemistry.about.com/od/demonstrationsexperiments/u/scienceprojects.htm

All School Level Math Videos - http://video.about.com/math/?zIvb=1

All basic Education - http://physics.about.com/
                                  http://chemistry.about.com/
                                  http://space.about.com/                                           
                                  http://biology.about.com/
                                  http://archaeology.about.com/
                                  http://math.about.com/

Monday, December 17, 2012

Imagining the 10th Dimension

http://www.youtube.com/watch?v=JkxieS-6WuA
http://www.youtube.com/watch?v=ySBaYMESb8o

Sunday, December 16, 2012

Universal Serial Bus (USB)

Linux based doc

http://www.lrr.in.tum.de/Par/arch/usb/usbdoc/usbdoc.html

Wednesday, December 12, 2012

The World cud have been easier with 12

http://www.youtube.com/watch?v=U6xJfP7-HCc&feature=g-high-u

Wednesday, December 5, 2012

Steve Jobs

https://www.youtube.com/watch?feature=player_embedded&v=zkTf0LmDqKI
https://www.youtube.com/watch?feature=player_embedded&v=8Iw_G4O8THA
https://www.youtube.com/watch?feature=player_embedded&v=qzzOwRx3D1E
http://www.mactrast.com/2012/12/long-lost-steve-jobs-1995-speech-predicts-the-future-of-animation/

Tuesday, December 4, 2012

smell sensor bookmarks

http://en.wikipedia.org/wiki/Electronic_nose
http://en.wikinews.org/wiki/Japanese_researchers_create_smell_sensor_using_genetically_engineered_frog_eggs
http://en.wikipedia.org/wiki/Organic_electronics
http://www.animatlab.com/BiomechanicsEditor/Bodies/OdorSensor.htm
http://www.coffeeresearch.org/science/nose.pdf
http://pubs.acs.org/doi/abs/10.1021/nn302917e?mi=0&af=R&pr...
http://www.umass.edu/newsoffice/umass-amherst-chemists-develop-nose-sensor-array-smell-cancer-diagnoses
http://www.sciencedirect.com/science/article/pii/S0142961211013986
http://en.wikipedia.org/wiki/G_protein

Matter is made of waves

http://www.rhythmodynamics.com/Gabriel_LaFreniere/matter.htm

Measuring distance in space

http://starchild.gsfc.nasa.gov/docs/StarChild/questions/question39.html

Monday, December 3, 2012

Why India Failed Produce Tech Giants? - Beautifully Explained

http://www.techinasia.com/india-failed-produce-tech-giants-apple-google-facebook-twitter/

Saturday, December 1, 2012

Auto fit dress!

http://www.youtube.com/watch?v=6wr_Zw1uGY8&feature=g-high

in the abv vid! chk how they r trying to grab a junk from space! and correlate it with batman's flying technique!

Thursday, November 22, 2012

seeing the past?

I actually saw SciShow http://www.youtube.com/watch?v=b3j4wz31gIM&list=UUZYTClx2T1of7BRZ86-8fow&index=2&feature=plcp
 now, why is this the most oldest news?
       it is coz! we are able to see any object only when it reflects light! for a moon light to reach earth it wud take 1.2 - 1.3 sec so, say if anything happens in moon! we could see it after 1.2 - 1.3 sec[8mins in case of sun]. so we see the distant truth very lately! 
      say if we are able to see wats happening in earth from a distant place like mars! wud we be actually seeing the past?
      ok ! the real qs is!! if saints who meditate can travel in space with their mind! what wud be they seeing?? the past??
    if this is right!! in the similar fashion! there shd be a way to see the future!!  

Wednesday, November 14, 2012

Elon Musk

http://www.bloomberg.com/video/73460184-elon-musk-profiled-bloomberg-risk-takers.html

Sunday, November 4, 2012

Working of Microwave Oven

http://www.youtube.com/watch?feature=player_embedded&v=kp33ZprO0Ck

Tuesday, October 30, 2012

confusions abt zero - cleared

http://www.youtube.com/watch?v=BRRolKTlF6Q&feature=g-all-lik

Wednesday, October 17, 2012

Journalist Covering Indian Technology Startups

http://www.quora.com/Startups-in-India/Who-are-the-top-journalists-covering-Indian-technology-startups-Why/answer/Vijay-Anand?srid=O7R&st=ns
VCCircle: Sainul Abudheen
Economic Times: Archana Rai, Radhika Nalllayam, Sudhir Syal
Mint: Deepti C, Anupama
Times of India: Ishan Shrivastava
The Hindu: Karthik Subramanian
MediaNama : Nikhil Pahwa
CNBC: Shereen Bhan

Tuesday, October 16, 2012

Understanding Big-O

http://ssp.impulsetrain.com/2012/10/15/big-o-misconceptions/

Sunday, October 14, 2012

Binaural Beats

http://www.scribd.com/doc/8179111/Binaural-Beats-Complete-with-ALL-info-about-Each-Brainstate-and-links-to-Programs-and-Cracks

     These beats at all freq are available in Youtube .

Wiki page of binaural beats talks abt the brain waves too

Indian Scientists are not given importance Higgs 'Boson'

http://www.huffingtonpost.com/2012/07/10/higgs-boson-controversy-bose-india_n_1662040.html

            Reiki  explains vibrations!! already thousands of years ago!

Quantum Cosmology

http://www.youtube.com/playlist?list=PL263218D49D7D16B9

Sunday, September 2, 2012

Web Tools

http://www.thetoolbox.cc/

Monday, August 13, 2012

mouse driver working

http://www.linux-mag.com/id/330/

Tuesday, August 7, 2012

Electronics Basics

HumanHardDrive
http://www.youtube.com/user/humanHardDrive/videos
  Electronics 101 -> analog [ loved the capacitors explanation ]
  Electronics 201 -> digital [ loved PullUp and PullDown explanation ]

Circuit Simulator

http://falstad.com/circuit/
(applet - circuit.jar)

Wednesday, August 1, 2012

List of Indian Tablets Designers

1) Notionink (Adam)
2) Micromax (funbook)[+ Mobile]
3) Reliance (3G Tablet)[+ Mobile]
4) Karbonn Mobiles (Smart Tab1)[+ Mobile]
5) Intex Technologies (i-Buddy)
6) Indian Govt's Akash Tablet

Tuesday, July 24, 2012

uevent message passing

Handling kernel uevent in userspace
        
⚫ ueventd
    ⚬ ueventd creates and 'poll' netlink socket.
        ueventd_main [init/ueventd.c]

    ⚬ read kernel event message -> parse -> handle
        handle_device_event [init/devices.c]
            -> device_changed [init/init.c]
                -> queue_device_triggers [init/init_parser.c]
                            |
            +---------------+
            |
            v
        : search action list to know what to do for this event.
          searching action which name is device-added/removed-[device node].
          [device node] is from 'DEVPATH' variable of uevent message.

    ⚬ action list : list declared at [init_parser.c]
        • builtin action (added by 'queue_builtin_action [init/init_parser.c]')
            ex. property_init, wait_for_coldboot_done etc.
        • from script (added by 'parse_action [init/init_parser.c]')
            section "on device-added-[device path] / on device-removed-[device path]"
            ex.
                [init.rc]
                on device-added-/dev/block/mmcblk0p18
                    exec /system/bin/sh /system/bin/hello_mmc.sh

⚫ other daemons (ex usbd)
    ⚬ create and 'poll' netlink socket. 
 
 
kobject uevent in kernel

   
⚫ Sendig kobject uevent to user space from kernel
    ⚬ Concept
        • Execute user-space binary with predefined + customized environment variables.
        • Send message to pre-defined netlink socket unit created by kernel.

    ⚬ From souce code (hotplug)
        • kernel node [kernel/sysctl.c] (ctl_table)
        : /proc/sys/kernel/hotplug

        • kobject_uevent_env() [kobject_uevent.c]
            default user process executable image path
                -> CONFIG_UEVENT_HELPER_PATH
        • kernel/sysctl.c
            'uevent_helper' value can be RWed through 'hotplug' node of sysctl.

    ⚬ From souce code (netlink)
        • kobject_uevent_env() [kobject_uevent.c]
            : #if defined(CONFIG_NET)
            write message to netlink socket unit (NETLINK_KOBJECT_UEVENT)
        • netlink.h
            netlink units
        • Creating in userspace
            socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT)

Linux Kernel Notifier Chains

Understanding UNIX like File Systems

Understanding Metadata
          Metadata is data about data(From Wikipedia). That is to say that metadata contains information about a piece of data. For example, if I own a car then I have a set of information about the car but which is not part of the car itself. Information such as the registration number, make, model, year of manufacture, insurance information, and so on. All of that information is collectively referred to as the metadata.

FileSystem
        A file system is a way of organizing information/ data on any kind of storage device. In Linux and UNIX file systems metadata exists at multiple levels of organization. A  good file system organizes data in an efficient manner and is tuned to the specific characteristics of the device.

File
       A file is really just a block of logically related arbitrary data or bunch of bytes arranged in certain order(Contents of File). When Linux opens a file, it also creates a file object, which holds data about where the file is stored and what processes are using it. The file object (but not the file data itself) is thrown away when the file is closed.


 Super block
         The superblock is essentially file system metadata and defines the file system type, size, status, and information about other metadata structures (metadata of metadata). The superblock is very critical to the file system and therefore is stored in multiple redundant copies for each file system. The superblock is a very "high level" metadata structure for the file system. For example, if the superblock of a partition, /var, becomes corrupt then the file system in question (/var) cannot be mounted by the operating system. Commonly in this event fsck is run and will automatically select an alternate, backup copy of the superblock and attempt to recover the file system. The backup copies themselves are stored in block groups spread through the file system with the first stored at a 1 block offset from the start of the partition. This is important in the event that a manual recovery is necessary. You may view information about superblock backups with the command dumpe2fs /dev/foo | grep -i superblock which is useful in the event of a manual recovery attempt. Let us suppose that the dumpe2fs command outputs the line Backup superblock at 163840, Group descriptors at 163841-163841. We can use this information, and additional knowledge about the file system structure, to attempt to use this superblock backup: /sbin/fsck.ext3 -b 163840 -B 1024 /dev/foo. Please note that I have assumed a block size of 1024 bytes for this example.

iNode
        An inode (short for "index node")exists in, or on, a file system and represents metadata about a file. For clarity, all objects in a Linux or UNIX system are files; actual files, directories, devices, and so on. There is one inode for each file (though with some filesystems, Linux has to create its own inodes because the information is spread around the filesystem). An inode contains essentially information about ownership (user, group), access mode (read, write, execute permissions), size of the file and file type. Each inode also contains a number unique to the filesystem partition; it's like a serial number for the file described by that inode.

Dentry
       A dentry (short for "directory entry") is what the Linux kernel uses to keep track of the hierarchy of files in directories. A dentry is the glue that holds inodes and files together by relating inode numbers to file names. Each dentry maps an inode number to a file name and a parent directory. Dentries also play a role in directory caching which, ideally, keeps the most frequently used files on-hand for faster access. File system traversal is another aspect of the dentry as it maintains a relationship between directories and their files.


Disk Arrangement in UNIX 
        The boot block contains the code to bootstrap the OS. The super block contains information about the entire disk. The I-node list a list of inodes, and the data blocks contains the actual data in the form of directories and files.
     The super block contains the following information, to keep track of the entire file system.
Size of the file system
Number of free blocks on the system
A list of free blocks
Index to next free block on the list
Size of the inode list
Number of free the inodes
A list of free inodes
Index to next free inode on the list
Lock fields for free block and free inode lists
Flag to indicate modification of super block
Size of the file system represents the actual no of blocks (used + unused) present in the file system.
The super block contains an array of free disk block numbers, one of which points to the next entry in the list. That entry in turn will be a data block, which contains an array of some other free blocks and a next pointer. When process requests for a block, it searches the free block list returns the available disk block from the array of free blocks in the super block. If the super block contains only one entry which is a pointer to a data block, which contains a list of other free blocks, all the entries from that block will be copied to the super block free list and returns that block to the process. Freeing of a block is reverse process of allocation. If the list of free blocks in super block has enough space for the entry then, this block address will be marked in the list. If the list is full, all the entries from the super block will be copied to the freed block and mark an entry for this block in the super block. Now the list in super block contains only this entry.
Index indexes to the next free disk block in the free disk block list.
Allocation Of Data Blocks
The super block also contains an array to represent free inodes. The size of this array need not be the actual number of free inodes. During assignment of an inode to a new file, the kernel searches the free inode list. If one free inode is found, that one is returned. If the free inode list is empty, then it searches the inode list for free inodes. Each inode will contain a type field, which if 0, means the inode is free. It then fills the free inode list of super block as much as it can, with number of free inodes from inode list. It then returns one of these ones. It then remembers the highest inode number. Next time it has to scan the inode list for free ones, it starts from this remembered one. Hence it doesn't have to scan already scanned ones. This improves the efficiency. While freeing an inode, if the free list in super block has space enough, the freed one is put there. If there is not enough space, and the freed inode number is less than the remembered inode, then the remembered inode is updated with the freed inode. If the freed inode number is greater than the remembered one, then it doesn't have to update, because it will be scanned from the remembered node and the freed one will be covered later.
During all these allocations, in a multi-tasking environment, there is a chance of the inodes getting corrupted. Like if one process was trying to allocate an inode and was preempted by the scheduler, and a second process does the same for same inode, it will be a critical problem. Hence lock flags are introduced. While accessing inodes, that inode will be locked. One more flag to indicate that the super block has been modified, is present in the super block.

Assignment of New iNodes


The I-node list (which server the purpose as FAT+ directory entries in DOS) is a list of inodes, which contains the following entries.
Owner
Type
Last modified time
Last accessed time
Last inode modified time
Access Permissions
No of links to the file
Size of the file
Data blocks owned
Owner indicates who owns the file(s) corresponding to this inode.
Type indicates whether inode represents a file, a directory, a FIFO, a character device or a block device. If the type value is 0 then the inode is free.
The times represent when, the file has been modified, when it was last accessed, or when the inode has been modified last. Whenever the contents of the file is changed, the "inode modified time" also changes. Moreover it changes when there are changes for the inode like permission change, creating a link etc.
Each file will be having nine access permissions for read, write and execute, for the owner, group and others in rwx rwx rwx format.
In Unix we can create links to some files or dThe data blocks contain the actual data contained in the files or directories. In Unix, a directory is a special file. A directory file contains names of the subdirectories and files present in that directory and its corresponding inode number.irectories. So we need to have a count of how many links are pointing to the same inode, so that if we delete one of the links the actual data is not gone.
Size of the file represents the actual size of the file.
In Unix, we have a kind of indexing to access the actual data blocks that contains data. We have an array of which (in each inode) first ten elements indicate direct indexing. The next entry is single indirect, then comes double indirect and then triple indirect. By direct indexing we mean that, the value in the array represents the actual data block. If the file needs more than 10 blocks, it uses single indirect indexing, means this is an index to the a block which contains an array of disk block numbers which in turn represent the actual disk block. If all these are exhausted, then double indirect indexing is used and then triple indirect.
iNode DataBlock Representation
The data blocks contain the actual data contained in the files or directories. The data blocks are the physical blocks that is created in storage devices. In Unix, a directory is a special file. A directory file contains names of the subdirectories and files present in that directory and its corresponding inode number.
  For better understanding check this:

Disk Allocation Methods(Data Blocks)
  • model the physical disk addresses with block numbers (usually each block number corresponds to one sector id, but sometimes a block corresponds to multiple sector ids)
  • I/O layer of the OS translates disk addresses, expressed as a combination of a drive #, a cyclinder #, a track #, and a sector #, into sector ids (and if necessary block numbers). 
 Some of the methods are
        
a)contiguous allocation
  • each file occupies a set of consecutive addresses on disk
  • each directory entry contains:
    • file name
    • starting address of the first block
    • block address = sector id (e.g., block = 4K)
    • length in blocks
  • usual dynamic storage allocation problem
    • use first fit, best fit, or worst fit algorithms to manage storage
  • if the file can increase in size, either
    • leave no extra space, and copy the file elsewhere if it expands
    • leave extra space 
 
b)linked allocation
  • each data block contains the block address of the next block in the file
  • each directory entry contains:
    • file name
    • block address: pointer to the first block
    • sometimes, also have a pointer to the last block (adding to the end of the file is much faster using this pointer) 

     
  • a view of the linked list 
 
 
c)indexed allocation
  • store all pointers together in an index table
    • the index table is stored in several index blocks
    • assume index table has been loaded into main memory

i)all files in one index




 The index has one entry for each block on disk.




  • better than linked allocation if we want to seek a particular offset of a file because many links are stored together instead of each one in a separate block
  • SGG call this organization a ``linked'' scheme, but I call it an ``indexed'' scheme because an index is kept in main memory.
  • problem: index is too large to fit in main memory for large disks
    • FAT may get really large and we may need to store FAT on disk, which will increase access time
    • e.g., 500 Mb disk with 1 Kb blocks = 4 bytes * 500 K = 2Mb entries
ii)separate index for each file
  • index block gives pointers to data blocks which can be scattered
  • direct access (computed offset)
a)one index block per file (assumes index is contiguous) 

b)linked list of index blocks for each file
c)multilevel index
d)combined scheme (i-node scheme) used in UNIX

 For more detailed explanation get into:

The Design of the Unix Operating System By Maurice J. Bach
 


Monday, July 23, 2012

Arduino tutorial series

This is Jeremy Blum's tutorial series!!(this guy is awesome - ECE Grad from Cornell who passed out by 2012 )
http://www.youtube.com/watch?v=fCxzA9_kg6s&feature=list_other&playnext=1&list=SPA567CE235D39FA84

Friday, July 20, 2012

scary mythical creatures

http://urbantitan.com/10-scariest-mythological-creatures/

Wednesday, July 18, 2012

SQL Joins

Best Explanation

Thursday, July 12, 2012

I2C Tutorial

http://www.robot-electronics.co.uk/acatalog/I2C_Tutorial.html

Wednesday, July 11, 2012

mknod in Android

mknod

  1. Android provides mknod() api (unistd.h) , but not provides mknod execution file.
  2. download the mknod.c from mknod.c
  3. There are two way to let the mknod work
    1. Build with toolbox (system/core/toolbox)
      1. change the mknod.c main function name to mknod_main
      2. Modify the Android.mk
        TOOLS :=\
        .... \
        mknod
      3. build android, then redownload the system.img and userdata.img
    2. Create a new appliation
      1. You can crate a new application in externel folder - mknod
      2. Copy the mknod to new folder
      3. Create a Android.mk
        LOCAL_PATH:= $(call my-dir)
        include $(CLEAR_VARS)
        LOCAL_SRC_FILES:= mknod.c
        LOCAL_MODULE := mknod
        include $(BUILD_EXECUTABLE)
      4. Build through NDK by using, ndk-build -C

Sunday, June 24, 2012

Thursday, June 14, 2012

Basics of Battery from batteryuniversity

http://batteryuniversity.com/learn/article

M.Sc Software Engineering, PSG College of Technology

MSc Software Engineering at PSG College of Technology, is a unique course which focuses on specializing the software engineering skills by giving students the industrial exposure by two 6 months internships and with its strong alumni feedback and support the department brings in the latest cutting-edge technologies as the part of the curriculum. The department builds students' coding skills by encouraging them with many coding projects at the end of every semester. Students get back to college after the first internship at renowned organizations with lots of exposure gained that help them understand the concepts in a new perception. The department also gives chance to meet the alumni twice a year which helps students to do their semester projects on the latest technologies that runs the industry.

Wednesday, June 13, 2012

e-MMC (Embedded MultiMedia Card)

     eMMC describes an architecture consisting of an embedded storage solution with MMC interface, flash memory and controller.In one line it is a flash/nand over MMC interface. Typically, flash memory is controlled by a dedicated controller that supervises data reads and writes, and operates under the control of the application's CPU.

     eMMC is a standard for embedded memory devices that contain not only a data storage element (such as NAND flash memory), but also a controller for the storage element integrated on the same silicon die. This results in several advantages, such as reduced development time and easier integration of the memory block in the overall system. Ultimately, this leads to a much shorter time-to-market for the end product.



  e·MMC embedded memory essentially transforms a program/erase/read device like NAND Flash into a simple write/read memory. This managed interface addresses potential NAND design concerns internally, using error correction code (ECC), wear leveling, and bad block management technology. Handling errors internally takes the burden off the host controller and increases speed, providing higher system performance.Managed NANDs are RAW NANDs combined with a memory controller and can support popular interfaces such as MMC (eMMC, moviNAND), SD (eSD) and SPI. The memory controller hides the details of the NAND and provides the intended interface and ECC support. This means that a eMMC/eSD NAND can talk to a embedded TI device through MMC/SD controller.

Composition of an e-MMC System
An e-MMC system generally consists of a host controller, an e-MMC device, and a HS-MMC driver, which is software that controls the e-MMC (see below).

  1. The host controller has a host CPU and a HS-MMC interface. The e-MMC also has a HS-MMC interface.
  2. The e-MMC consists of raw MLC NAND flash memory and a controller. The controller has a HS-MMC interface which can be connected to the host controller. It also has a NAND interface which is connected to the raw MLC NAND flash memory. It has several functions such as bad block management, wear leveling and error correction code (ECC), to utilize the raw MLC NAND flash memory efficiently.
  3. The HS-MMC driver handles operations between the host controller and the e-MMC.

Sunday, June 10, 2012

Monday, May 14, 2012

CPU Load Calculation

In Unix computing, the system load is a measure of the amount of work that a computer system performs.
  The most common tools are  uptime, procinfo, w(ho), top. among which top covers pretty much. so lets stick to top
$top
The Unix and Linux top command shows memory and cpu use
    As you can see
  • Line 1 “top”, indicates that the system has been up and running for 171 days.
  • Line 2 “Tasks”, displays the total number of processes along with a breakdown of running, sleeping, stopped and zombie processes count. 
  • it takes values from /proc/stat.
  • the first /proc/stat line shows like this at t0
    cpu user nice system idle iowait irq softirq (dont know)
    cpu 736324 49874 581102 298162832 3012015 120311 0 0
    a few seconds later (t1):
    cpu 736334 49874 581102 298162971 3012015 120311 0 0
    differences:
    cpu 10 0 0 139 0 0 0 0
    all numbers together at t0 are: 302662458
    a few seconds later (t1): 302662607
    difference (t1-t0): 149

    the difference 149 is 100% cpu time
    so it seems the cpu has spent 93.28% (139 time unit's (seems to be USER_HZ)) in cpu idle
    and 6.72% in user mode
     

    for more detailed description see: http://www.linuxhowtos.org/System/procstat.htm
    as the link describes the values in /proc/stat identify the amount of time the cpu has spent in what kind of "work"

     
  • Line 3 “Cpu(s)” displays the current CPU utilization of the system. In this example, CPU is 98.7% idle
    • here the meaning of each 
    •  us -> User CPU time: The time the CPU has spent running users’ processes that are not niced.
    • sy -> System CPU time: The time the CPU has spent running the kernel and its processes.
    • ni -> Nice CPU time: The time the CPU has spent running users’ proccess that have been niced.
    • wa -> iowait: Amount of time the CPU has been waiting for I/O to complete.
    • hi -> Hardware IRQ: The amount of time the CPU has been servicing hardware interrupts.
    • si -> Software Interrupts.: The amount of time the CPU has been servicing software interrupts. 
    • st -> Time stolen from a virtual machine.
  • Line 4 “Mem” and line 5 “Swap” provides the memory information. This is the same information from the free command.
  • The rest of the lines display all the active processes on the system, sorted default by CPU usage (%CPU column). i.e the most CPU intensive processes will be displayed on the top by default.                                                        PID - The thread ID. This can be converted into hexadecimal and used to correlate to the "native ID" in a javacore.txt file.
    USER - The user ID of the user that started the process.
    PR - The priority of the thread.
    NI - The "nice" value for the process.
    VIRT - The virtual memory (allocated) usage of the process.
    RES - The resident memory (committed) usage of the process.
    SHR - The shared memory usage of the process.
    S - The state of the thread. This can be one of the following:
    R - Running
    S - Sleeping
    D - Uninterruptible sleep
    T - Traced
    Z - Zombie
    %CPU - The percentage of a single CPU usage by the thread.
    %MEM - The percentage of the memory used by the process.
    TIME+ - The amount of CPU time used by the thread.
    COMMAND - The name of the process executable.

  •  top - 16:15:45 up 21 days,  2:27,  3 users,  load   average: 17.94, 12.30, 5.52   
      Tasks: 150 total,  26 running, 124 sleeping,   0   stopped,   0 zombie   
      Cpu(s): 87.3% us,  1.2% sy,  0.0% ni, 27.6% id,  0.0%   wa,  0.0% hi,  0.0% si   
      Mem:   4039848k total,  3999776k used,   40072k free,    92824k buffers   
      Swap:  2097144k total,      224k used, 2096920k free,  1131652k cached 
      PID USER    PR  NI  VIRT  RES  SHR S %CPU   %MEM    TIME+  COMMAND   
      31253 user1   16   0 2112m 2.1g 1764 R 37.0   53.2   0:39.89 java   
      31249 user1   16   0 2112m 2.1g 1764 R 15.5   53.2   0:38.29 java   
      31244 user1   16   0 2112m 2.1g 1764 R 13.6   53.2   0:40.05 java   
      31250 user1   16   0 2112m 2.1g 1764 R 13.6   53.2   0:41.23 java   
      31242 user1   16   0 2112m 2.1g 1764 R 12.9   53.2   0:40.56 java   
      31238 user1   16   0 2112m 2.1g 1764 S 12.6   53.2   1:22.21 java   
      31246 user1   16   0 2112m 2.1g 1764 R 12.6   53.2   0:39.62 java   
      31248 user1   16   0 2112m 2.1g 1764 R 12.6   53.2   0:39.40 java   
      31258 user1   16   0 2112m 2.1g 1764 R 12.6   53.2   0:39.98 java   
      31264 user1   17   0 2112m 2.1g 1764 R 12.6   53.2   0:39.54 java   
      31243 user1   16   0 2112m 2.1g 1764 R 12.2   53.2   0:37.43 java   
      31245 user1   16   0 2112m 2.1g 1764 R 12.2   53.2   0:37.53 java   
      31255 user1   16   0 2112m 2.1g 1764 R 11.9   53.2   0:40.84 java   
      31265 user1   16   0 2112m 2.1g 1764 R 11.9   53.2   0:40.46 java   
      31239 user1   16   0 2112m 2.1g 1764 S 11.6   53.2   1:22.79 java   
      31254 user1   16   0 2112m 2.1g 1764 R 11.6   53.2   0:41.12 java   
      31266 user1   16   0 2112m 2.1g 1764 R 11.2   53.2   0:40.47 java   
      31261 user1   16   0 2112m 2.1g 1764 R 10.9   53.2   0:39.31 java   
      31262 user1   16   0 2112m 2.1g 1764 R 10.9   53.2   0:38.50 java    
    



       In the per-thread breakdown of the CPU usage shown above, the java process is taking approximately 75% of the CPU usage. This value is found by totalling the %CPU column for all the Java threads (not all threads are shown above) and dividing by the number of CPUs. The Java process is not limited by other processes, because the CPU there is still approximately 25% idle. You can also see that the CPU usage of the Java process is spread reasonably evenly over all of the threads in the Java process. This spread implies that no one thread has a particular problem. Although the application is allowed to use most of the available CPU, approximately 25% of the total CPU is idle meaning that some points of contention or delay in the Java process can be identified. A report indicating that active processes are using a small percentage of CPU, even though the machine appears idle, means that the performance of the application is probably limited by points of contention or process delay, preventing the application from scaling to use all of the available CPU. If a deadlock is present, the reported CPU usage for the Java process is low or zero. If threads are looping, the Java CPU usage approaches 100%, but a small number of the threads account for all of that CPU time.
  • Line 1 also has load average details. The load average represents the average system load over a period of time. The system load measures the amount of work your system performs. On *x Systems you usually get the 3 numbers representing the average load during the last 1, 5 and 15 minutes. You can also query the current values from the shell with many tools including uptime, w and top. On Linux Systems you can also read /proc/loadavg. The Value itself starts with 0 for an idle computer. Each process using or waiting for CPU increments the load number by 1. Depending on the number of CPUs you can estimate the system usage in percent. With one CPU a load average of 1 means 100% CPU "usage" and a load average of 1.86 means the CPU is overloaded by 86 percent. Just divide by the number of CPUs available to get your percentage. The Load shouldnt exceed the number of CPU's in your system. Technically the load average is the sum of the run queue length and the number of jobs currently running on the CPUs. The load average tries to measure the number of active processes at any time. As a measure of CPU utilization, the load average is simplistic, poorly defined, but far from useless.
Help screen for the Unix and Linux top command





















 The above Fig shows the different options along with top. Consider that there are two basic modes to display load : "IRIX mode" and "Solaris mode". In IRIX mode (Linux default), a load average of 1 means that one CPU is fully loaded ( or 25% of each CPU on a 4 CPU system, etc). In Solaris mode, a load average of 1 means that all CPUs are fully loaded (so it's actually equivalent to "IRIX mode" load divided by CPU count ).
Note that the "Cpu(s)" line in the header of the output shows the percentage usage across all of the available CPUs, whereas the %CPU column represents the percentage usage of a single CPU. For example, on a four-CPU machine the Cpu(s) row will total 100% and the %CPU column will total 400%. We can view each Cpus load separately by toggling '1'
Lets Get Down Deep
     Now let’s go inside the Linux kernel and see what it is doing to generate these load average numbers.
unsigned long avenrun[3];
 
static inline void calc_load(unsigned long ticks)
{
unsigned long active_tasks; /* fixed-point */
628       
static int count = LOAD_FREQ;
count -= ticks;
if (count > 0) {
count += LOAD_FREQ;
active_tasks = count_active_tasks( );
CALC_LOAD(avenrun[0], EXP_1, active_tasks);
CALC_LOAD(avenrun[1], EXP_5, active_tasks);
CALC_LOAD(avenrun[2], EXP_15, active_tasks);
}
}
The countdown is over a LOAD_FREQ of 5 HZ. How often is that?
1 HZ = 100 ticks
5 HZ = 500 ticks
1 tick = 10 milliseconds
500 ticks = 5000 milliseconds (or 5 seconds)

So, 5 HZ means that CALC_LOAD is called every 5 seconds.

Magic NumbersThe function CALC_LOAD is a macro defined in sched.h
extern unsigned long avenrun[]; /* Load averages */

#define FSHIFT 11 /* nr of bits of precision */
#define FIXED_1 (1<
#define LOAD_FREQ (5*HZ) /* 5 sec intervals */
#define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */
#define EXP_5 2014 /* 1/exp(5sec/5min) */
#define EXP_15 2037 /* 1/exp(5sec/15min) */

#define CALC_LOAD(load,exp,n) \
load *= exp; \
load += n*(FIXED_1-exp); \
load >>= FSHIFT;
A noteable curiosity is the appearance of those magic numbers: 1884, 2014, 2037. What do they mean? If we look at the preamble to the code we learn,
/*
 * These are the constant used to fake the fixed-point load-average
 * counting. Some notes:
 * - 11 bit fractions expand to 22 bits by the multiplies: this gives
 * a load-average precision of 10 bits integer + 11 bits fractional
 * - if you want to count load-averages more often, you need more
 * precision, or rounding will get you. With 2-second counting freq,
 * the EXP_n values would be 1981, 2034 and 2043 if still using only
 * 11 bit fractions.
 */
These magic numbers are a result of using a fixed-point (rather than a floating-point) representation. For more information 4th Chapter , Neil J. Gunther. "UNIX Load Average – Part 1: How It Works" (pdf). TeamQuest. http://www.teamquest.com/pdfs/whitepaper/ldavg1.pdf. Retrieved 2009-08-12.


so now its clear that the problems with this are
  1. The “load” is not the utilization but the total queue length.
  2. They are point samples of three different time series.
  3. They are exponentially-damped moving averages.
  4. They are in the wrong order to represent trend information.
 It is necessary to consider this if we are trying to do capacity calcs based on these values :P


Friday, April 13, 2012

Open Source Hardware Association

The Open Source Hardware Association is Coming Soon! 
http://www.oshwa.org/

http://blog.makezine.com/2012/04/23/makes-exclusive-interview-with-alicia-gibb-president-of-the-open-source-hardware-association/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+makezineonline+%28MAKE%29&utm_content=Google+Reader

Monday, April 2, 2012

Interesting Fact on Calendar (History)




Here’s an interesting historical fact, that you might probably never knew. Check below pictures. Just go through it.
Take a look at September 1752
cid:image006.png@01CB83F6.D9947610
cid:_2_07E3844407E381F00023BECA652574AB
n i d o k i d o s
 Have you ever seen the calendar for September 1752 ???
If you are working on Unix, please try this out. At $ prompt, type: cal 9 1752
Surprised ????
cid:image003.gif@01CB6536.A3EBA580
Not only in Unix, you can also search it on Google
 Explanation for what you see:
Isn't the output queer? A month with whole of eleven days missing. This was the time England shifted from Roman Julian Calendar to the Gregorian Calendar, and the King of England ordered those 11 days to be wiped off the face of the month of September of 1752. (What couldn't a King do in those days?!) And yes, the workers worked for 11 days less, but got paid for the entire 30 days. And that's how "Paid Leave" was born. Hail the King !!!
Before that, April was the first Month of the year. Even then, people didn’t agree to use the Roman Julian Calendar and celebrated 1st April as a New Year.
Then the King announced that those who celebrated April as the New Year are fools… (
April Fools…)
History is really interesting, isn’t it !!!

Share Internet from Dongle(Windows)

Once You are connected to internet through your USB dongle, go to
1) Command Prompt and type >nslookup
           nslookup is a command to query ur DNS.Copy & Save the DNS Address
2) Setup a Ad-Hoc Wifi Network
  1. Open the Start Menu.
  2. Click Control Panel.
  3. Click Network and Internet.
  4. Click Network and Sharing Center.
  5. Under Change your networking settings, click Set up a new connection or network.
  6. Select Set up a wireless ad hoc (computer-to-computer) network.
  7. Click on Next twice.
  8. Enter the Network name such as "LogicNetwork".
  9. Select the Security WAP (or WEP).
  10. Enter the Security key or password.
  11. Check Save this network check box.
  12. Click Turn on Internet connection sharing.

3)Setup a Wifi Network with Static IP
     now,
a)To change the computer’s IP address in Windows 7, type network and sharing into the Search box in the Start Menu and select Network and Sharing Center when it comes up.
1start menu
 b)Then when the Network and Sharing Center opens, click on Change adapter settings.







 
 c)Right-click on your wireless adapter and select Properties. (Not the Local Area Connection as in Picture)



In the Wireless connection Properties window highlight Internet Protocol Version 4 (TCP/IPv4) then click the Properties button.

 
 d)Once You get into properties...
           set ur IP address as "192.168.2.1"
           subnet mask as "255.255.255.0"
           default gateway as "192.168.2.1"


 e) and Finally in ur DNS and alternate DNS you need to setup the Address you copied in step 1 (Result of nslookup)

 4) Now you need to Bridge the Connections(Wireless Connection & LAN)
 
A network bridge is software or hardware that connects two or more networks so that they can communicate. You can create only one network bridge on a computer, but one bridge can handle any number of network connections.
  1. Open Network Connections by clicking the Start button Picture of the Start button, clicking Control Panel, clicking Network and Internet, clicking Network and Sharing Center, and then clicking Manage network connections.
  2. Hold down CTRL and select each(Wireless Network Connection and LAN) network connection that you want to add to the bridge.
  3. Right-click one of the selected network connections, and then click Bridge Connections. Administrator permission required If you are prompted for an administrator password or confirmation, type the password or provide confirmation.


 5) Client Setup(phone or other computer)
a) Switch on wifi in ur clinet and get into settings and setup static IP
          IP Address: "192.168.2.X" where x>1 <= 255 Ex: 192.168.2.2
          Subnet as : 255.255.255.0
          gateway :  192.168.2.1 [IP address of computer in which dongle is connected]
           preferred DNS :  whatever DNS address u got in step 1

Save all!! Connections !!
        Now The client devices shd have internet! enabled!!!
          Happy Surfing :)
          
   

          



Sunday, April 1, 2012

Clock Signal

http://www.designcabana.com/knowledge/electrical/electronics/digital/clock/
http://www.pcguide.com/intro/fun/clockClocks-c.html
http://zone.ni.com/devzone/cda/tut/p/id/5535

Thursday, March 15, 2012

x264


http://mewiki.project357.com/wiki/X264_Settings
http://www.digital-digest.com/articles/x264_options_page1.html

Use mencoder for converting your video into a raw video
mencoder Videos/xacti_hd2000_dogsample20090207_1.mp4 -o dogsampleraw.mp4 -ovc raw -oac pcm

cut tool
         ss will skip first 15 seconds and start and will end after t seconds. `copy` will use the same codec as the input file to generate output file 
fmpeg -ss 15 -t 30 -i input.mkv -acodec copy -vcodec copy output.mkv 

Tuesday, March 13, 2012

Electronics Store - Bangalore

http://tenettech.com/
http://www.nskelectronics.com

Sunday, March 11, 2012

Friday, March 9, 2012

Charles Poynton

1 Amazing Guy....!!! 
http://en.wikipedia.org/wiki/Charles_Poynton
http://www.poynton.com/
 

Chroma Sampling

 http://www.nattress.com/Chroma_Investigation/chromasampling.htm

The Power of VLC

The Power of VLC,
          
http://www.videolan.org/doc/streaming-howto/en/ch01.html

Wednesday, March 7, 2012

Android - Mount a Filesystem

Mount a filesystem read-write

Very often when you want to write files to a particular partition on ADP1, you will get a "Permission Denied" if the partition is mounted read-only.
To get around this, you need to mount the partition read-write. Typically this is done with /system partition

$ adb shell
$ su
$ mount -o rw,remount -t yaffs2 /dev/block/mmcblk0p3 /system

(Replace /dev/block/mmcblk0p3 & /system with appropriate device path and mount point, as obtained from cat /proc/mounts)

Monday, March 5, 2012

UART

http://www.freebsd.org/doc/en/articles/serial-uart/
http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter

Thursday, March 1, 2012

Physics Basics

http://www.youtube.com/watch?v=1xPjES-sHwg --> current & Voltage
http://www.youtube.com/watch?v=F1p3fgbDnkY&feature=related --> potential difference
http://www.youtube.com/watch?v=ZjwzpoCiF8A&feature=related  --> Transformer

3D Chip

Tuesday, February 28, 2012

XNA Basic Tutorial

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Drawing_fullscreen_images.php

Kernel Major Types

Wednesday, February 15, 2012

Digital Sound Recording

During recording, a microphone is set near the source sound. The air pressure inside the microphone is then sampled many times per second and recorded as a fixed point number. For stereo recordings, the sound is sampled at two positions in space, corresponding to a right and left sound channel, and the sampled amplitudes are stored separately. The number of times per second the sound is sampled is called the sampling frequency. The precision of the recording refers to the allowed dynamic range of the pressure readings. For example, if the air pressure at each sample is stored as an 8-bit signed floating point number, then there would be 2^8 possible values that a sampled pressure could attain. If we instead use a 16-bit signed floating point number to represent the sampled pressure, then we would have a dynamic range of 2^16 .

The more bits we use to represent the pressure, and the higher the sampling
frequency used, the better quality a digital recording we produce. However, we pay for this improvement in sound quality with an increase in file size. In fact,

File Size= (Fs × t × d)/8 (bytes)

where Fs is the sampling frequency, t is the length of the recorded sound in seconds, and the amplitude is recorded using d-bits. We divide by 8 to convert from bits to bytes (1 byte = 8 bits) since file size is typically measured in bytes.

Additionally, the bytes of a sound file can be represented as linear or logarithmic progressions. The unit of measurement of the represented sound pressure is constant from sample to sample in linear encoding, whereas in logarithmic encoding that unit grows as the sample value increases. The latter has the advantage of representing a greater range of sound levels, albeit with higher noise levels. The µ-law and a-law variations of the AU format, originating from Sun Microsystems and NeXT Computer, use logarithmic coding. An 8- bit µ-law sample, for example, can provide the same dynamic level as a 12-bit linear encoded sample.

The Nyquist–Shannon sampling theorem states that perfect reconstruction of a signal is possible when the sampling frequency is greater than twice the maximum frequency of the signal being sampled, or equivalently, when the Nyquist frequency (half the sample rate) exceeds the highest frequency of the signal being sampled. If lower sampling rates are used, the original signal's information may not be completely recoverable from the sampled signal.For example, if a signal has an upper band limit of 100 Hz, a sampling frequency greater than 200 Hz will avoid aliasing and allow theoretically perfect reconstruction.
The full range of human hearing is between 20 Hz and 20 kHz. The minimum sampling rate that satisfies the sampling theorem for this full bandwidth is 40 kHz. The 44.1 kHz sampling rate used for Compact Disc was chosen for this and other technical reasons.When you start to talk about the 192000hz then your talking the high resolution sources such as DVD - Audio discs. In digital audio the most common sampling rates are 44.1 kHz, 48 kHz, and 96 kHz. A common frequency in computer sound cards is 48 kHz – many work at only this frequency, offering the use of other sample rates only through resampling. The earliest add-in cards ran at 22 kHz.High-end audio equipment, such as in SACD or DVD-Audio players or studio equipment, can reach as high as 192 kHz.

Here is the complete list of common audio sample rates

Tuesday, February 7, 2012

openGL ES Basics

http://db-in.com/blog/2011/01/all-about-opengl-es-2-x-part-13/
http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html

Sunday, February 5, 2012

importance of sleep in a startup

http://leostartsup.com/2012/02/the-importance-of-sleep-in-a-startup/

its time for waterproof devices

http://www.mactrast.com/2012/01/permanently-waterproof-your-ios-devices-no-case-needed/
http://ces.cnet.com/8301-34447_1-57562891/liquipel-2.0-phone-waterproofer-splashes-down/

Saturday, February 4, 2012

Sim Card for iPhone 4/iPad

http://www.techradar.com/news/mobile-computing/tablets/how-to-make-your-own-ipad-or-iphone-4-micro-sim-681020

Tuesday, January 24, 2012

Understanding :(){ :|:& };: fork() bomb code

gets called recursively (recursive function). This is most horrible code for any Unix / Linux box. It is often used by sys admin to test user processes limitations (Linux process limits can be configured via /etc/security/limits.conf and PAM).

Once a successful fork bomb has been activated in a system it may not be possible to resume normal operation without rebooting, as the only solution to a fork bomb is to destroy all instances of it.

:() - It is a function name. It accepts no arguments at all. Generally, bash function is defined as follows:

foo(){  arg1=$1  echo ''  #do_something on $arg argument }

fork() bomb is defined as follows:

:(){  :|:& };:

:|: - Next it call itself using programming technique called recursion and pipes the output to another call of the function ':'. The worst part is function get called two times to bomb your system.

& - Puts the function call in the background so child cannot die at all and start eating system resources.

; - Terminate the function definition

: - Call (run) the function aka set the fork() bomb.

Here is more human readable code:

bomb() {  bomb | bomb & }; bomb

Properly configured Linux / UNIX box should not go down when fork() bomb sets off.

Saturday, January 21, 2012

Friday, January 20, 2012

Virtual Memory in Linux Kernel

http://www.informit.com/articles/article.aspx?p=29961

Garbage Collector - concepts

http://blogs.msdn.com/b/abhinaba/archive/2009/01/25/back-to-basic-series-on-dynamic-memory-management.aspx

rms, classic geek!

The Most Excellent and Lamentable Tragedy of Richard Stallman


http://edward.oconnor.cx/2005/04/rms

GCC guide

http://www.network-theory.co.uk/docs/gccintro/index.html
Must See Chapters 5,6,10,11,12,13

Thursday, January 19, 2012

link for linux system tools

http://lcamtuf.coredump.cx/fenris/other.txt

CS Grads not really trained

really worth reading...
morden frameworks and tools....spoil the students(CS Grads)

http://itmanagement.earthweb.com/article.php/3761921
http://www.crosstalkonline.org/storage/issue-archives/2008/200801/200801-Dewar.pdf

A professional embedded systems software engineer requires specific knowledge in a number of areas, together with problem-solving skills to apply this knowledge as a team member in building safe, secure, and reliable systems. Regrettably, says Adacore’s Robert Dewar, emeritus professor at New York University, the educational approach typically seen in university Computer Science programs, especially in the U.S., fails to provide either. Changes in course content and focus are needed.
 
http://www.eetimes.com/design/embedded/4238223/The-education-of-embedded-systems-software-engineers--failures-and-fixes?pageNumber=0

here is something against WEB
http://www.codinghorror.com/blog/2009/08/all-programming-is-web-programming.html

compilers - basic optimization

http://www.strchr.com/what_your_compiler_can_do_for_you

DSP Beginners Guide

http://eetimes.com/design/signal-processing-dsp/4017022/DSP-programmer-s-guide

Embedded Systems Kick start

http://en.wikibooks.org/wiki/Embedded_Systems

Most Programming Interviews are waste of time

http://teddziuba.com/2008/10/most-programming-interviews-ar.html

Why Software Suck

http://xahlee.org/UnixResource_dir/writ/why_software_suck.html

References are not Addresses

Pointers are strictly "more powerful" than references; anything you can do with references you can do with pointers, but not vice versa. I imagine that's why there are no references in C -- it's a deliberately austere and powerful language.
http://blogs.msdn.com/b/ericlippert/archive/2009/02/17/references-are-not-addresses.aspx

Gstreamer Plugin Development(Android)

A simple gst plugin can be developed from the below links

http://lca2007.linux.org.au/talk/272.html
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/part-building.html

once we are able to develop plugins for linux, we should also able to develop for android...
I managed to develop plugin for android by writing Android.mk and was able to see the boilerplate details... but still stuck up with my element registration with the plugin...
Tried to debug using remote gdb and found some memory access violation errors. Since I am using emulator... there are differences between the shared objects in emulator and in NDK.. so have to try in dev...

Wednesday, January 18, 2012

understanding virtual functions

http://jovechia.blogspot.com/2009/02/how-g-implement-virtual-function.html

using gdbserver on android emulator

1. Make your library debugable (add -g options in makefile)
modify your Android.mk add below command "LOCAL_CPPFLAGS += -g" for C++ files and "LOCAL_CFLAGS += -G" FOR C files.
rebuild your library and system image(if necessary)

2. in your local system redirect the debug port
$ telnet localhost 5554
redir add tcp:1234:1234
exit

3.you can start emulator by below command with debug port redirected.
./emulator -avd avdname -qemu -redir udp:1234::1234

4. push gdbserver to emulator
adb push ./out/target/product/generic/obj/EXECUTABLES/gdbserver_intermediates/gdbserver /system/bin/

5. run # gdbserver :1234 --attach your-desired-pid or gdbserver :1234 desired_process

6. run ./prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gdb ./out/target/product/generic/symbols/system/bin/app_process

7. in gdb-terminal
gdb>set solib-search-path out/target/product/generic/symbols/system/lib
In case there are multiple library paths to be searched, use ':' to concatenate the paths
gdb>target remote localhost:1234

8. Now you can see the Errors .... Happy remote Debugging!!!!

Common Error:

Malformed packet(b) (missing colon): re:0;
Packet: 'T050b:00000000;0d:c03ecebe;0f:b0070040;thread:4ab;core:0;'

This means the gdbserver and gdb in localhost are not compatible!!

Sunday, January 15, 2012

linux-android cross-compiling EGL surafce

Here is a simple HelloWorld EGL prog tat creates android window and displays openGL ES Surface
http://jiggawatt.org/badc0de/android/
(main.c)

Here is a Android.mk file for cross compiling this with NDK

LOCAL_PATH:=$(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE:=arm
LOCAL_MODULE:=mini
LOCAL_SRC_FILES:=main.c
LOCAL_MODULE_TAGS:=eng debug
LD_LIBRARY_PATH:=/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/lib
LOCAL_LDLIBS:=\
-L/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/lib \
-lEGL \
-ldl \
-lsurfaceflinger \

-lhardware \
-lhardware_legacy \
-lpixelflinger \

-lwpa_client \
-lemoji \
-lnetutils \
-ljpeg \
-lc \
-llog \
-lexpat \
-lskia \
-lui \
-lcutils \
-lutils \
-lbinder \
-lsurfaceflinger_client \
-lGLESv1_CM

LD:=/home/shivram/android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld
LOCAL_SHARED_LIBRARIES:=\
EGL \
GLESv1_CM
LOCAL_CFLAGS := \
-DHAVE_CONFIG_H \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include/EGL \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include/GLES \
-DG_THREADS_MANDATORY \
-DG_DISABLE_DEPRECATED \
-Wall \

-Wdeclaration-after-statement \
-Wvla \
-Wpointer-arith \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wredundant-decls \
-Wundef \
-Wwrite-strings \
-Wformat-nonliteral \
-Wformat-security \
-Wold-style-definition \
-Winit-self \
-Wmissing-include-dirs \
-Waddress \
-Waggregate-return \

-Wno-multichar \
-Wnested-externs \
-g \
-nostdlib \
-Bdynamic \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
-DGST_DISABLE_DEPRECATED

include $(BUILD_EXECUTABLE)

When we try to compile this.. we get... undefined reference to some pthread functions

To resolve this, the key is to write a wrapper or define those missing functions in ur (main.c) code ;)

Friday, January 13, 2012

Building GStreamer for Android

http://gstreamer.freedesktop.org/wiki/GstreamerAndroid_InstallInstructions

1)Best use NDKr6b(copy the platform[android-14])
2) ICS-src/bionic/linker/linker.c --> SO_MAX 128 --> +62 needed --> Maximum number of shared objects tat can be loaded at a time should be increased and Android Src must be recompiled
3)GST_REGISTRY_UPDATE=yes
4)GST_REGISTRY=/data/data/com.android.freedesktop.gstreamer/cache/registry.bin
5)GST_PLUGIN_PATH=/data/data/com.android.freedesktop.gstreamer/lib
6)GST_PLUGIN_SCANNER=/data/data/com.android.freedesktop.gstreamer/bin/gst-plugin-scanner
7) Better Copy the bins in the application to /system/bin/ with 777 permissions

After Building GST for ICS(android-14), I was able to play audio files on the device and also tried to ndk-build with proper JNI[Key: LDFLAGS:=-lX --> means load libX.so from LD_LIBRARY_PATH].....then I realised that there is no proper video sink for android in GST as it uses X-Overlay. so.....

https://wiki.linaro.org/WorkingGroups/Middleware/Multimedia/Specs/1105/GstreamerEglSink

Android NDK Build - Tutorial

http://marakana.com/forums/android/examples/49.html
http://earlence.blogspot.com/2009/07/writing-applications-using-android-ndk.html

Running a (*.o) Exec in Android Shell

http://jiggawatt.org/badc0de/android/

Thursday, January 12, 2012

Linux Kernel Bootup Process

http://www.ibm.com/developerworks/library/l-linuxboot/index.html
http://free-7.blogspot.com/2010/10/linux-boot-process.html

Linux Kernel Doc - Help

http://whatisthekernel.blogspot.com/
http://www.kernel.org/doc/
http://web.dit.upm.es/~jmseyas/linux/kernel/hackers-docs.html
http://www.nondot.org/sabre/os/articles
http://kernelnewbies.org/Documents/Kernel-Docbooks

Wednesday, January 11, 2012

Reset Linux passwd ~ by booting in Single User Mode


You can enter single user mode directly after turning on the power to your system. The steps to do this are listed below.

1. Power on your system. Wait for the "Grub loading" message to appear and, depending on your Linux distribution, get ready to hit either any key or the ESC key to enter the grub boot menu.

Grub loading, please wait ... Press ESC to enter the menu 

or

Grub loading, please wait ... Press any key to enter the menu 

2. You will then get grub's main menu which will display a list of available kernels. Use the arrow keys to scroll to your desired version of the kernel and then press e for "edit".

Fedora Core (2.6.18-1.2239.fc5smp) Fedora Core (2.6.18-1.2200.fc5smp) 

3. The kernel's boot menu will appear. Use the arrow keys to scroll to the "kernel" line and then press e for "edit".

root (hd0,0) kernel /vmlinuz-2.6.18-1.2239.fc5smp ro root=LABEL=/ initrd /initrd-2.6.18-1.2239.fc5smp.img 

4. A grub edit prompt will appear. Use the arrow keys to move to the end of the line and add the word "single" to the end, separated by a space. Change

grub edit> kernel /vmlinuz-2.6.18-1.2239.fc5smp ro root=LABEL=/ 

to

grub edit> kernel /vmlinuz-2.6.18-1.2239.fc5smp ro root=LABEL=/ single 

5. Press enter to save your changes, and then b for "boot".

6. The system will continue to boot, but will go straight to the root # prompt without first asking for a username and password and now we can reset any passwd.

Basic Linux Hello World Kernel module

Step 1: vi hello.c


#include
#include
#include

static int hello_init(void)
{
printk(KERN_ALERT "Hello World");
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye World");
}

module_init(hello_init);
module_exit(hello_exit);

MODULE_LICENSE("GPL v2");
MODULE_AUTHOR(RICHIE);


Step 2: vi Makefile

obj-m := hello-kernel.o
hello-kernel-objs := hello.o

Step 3: make -C /lib/modules/`uname -r`/build M=`pwd`
You should see hello-kernel.ko in your current directory, by now.

Step 4: sudo /sbin/insmod hello-kernel.ko

Step 5: dmesg

You should see "Hello World" here.

Step 6: lsmod | grep hello-kernel

Step 7: modinfo hello-kernel.ko

Step 8: sudo /sbin/rmmod hello-kernel.ko

Step 9: dmesg

You should see "Goodbye World" here.