Monday, February 26, 2018

Friday, February 23, 2018

Create Shared Library Function Calls in Linux or Unix 3 steps

Creating Shared Library Function Calls in Linux

1. Create programe code ngprogram.c

#include <stdio.h>
#include <unistd.h>
int main() 
{
        puts("aroundng dot com world!n");
    return 0;
}

2. libaroundng.c file library code

#include <stdio.h> 
#include <unistd.h> 
#include <dlfcn.h> 
int puts(const char *message) 
int (*new_puts)(const char *message);
int result; 
new_puts = dlsym(RTLD_NEXT, "puts"); 
if(strcmp(message, "aroundng dot com world!n") == 0)
   { 
       result = new_puts("Goodbye, aroundng!\n");
    } 
   else 
    { 
         result = new_puts(message);
     } 
   return result; 
}

3. Create and then export library :
$ gcc libaroundng.c -o libaroundng.so -fPIC -shared -ldl -D_GNU_SOURCE
$ export LD_PRELOAD="${PWD}/libexample.so"

Finally, Compile:
$ gcc ngprogram.c -o ngprogram
$ ./ngprogram
Goodbye, aroundng!
$

Here system call is   puts(const char *message)

Feel free ask any queries  

Yocto : bitbake commands

 bitbake commands

bitbake <image> Bake an image (add -k to continue building even errors are found in the tasks execution)    
bitbake <package> -c <task> Execute a particular package's task. Default Tasks names: fetch, unpack, patch,configure, compile, install, package, package_write, and build.


Example: To (force) compiling a kernel and then build, type:
$ bitbake  linux-imx -f -c compile
$ bitbake linux-imx
   
bitbake <image > -g -u depexp
Show the package dependency for image.

Example: To show all packages included on fsl-image-gui
$ bitbake fsl-image-gui -g -u depexp

NOTE: This command will open a UI window, so it must be execute on a console inside the host machine (either virtual or native).    
bitbake <package> -c  devshell Open a new shell where with neccesary system values already defined for package    
hob bitbake frontend/GUI. 
   
bitbake <package> -c listtasks List all tasks for package    
bitbake virtual/kernel -c menuconfig
Interactive kernel configuration    
bitbake <image> -c fetchall Fetch sources for a particular image    
bitbake-layers show-layers Show layers    
bitbake-layers show-recipes "*-image-*" Show possible images to bake. Without "*-images-*", it shows ALL recipes    
bitbake -g <image> && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq Show image's packages    
bitbake -g <pkg> && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq Show package's dependencies    
bitbake –v <image> 2>&1 | tee image_build.log Print (on console) and store verbose baking    
bitbake -s | grep <pkg> Check if certain package is present on current Yocto Setup  

Yocto busybox menuconfig for any machine 3 steps

Yocto busybox menuconfig

It's just easy to build on Yocto repo. Only machine name required if the same BASE used for mutiple machines/boards.

 #Use MACHINE=intel-x86-32  if applciable on front of the command 


$ bitbake -c menuconfig busybox    

$ bitbake -c diffconfig busybox

$ bitbake busybox                          

$ bitbake -k  image_name              


Then change below files :

Now, in project layers,  the following files:
recipes-core/busybox/busybox_%.bbappend:
SRC_URI += "file://fragment.cfg"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
recipes-core/busybox/busybox/fragment.cfg:
CONFIG_EJECT=y 
CONFIG_FEATURE_EJECT_SCSI=y

How to Recover Unallocated part Space on USB Flash Drive?


Recovering  Unallocated Part Space on USB Flash Drive
C:\WINDOWS\system32>diskpart 
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB      0 B        *
  Disk 1    Online          894 GB      0 B
  Disk 2    Online         3750 MB      0 B 
DISKPART> select disk 2                 //depends on disk
Disk 2 is now the selected disk. 
DISKPART> clean
DiskPart succeeded in cleaning the disk.
Run CMD Line Terminal on windows as Administrator 

Now try allocating Disk by going to computer -> (right click)Manage -> Disk Management ->
Allocate drive   

Wednesday, February 21, 2018

Check Motherboard, BIOS, Processor, CPU ID From Command Line In Linux or Unix

BIOS information :
 dmidecode needs sudo permissions

$ sudo dmidecode –t 0   # shows bios information  

$ sudo dmidecode –t 4 | grep ID      # shows Device ID 

$ sudo dmidecode         // displays overall hardware information 

Tuesday, February 20, 2018

Unix - Linux : Capturing the output from strings command?

$strings file_ASCI > output_name.txt
$strings -n 2 file1 file2
$strings -o welcome_obj
$strings -f /bin/* | grep Copy
Note : strings - print the strings of printable characters in files. Helps to read Binary file

strings -e s your_filename
strings --encoding=s file
strings --bytes=8 yourfilename

Linux/Unix : screen command Usage

screen - screen is a manager with VT100/ANSI terminal emulation

When the screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would.  Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill existing windows, view a list of windows, turn output logging on and off, copy-and-paste text between windows, view the scrollback history, switch between windows  in  whatever  manner you  wish, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user's terminal.  When a program terminates, screen (per default) kills the window that contained it. If this window was in the foreground, the display switches to the previous window; if none are left, screen exits. Shells usually distinguish between running as login-shell or sub-shell. 
 screen -r
man screen   #For Help

General commands

Every screen command begins with Ctrl-a.
Ctrl-a cCreate new window (shell)
Ctrl-a kKill the current window
Ctrl-a w
List all windows (the current window is marked with "*")
Ctrl-a 0-9Go to a window numbered 0-9
Ctrl-a nGo to the next window
Ctrl-a Ctrl-a
Toggle between the current and previous window
Ctrl-a [Start copy mode
Ctrl-a ]Paste copied text
Ctrl-a ?
Help (display a list of commands)
Ctrl-a Ctrl-\Quit screen
Ctrl-a D (Shift-d)Power detach and logout
Ctrl-a d
Detach but keep shell window open

Friday, February 9, 2018

Friday, February 2, 2018

Live news channels around the worlds

I'm proudly serving you to provide best live News channels.

Top New channels Pay List Down The Follow:





Telugu langues manchu Lakshmi spoof video




"NCBN Nara chandrababu naidu" CEO Deals to grow Andhra Pradesh

CISCO network and andhra pradesh CEO Chandra babu  Microsoft Kaizala for andhra pradesh  Google Wi-fi for andhra pradesh CEO Micro...