Friday, July 31, 2015

How to disable automount-open for SD or USB in Ubuntu

Hi folks, Welcome to my blog..!!

I wanted to write this post, considering the developers working on Linux embedded devices where the boot media is SD card. 

Its very obvious that developers have to change the images on SD very frequently to try their new changes incorporated, but the very frustrating or cumbersome thing is we will be having multiple partitions on SD card and the moment it is inserted on host machine for updating the images we have to wait until all the partitions mounted, and the same thing while un-mounting as well.

**of-course we have scripts to prepare images, but I feel this will save some time & useful

To save time or to make things go easily I prefer SD card to be auto mounted but not opened, this will be very help and saves time and also we need not to spend extra time closing the opened windows by dragging our mouse leaving the key-board where we love to use commands instead of GUI.
for doing that in Ubuntu 12.04 or 14.04 we have to install "dconf Editor"  Related image


After you install "dconf Editor" open the application, at the left side of the application you will see a menu with lot of options.

Goto -> "org"--> "gnome"--> "desktop" --> "applications" --> "media-handling"

after you select "media-handling" in the right side window you will see options as shown in the below screenshot.


Un-Check "automount-open" option

There are lots of option you find interesting with "dconf Editor".

Please leave your comments, it will be encouraging :)



Thursday, July 30, 2015

Using ipmi-oem command with Dell server

Hi folks, welcome to my blog.

People who are searching for this info will be well aware of BMC (Board management Controller) and IPMI (Intelligent Platform Management Interface) and there is a lot of information about BMC & IPMI on Internet

The IPMI specification defines a set of interfaces for platform management.  It is utilized by a wide variety of vendors for system management on motherboards.  The features of IPMI that most users will be interested in are sensor monitoring, remote power control, serial-over-LAN (SOL), and system debugging.  The FreeIPMI tools and libraries listed below should provide users with the ability to access and utilize these features.

IPMI can be used in-band (i.e. running on a machine locally) or out-of-band (i.e. connecting remotely). I am working on connecting remotely


Here I am trying to explain the usage of ipmi-oem command.

Pr-requisites:

Linux Machine: I have a  Ubuntu desktop
Tools needed: freeipmi-tools
Server: Here I have a Dell server
Server BMC IP: IP address of the BMC on server is need, soon power is given to server, BMC will get booted independently and will configure the IP either through DHCP/Static based on your BIOS configuraiton.

In my case I have a dhcp & its IP is 192.168.19.114

ipmi-oem supports many OEMs like Dell, IBM, Fujitsu, Intel etc specific commands.

ipmi-oem command is available through freeipmi-tools.

$ sudo apt-get install freeipmi-tools 

It is common that username is root & password is calvin for the DELL server BMC

$ sudo ipmi-oem -D LAN_2_0 -h 192.168.19.114 -u root -p calvin Dell power-supply-info

[sudo] password for gvk51:
Power Supply      : Power Supply 1 Status
Rated Watts       : 900 W
Rated Amps        : 5.00 A
Rated Volts       : 264 V
Rated DC Watts    : 750 W
Power Supply Type : AC
Online Status     : Power Supply Failure detected
Firmare Version   : 00.24.71
Dell Componentid  : 101095

Power Supply      : Power Supply 2 Status
Rated Watts       : 900 W
Rated Amps        : 5.00 A
Rated Volts       : 264 V
Rated DC Watts    : 750 W
Power Supply Type : AC
Online Status     : Power Supply Failure detected
Firmare Version   : 00.24.71
Dell Componentid  : 101095

this is how you can use the ipmi-oem command to get the Dell server specific information.


Please give your comments, that will be encouraging :)

Sunday, July 26, 2015

Using ## in Linux Kernel

Here is a simple example to quickly understand the usage of ## pre-processing operator. It is used to merge two tokens into one, I mean two strings into one, which is refereed as token pasting or token concatenation. When a macro is expanded, the two tokens on either side of each ## operator are combined into a single token, which then replaces the ## and the two original tokens in the macro expansion.

Example code:

Code:
/*
 * main.c file
 */

#include <stdio.h>

#define MY_DEVICE_BASE_ADDR  0x40004000
#define MY_DEVICE_REG_CTRL_OFS  0x20
#define MY_DEVICE_REG_STATUS_OFS 0x30
#define MY_DEVICE_REG_INTR_OFS  0x40

