Thursday, January 12, 2012

Get to know the libraries requried for an executable

1.  ldd
          ldd exe-binary
example:
[root@localhost home] ldd /bin/netstat
                                         linux-gate.so.1 =>  (0x00cfa000)
                                         libselinux.so.1 => /lib/libselinux.so.1 (0x0071c000)
                                         libc.so.6 => /lib/libc.so.6 (0x004f4000)
                                         libdl.so.2 => /lib/libdl.so.2 (0x00689000)
                                         /lib/ld-linux.so.2 (0x004cc000)

2 . readelf

[root@localhost static&shared]# readelf -a /bin/netstat | grep NEEDED
      0x00000001 (NEEDED)                     Shared library: [libselinux.so.1]
      0x00000001 (NEEDED)                     Shared library: [libc.so.6]









Wednesday, January 11, 2012

Reasons for root file system mount failure during Embedded Linux Start-up

Kernel panic: VFS: Unable to mount root fs on 02:00

We all have encountered this error while booting Linux. There might be many reasons for it, but most of the times the error is simple and yet goes undetected and causes problem before we detect it. Some of the obvious reasons are:

1. Driver for blockdev is not found in the kernel hence it can’t talk to the device
2. Driver for the corresponding file system is not present in the kernel hence it does not know how to interpret the data on the device
3. Root partition passed to the kernel is wrong
4. In case of nfs, it is not set up correctly. That is, the nfs mount point cannot be accessed from other Linux systems as well

Tuesday, March 22, 2011

Linux Modules

All the modules which are currently running under linux can be seen by

cat /proc/modules
cat /sys/module
 

/sys/module is a sysfs directory hierarchy containing information on currently-
loaded modules. /proc/modules is the older, single-file version of that informa-
tion. Entries contain the module name, the amount of memory each module
occupies, and the usage count. Extra strings are appended to each line to specify
flags that are currently active for the module.







All the kernel symbols can be listed using 


cat /proc/kallsyms

To check the Type of file -- i.e the type of executable , cpu architecture build for , format

file binary

example: [Naveen@localhost ~]$ file xor
xor: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped


cat /proc/devices
       Currently assigned Major No.