#define REG(name) \
 ((unsigned int)(MY_DEVICE_BASE_ADDR) + MY_DEVICE_REG_##name##_OFS)

int main()
{
 printf("Example to use ## Pre-Processor!\n");
 
 printf("   *** My-Device Register ***\n");
 printf("   - Control-Register Addr = 0x%x\n", REG(CTRL));
 printf("   - Status-Register Addr = 0x%x\n", REG(STATUS));
 printf("   - Interrupt-Register Addr = 0x%x\n", REG(INTR));
 printf("[END]\n");
 return 0;
}



Output:

Example to use ## Pre-Processor!
   *** My-Device Register ***
   - Control-Register Addr = 0x40004020
   - Status-Register Addr = 0x40004030
   - Interrupt-Register Addr = 0x40004040
[END]


Note: Copying the code directly into your source.c file will also copies the invisible characters and finally you will left out with stray errors, i recommend you to type the code and that even becomes a practice.

For more details check this link

Please give your comments it will be encouraging for me :) 

Click to Download Code

How to use ## pre-processor in C

Here is a simple example to quickly understand the usage of ## pre-processing operator. It is used to merge two tokens into one, I mean two strings into one, which is refereed as token pasting or token concatenation. When a macro is expanded, the two tokens on either side of each ## operator are combined into a single token, which then replaces the ## and the two original tokens in the macro expansion.

Example code:

Code:
/*
 * main.c file
 */

#include <stdio.h>

#define MY_DEVICE_BASE_ADDR  0x40004000
#define MY_DEVICE_REG_CTRL_OFS  0x20
#define MY_DEVICE_REG_STATUS_OFS 0x30
#define MY_DEVICE_REG_INTR_OFS  0x40

#define REG(name) \
 ((unsigned int)(MY_DEVICE_BASE_ADDR) + MY_DEVICE_REG_##name##_OFS)

int main()
{
 printf("Example to use ## Pre-Processor!\n");
 
 printf("   *** My-Device Register ***\n");
 printf("   - Control-Register Addr = 0x%x\n", REG(CTRL));
 printf("   - Status-Register Addr = 0x%x\n", REG(STATUS));
 printf("   - Interrupt-Register Addr = 0x%x\n", REG(INTR));
 printf("[END]\n");
 return 0;
}



Output:

Example to use ## Pre-Processor!
   *** My-Device Register ***
   - Control-Register Addr = 0x40004020
   - Status-Register Addr = 0x40004030
   - Interrupt-Register Addr = 0x40004040
[END]


Note: Copying the code directly into your source.c file will also copies the invisible characters and finally you will left out with stray errors, i recommend you to type the code and that even becomes a practice.

For more details check this link

Please give your comments it will be encouraging for me :) 

Click to Download Code

How to use ## in C

Here is a simple example to quickly understand the usage of ## pre-processing operator. It is used to merge two tokens into one, I mean two strings into one, which is refereed as token pasting or token concatenation. When a macro is expanded, the two tokens on either side of each ## operator are combined into a single token, which then replaces the ## and the two original tokens in the macro expansion.

Example code:

Code:
/*
 * main.c file
 */

#include <stdio.h>

#define MY_DEVICE_BASE_ADDR  0x40004000
#define MY_DEVICE_REG_CTRL_OFS  0x20
#define MY_DEVICE_REG_STATUS_OFS 0x30
#define MY_DEVICE_REG_INTR_OFS  0x40

#define REG(name) \
 ((unsigned int)(MY_DEVICE_BASE_ADDR) + MY_DEVICE_REG##_##name##_##OFS)

int main()
{
 printf("Example to use ## Pre-Processor!\n");
 
 printf("   *** My-Device Register ***\n");
 printf("   - Control-Register Addr = 0x%x\n", REG(CTRL));
 printf("   - Status-Register Addr = 0x%x\n", REG(STATUS));
 printf("   - Interrupt-Register Addr = 0x%x\n", REG(INTR));
 printf("[END]\n");
 return 0;
}



Output:

Example to use ## Pre-Processor!
   *** My-Device Register ***
   - Control-Register Addr = 0x40004020
   - Status-Register Addr = 0x40004030
   - Interrupt-Register Addr = 0x40004040
[END]


Note: Copying the code directly into your source.c file will also copies the invisible characters and finally you will left out with stray errors, i recommend you to type the code and that even becomes a practice.

For more details check this link

Please give your comments it will be encouraging for me :) 

Click to Download Code